[PATCH V2 03/17] staging: wilc1000: wilc_wlan_cfg_get: add argument struct net_device

Greg KH gregkh at linuxfoundation.org
Wed Nov 4 20:45:44 UTC 2015


On Fri, Oct 30, 2015 at 06:47:09PM +0900, Glen Lee wrote:
> Adds argument struct net_device and use netdev private data member wilc
> instead of g_linux_wlan, pass dev to the functions as well.
> 
> Signed-off-by: Glen Lee <glen.lee at atmel.com>
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 3 ++-
>  drivers/staging/wilc1000/linux_wlan.c       | 2 +-
>  drivers/staging/wilc1000/wilc_wlan.c        | 8 ++++++--
>  drivers/staging/wilc1000/wilc_wlan.h        | 3 ++-
>  4 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
> index 3b4a950..530d64a 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -595,7 +595,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
>  		for (counter = 0; counter < count; counter++) {
>  			PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter,
>  				   (counter == count - 1));
> -			if (!wilc_wlan_cfg_get(!counter,
> +			if (!wilc_wlan_cfg_get(dev,
> +					       !counter,
>  					       wids[counter].id,
>  					       (counter == count - 1),
>  					       drv)) {
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index d0161cd..4ed324c 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -1153,7 +1153,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
>  
>  		wilc_bus_set_max_speed();
>  
> -		if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
> +		if (wilc_wlan_cfg_get(dev, 1, WID_FIRMWARE_VERSION, 1, 0)) {
>  			int size;
>  			char Firmware_ver[20];
>  
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index 16224ce..768fd30 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1809,12 +1809,16 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
>  
>  	return ret_size;
>  }
> -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)
> +int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
> +		      u32 drvHandler)
>  {
>  	wilc_wlan_dev_t *p = &g_wlan;
>  	u32 offset;
>  	int ret_size;
> +	perInterface_wlan_t *nic = netdev_priv(dev);
> +	struct wilc *wilc;
>  
> +	wilc = nic->wilc;

As you really want 'wilc', why not just pass that instead of a struct
net_device *?  You don't have to make it this complex :)

thanks,

greg k-h


More information about the devel mailing list