[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1765908.3QOFSVW2eC@linux-lqwf.site>
Date: Tue, 09 Oct 2012 10:47:03 +0200
From: Oliver Neukum <oneukum@...e.de>
To: Ming Lei <ming.lei@...onical.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
netdev@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 01/12] usbnet: introduce usbnet 3 command helpers
On Tuesday 02 October 2012 14:51:12 Ming Lei wrote:
> This patch introduces the below 3 usb command helpers:
>
> usbnet_read_cmd / usbnet_write_cmd / usbnet_write_cmd_async
>
> so that each low level driver doesn't need to implement them
> by itself, and the dma buffer allocation for usb transfer and
> runtime PM things can be handled just in one place.
>
> Signed-off-by: Ming Lei <ming.lei@...onical.com>
> ---
> drivers/net/usb/usbnet.c | 133 ++++++++++++++++++++++++++++++++++++++++++++
> include/linux/usb/usbnet.h | 6 ++
> 2 files changed, 139 insertions(+)
>
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index fc9f578..3b51554 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -1592,6 +1592,139 @@ int usbnet_resume (struct usb_interface *intf)
> }
> EXPORT_SYMBOL_GPL(usbnet_resume);
>
> +/*-------------------------------------------------------------------------*/
> +int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
> + u16 value, u16 index, void *data, u16 size)
> +{
> + void *buf = NULL;
> + int err = -ENOMEM;
> +
> + netdev_dbg(dev->net, "usbnet_read_cmd cmd=0x%02x reqtype=%02x"
> + " value=0x%04x index=0x%04x size=%d\n",
> + cmd, reqtype, value, index, size);
> +
> + if (data) {
> + buf = kmalloc(size, GFP_KERNEL);
Using GFP_KERNEL you preclude using those in resume() and error handling.
Please pass a gfp_t parameter.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists