wifi: libertas: Deadcoding
cover wifi: libertas: Deadcoding
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
The first two patches remove functions that haven't been
called since a commit in 2010.
The last one cleans up a bunch of unreachable code and
never set variables, due to the functions that weren't called.
This series is build test only, which the first two are fine, but the 3rd one might be best to check a bit more given that it's actually removing some if's.
Dr. David Alan Gilbert (3):
wifi: libertas: Remove unused functions in main
wifi: libertas: Remove unused cmd functions
wifi: libertas: Remove unused auto deep sleep code
drivers/net/wireless/marvell/libertas/cmd.c | 143 +----------------- drivers/net/wireless/marvell/libertas/cmd.h | 10 -- .../net/wireless/marvell/libertas/cmdresp.c | 1 - drivers/net/wireless/marvell/libertas/decl.h | 4 - drivers/net/wireless/marvell/libertas/dev.h | 4 - drivers/net/wireless/marvell/libertas/main.c | 88 +---------- 6 files changed, 6 insertions(+), 244 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/3 wifi: libertas: Remove unused functions in main
From: "Dr. David Alan Gilbert" <[email protected]>
lbs_data_rate_to_fw_index(), lbs_enter_auto_deep_sleep() and lbs_exit_auto_deep_sleep() last use was removed in 2010 by commit e86dc1ca4676 ("Libertas: cfg80211 support")
Remove them.
--- drivers/net/wireless/marvell/libertas/decl.h | 4 -- drivers/net/wireless/marvell/libertas/main.c | 40 -------------------- 2 files changed, 44 deletions(-)
drivers/net/wireless/marvell/libertas/decl.h +0 -4
@@ -64,11 +64,7 @@ int lbs_resume(struct lbs_private *priv);void lbs_queue_event (struct lbs_private *priv,u32 event);void lbs_notify_command_response (struct lbs_private *priv,u8 resp_idx); -int lbs_enter_auto_deep_sleep (struct lbs_private *priv); -int lbs_exit_auto_deep_sleep (struct lbs_private *priv); -u32 lbs_fw_index_to_data_rate (u8 index); -u8 lbs_data_rate_to_fw_index (u32 rate); int lbs_get_firmware(struct device *dev, u32 card_model, const struct lbs_fw_table *fw_table,
drivers/net/wireless/marvell/libertas/main.c +0 -40
@@ -79,26 +79,6 @@ u32 lbs_fw_index_to_data_rate(u8 idx)return fw_data_rates[idx]; } -/** -* lbs_data_rate_to_fw_index - use rate to get the index -* -* @rate: data rate -* returns: index or 0 -*/ -u8 lbs_data_rate_to_fw_index (u32 rate) -{ -u8 i; - -if (!rate) -return 0 ; - -for (i =0 ; i <sizeof (fw_data_rates); i++) { -if (rate == fw_data_rates[i]) -return i; - } -return 0 ; -} -int lbs_set_iface_type (struct lbs_private *priv,enum nl80211_iftype type) {int ret =0 ;
@@ -802,26 +782,6 @@ static void auto_deepsleep_timer_fn(struct timer_list *t) (priv->auto_deep_sleep_timeout * HZ)/1000); } -int lbs_enter_auto_deep_sleep (struct lbs_private *priv) -{ - priv->is_auto_deep_sleep_enabled =1 ; -if (priv->is_deep_sleep) - priv->wakeup_dev_required =1 ; -mod_timer (&priv->auto_deepsleep_timer , - jiffies + (priv->auto_deep_sleep_timeout *HZ )/1000 ); - -return 0 ; -} - -int lbs_exit_auto_deep_sleep (struct lbs_private *priv) -{ - priv->is_auto_deep_sleep_enabled =0 ; - priv->auto_deep_sleep_timeout =0 ; -del_timer (&priv->auto_deepsleep_timer); - -return 0 ; -} -static int lbs_init_adapter (struct lbs_private *priv) {int ret;
Signature · 1 line
2.48.1
Re: [1/3] wifi: libertas: main: remove unused functions
Quoted 9 lines · [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
lbs_data_rate_to_fw_index(),lbs_enter_auto_deep_sleep()andlbs_exit_auto_deep_sleep()last use was removed in 2010 by commite86dc1ca4676("Libertas: cfg80211 support").Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
3 patches applied to wireless-next.git, thanks.
d5b66511fd35 wifi: libertas: main: remove unused functions 5a7148ba1806 wifi: libertas: cmd: remove unused functions 107c2be8ddf4 wifi: libertas: Remove unused auto deep sleep code
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 2/3 wifi: libertas: Remove unused cmd functions
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
lbs_get_snmp_mib(), lbs_set_power_adapt_cfg(), lbs_set_tpc_cfg() and lbs_set_tx_power() have been unused since 2010's commit e86dc1ca4676 ("Libertas: cfg80211 support")
Remove them.
--- drivers/net/wireless/marvell/libertas/cmd.c | 129 -------------------- drivers/net/wireless/marvell/libertas/cmd.h | 10 -- 2 files changed, 139 deletions(-)
drivers/net/wireless/marvell/libertas/cmd.c +0 -129
@@ -452,46 +452,6 @@ int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val)return ret; } -/** -* lbs_get_snmp_mib - Get an SNMP MIB value -* -* @priv: A pointer to &struct lbs_private structure -* @oid: The OID to retrieve from the firmware -* @out_val: Location for the returned value -* -* returns: 0 on success, error on failure -*/ -int lbs_get_snmp_mib (struct lbs_private *priv,u32 oid,u16 *out_val) -{ -struct cmd_ds_802_11_snmp_mib cmd; -int ret; - -memset (&cmd,0 ,sizeof (cmd)); - cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); - cmd.action =cpu_to_le16 (CMD_ACT_GET ); - cmd.oid =cpu_to_le16 (oid); - - ret =lbs_cmd_with_response (priv,CMD_802_11_SNMP_MIB , &cmd); -if (ret) - goto out; - -switch (le16_to_cpu (cmd.bufsize)) { -case sizeof (u8): - *out_val = cmd.value[0 ]; -break ; -case sizeof (u16): - *out_val =le16_to_cpu (*((__le16 *)(&cmd.value))); -break ; -default : -lbs_deb_cmd ("SNMP_CMD: (get) unhandled OID 0x%x size %d\n" , - oid,le16_to_cpu (cmd.bufsize)); -break ; - } - -out: -return ret; -} -/** * lbs_get_tx_power - Get the min, max, and current TX power *
@@ -524,31 +484,6 @@ int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel,return ret; } -/** -* lbs_set_tx_power - Set the TX power -* -* @priv: A pointer to &struct lbs_private structure -* @dbm: The desired power level in dBm -* -* returns: 0 on success, error on failure -*/ -int lbs_set_tx_power (struct lbs_private *priv,s16 dbm) -{ -struct cmd_ds_802_11_rf_tx_power cmd; -int ret; - -memset (&cmd,0 ,sizeof (cmd)); - cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); - cmd.action =cpu_to_le16 (CMD_ACT_SET ); - cmd.curlevel =cpu_to_le16 (dbm); - -lbs_deb_cmd ("SET_RF_TX_POWER: %d dBm\n" , dbm); - - ret =lbs_cmd_with_response (priv,CMD_802_11_RF_TX_POWER , &cmd); - -return ret; -} -/** * lbs_set_monitor_mode - Enable or disable monitor mode * (only implemented on OLPC usb8388 FW)
@@ -1440,70 +1375,6 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv) } -/** -* lbs_set_tpc_cfg - Configures the transmission power control functionality -* -* @priv: A pointer to &struct lbs_private structure -* @enable: Transmission power control enable -* @p0: Power level when link quality is good (dBm). -* @p1: Power level when link quality is fair (dBm). -* @p2: Power level when link quality is poor (dBm). -* @usesnr: Use Signal to Noise Ratio in TPC -* -* returns: 0 on success -*/ -int lbs_set_tpc_cfg (struct lbs_private *priv,int enable,int8_t p0,int8_t p1, -int8_t p2,int usesnr) -{ -struct cmd_ds_802_11_tpc_cfg cmd; -int ret; - -memset (&cmd,0 ,sizeof (cmd)); - cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); - cmd.action =cpu_to_le16 (CMD_ACT_SET ); - cmd.enable = !!enable; - cmd.usesnr = !!usesnr; - cmd.P0 = p0; - cmd.P1 = p1; - cmd.P2 = p2; - - ret =lbs_cmd_with_response (priv,CMD_802_11_TPC_CFG , &cmd); - -return ret; -} - -/** -* lbs_set_power_adapt_cfg - Configures the power adaptation settings -* -* @priv: A pointer to &struct lbs_private structure -* @enable: Power adaptation enable -* @p0: Power level for 1, 2, 5.5 and 11 Mbps (dBm). -* @p1: Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm). -* @p2: Power level for 48 and 54 Mbps (dBm). -* -* returns: 0 on Success -*/ - -int lbs_set_power_adapt_cfg (struct lbs_private *priv,int enable,int8_t p0, -int8_t p1,int8_t p2) -{ -struct cmd_ds_802_11_pa_cfg cmd; -int ret; - -memset (&cmd,0 ,sizeof (cmd)); - cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); - cmd.action =cpu_to_le16 (CMD_ACT_SET ); - cmd.enable = !!enable; - cmd.P0 = p0; - cmd.P1 = p1; - cmd.P2 = p2; - - ret =lbs_cmd_with_response (priv,CMD_802_11_PA_CFG , &cmd); - -return ret; -} - - struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
drivers/net/wireless/marvell/libertas/cmd.h +0 -10
@@ -105,19 +105,9 @@ int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel,int lbs_set_snmp_mib (struct lbs_private *priv,u32 oid,u16 val); -int lbs_get_snmp_mib (struct lbs_private *priv,u32 oid,u16 *out_val); -/* Commands only used in wext.c, assoc. and scan.c */ -int lbs_set_power_adapt_cfg (struct lbs_private *priv,int enable,int8_t p0, -int8_t p1,int8_t p2); - -int lbs_set_tpc_cfg (struct lbs_private *priv,int enable,int8_t p0,int8_t p1, -int8_t p2,int usesnr); - -int lbs_set_tx_power (struct lbs_private *priv,s16 dbm); -int lbs_set_deep_sleep (struct lbs_private *priv,int deep_sleep);int lbs_set_host_sleep (struct lbs_private *priv,int host_sleep);
Signature · 1 line
2.48.1
PATCH 3/3 wifi: libertas: Remove unused auto deep sleep code
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
With the recent removal of the uncalled
lbs_(enter|exit)_auto_deep_sleep()
functions, it's no longer possible to set
priv->is_auto_deep_sleep_enabled
so we can remove all tests of it and the variable itself.
With that gone, priv->wakeup_dev_required also doesn't get set, so we can remove any testing of it.
Now the timer itself, and the function it calls goes. The timer used the apparently unset auto_deep_sleep_timeout member, which can also go.
--- drivers/net/wireless/marvell/libertas/cmd.c | 14 ++---- .../net/wireless/marvell/libertas/cmdresp.c | 1 - drivers/net/wireless/marvell/libertas/dev.h | 4 -- drivers/net/wireless/marvell/libertas/main.c | 48 +------------------ 4 files changed, 6 insertions(+), 61 deletions(-)
drivers/net/wireless/marvell/libertas/cmd.c +4 -10
@@ -903,10 +903,6 @@ static void lbs_submit_command(struct lbs_private *priv, }if (command ==CMD_802_11_DEEP_SLEEP ) { -if (priv->is_auto_deep_sleep_enabled) { - priv->wakeup_dev_required =1 ; - priv->dnld_sent =0 ; - } priv->is_deep_sleep =1 ;lbs_complete_command (priv, cmdnode,0 ); }else {
@@ -1391,12 +1387,10 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,/* No commands are allowed in Deep Sleep until we toggle the GPIO * to wake up the card and it has signaled that it's ready. */ -if (!priv->is_auto_deep_sleep_enabled) { -if (priv->is_deep_sleep) { -lbs_deb_cmd ("command not allowed in deep sleep\n" ); - cmdnode =ERR_PTR (-EBUSY ); - goto done; - } +if (priv->is_deep_sleep) { +lbs_deb_cmd ("command not allowed in deep sleep\n" ); + cmdnode =ERR_PTR (-EBUSY ); + goto done; } cmdnode =lbs_get_free_cmd_node (priv);
drivers/net/wireless/marvell/libertas/cmdresp.c +0 -1
@@ -279,7 +279,6 @@ void lbs_process_event(struct lbs_private *priv, u32 event) priv->reset_deep_sleep_wakeup (priv);lbs_deb_cmd ("EVENT: ds awake\n" ); priv->is_deep_sleep =0 ; - priv->wakeup_dev_required =0 ;wake_up_interruptible (&priv->ds_awake_q);break ;
drivers/net/wireless/marvell/libertas/dev.h +0 -4
@@ -83,12 +83,8 @@ struct lbs_private {/* Deep sleep */ int is_deep_sleep;int deep_sleep_required; -int is_auto_deep_sleep_enabled; -int wakeup_dev_required;int is_activity_detected; -int auto_deep_sleep_timeout;/* in ms */ wait_queue_head_t ds_awake_q; -struct timer_list auto_deepsleep_timer;/* Host sleep*/ int is_host_sleep_configured;
drivers/net/wireless/marvell/libertas/main.c +2 -46
97 lines not on this page · raw message
Signature · 1 line
2.48.1