Re: [PATCH 24/24] staging: wilc1000: remove unnecessary static variable 'p2p_listen_state'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 23 Aug 2018 11:13:04 +0300
Claudiu Beznea <Claudiu.Beznea@xxxxxxxxxxxxx> wrote:

> 
> 
> On 14.08.2018 09:50, Ajay Singh wrote:
> > Remove the use of unnecessary static variable 'p2p_listen_state'.
> > Already 'p2p_listen_state' is present in 'wilc_priv' struct. So
> > making use of that variable as its getting set in channel ready and
> > remain on channel expired callback.
> > 
> > Signed-off-by: Ajay Singh <ajay.kathat@xxxxxxxxxxxxx>
> > ---
> >  drivers/staging/wilc1000/host_interface.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/wilc1000/host_interface.c
> > b/drivers/staging/wilc1000/host_interface.c index d8cc08b..cf7ead5
> > 100644 --- a/drivers/staging/wilc1000/host_interface.c
> > +++ b/drivers/staging/wilc1000/host_interface.c
> > @@ -185,8 +185,6 @@ struct join_bss_param {
> >  	u8 start_time[4];
> >  };
> >  
> > -static u8 p2p_listen_state;
> > -
> >  /* 'msg' should be free by the caller for syc */
> >  static struct host_if_msg*
> >  wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct
> > work_struct *), @@ -2351,7 +2349,6 @@ static int
> > handle_remain_on_chan(struct wilc_vif *vif, netdev_err(vif->ndev,
> > "Failed to set remain on channel\n"); 
> >  error:
> > -	p2p_listen_state = 1;
> >  	hif_drv->remain_on_ch_timer_vif = vif;
> >  	mod_timer(&hif_drv->remain_on_ch_timer,
> >  		  jiffies +
> > msecs_to_jiffies(hif_remain_ch->duration)); @@ -2407,8 +2404,9 @@
> > static void handle_listen_state_expired(struct work_struct *work)
> > struct wid wid; int result;
> >  	struct host_if_drv *hif_drv = vif->hif_drv;
> > +	struct wilc_priv *priv =
> > wdev_priv(vif->ndev->ieee80211_ptr); 
> > -	if (p2p_listen_state) {
> > +	if (priv->p2p_listen_state) {
> >  		remain_on_chan_flag = false;
> >  		wid.id = WID_REMAIN_ON_CHAN;
> >  		wid.type = WID_STR;
> > @@ -2433,7 +2431,6 @@ static void
> > handle_listen_state_expired(struct work_struct *work)
> > hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg,
> > hif_remain_ch->id); }
> > -		p2p_listen_state = 0;
> 
> Is this useless at all?

Instead of using the static variable now making use of
'p2p_listen_state' variable already maintained in priv data.
'p2p_listen_state' variable is already getting set in the
wilc_wfi_remain_on_channel_ready() and
wilc_wfi_remain_on_channel_expired(). So I think setting it explicitly
not required as the callbacks will take care to set the flag.

> 
> >  	} else {
> >  		netdev_dbg(vif->ndev, "Not in listen state\n");
> >  	}
> > 

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux