Re: [PATCH v2 1/4] USB: introduce usb_device_no_sg_constraint() helper
From: Ming Lei <hidden>
Date: 2013-08-05 14:33:32
On Mon, Aug 5, 2013 at 10:07 PM, Alan Stern [off-list ref] wrote:
On Mon, 5 Aug 2013, Ming Lei wrote:quoted
Some host controllers(such as xHCI) can support building packet from discontinuous buffers, so introduce one flag and helper for this kind of host controllers, then the feature can help some applications(such as usbnet) by supporting arbitrary length of sg buffers.quoted
+static inline bool usb_device_no_sg_constraint(struct usb_device *udev) +{ + if (udev && udev->bus && udev->bus->no_sg_constraint) + return true; + else + return false; +}A more elegant implementation would be: return udev && udev->bus && udev->bus->no_sg_constraint; I doubt it will make any difference to the object code, though. Apart from that, this looks fine.
OK, this can save 3 line code, and I will take it in v3.
Acked-by: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Thanks for your Ack and review. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html