From b412fb7ad58bb307a5b27d9e720e9975ac92f38f Mon Sep 17 00:00:00 2001 From: Kees van Reeuwijk Date: Thu, 15 Apr 2010 18:49:36 +0000 Subject: [PATCH] Code cleanup: remove unused #include, variables and code, --- boot/boot.c | 2 +- commands/ash/error.c | 3 --- drivers/audio/es1370/es1370.c | 3 ++- drivers/audio/es1371/es1371.c | 3 ++- drivers/dec21140A/dec21140A.c | 1 - drivers/dp8390/dp8390.c | 5 ++--- drivers/dpeth/8390.c | 4 ++-- drivers/dpeth/dp.c | 5 +---- drivers/dpeth/dp.h | 2 +- drivers/e1000/e1000.c | 7 ++----- drivers/filter/driver.c | 3 +-- drivers/fxp/fxp.c | 3 +-- drivers/lance/lance.c | 5 ----- drivers/log/log.c | 2 -- drivers/orinoco/orinoco.c | 5 +---- drivers/pci/main.c | 3 +-- drivers/pci/pci.c | 8 ++------ drivers/rtl8139/rtl8139.c | 3 +-- drivers/rtl8169/rtl8169.c | 1 - drivers/tty/console.c | 2 +- kernel/system/do_safecopy.c | 6 +++--- 21 files changed, 24 insertions(+), 52 deletions(-) diff --git a/boot/boot.c b/boot/boot.c index 5e613973b..c72838fc1 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -1494,7 +1494,7 @@ static void ls(char *dir) } (void) r_readdir(name); /* Skip ".." too. */ - while ((ino= r_readdir(name)) != 0) printf("%s/%s\n", dir, name); + while (r_readdir(name) != 0) printf("%s/%s\n", dir, name); } static u32_t milli_time(void) diff --git a/commands/ash/error.c b/commands/ash/error.c index a24807e44..a56d0f228 100644 --- a/commands/ash/error.c +++ b/commands/ash/error.c @@ -49,13 +49,10 @@ __FBSDID("$FreeBSD: src/bin/sh/error.c,v 1.25 2004/04/06 20:06:51 markm Exp $"); #include "options.h" #include "output.h" #include "error.h" -#include "nodes.h" /* show.h needs nodes.h */ -#include "show.h" #include "trap.h" #include #include #include -#include #include diff --git a/drivers/audio/es1370/es1370.c b/drivers/audio/es1370/es1370.c index 3832f6662..c690dee17 100644 --- a/drivers/audio/es1370/es1370.c +++ b/drivers/audio/es1370/es1370.c @@ -620,7 +620,8 @@ PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) { default: return EINVAL; } - samp_ct = pci_inw(reg(samp_ct_reg)); + /* TODO: is this inw useful? */ + (void) pci_inw(reg(samp_ct_reg)); curr_samp_ct = pci_inw(reg(curr_samp_ct_reg)); *samples_in_buf = (u32_t) (sub_dev[chan].BufLength * 8192) + diff --git a/drivers/audio/es1371/es1371.c b/drivers/audio/es1371/es1371.c index a65a6d1c4..9ac2fc121 100644 --- a/drivers/audio/es1371/es1371.c +++ b/drivers/audio/es1371/es1371.c @@ -622,7 +622,8 @@ PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) { default: return EINVAL; } - samp_ct = pci_inw(reg(samp_ct_reg)); + /* TODO: is this statement useful? */ + (void) pci_inw(reg(samp_ct_reg)); curr_samp_ct = pci_inw(reg(curr_samp_ct_reg)); *samples_in_buf = (u32_t) (sub_dev[chan].BufLength * 8192) + diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index a9f3b60f5..1ac73f2e3 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -156,7 +156,6 @@ PRIVATE void sef_local_startup() PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the DEC 21140A driver. */ - int r; int fkeys, sfkeys; (progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]); diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index 9c152ce80..ad15fe054 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -318,7 +318,7 @@ PRIVATE void sef_local_startup() PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the dp8390 driver. */ - int i, r; + int i; dpeth_t *dep; long v; @@ -879,8 +879,7 @@ dpeth_t *dep; /*===========================================================================* * do_getstat * *===========================================================================*/ -static void do_getstat(mp) -message *mp; +static void do_getstat(message *mp) { int port, r; dpeth_t *dep; diff --git a/drivers/dpeth/8390.c b/drivers/dpeth/8390.c index 51a200466..5240844ba 100644 --- a/drivers/dpeth/8390.c +++ b/drivers/dpeth/8390.c @@ -89,12 +89,12 @@ static void mem_getblock(dpeth_t *dep, u16_t offset, int size, void *dst) */ static void mem_nic2user(dpeth_t * dep, int pageno, int pktsize) { + panic("mem_nic2user: not converted to safecopies"); +#if 0 phys_bytes offset; iovec_dat_s_t *iovp = &dep->de_read_iovec; int bytes, ix = 0; - panic("mem_nic2user: not converted to safecopies"); -#if 0 /* Computes shared memory address (skipping receive header) */ offset = pageno * DP_PAGESIZE + sizeof(dp_rcvhdr_t); diff --git a/drivers/dpeth/dp.c b/drivers/dpeth/dp.c index 927848ac0..e536f9f5a 100644 --- a/drivers/dpeth/dp.c +++ b/drivers/dpeth/dp.c @@ -283,7 +283,6 @@ static void do_init(const message * mp) dpeth_t *dep; dp_conf_t *dcp; message reply_mess; - const char *portname; port = mp->DL_PORT; if (port >= 0 && port < DE_PORT_NR) { @@ -292,7 +291,6 @@ static void do_init(const message * mp) dcp = &dp_conf[port]; strcpy(dep->de_name, DevName); dep->de_name[4] = '0' + port; - portname = dep->de_name; if (dep->de_mode == DEM_DISABLED) { @@ -345,7 +343,6 @@ static void do_init(const message * mp) } else { /* Port number is out of range */ port = ENXIO; - portname = "(illegal dpeth port)"; } reply_mess.m_type = DL_CONF_REPLY; @@ -667,7 +664,7 @@ PRIVATE void sef_local_startup() PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the dpeth driver. */ - int r, rc, fkeys, sfkeys; + int fkeys, sfkeys; (progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]); diff --git a/drivers/dpeth/dp.h b/drivers/dpeth/dp.h index a0ec2d765..836346b9d 100644 --- a/drivers/dpeth/dp.h +++ b/drivers/dpeth/dp.h @@ -279,7 +279,7 @@ int wdeth_probe(dpeth_t * dep); #endif #define lock() (++dep->de_int_pending,sys_irqdisable(&dep->de_hook)) -#define unlock() do{int i=(--dep->de_int_pending)?0:sys_irqenable(&dep->de_hook);}while(0) +#define unlock() do{int i=(--dep->de_int_pending)?0:sys_irqenable(&dep->de_hook);(void) i;}while(0) #define milli_delay(t) tickdelay(1) /** dp.h **/ diff --git a/drivers/e1000/e1000.c b/drivers/e1000/e1000.c index e328ae757..214ef69fd 100644 --- a/drivers/e1000/e1000.c +++ b/drivers/e1000/e1000.c @@ -248,7 +248,7 @@ PRIVATE int e1000_probe(e1000_t *e) int i, r, devind; u16_t vid, did; u32_t status[2]; - u32_t gfpreg, sector_base_addr, sector_end_addr; + u32_t gfpreg, sector_base_addr; char *dname; E1000_DEBUG(3, ("%s: probe()\n", e->name)); @@ -338,12 +338,9 @@ PRIVATE int e1000_probe(e1000_t *e) gfpreg = E1000_READ_FLASH_REG(e, ICH_FLASH_GFPREG); /* - * sector_X_addr is a "sector"-aligned address (4096 bytes) - * Add 1 to sector_end_addr since this sector is included in - * the overall size. + * sector_base_addr is a "sector"-aligned address (4096 bytes) */ sector_base_addr = gfpreg & FLASH_GFPREG_BASE_MASK; - sector_end_addr = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK) + 1; /* flash_base_addr is byte-aligned */ e->flash_base_addr = sector_base_addr << FLASH_SECTOR_ADDR_SHIFT; diff --git a/drivers/filter/driver.c b/drivers/filter/driver.c index 4738ef99a..77582b3c3 100644 --- a/drivers/filter/driver.c +++ b/drivers/filter/driver.c @@ -419,8 +419,7 @@ static void restart_driver(int which, int tell_rs) */ message msg; int ipc_status; - endpoint_t endpt; - int r, w = 0; + int r; if (tell_rs) { /* Tell RS to refresh or restart the driver */ diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index 09aa88e6f..e38063f1f 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -722,8 +722,7 @@ static int fxp_probe(fxp_t *fp) /*===========================================================================* * fxp_conf_hw * *===========================================================================*/ -static void fxp_conf_hw(fp) -fxp_t *fp; +static void fxp_conf_hw(fxp_t *fp) { int i; int mwi, ext_stat1, ext_stat2, lim_fifo, i82503, fc; diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 10eb68f07..10ef1e4dc 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -1472,7 +1472,6 @@ ether_card_t *ec; int devind, just_one, i, r; u16_t vid, did; - char *dname; if ((ec->ec_pcibus | ec->ec_pcidev | ec->ec_pcifunc) != 0) { @@ -1528,10 +1527,6 @@ ether_card_t *ec; return 0; } - dname= pci_dev_name(vid, did); - if (!dname) - dname= "unknown device"; - pci_reserve(devind); getAddressing(devind, ec); diff --git a/drivers/log/log.c b/drivers/log/log.c index 79dddd303..a2e72ec42 100644 --- a/drivers/log/log.c +++ b/drivers/log/log.c @@ -299,7 +299,6 @@ unsigned nr_req; /* length of request vector */ /* Read or write one the driver's minor devices. */ unsigned count; vir_bytes user_vir; - struct device *dv; int accumulated_read = 0; struct logdevice *log; size_t vir_offset = 0; @@ -308,7 +307,6 @@ unsigned nr_req; /* length of request vector */ return EIO; /* Get minor device number and check for /dev/null. */ - dv = &log_geom[log_device]; log = &logdevices[log_device]; while (nr_req > 0) { diff --git a/drivers/orinoco/orinoco.c b/drivers/orinoco/orinoco.c index 61c8e5310..eb58bfb4a 100644 --- a/drivers/orinoco/orinoco.c +++ b/drivers/orinoco/orinoco.c @@ -1507,18 +1507,15 @@ suspend_write: * Write data which is denoted by the message to the card and send it. * *****************************************************************************/ static void or_writev_s (message * mp, int from_int) { - int port, or_client, count, size, err, data_len, data_off, tx_head; + int port, or_client, count, size, err, data_len, data_off; int o, j, n, i, s, p, cps ; struct ethhdr *eh; t_or *orp; - clock_t timebefore, t0; - phys_bytes phys_user; hermes_t *hw; struct hermes_tx_descriptor desc; int iov_offset = 0; struct header_struct hdr; iovec_s_t *iovp; - phys_bytes phys_databuf; u16_t txfid; /* We need space for the max packet size itself, plus an ethernet diff --git a/drivers/pci/main.c b/drivers/pci/main.c index 64812764d..11f53c055 100644 --- a/drivers/pci/main.c +++ b/drivers/pci/main.c @@ -150,8 +150,7 @@ message *mp; } } -PRIVATE void do_next_dev(mp) -message *mp; +PRIVATE void do_next_dev(message *mp) { int r, devind; u16_t vid, did; diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6362ce4f9..759ec5e49 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -295,7 +295,7 @@ PUBLIC int pci_first_dev_a( u16_t *didp ) { - int i, devind; + int devind; for (devind= 0; devind < nr_pcidev; devind++) { @@ -2279,12 +2279,8 @@ PRIVATE void pcibr_cb_wsts(int busind, u16_t value) /*===========================================================================* * pcibr_via_rsts * *===========================================================================*/ -PRIVATE u16_t pcibr_via_rsts(busind) -int busind; +PRIVATE u16_t pcibr_via_rsts(int busind) { - int devind; - devind= pcibus[busind].pb_devind; - return 0; } diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 3be5331e5..9da970e26 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -2407,8 +2407,7 @@ static void do_hard_int(void) /*===========================================================================* * rl_handler * *===========================================================================*/ -static int rl_handler(rep) -re_t *rep; +static int rl_handler(re_t *rep) { int i, port, tx_head, tx_tail, link_up; u16_t isr, tsad; diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index 8b84edcfd..a21298189 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -368,7 +368,6 @@ PRIVATE void sef_local_startup() PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the rtl8169 driver. */ - int r; re_t *rep; long v; diff --git a/drivers/tty/console.c b/drivers/tty/console.c index 985f5608a..4c4975d78 100644 --- a/drivers/tty/console.c +++ b/drivers/tty/console.c @@ -965,7 +965,7 @@ tty_t *tp; /* Get the BIOS parameters that describe the VDU. */ if (! vdu_initialized++) { - /* How about error checking? What to do on failure??? */ + /* FIXME: How about error checking? What to do on failure??? */ s=sys_readbios(VDU_SCREEN_COLS_ADDR, &bios_columns, VDU_SCREEN_COLS_SIZE); s=sys_readbios(VDU_CRT_BASE_ADDR, &bios_crtbase, diff --git a/kernel/system/do_safecopy.c b/kernel/system/do_safecopy.c index 6cf85397a..ff4fd93e3 100644 --- a/kernel/system/do_safecopy.c +++ b/kernel/system/do_safecopy.c @@ -47,7 +47,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */ static cp_grant_t g; static int proc_nr; static const struct proc *granter_proc; - int r, depth = 0; + int depth = 0; do { /* Get granter process slot (if valid), and check range of @@ -86,9 +86,9 @@ endpoint_t *e_granter; /* new granter (magic grants) */ * (presumably) set an invalid grant table entry by returning * EPERM, just like with an invalid grant id. */ - if((r=data_copy(granter, + if(data_copy(granter, priv(granter_proc)->s_grant_table + sizeof(g)*grant, - KERNEL, (vir_bytes) &g, sizeof(g))) != OK) { + KERNEL, (vir_bytes) &g, sizeof(g)) != OK) { printf( "verify_grant: grant verify: data_copy failed\n"); return EPERM; -- 2.44.0