From 04b31c776f34d127b422da92899272a0b8cda21d Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Wed, 16 Feb 2011 23:47:51 +0900 Subject: usb: isp1362-hcd: use bitmap_clear() and bitmap_set() Use bitmap_set()/bitmap_clear() to fill/zero a region of a bitmap instead of doing set_bit()/clear_bit() each bit. Signed-off-by: Akinobu Mita Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/isp1362-hcd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/usb/host/isp1362-hcd.c') diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 43a39eb..02b742d 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c @@ -226,7 +226,6 @@ static int claim_ptd_buffers(struct isp1362_ep_queue *epq, static inline void release_ptd_buffers(struct isp1362_ep_queue *epq, struct isp1362_ep *ep) { - int index = ep->ptd_index; int last = ep->ptd_index + ep->num_ptds; if (last > epq->buf_count) @@ -236,10 +235,8 @@ static inline void release_ptd_buffers(struct isp1362_ep_queue *epq, struct isp1 epq->buf_map, epq->skip_map); BUG_ON(last > epq->buf_count); - for (; index < last; index++) { - __clear_bit(index, &epq->buf_map); - __set_bit(index, &epq->skip_map); - } + bitmap_clear(&epq->buf_map, ep->ptd_index, ep->num_ptds); + bitmap_set(&epq->skip_map, ep->ptd_index, ep->num_ptds); epq->buf_avail += ep->num_ptds; epq->ptd_count--; -- cgit v1.1 From da13051cc756756f10b2da8ea97b05bdf84bd7bb Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Tue, 30 Nov 2010 15:55:51 -0800 Subject: USB: Remove bitmap #define from hcd.h Using a #define to redefine a common variable name is a bad thing, especially when the #define is in a header. include/linux/usb/hcd.h redefined bitmap to DeviceRemovable to avoid typing a long field in the hub descriptor. This has unintended side effects for files like drivers/usb/core/devio.c that include that file, since another header included after hcd.h has different variables named bitmap. Remove the bitmap #define and replace instances of it in the host controller code. Cleanup the spaces around function calls and square brackets while we're at it. Signed-off-by: Sarah Sharp Cc: Nobuhiro Iwamatsu Cc: Inaky Perez-Gonzalez Cc: Tony Olech Cc: "Robert P. J. Day" Cc: Max Vozeler Cc: Tejun Heo Cc: Yoshihiro Shimoda Cc: Rodolfo Giometti Cc: Mike Frysinger Cc: Anton Vorontsov Cc: Sebastian Siewior Cc: Lothar Wassmann Cc: Olav Kongas Cc: Martin Fuzzey Cc: Alan Stern Cc: David Brownell --- drivers/usb/host/isp1362-hcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/usb/host/isp1362-hcd.c') diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 02b742d..6dd94b9 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c @@ -1552,9 +1552,9 @@ static void isp1362_hub_descriptor(struct isp1362_hcd *isp1362_hcd, desc->wHubCharacteristics = cpu_to_le16((reg >> 8) & 0x1f); DBG(0, "%s: hubcharacteristics = %02x\n", __func__, cpu_to_le16((reg >> 8) & 0x1f)); desc->bPwrOn2PwrGood = (reg >> 24) & 0xff; - /* two bitmaps: ports removable, and legacy PortPwrCtrlMask */ - desc->bitmap[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; - desc->bitmap[1] = ~0; + /* ports removable, and legacy PortPwrCtrlMask */ + desc->DeviceRemovable[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; + desc->DeviceRemovable[1] = ~0; DBG(3, "%s: exit\n", __func__); } -- cgit v1.1 From dbe79bbe9dcb22cb3651c46f18943477141ca452 Mon Sep 17 00:00:00 2001 From: John Youn Date: Mon, 17 Sep 2001 00:00:00 -0700 Subject: USB 3.0 Hub Changes Update the USB core to deal with USB 3.0 hubs. These hubs have a slightly different hub descriptor than USB 2.0 hubs, with a fixed (rather than variable length) size. Change the USB core's hub descriptor to have a union for the last fields that differ. Change the host controller drivers that access those last fields (DeviceRemovable and PortPowerCtrlMask) to use the union. Translate the new version of the hub port status field into the old version that khubd understands. (Note: we need to fix it to translate the roothub's port status once we stop converting it to USB 2.0 hub status internally.) Add new code to handle link state change status. Send out new control messages that are needed for USB 3.0 hubs, like Set Hub Depth. This patch is a modified version of the original patch submitted by John Youn. It's updated to reflect the removal of the "bitmap" #define, and change the hub descriptor accesses of a couple new host controller drivers. Signed-off-by: John Youn Signed-off-by: Sarah Sharp Cc: Nobuhiro Iwamatsu Cc: Inaky Perez-Gonzalez Cc: Tony Olech Cc: "Robert P. J. Day" Cc: Max Vozeler Cc: Tejun Heo Cc: Yoshihiro Shimoda Cc: Rodolfo Giometti Cc: Mike Frysinger Cc: Anton Vorontsov Cc: Sebastian Siewior Cc: Lothar Wassmann Cc: Olav Kongas Cc: Martin Fuzzey Cc: Alan Stern Cc: David Brownell --- drivers/usb/host/isp1362-hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb/host/isp1362-hcd.c') diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 6dd94b9..662cd00 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c @@ -1553,8 +1553,8 @@ static void isp1362_hub_descriptor(struct isp1362_hcd *isp1362_hcd, DBG(0, "%s: hubcharacteristics = %02x\n", __func__, cpu_to_le16((reg >> 8) & 0x1f)); desc->bPwrOn2PwrGood = (reg >> 24) & 0xff; /* ports removable, and legacy PortPwrCtrlMask */ - desc->DeviceRemovable[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; - desc->DeviceRemovable[1] = ~0; + desc->u.hs.DeviceRemovable[0] = desc->bNbrPorts == 1 ? 1 << 1 : 3 << 1; + desc->u.hs.DeviceRemovable[1] = ~0; DBG(3, "%s: exit\n", __func__); } -- cgit v1.1