X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=drivers%2Fstaging%2Fgdm72xx%2Fgdm_usb.c;h=5a6b86a180b3c06bc83109fe41cf6acbb2397533;hb=a8a175d9fc2ddb513baf5f043c1e9de512f886f7;hp=78d6667fa0d59b46744657f0c55c81cab08e259f;hpb=3f17ea6dea8ba5668873afa54628a91aaa3fb1c0;p=karo-tx-linux.git diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index 78d6667fa0d5..5a6b86a180b3 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -36,10 +36,6 @@ MODULE_DEVICE_TABLE(usb, id_table); #define GDM7205_PADDING 256 -#define H2B(x) __cpu_to_be16(x) -#define B2H(x) __be16_to_cpu(x) -#define DB2H(x) __be32_to_cpu(x) - #define DOWNLOAD_CONF_VALUE 0x21 #ifdef CONFIG_WIMAX_GDM72XX_K_MODE @@ -312,7 +308,8 @@ static int gdm_usb_send(void *priv_dev, void *data, int len, return -ENODEV; } - BUG_ON(len > TX_BUF_SIZE - padding - 1); + if (len > TX_BUF_SIZE - padding - 1) + return -EINVAL; spin_lock_irqsave(&tx->lock, flags); @@ -338,8 +335,7 @@ static int gdm_usb_send(void *priv_dev, void *data, int len, t->callback = cb; t->cb_data = cb_data; - /* - * In some cases, USB Module of WiMax is blocked when data size is + /* In some cases, USB Module of WiMax is blocked when data size is * the multiple of 512. So, increment length by one in that case. */ if ((len % 512) == 0) @@ -439,8 +435,7 @@ static void gdm_usb_rcv_complete(struct urb *urb) list_for_each_entry(t, &tx->sdu_list, list) { usb_submit_urb(t->urb, GFP_ATOMIC); } - /* - * If free buffer for sdu tx doesn't + /* If free buffer for sdu tx doesn't * exist, then tx queue should not be * woken. For this reason, don't pass * the command, START_SDU_TX. @@ -542,9 +537,9 @@ static int gdm_usb_probe(struct usb_interface *intf, bConfigurationValue = usbdev->actconfig->desc.bConfigurationValue; /*USB description is set up with Little-Endian*/ - idVendor = L2H(usbdev->descriptor.idVendor); - idProduct = L2H(usbdev->descriptor.idProduct); - bcdDevice = L2H(usbdev->descriptor.bcdDevice); + idVendor = le16_to_cpu(usbdev->descriptor.idVendor); + idProduct = le16_to_cpu(usbdev->descriptor.idProduct); + bcdDevice = le16_to_cpu(usbdev->descriptor.bcdDevice); dev_info(&intf->dev, "Found GDM USB VID = 0x%04x PID = 0x%04x...\n", idVendor, idProduct); @@ -627,12 +622,11 @@ static void gdm_usb_disconnect(struct usb_interface *intf) phy_dev = usb_get_intfdata(intf); /*USB description is set up with Little-Endian*/ - idProduct = L2H(usbdev->descriptor.idProduct); + idProduct = le16_to_cpu(usbdev->descriptor.idProduct); if (idProduct != EMERGENCY_PID && bConfigurationValue != DOWNLOAD_CONF_VALUE && (idProduct & B_DOWNLOAD) == 0) { - udev = phy_dev->priv_dev; udev->usbdev = NULL; @@ -710,10 +704,8 @@ static int k_mode_thread(void *arg) int ret; while (!k_mode_stop) { - spin_lock_irqsave(&k_lock, flags2); while (!list_empty(&k_list)) { - udev = list_entry(k_list.next, struct usbwm_dev, list); tx = &udev->tx; rx = &udev->rx;