Driver has dead code compiled out using preprocessor directives. TODO file asks for these not to be removed - ignore this. Remove dead code. Remove 'do not remove #if 0/1 ...' from TODO file. Signed-off-by: Tobin C. Harding <me@xxxxxxxx> --- drivers/staging/ks7010/TODO | 2 - drivers/staging/ks7010/ks7010_sdio.c | 40 ++--- drivers/staging/ks7010/ks_wlan_net.c | 297 +---------------------------------- 3 files changed, 13 insertions(+), 326 deletions(-) diff --git a/drivers/staging/ks7010/TODO b/drivers/staging/ks7010/TODO index 2938d35..87a6dac 100644 --- a/drivers/staging/ks7010/TODO +++ b/drivers/staging/ks7010/TODO @@ -18,8 +18,6 @@ First a few words what not to do (at least not blindly): - don't be overly strict with the 80 char limit. Only if it REALLY makes the code more readable -- No '#if 0/1' removal unless the surrounding code is understood and removal is - really OK. There might be some hints hidden there. Now the TODOs: diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index df90c20..0c4d00f 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -595,39 +595,19 @@ static void ks_sdio_interrupt(struct sdio_func *func) (uint16_t)(rsize << 4)); } if (rw_data & WSTATUS_MASK) { -#if 0 - if (status & INT_WRITE_STATUS - && !cnt_txqbody(priv)) { - /* dummy write for interrupt clear */ - rw_data = 0; - retval = - ks7010_sdio_write(priv, DATA_WINDOW, - &rw_data, - sizeof(rw_data)); - if (retval) { - DPRINTK(1, - "write DATA_WINDOW Failed!!(%d)\n", - retval); + if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { + if (cnt_txqbody(priv)) { + ks_wlan_hw_wakeup_request(priv); + queue_delayed_work + (priv->ks_wlan_hw. + ks7010sdio_wq, + &priv->ks_wlan_hw. + rw_wq, 1); + return; } - status &= ~INT_WRITE_STATUS; } else { -#endif - if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) { - if (cnt_txqbody(priv)) { - ks_wlan_hw_wakeup_request(priv); - queue_delayed_work - (priv->ks_wlan_hw. - ks7010sdio_wq, - &priv->ks_wlan_hw. - rw_wq, 1); - return; - } - } else { - tx_device_task((void *)priv); - } -#if 0 + tx_device_task((void *)priv); } -#endif } } while (rsize); } diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index b4b7e2d..7f48535 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -339,25 +339,14 @@ static int ks_wlan_get_essid(struct net_device *dev, if (priv->reg.ssid.size) { /* Get the current SSID */ memcpy(extra, priv->reg.ssid.body, priv->reg.ssid.size); -#if 0 - extra[priv->reg.ssid.size] = '\0'; -#endif + /* If none, we may want to get the one that was set */ /* Push it out ! */ -#if 1 dwrq->length = priv->reg.ssid.size; -#else - dwrq->length = priv->reg.ssid.size + 1; -#endif dwrq->flags = 1; /* active */ } else { -#if 1 dwrq->length = 0; -#else - extra[0] = '\0'; - dwrq->length = 1; -#endif dwrq->flags = 0; /* ANY */ } @@ -1550,18 +1539,7 @@ static int ks_wlan_get_scan(struct net_device *dev, DPRINTK(2, "aplist 0\n"); return -ENODATA; } -#if 0 - /* current connect ap */ - if ((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS) { - if ((extra + dwrq->length) - current_ev <= IW_EV_ADDR_LEN) { - dwrq->length = 0; - return -E2BIG; - } - current_ev = ks_wlan_translate_scan(dev, current_ev, - extra + dwrq->length, - &priv->current_ap); - } -#endif + /* Read and parse all entries */ for (i = 0; i < priv->aplist.size; i++) { if ((extra + dwrq->length) - current_ev <= IW_EV_ADDR_LEN) { @@ -2106,66 +2084,6 @@ static int ks_wlan_get_firmware_version(struct net_device *dev, return 0; } -#if 0 -/*------------------------------------------------------------------*/ -/* Private handler : set force disconnect status */ -static int ks_wlan_set_detach(struct net_device *dev, - struct iw_request_info *info, __u32 *uwrq, - char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - - /* for SLEEP MODE */ - if (*uwrq == CONNECT_STATUS) { /* 0 */ - priv->connect_status &= ~FORCE_DISCONNECT; - if ((priv->connect_status & CONNECT_STATUS_MASK) == - CONNECT_STATUS) - netif_carrier_on(dev); - } else if (*uwrq == DISCONNECT_STATUS) { /* 1 */ - priv->connect_status |= FORCE_DISCONNECT; - netif_carrier_off(dev); - } else { - return -EINVAL; - } - return 0; -} - -/*------------------------------------------------------------------*/ -/* Private handler : get force disconnect status */ -static int ks_wlan_get_detach(struct net_device *dev, - struct iw_request_info *info, __u32 *uwrq, - char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - - /* for SLEEP MODE */ - *uwrq = ((priv->connect_status & FORCE_DISCONNECT) ? 1 : 0); - return 0; -} - -/*------------------------------------------------------------------*/ -/* Private handler : get connect status */ -static int ks_wlan_get_connect(struct net_device *dev, - struct iw_request_info *info, __u32 *uwrq, - char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - - /* for SLEEP MODE */ - *uwrq = (priv->connect_status & CONNECT_STATUS_MASK); - return 0; -} -#endif - static int ks_wlan_set_preamble(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) @@ -2286,137 +2204,6 @@ static int ks_wlan_get_scan_type(struct net_device *dev, return 0; } -#if 0 -/*------------------------------------------------------------------*/ -/* Private handler : write raw data to device */ -static int ks_wlan_data_write(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - unsigned char *wbuff = NULL; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - wbuff = kmalloc(dwrq->length, GFP_ATOMIC); - if (!wbuff) - return -EFAULT; - memcpy(wbuff, extra, dwrq->length); - - /* write to device */ - ks_wlan_hw_tx(priv, wbuff, dwrq->length, NULL, NULL, NULL); - - return 0; -} - -/*------------------------------------------------------------------*/ -/* Private handler : read raw data form device */ -static int ks_wlan_data_read(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - unsigned short read_length; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - if (!atomic_read(&priv->event_count)) { - if (priv->dev_state < DEVICE_STATE_BOOT) { /* Remove device */ - read_length = 4; - memset(extra, 0xff, read_length); - dwrq->length = read_length; - return 0; - } - read_length = 0; - *extra = '\0'; - dwrq->length = 0; - return 0; - } - - if (atomic_read(&priv->event_count) > 0) - atomic_dec(&priv->event_count); - - spin_lock(&priv->dev_read_lock); /* request spin lock */ - - /* Copy length max size 0x07ff */ - if (priv->dev_size[priv->dev_count] > 2047) - read_length = 2047; - else - read_length = priv->dev_size[priv->dev_count]; - - /* Copy data */ - memcpy(extra, &priv->dev_data[priv->dev_count][0], read_length); - - spin_unlock(&priv->dev_read_lock); /* release spin lock */ - - /* Initialize */ - priv->dev_data[priv->dev_count] = 0; - priv->dev_size[priv->dev_count] = 0; - - priv->dev_count++; - if (priv->dev_count == DEVICE_STOCK_COUNT) - priv->dev_count = 0; - - /* Set read size */ - dwrq->length = read_length; - - return 0; -} -#endif - -#if 0 -/*------------------------------------------------------------------*/ -/* Private handler : get wep string */ -#define WEP_ASCII_BUFF_SIZE (17 + 64 * 4 + 1) -static int ks_wlan_get_wep_ascii(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - int i, j, len = 0; - char tmp[WEP_ASCII_BUFF_SIZE]; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - strcpy(tmp, " WEP keys ASCII \n"); - len += strlen(" WEP keys ASCII \n"); - - for (i = 0; i < 4; i++) { - strcpy(tmp + len, "\t["); - len += strlen("\t["); - tmp[len] = '1' + i; - len++; - strcpy(tmp + len, "] "); - len += strlen("] "); - if (priv->reg.wep_key[i].size) { - strcpy(tmp + len, - (priv->reg.wep_key[i].size < - 6 ? "(40bits) [" : "(104bits) [")); - len += - strlen((priv->reg.wep_key[i].size < - 6 ? "(40bits) [" : "(104bits) [")); - for (j = 0; j < priv->reg.wep_key[i].size; j++, len++) - tmp[len] = - (isprint(priv->reg.wep_key[i].val[j]) ? - priv->reg.wep_key[i].val[j] : ' '); - - strcpy(tmp + len, "]\n"); - len += strlen("]\n"); - } else { - strcpy(tmp + len, "off\n"); - len += strlen("off\n"); - } - } - - memcpy(extra, tmp, len); - dwrq->length = len + 1; - return 0; -} -#endif - static int ks_wlan_set_beacon_lost(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) @@ -2573,46 +2360,8 @@ static int ks_wlan_get_sleep_mode(struct net_device *dev, return 0; } - -#if 0 -/*------------------------------------------------------------------*/ -/* Private handler : set phy information timer */ -static int ks_wlan_set_phy_information_timer(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - if (*uwrq >= 0 && *uwrq <= 0xFFFF) /* 0-65535 */ - priv->reg.phy_info_timer = (uint16_t)*uwrq; - else - return -EINVAL; - - hostif_sme_enqueue(priv, SME_PHY_INFO_REQUEST); - - return 0; -} - -/*------------------------------------------------------------------*/ -/* Private handler : get phy information timer */ -static int ks_wlan_get_phy_information_timer(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - *uwrq = priv->reg.phy_info_timer; - return 0; -} -#endif - #ifdef WPS + static int ks_wlan_set_wps_enable(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) @@ -2686,24 +2435,6 @@ static int ks_wlan_set_wps_probe_req(struct net_device *dev, return 0; } - -#if 0 -/*------------------------------------------------------------------*/ -/* Private handler : get WPS probe req */ -static int ks_wlan_get_wps_probe_req(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - DPRINTK(2, "\n"); - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - return 0; -} -#endif #endif /* WPS */ static int ks_wlan_set_tx_gain(struct net_device *dev, @@ -2784,28 +2515,6 @@ static int ks_wlan_get_rx_gain(struct net_device *dev, return 0; } -#if 0 -/*------------------------------------------------------------------*/ -/* Private handler : set region value */ -static int ks_wlan_set_region(struct net_device *dev, - struct iw_request_info *info, __u32 *uwrq, - char *extra) -{ - struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; - - if (priv->sleep_mode == SLP_SLEEP) - return -EPERM; - /* for SLEEP MODE */ - if (*uwrq >= 0x9 && *uwrq <= 0xF) /* 0x9-0xf */ - priv->region = (uint8_t)*uwrq; - else - return -EINVAL; - - hostif_sme_enqueue(priv, SME_SET_REGION); - return 0; -} -#endif - static int ks_wlan_get_eeprom_cksum(struct net_device *dev, struct iw_request_info *info, __u32 *uwrq, char *extra) -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel