Re: [PATCH v2 3/8] rndis_wlan: Make use of cpu_to_le16_array()

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

 



+ linux-wireless

Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> writes:

> Since we have a new helper, let's replace open coded variant by it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Cc: Jussi Kivilinna <jussi.kivilinna@xxxxxx>
> Cc: Kalle Valo <kvalo@xxxxxxxxxxxxxx>
> ---
> v2: new patch
>  drivers/net/wireless/rndis_wlan.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
> index 8852a1832951..06850ee6d6dc 100644
> --- a/drivers/net/wireless/rndis_wlan.c
> +++ b/drivers/net/wireless/rndis_wlan.c
> @@ -859,9 +859,12 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
>  						int value_type, void *value)
>  {
>  	struct ndis_config_param *infobuf;
> -	int value_len, info_len, param_len, ret, i;
> +	int value_len, info_len, param_len, ret;
>  	__le16 *unibuf;
>  	__le32 *dst_value;
> +#ifdef DEBUG
> +	int i;
> +#endif
>  
>  	if (value_type == 0)
>  		value_len = sizeof(__le32);
> @@ -901,13 +904,11 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
>  
>  	/* simple string to unicode string conversion */
>  	unibuf = (void *)infobuf + sizeof(*infobuf);
> -	for (i = 0; i < param_len / sizeof(__le16); i++)
> -		unibuf[i] = cpu_to_le16(param[i]);
> +	cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
>  
>  	if (value_type == 2) {
>  		unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
> -		for (i = 0; i < value_len / sizeof(__le16); i++)
> -			unibuf[i] = cpu_to_le16(((u8 *)value)[i]);
> +		cpu_to_le16_array(unibuf, value, value_len / sizeof(__le16));
>  	} else {
>  		dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
>  		*dst_value = cpu_to_le32(*(u32 *)value);

I assume this goes via usb tree:

Acked-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx>

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux