Re: [PATCH 2/2] staging: rtl8188eu: Use USB subsystem functions to check endpoint type
On Tue, Apr 29, 2014 at 06:55:13AM +0530, navin patidar wrote: > Use inline functions provided by USB subsystem to check endpoint type, > instead of inline functions implemented by driver to do the same. > > Signed-off-by: navin patidar Looks nice. Thanks. :) Reviewed-by: Dan Carpenter regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] staging: rtl8188eu: Use USB subsystem functions to check endpoint type
On Tue, Apr 29, 2014 at 06:55:13AM +0530, navin patidar wrote: Use inline functions provided by USB subsystem to check endpoint type, instead of inline functions implemented by driver to do the same. Signed-off-by: navin patidar navin.pati...@gmail.com Looks nice. Thanks. :) Reviewed-by: Dan Carpenter dan.carpen...@oracle.com regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] staging: rtl8188eu: Use USB subsystem functions to check endpoint type
Use inline functions provided by USB subsystem to check endpoint type, instead of inline functions implemented by driver to do the same. Signed-off-by: navin patidar --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 57 +-- 1 file changed, 10 insertions(+), 47 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 8a52829..8ed2ac8 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -80,46 +80,6 @@ static struct rtw_usb_drv rtl8188e_usb_drv = { static struct rtw_usb_drv *usb_drv = _usb_drv; -static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) -{ - return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN; -} - -static inline int RT_usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) -{ - return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT; -} - -static inline int RT_usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) -{ - return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT; -} - -static inline int RT_usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) -{ - return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK; -} - -static inline int RT_usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) -{ - return RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_in(epd); -} - -static inline int RT_usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) -{ - return RT_usb_endpoint_xfer_bulk(epd) && RT_usb_endpoint_dir_out(epd); -} - -static inline int usb_endpoint_is_int(const struct usb_endpoint_descriptor *epd) -{ - return RT_usb_endpoint_xfer_int(epd) && RT_usb_endpoint_dir_in(epd); -} - -static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor *epd) -{ - return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; -} - static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj) { u8 rst = _SUCCESS; @@ -183,21 +143,24 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints; for (i = 0; i < pdvobjpriv->nr_endpoint; i++) { + int ep_num; phost_endp = phost_iface->endpoint + i; + if (phost_endp) { pendp_desc = _endp->desc; + ep_num = usb_endpoint_num(pendp_desc); - if (RT_usb_endpoint_is_bulk_in(pendp_desc)) { - pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = RT_usb_endpoint_num(pendp_desc); + if (usb_endpoint_is_bulk_in(pendp_desc)) { + pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = ep_num; pdvobjpriv->RtNumInPipes++; - } else if (usb_endpoint_is_int(pendp_desc)) { - pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = RT_usb_endpoint_num(pendp_desc); + } else if (usb_endpoint_is_int_in(pendp_desc)) { + pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = ep_num; pdvobjpriv->RtNumInPipes++; - } else if (RT_usb_endpoint_is_bulk_out(pendp_desc)) { - pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = RT_usb_endpoint_num(pendp_desc); + } else if (usb_endpoint_is_bulk_out(pendp_desc)) { + pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = ep_num; pdvobjpriv->RtNumOutPipes++; } - pdvobjpriv->ep_num[i] = RT_usb_endpoint_num(pendp_desc); + pdvobjpriv->ep_num[i] = ep_num; } } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] staging: rtl8188eu: Use USB subsystem functions to check endpoint type
Use inline functions provided by USB subsystem to check endpoint type, instead of inline functions implemented by driver to do the same. Signed-off-by: navin patidar navin.pati...@gmail.com --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 57 +-- 1 file changed, 10 insertions(+), 47 deletions(-) diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 8a52829..8ed2ac8 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -80,46 +80,6 @@ static struct rtw_usb_drv rtl8188e_usb_drv = { static struct rtw_usb_drv *usb_drv = rtl8188e_usb_drv; -static inline int RT_usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) -{ - return (epd-bEndpointAddress USB_ENDPOINT_DIR_MASK) == USB_DIR_IN; -} - -static inline int RT_usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) -{ - return (epd-bEndpointAddress USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT; -} - -static inline int RT_usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) -{ - return (epd-bmAttributes USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT; -} - -static inline int RT_usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) -{ - return (epd-bmAttributes USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK; -} - -static inline int RT_usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) -{ - return RT_usb_endpoint_xfer_bulk(epd) RT_usb_endpoint_dir_in(epd); -} - -static inline int RT_usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) -{ - return RT_usb_endpoint_xfer_bulk(epd) RT_usb_endpoint_dir_out(epd); -} - -static inline int usb_endpoint_is_int(const struct usb_endpoint_descriptor *epd) -{ - return RT_usb_endpoint_xfer_int(epd) RT_usb_endpoint_dir_in(epd); -} - -static inline int RT_usb_endpoint_num(const struct usb_endpoint_descriptor *epd) -{ - return epd-bEndpointAddress USB_ENDPOINT_NUMBER_MASK; -} - static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj) { u8 rst = _SUCCESS; @@ -183,21 +143,24 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) pdvobjpriv-nr_endpoint = piface_desc-bNumEndpoints; for (i = 0; i pdvobjpriv-nr_endpoint; i++) { + int ep_num; phost_endp = phost_iface-endpoint + i; + if (phost_endp) { pendp_desc = phost_endp-desc; + ep_num = usb_endpoint_num(pendp_desc); - if (RT_usb_endpoint_is_bulk_in(pendp_desc)) { - pdvobjpriv-RtInPipe[pdvobjpriv-RtNumInPipes] = RT_usb_endpoint_num(pendp_desc); + if (usb_endpoint_is_bulk_in(pendp_desc)) { + pdvobjpriv-RtInPipe[pdvobjpriv-RtNumInPipes] = ep_num; pdvobjpriv-RtNumInPipes++; - } else if (usb_endpoint_is_int(pendp_desc)) { - pdvobjpriv-RtInPipe[pdvobjpriv-RtNumInPipes] = RT_usb_endpoint_num(pendp_desc); + } else if (usb_endpoint_is_int_in(pendp_desc)) { + pdvobjpriv-RtInPipe[pdvobjpriv-RtNumInPipes] = ep_num; pdvobjpriv-RtNumInPipes++; - } else if (RT_usb_endpoint_is_bulk_out(pendp_desc)) { - pdvobjpriv-RtOutPipe[pdvobjpriv-RtNumOutPipes] = RT_usb_endpoint_num(pendp_desc); + } else if (usb_endpoint_is_bulk_out(pendp_desc)) { + pdvobjpriv-RtOutPipe[pdvobjpriv-RtNumOutPipes] = ep_num; pdvobjpriv-RtNumOutPipes++; } - pdvobjpriv-ep_num[i] = RT_usb_endpoint_num(pendp_desc); + pdvobjpriv-ep_num[i] = ep_num; } } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/