Search Linux Wireless

Re: [PATCH 20/20] wlcore: Always pass DMA-able buffers to mmc functions

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

 



On Wed, 2012-11-28 at 11:42 +0200, Arik Nemtsov wrote:
> From: Ido Yariv <ido@xxxxxxxxxx>
> 
> Some of the mmc drivers initiate DMA transfers with buffers passed from
> higher layers. This means that the driver shouldn't ever pass non
> DMA-able buffers, such as ones that are unaligned, allocated on the
> stack or static.
> 
> Fix a couple of calls to the mmc layer in which buffers which weren't
> necessarily DMA-able were passed.
> 
> Signed-off-by: Ido Yariv <ido@xxxxxxxxxx>
> Signed-off-by: Arik Nemtsov <arik@xxxxxxxxxx>
> ---

[...]

> diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h
> index 5897747..70f9bdc 100644
> --- a/drivers/net/wireless/ti/wlcore/io.h
> +++ b/drivers/net/wireless/ti/wlcore/io.h
> @@ -105,13 +105,12 @@ static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr,
>  {
>  	int ret;
>  
> -	ret = wlcore_raw_read(wl, addr, &wl->buffer_32,
> -			      sizeof(wl->buffer_32), false);
> +	ret = wlcore_raw_read(wl, addr, wl->buffer_32, sizeof(u32), false);
>  	if (ret < 0)
>  		return ret;
>  
>  	if (val)
> -		*val = le32_to_cpu(wl->buffer_32);
> +		*val = le32_to_cpu(*wl->buffer_32);
>  
>  	return 0;
>  }
> @@ -119,9 +118,8 @@ static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr,
>  static inline int __must_check wlcore_raw_write32(struct wl1271 *wl, int addr,
>  						  u32 val)
>  {
> -	wl->buffer_32 = cpu_to_le32(val);
> -	return wlcore_raw_write(wl, addr, &wl->buffer_32,
> -				sizeof(wl->buffer_32), false);
> +	*wl->buffer_32 = cpu_to_le32(val);
> +	return wlcore_raw_write(wl, addr, wl->buffer_32, sizeof(u32), false);
>  }
>  
>  static inline int __must_check wlcore_read(struct wl1271 *wl, int addr,
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> index 1793a82..e4ff66a 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -5890,8 +5890,17 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
>  		goto err_fwlog;
>  	}
>  
> +	wl->buffer_32 = kmalloc(sizeof(u32), GFP_KERNEL);
> +	if (!wl->buffer_32) {
> +		ret = -ENOMEM;
> +		goto err_mbox;
> +	}
> +
>  	return hw;
>  
> +err_mbox:
> +	kfree(wl->mbox);
> +
>  err_fwlog:
>  	free_page((unsigned long)wl->fwlog);


Can't we change sizeof(u32) to sizeof(__le32) or sizeof(*wl->buffer_32)
just for consistency?

I'll change it to the latter if you agree.

--
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux