diff options
Diffstat (limited to 'drivers/staging/gdm72xx')
-rw-r--r-- | drivers/staging/gdm72xx/TODO | 1 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_qos.c | 100 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_qos.h | 17 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_sdio.c | 27 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_sdio.h | 29 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_usb.c | 64 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_usb.h | 11 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_wimax.c | 104 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/gdm_wimax.h | 29 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/hci.h | 87 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/netlink_k.c | 11 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/netlink_k.h | 4 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/sdio_boot.c | 4 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/sdio_boot.h | 2 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/usb_boot.c | 39 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/usb_boot.h | 4 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/usb_ids.h | 2 | ||||
-rw-r--r-- | drivers/staging/gdm72xx/wm_ioctl.h | 22 |
18 files changed, 236 insertions, 321 deletions
diff --git a/drivers/staging/gdm72xx/TODO b/drivers/staging/gdm72xx/TODO index 5ab27fb29594..62d0cd6225c8 100644 --- a/drivers/staging/gdm72xx/TODO +++ b/drivers/staging/gdm72xx/TODO @@ -1,3 +1,2 @@ TODO: -- Replace kernel_thread with kthread in gdm_usb.c - Clean up coding style to meet kernel standard. diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 50d43ada0936..df6f000534d4 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -24,7 +24,7 @@ #include "hci.h" #include "gdm_qos.h" -#define B2H(x) __be16_to_cpu(x) +#define B2H(x) __be16_to_cpu(x) #define MAX_FREE_LIST_CNT 32 static struct { @@ -48,7 +48,7 @@ static void *alloc_qos_entry(void) spin_lock_irqsave(&qos_free_list.lock, flags); if (qos_free_list.cnt) { entry = list_entry(qos_free_list.head.prev, struct qos_entry_s, - list); + list); list_del(&entry->list); qos_free_list.cnt--; spin_unlock_irqrestore(&qos_free_list.lock, flags); @@ -56,13 +56,13 @@ static void *alloc_qos_entry(void) } spin_unlock_irqrestore(&qos_free_list.lock, flags); - entry = kmalloc(sizeof(struct qos_entry_s), GFP_ATOMIC); + entry = kmalloc(sizeof(*entry), GFP_ATOMIC); return entry; } static void free_qos_entry(void *entry) { - struct qos_entry_s *qentry = (struct qos_entry_s *) entry; + struct qos_entry_s *qentry = (struct qos_entry_s *)entry; unsigned long flags; spin_lock_irqsave(&qos_free_list.lock, flags); @@ -142,24 +142,24 @@ void gdm_qos_release_list(void *nic_ptr) free_qos_entry_list(&free_list); } -static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port) +static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) { int i; if (csr->classifier_rule_en&IPTYPEOFSERVICE) { - if (((Stream[1] & csr->ip2s_mask) < csr->ip2s_lo) || - ((Stream[1] & csr->ip2s_mask) > csr->ip2s_hi)) + if (((stream[1] & csr->ip2s_mask) < csr->ip2s_lo) || + ((stream[1] & csr->ip2s_mask) > csr->ip2s_hi)) return 1; } if (csr->classifier_rule_en&PROTOCOL) { - if (Stream[9] != csr->protocol) + if (stream[9] != csr->protocol) return 1; } if (csr->classifier_rule_en&IPMASKEDSRCADDRESS) { for (i = 0; i < 4; i++) { - if ((Stream[12 + i] & csr->ipsrc_addrmask[i]) != + if ((stream[12 + i] & csr->ipsrc_addrmask[i]) != (csr->ipsrc_addr[i] & csr->ipsrc_addrmask[i])) return 1; } @@ -167,7 +167,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port) if (csr->classifier_rule_en&IPMASKEDDSTADDRESS) { for (i = 0; i < 4; i++) { - if ((Stream[16 + i] & csr->ipdst_addrmask[i]) != + if ((stream[16 + i] & csr->ipdst_addrmask[i]) != (csr->ipdst_addr[i] & csr->ipdst_addrmask[i])) return 1; } @@ -190,25 +190,24 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port) static u32 get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) { - u32 IP_Ver, Header_Len, i; + u32 IP_ver, i; struct qos_cb_s *qcb = &nic->qos; if (iph == NULL || tcpudph == NULL) return -1; - IP_Ver = (iph[0]>>4)&0xf; - Header_Len = iph[0]&0xf; + IP_ver = (iph[0]>>4)&0xf; - if (IP_Ver == 4) { - for (i = 0; i < QOS_MAX; i++) { - if (qcb->csr[i].enabled) { - if (qcb->csr[i].classifier_rule_en) { - if (chk_ipv4_rule(&qcb->csr[i], iph, - tcpudph) == 0) - return i; - } - } - } + if (IP_ver != 4) + return -1; + + for (i = 0; i < QOS_MAX; i++) { + if (!qcb->csr[i].enabled) + continue; + if (!qcb->csr[i].classifier_rule_en) + continue; + if (chk_ipv4_rule(&qcb->csr[i], iph, tcpudph) == 0) + return i; } return -1; @@ -223,22 +222,21 @@ static u32 extract_qos_list(struct nic *nic, struct list_head *head) INIT_LIST_HEAD(head); for (i = 0; i < QOS_MAX; i++) { - if (qcb->csr[i].enabled) { - if (qcb->csr[i].qos_buf_count < qcb->qos_limit_size) { - if (!list_empty(&qcb->qos_list[i])) { - entry = list_entry( - qcb->qos_list[i].prev, - struct qos_entry_s, list); - list_move_tail(&entry->list, head); - qcb->csr[i].qos_buf_count++; - - if (!list_empty(&qcb->qos_list[i])) - netdev_warn(nic->netdev, - "Index(%d) is piled!!\n", - i); - } - } - } + if (!qcb->csr[i].enabled) + continue; + if (qcb->csr[i].qos_buf_count >= qcb->qos_limit_size) + continue; + if (list_empty(&qcb->qos_list[i])) + continue; + + entry = list_entry(qcb->qos_list[i].prev, struct qos_entry_s, + list); + + list_move_tail(&entry->list, head); + qcb->csr[i].qos_buf_count++; + + if (!list_empty(&qcb->qos_list[i])) + netdev_warn(nic->netdev, "Index(%d) is piled!!\n", i); } return 0; @@ -261,14 +259,14 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev) int index; struct qos_cb_s *qcb = &nic->qos; unsigned long flags; - struct ethhdr *ethh = (struct ethhdr *) (skb->data + HCI_HEADER_SIZE); - struct iphdr *iph = (struct iphdr *) ((char *) ethh + ETH_HLEN); + struct ethhdr *ethh = (struct ethhdr *)(skb->data + HCI_HEADER_SIZE); + struct iphdr *iph = (struct iphdr *)((char *)ethh + ETH_HLEN); struct tcphdr *tcph; struct qos_entry_s *entry = NULL; struct list_head send_list; int ret = 0; - tcph = (struct tcphdr *) iph + iph->ihl*4; + tcph = (struct tcphdr *)iph + iph->ihl*4; if (B2H(ethh->h_proto) == ETH_P_IP) { if (qcb->qos_list_cnt && !qos_free_list.cnt) { @@ -281,7 +279,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev) spin_lock_irqsave(&qcb->qos_lock, flags); if (qcb->qos_list_cnt) { - index = get_qos_index(nic, (u8 *)iph, (u8 *) tcph); + index = get_qos_index(nic, (u8 *)iph, (u8 *)tcph); if (index == -1) index = qcb->qos_null_idx; @@ -336,16 +334,16 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) { struct nic *nic = nic_ptr; u32 i, SFID, index, pos; - u8 subCmdEvt; + u8 sub_cmd_evt; struct qos_cb_s *qcb = &nic->qos; struct qos_entry_s *entry, *n; struct list_head send_list; struct list_head free_list; unsigned long flags; - subCmdEvt = (u8)buf[4]; + sub_cmd_evt = (u8)buf[4]; - if (subCmdEvt == QOS_REPORT) { + if (sub_cmd_evt == QOS_REPORT) { spin_lock_irqsave(&qcb->qos_lock, flags); for (i = 0; i < qcb->qos_list_cnt; i++) { SFID = ((buf[(i*5)+6]<<24)&0xff000000); @@ -367,7 +365,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) return; } - /* subCmdEvt == QOS_ADD || subCmdEvt == QOS_CHANG_DEL */ + /* sub_cmd_evt == QOS_ADD || sub_cmd_evt == QOS_CHANG_DEL */ pos = 6; SFID = ((buf[pos++]<<24)&0xff000000); SFID += ((buf[pos++]<<16)&0xff0000); @@ -377,12 +375,12 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) index = get_csr(qcb, SFID, 1); if (index == -1) { netdev_err(nic->netdev, - "QoS ERROR: csr Update Error / Wrong index (%d) \n", + "QoS ERROR: csr Update Error / Wrong index (%d)\n", index); return; } - if (subCmdEvt == QOS_ADD) { + if (sub_cmd_evt == QOS_ADD) { netdev_dbg(nic->netdev, "QOS_ADD SFID = 0x%x, index=%d\n", SFID, index); @@ -423,7 +421,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->qos_limit_size = 254/qcb->qos_list_cnt; spin_unlock_irqrestore(&qcb->qos_lock, flags); - } else if (subCmdEvt == QOS_CHANGE_DEL) { + } else if (sub_cmd_evt == QOS_CHANGE_DEL) { netdev_dbg(nic->netdev, "QOS_CHANGE_DEL SFID = 0x%x, index=%d\n", SFID, index); @@ -435,7 +433,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->qos_limit_size = 254/qcb->qos_list_cnt; list_for_each_entry_safe(entry, n, &qcb->qos_list[index], - list) { + list) { list_move_tail(&entry->list, &free_list); } spin_unlock_irqrestore(&qcb->qos_lock, flags); diff --git a/drivers/staging/gdm72xx/gdm_qos.h b/drivers/staging/gdm72xx/gdm_qos.h index 8f18119d22a9..6543cff2a876 100644 --- a/drivers/staging/gdm72xx/gdm_qos.h +++ b/drivers/staging/gdm72xx/gdm_qos.h @@ -34,23 +34,6 @@ #define IEEE802_1QVLANID 0x10 struct gdm_wimax_csr_s { - /* union{ - U16 all; - struct _CS_CLASSIFIER_RULE_ENABLE{ - IPTypeOfService:1, - Protocol:1, - IPMaskedSrcAddress:1, - IPMaskedDstAddress:1, - ProtocolSrcPortRange:1, - ProtocolDstPortRange:1, - DstMacAddr:1, - SrcMacAddr:1, - Ethertype:1, - IEEE802_1DUserPriority:1, - IEEE802_1QVLANID:1, - Reserved:5; - } fields; - } */ BOOLEAN enabled; u32 SFID; u8 qos_buf_count; diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index c24653739e13..7398d451ccc2 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -31,11 +31,11 @@ #define MAX_NR_RX_BUF 4 #define SDU_TX_BUF_SIZE 2048 -#define TX_BUF_SIZE 2048 +#define TX_BUF_SIZE 2048 #define TX_CHUNK_SIZE (2048 - TYPE_A_HEADER_SIZE) -#define RX_BUF_SIZE (25*1024) +#define RX_BUF_SIZE (25*1024) -#define TX_HZ 2000 +#define TX_HZ 2000 #define TX_INTERVAL (1000000/TX_HZ) static int init_sdio(struct sdiowm_dev *sdev); @@ -127,10 +127,10 @@ static void put_rx_struct(struct rx_cxt *rx, struct sdio_rx *r) static int init_sdio(struct sdiowm_dev *sdev) { int ret = 0, i; - struct tx_cxt *tx = &sdev->tx; - struct rx_cxt *rx = &sdev->rx; - struct sdio_tx *t; - struct sdio_rx *r; + struct tx_cxt *tx = &sdev->tx; + struct rx_cxt *rx = &sdev->rx; + struct sdio_tx *t; + struct sdio_rx *r; INIT_LIST_HEAD(&tx->free_list); INIT_LIST_HEAD(&tx->sdu_list); @@ -313,7 +313,7 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt *tx) } static void send_hci(struct sdio_func *func, struct tx_cxt *tx, - struct sdio_tx *t) + struct sdio_tx *t) { unsigned long flags; @@ -380,7 +380,7 @@ static void do_tx(struct work_struct *work) } static int gdm_sdio_send(void *priv_dev, void *data, int len, - void (*cb)(void *data), void *cb_data) + void (*cb)(void *data), void *cb_data) { struct sdiowm_dev *sdev = priv_dev; struct tx_cxt *tx = &sdev->tx; @@ -510,6 +510,7 @@ static void gdm_sdio_irq(struct sdio_func *func) if (hdr[3] == 1) { /* Ack */ u32 *ack_seq = (u32 *)&hdr[4]; + spin_lock_irqsave(&tx->lock, flags); tx->can_send = 1; @@ -521,7 +522,7 @@ static void gdm_sdio_irq(struct sdio_func *func) } memcpy(rx->rx_buf, hdr + TYPE_A_HEADER_SIZE, - TYPE_A_LOOKAHEAD_SIZE - TYPE_A_HEADER_SIZE); + TYPE_A_LOOKAHEAD_SIZE - TYPE_A_HEADER_SIZE); buf = rx->rx_buf + TYPE_A_LOOKAHEAD_SIZE - TYPE_A_HEADER_SIZE; remain = len - TYPE_A_LOOKAHEAD_SIZE + TYPE_A_HEADER_SIZE; @@ -577,8 +578,8 @@ done: } static int gdm_sdio_receive(void *priv_dev, - void (*cb)(void *cb_data, void *data, int len), - void *cb_data) + void (*cb)(void *cb_data, void *data, int len), + void *cb_data) { struct sdiowm_dev *sdev = priv_dev; struct rx_cxt *rx = &sdev->rx; @@ -602,7 +603,7 @@ static int gdm_sdio_receive(void *priv_dev, } static int sdio_wimax_probe(struct sdio_func *func, - const struct sdio_device_id *id) + const struct sdio_device_id *id) { int ret; struct phy_dev *phy_dev = NULL; diff --git a/drivers/staging/gdm72xx/gdm_sdio.h b/drivers/staging/gdm72xx/gdm_sdio.h index 216e98f31bae..0c0e2cbb727e 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.h +++ b/drivers/staging/gdm72xx/gdm_sdio.h @@ -22,10 +22,8 @@ struct sdio_tx { struct list_head list; struct tx_cxt *tx_cxt; - - u8 *buf; - int len; - + u8 *buf; + int len; void (*callback)(void *cb_data); void *cb_data; }; @@ -35,18 +33,15 @@ struct tx_cxt { struct list_head sdu_list; struct list_head hci_list; struct timeval sdu_stamp; - - u8 *sdu_buf; - - spinlock_t lock; - int can_send; - int stop_sdu_tx; + u8 *sdu_buf; + spinlock_t lock; + int can_send; + int stop_sdu_tx; }; struct sdio_rx { struct list_head list; struct rx_cxt *rx_cxt; - void (*callback)(void *cb_data, void *data, int len); void *cb_data; }; @@ -54,18 +49,14 @@ struct sdio_rx { struct rx_cxt { struct list_head free_list; struct list_head req_list; - - u8 *rx_buf; - - spinlock_t lock; + u8 *rx_buf; + spinlock_t lock; }; struct sdiowm_dev { struct sdio_func *func; - - struct tx_cxt tx; - struct rx_cxt rx; - + struct tx_cxt tx; + struct rx_cxt rx; struct work_struct ws; }; diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index 20539d809397..78d6667fa0d5 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c @@ -27,6 +27,7 @@ MODULE_DEVICE_TABLE(usb, id_table); #define TX_BUF_SIZE 2048 + #if defined(CONFIG_WIMAX_GDM72XX_WIMAX2) #define RX_BUF_SIZE (128*1024) /* For packet aggregation */ #else @@ -166,10 +167,10 @@ static void put_rx_struct(struct rx_cxt *rx, struct usb_rx *r) static int init_usb(struct usbwm_dev *udev) { int ret = 0, i; - struct tx_cxt *tx = &udev->tx; - struct rx_cxt *rx = &udev->rx; - struct usb_tx *t; - struct usb_rx *r; + struct tx_cxt *tx = &udev->tx; + struct rx_cxt *rx = &udev->rx; + struct usb_tx *t; + struct usb_rx *r; unsigned long flags; INIT_LIST_HEAD(&tx->free_list); @@ -215,10 +216,10 @@ fail: static void release_usb(struct usbwm_dev *udev) { - struct tx_cxt *tx = &udev->tx; - struct rx_cxt *rx = &udev->rx; - struct usb_tx *t, *t_next; - struct usb_rx *r, *r_next; + struct tx_cxt *tx = &udev->tx; + struct rx_cxt *rx = &udev->rx; + struct usb_tx *t, *t_next; + struct usb_rx *r, *r_next; unsigned long flags; spin_lock_irqsave(&tx->lock, flags); @@ -344,16 +345,11 @@ static int gdm_usb_send(void *priv_dev, void *data, int len, if ((len % 512) == 0) len++; - usb_fill_bulk_urb(t->urb, - usbdev, - usb_sndbulkpipe(usbdev, 1), - t->buf, - len + padding, - gdm_usb_send_complete, - t); + usb_fill_bulk_urb(t->urb, usbdev, usb_sndbulkpipe(usbdev, 1), t->buf, + len + padding, gdm_usb_send_complete, t); - print_hex_dump_debug("usb_send: ", DUMP_PREFIX_NONE, 16, 1, - t->buf, len + padding, false); + print_hex_dump_debug("usb_send: ", DUMP_PREFIX_NONE, 16, 1, t->buf, + len + padding, false); #ifdef CONFIG_WIMAX_GDM72XX_USB_PM if (usbdev->state & USB_STATE_SUSPENDED) { list_add_tail(&t->p_list, &tx->pending_list); @@ -470,8 +466,8 @@ static void gdm_usb_rcv_complete(struct urb *urb) } static int gdm_usb_receive(void *priv_dev, - void (*cb)(void *cb_data, void *data, int len), - void *cb_data) + void (*cb)(void *cb_data, void *data, int len), + void *cb_data) { struct usbwm_dev *udev = priv_dev; struct usb_device *usbdev = udev->usbdev; @@ -494,13 +490,8 @@ static int gdm_usb_receive(void *priv_dev, r->callback = cb; r->cb_data = cb_data; - usb_fill_bulk_urb(r->urb, - usbdev, - usb_rcvbulkpipe(usbdev, 0x82), - r->buf, - RX_BUF_SIZE, - gdm_usb_rcv_complete, - r); + usb_fill_bulk_urb(r->urb, usbdev, usb_rcvbulkpipe(usbdev, 0x82), r->buf, + RX_BUF_SIZE, gdm_usb_rcv_complete, r); return usb_submit_urb(r->urb, GFP_ATOMIC); } @@ -518,8 +509,8 @@ static void do_pm_control(struct work_struct *work) usb_autopm_put_interface(udev->intf); spin_lock_irqsave(&tx->lock, flags); - if (!(udev->usbdev->state & USB_STATE_SUSPENDED) - && (!list_empty(&tx->hci_list) || !list_empty(&tx->sdu_list))) { + if (!(udev->usbdev->state & USB_STATE_SUSPENDED) && + (!list_empty(&tx->hci_list) || !list_empty(&tx->sdu_list))) { struct usb_tx *t, *temp; list_for_each_entry_safe(t, temp, &tx->pending_list, p_list) { @@ -537,7 +528,7 @@ static void do_pm_control(struct work_struct *work) #endif /* CONFIG_WIMAX_GDM72XX_USB_PM */ static int gdm_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) + const struct usb_device_id *id) { int ret = 0; u8 bConfigurationValue; @@ -567,7 +558,7 @@ static int gdm_usb_probe(struct usb_interface *intf, /* Support for EEPROM bootloader */ if (bConfigurationValue == DOWNLOAD_CONF_VALUE || - idProduct & B_DOWNLOAD) { + idProduct & B_DOWNLOAD) { ret = usb_boot(usbdev, bcdDevice); goto out; } @@ -639,8 +630,9 @@ static void gdm_usb_disconnect(struct usb_interface *intf) idProduct = L2H(usbdev->descriptor.idProduct); if (idProduct != EMERGENCY_PID && - bConfigurationValue != DOWNLOAD_CONF_VALUE && - (idProduct & B_DOWNLOAD) == 0) { + bConfigurationValue != DOWNLOAD_CONF_VALUE && + (idProduct & B_DOWNLOAD) == 0) { + udev = phy_dev->priv_dev; udev->usbdev = NULL; @@ -730,7 +722,7 @@ static int k_mode_thread(void *arg) spin_unlock_irqrestore(&k_lock, flags2); expire = jiffies + K_WAIT_TIME; - while (jiffies < expire) + while (time_before(jiffies, expire)) schedule_timeout(K_WAIT_TIME); spin_lock_irqsave(&rx->lock, flags); @@ -743,7 +735,7 @@ static int k_mode_thread(void *arg) spin_lock_irqsave(&tx->lock, flags); list_for_each_entry_safe(t, temp, &tx->pending_list, - p_list) { + p_list) { list_del(&t->p_list); ret = usb_submit_urb(t->urb, GFP_ATOMIC); @@ -759,8 +751,8 @@ static int k_mode_thread(void *arg) spin_lock_irqsave(&k_lock, flags2); } wait_event_interruptible_lock_irq(k_wait, - !list_empty(&k_list) || k_mode_stop, - k_lock); + !list_empty(&k_list) || + k_mode_stop, k_lock); spin_unlock_irqrestore(&k_lock, flags2); } return 0; diff --git a/drivers/staging/gdm72xx/gdm_usb.h b/drivers/staging/gdm72xx/gdm_usb.h index f2c54511bb96..30506529a8cc 100644 --- a/drivers/staging/gdm72xx/gdm_usb.h +++ b/drivers/staging/gdm72xx/gdm_usb.h @@ -28,12 +28,10 @@ struct usb_tx { struct list_head p_list; #endif struct tx_cxt *tx_cxt; - struct urb *urb; u8 *buf; - void (*callback)(void *cb_data); - void *cb_data; + void *cb_data; }; struct tx_cxt { @@ -43,17 +41,14 @@ struct tx_cxt { #if defined(CONFIG_WIMAX_GDM72XX_USB_PM) || defined(CONFIG_WIMAX_GDM72XX_K_MODE) struct list_head pending_list; #endif - spinlock_t lock; }; struct usb_rx { struct list_head list; struct rx_cxt *rx_cxt; - struct urb *urb; u8 *buf; - void (*callback)(void *cb_data, void *data, int len); void *cb_data; }; @@ -75,11 +70,9 @@ struct usbwm_dev { int bw_switch; struct list_head list; #endif - struct tx_cxt tx; struct rx_cxt rx; - - int padding; + int padding; }; #endif /* __GDM_USB_H__ */ diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index 05ce2a22c220..e5e511585122 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -35,10 +35,10 @@ #define EVT_MAX_SIZE 2048 struct evt_entry { - struct list_head list; - struct net_device *dev; - char evt_data[EVT_MAX_SIZE]; - int size; + struct list_head list; + struct net_device *dev; + char evt_data[EVT_MAX_SIZE]; + int size; }; static void __gdm_wimax_event_send(struct work_struct *work); @@ -52,7 +52,6 @@ static struct { struct sock *sock; struct list_head evtq; spinlock_t evt_lock; - struct list_head freeq; struct work_struct ws; } wm_event; @@ -135,24 +134,24 @@ static void dump_eth_packet(struct net_device *dev, const char *title, u16 port = 0; protocol = (data[12]<<8) | data[13]; - ih = (struct iphdr *) (data+ETH_HLEN); + ih = (struct iphdr *)(data+ETH_HLEN); if (protocol == ETH_P_IP) { - uh = (struct udphdr *) ((char *)ih + sizeof(struct iphdr)); + uh = (struct udphdr *)((char *)ih + sizeof(struct iphdr)); ip_protocol = ih->protocol; port = ntohs(uh->dest); } else if (protocol == ETH_P_IPV6) { - struct ipv6hdr *i6h = (struct ipv6hdr *) data; - uh = (struct udphdr *) ((char *)i6h + sizeof(struct ipv6hdr)); + struct ipv6hdr *i6h = (struct ipv6hdr *)data; + + uh = (struct udphdr *)((char *)i6h + sizeof(struct ipv6hdr)); ip_protocol = i6h->nexthdr; port = ntohs(uh->dest); } - netdev_dbg(dev, "[%s] len=%d, %s, %s, %s\n", - title, len, - get_protocol_name(protocol), - get_ip_protocol_name(ip_protocol), - get_port_name(port)); + netdev_dbg(dev, "[%s] len=%d, %s, %s, %s\n", title, len, + get_protocol_name(protocol), + get_ip_protocol_name(ip_protocol), + get_port_name(port)); if (!(data[0] == 0xff && data[1] == 0xff)) { if (protocol == ETH_P_IP) @@ -168,7 +167,6 @@ static inline int gdm_wimax_header(struct sk_buff **pskb) { u16 buf[HCI_HEADER_SIZE / sizeof(u16)]; struct sk_buff *skb = *pskb; - int ret = 0; if (unlikely(skb_headroom(skb) < HCI_HEADER_SIZE)) { struct sk_buff *skb2; @@ -188,7 +186,7 @@ static inline int gdm_wimax_header(struct sk_buff **pskb) memcpy(skb->data, buf, HCI_HEADER_SIZE); *pskb = skb; - return ret; + return 0; } static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg, @@ -196,9 +194,10 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg, { struct nic *nic = netdev_priv(dev); - u8 *buf = (u8 *) msg; + u8 *buf = (u8 *)msg; u16 hci_cmd = (buf[0]<<8) | buf[1]; u16 hci_len = (buf[2]<<8) | buf[3]; + netdev_dbg(dev, "H=>D: 0x%04x(%d)\n", hci_cmd, hci_len); gdm_wimax_send(nic, msg, len); @@ -263,9 +262,9 @@ static struct evt_entry *get_event_entry(void) { struct evt_entry *e; - if (list_empty(&wm_event.freeq)) + if (list_empty(&wm_event.freeq)) { e = alloc_event_entry(); - else { + } else { e = list_entry(wm_event.freeq.next, struct evt_entry, list); list_del(&e->list); } @@ -310,6 +309,7 @@ static int gdm_wimax_event_send(struct net_device *dev, char *buf, int size) u16 hci_cmd = ((u8)buf[0]<<8) | (u8)buf[1]; u16 hci_len = ((u8)buf[2]<<8) | (u8)buf[3]; + netdev_dbg(dev, "D=>H: 0x%04x(%d)\n", hci_cmd, hci_len); spin_lock_irqsave(&wm_event.evt_lock, flags); @@ -347,7 +347,7 @@ int gdm_wimax_send_tx(struct sk_buff *skb, struct net_device *dev) struct nic *nic = netdev_priv(dev); ret = gdm_wimax_send_with_cb(nic, skb->data, skb->len, tx_complete, - nic); + nic); if (ret == -ENOSPC) { netif_stop_queue(dev); ret = 0; @@ -368,7 +368,7 @@ static int gdm_wimax_tx(struct sk_buff *skb, struct net_device *dev) { int ret = 0; struct nic *nic = netdev_priv(dev); - struct fsm_s *fsm = (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf; + struct fsm_s *fsm = (struct fsm_s *)nic->sdk_data[SIOC_DATA_FSM].buf; dump_eth_packet(dev, "TX", skb->data, skb->len); @@ -379,9 +379,9 @@ static int gdm_wimax_tx(struct sk_buff *skb, struct net_device *dev) } #if !defined(LOOPBACK_TEST) - if (!fsm) + if (!fsm) { netdev_err(dev, "ASSERTION ERROR: fsm is NULL!!\n"); - else if (fsm->m_status != M_CONNECTED) { + } else if (fsm->m_status != M_CONNECTED) { netdev_emerg(dev, "ASSERTION ERROR: Device is NOT ready. status=%d\n", fsm->m_status); kfree_skb(skb); @@ -408,7 +408,7 @@ static int gdm_wimax_set_config(struct net_device *dev, struct ifmap *map) static void __gdm_wimax_set_mac_addr(struct net_device *dev, char *mac_addr) { u16 hci_pkt_buf[32 / sizeof(u16)]; - u8 *pkt = (u8 *) &hci_pkt_buf[0]; + u8 *pkt = (u8 *)&hci_pkt_buf[0]; struct nic *nic = netdev_priv(dev); /* Since dev is registered as a ethernet device, @@ -454,7 +454,7 @@ static struct net_device_stats *gdm_wimax_stats(struct net_device *dev) static int gdm_wimax_open(struct net_device *dev) { struct nic *nic = netdev_priv(dev); - struct fsm_s *fsm = (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf; + struct fsm_s *fsm = (struct fsm_s *)nic->sdk_data[SIOC_DATA_FSM].buf; netif_start_queue(dev); @@ -466,7 +466,7 @@ static int gdm_wimax_open(struct net_device *dev) static int gdm_wimax_close(struct net_device *dev) { struct nic *nic = netdev_priv(dev); - struct fsm_s *fsm = (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf; + struct fsm_s *fsm = (struct fsm_s *)nic->sdk_data[SIOC_DATA_FSM].buf; netif_stop_queue(dev); @@ -536,17 +536,17 @@ static void gdm_wimax_cleanup_ioctl(struct net_device *dev) static void gdm_update_fsm(struct net_device *dev, struct fsm_s *new_fsm) { struct nic *nic = netdev_priv(dev); - struct fsm_s *cur_fsm = - (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf; + struct fsm_s *cur_fsm = (struct fsm_s *) + nic->sdk_data[SIOC_DATA_FSM].buf; if (!cur_fsm) return; if (cur_fsm->m_status != new_fsm->m_status || - cur_fsm->c_status != new_fsm->c_status) { - if (new_fsm->m_status == M_CONNECTED) + cur_fsm->c_status != new_fsm->c_status) { + if (new_fsm->m_status == M_CONNECTED) { netif_carrier_on(dev); - else if (cur_fsm->m_status == M_CONNECTED) { + } else if (cur_fsm->m_status == M_CONNECTED) { netif_carrier_off(dev); #if defined(CONFIG_WIMAX_GDM72XX_QOS) gdm_qos_release_list(nic); @@ -558,7 +558,7 @@ static void gdm_update_fsm(struct net_device *dev, struct fsm_s *new_fsm) static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct wm_req_s *req = (struct wm_req_s *) ifr; + struct wm_req_s *req = (struct wm_req_s *)ifr; struct nic *nic = netdev_priv(dev); int ret; @@ -574,8 +574,8 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EOPNOTSUPP; } if (req->cmd == SIOCG_DATA) { - ret = gdm_wimax_ioctl_get_data(&req->data, - &nic->sdk_data[req->data_id]); + ret = gdm_wimax_ioctl_get_data( + &req->data, &nic->sdk_data[req->data_id]); if (ret < 0) return ret; } else if (req->cmd == SIOCS_DATA) { @@ -583,7 +583,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*NOTE: gdm_update_fsm should be called before gdm_wimax_ioctl_set_data is called*/ gdm_update_fsm(dev, - (struct fsm_s *) req->data.buf); + (struct fsm_s *)req->data.buf); } ret = gdm_wimax_ioctl_set_data( &nic->sdk_data[req->data_id], &req->data); @@ -603,7 +603,7 @@ static void gdm_wimax_prepare_device(struct net_device *dev) { struct nic *nic = netdev_priv(dev); u16 buf[32 / sizeof(u16)]; - struct hci_s *hci = (struct hci_s *) buf; + struct hci_s *hci = (struct hci_s *)buf; u16 len = 0; u32 val = 0; @@ -661,7 +661,7 @@ static int gdm_wimax_hci_get_tlv(u8 *buf, u8 *T, u16 *L, u8 **V) } static int gdm_wimax_get_prepared_info(struct net_device *dev, char *buf, - int len) + int len) { u8 T, *V; u16 L; @@ -740,7 +740,7 @@ static void gdm_wimax_transmit_aggr_pkt(struct net_device *dev, char *buf, int length; while (len > 0) { - hci = (struct hci_s *) buf; + hci = (struct hci_s *)buf; if (B2H(hci->cmd_evt) != WIMAX_RX_SDU) { netdev_err(dev, "Wrong cmd_evt(0x%04X)\n", @@ -786,7 +786,7 @@ static void gdm_wimax_transmit_pkt(struct net_device *dev, char *buf, int len) switch (cmd_evt) { case WIMAX_RX_SDU_AGGR: gdm_wimax_transmit_aggr_pkt(dev, &buf[HCI_HEADER_SIZE], - cmd_len); + cmd_len); break; case WIMAX_RX_SDU: gdm_wimax_netif_rx(dev, &buf[HCI_HEADER_SIZE], cmd_len); @@ -822,13 +822,13 @@ static void gdm_wimax_ind_fsm_update(struct net_device *dev, struct fsm_s *fsm) memcpy(&hci_pkt_buf[HCI_HEADER_SIZE], fsm, sizeof(struct fsm_s)); gdm_wimax_event_send(dev, hci_pkt_buf, - HCI_HEADER_SIZE + sizeof(struct fsm_s)); + HCI_HEADER_SIZE + sizeof(struct fsm_s)); } static void gdm_wimax_ind_if_updown(struct net_device *dev, int if_up) { u16 buf[32 / sizeof(u16)]; - struct hci_s *hci = (struct hci_s *) buf; + struct hci_s *hci = (struct hci_s *)buf; unsigned char up_down; up_down = if_up ? WIMAX_IF_UP : WIMAX_IF_DOWN; @@ -855,17 +855,13 @@ static void prepare_rx_complete(void *arg, void *data, int len) int ret; ret = gdm_wimax_get_prepared_info(nic->netdev, data, len); - if (ret == 1) + if (ret == 1) { gdm_wimax_rcv_with_cb(nic, rx_complete, nic); - else { + } else { if (ret < 0) netdev_err(nic->netdev, "get_prepared_info failed(%d)\n", ret); gdm_wimax_rcv_with_cb(nic, prepare_rx_complete, nic); - #if 0 - /* Re-prepare WiMax device */ - gdm_wimax_prepare_device(nic->netdev); - #endif } } @@ -875,13 +871,13 @@ static void start_rx_proc(struct nic *nic) } static struct net_device_ops gdm_netdev_ops = { - .ndo_open = gdm_wimax_open, - .ndo_stop = gdm_wimax_close, - .ndo_set_config = gdm_wimax_set_config, - .ndo_start_xmit = gdm_wimax_tx, - .ndo_get_stats = gdm_wimax_stats, + .ndo_open = gdm_wimax_open, + .ndo_stop = gdm_wimax_close, + .ndo_set_config = gdm_wimax_set_config, + .ndo_start_xmit = gdm_wimax_tx, + .ndo_get_stats = gdm_wimax_stats, .ndo_set_mac_address = gdm_wimax_set_mac_addr, - .ndo_do_ioctl = gdm_wimax_ioctl, + .ndo_do_ioctl = gdm_wimax_ioctl, }; int register_wimax_device(struct phy_dev *phy_dev, struct device *pdev) @@ -948,7 +944,7 @@ cleanup: void unregister_wimax_device(struct phy_dev *phy_dev) { struct nic *nic = netdev_priv(phy_dev->netdev); - struct fsm_s *fsm = (struct fsm_s *) nic->sdk_data[SIOC_DATA_FSM].buf; + struct fsm_s *fsm = (struct fsm_s *)nic->sdk_data[SIOC_DATA_FSM].buf; if (fsm) fsm->m_status = M_INIT; diff --git a/drivers/staging/gdm72xx/gdm_wimax.h b/drivers/staging/gdm72xx/gdm_wimax.h index 1fcfc8555417..7e2c88877ed0 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.h +++ b/drivers/staging/gdm72xx/gdm_wimax.h @@ -23,10 +23,6 @@ #define DRIVER_VERSION "3.2.3" -/*#define ETH_P_IP 0x0800 */ -/*#define ETH_P_ARP 0x0806 */ -/*#define ETH_P_IPV6 0x86DD */ - #define H2L(x) __cpu_to_le16(x) #define L2H(x) __le16_to_cpu(x) #define DH2L(x) __cpu_to_le32(x) @@ -38,12 +34,11 @@ #define DB2H(x) __be32_to_cpu(x) struct phy_dev { - void *priv_dev; + void *priv_dev; struct net_device *netdev; - - int (*send_func)(void *priv_dev, void *data, int len, - void (*cb)(void *cb_data), void *cb_data); - int (*rcv_func)(void *priv_dev, + int (*send_func)(void *priv_dev, void *data, int len, + void (*cb)(void *cb_data), void *cb_data); + int (*rcv_func)(void *priv_dev, void (*cb)(void *cb_data, void *data, int len), void *cb_data); }; @@ -51,21 +46,15 @@ struct phy_dev { struct nic { struct net_device *netdev; struct phy_dev *phy_dev; - struct net_device_stats stats; - - struct data_s sdk_data[SIOC_DATA_MAX]; - + struct data_s sdk_data[SIOC_DATA_MAX]; #if defined(CONFIG_WIMAX_GDM72XX_QOS) - struct qos_cb_s qos; + struct qos_cb_s qos; #endif - }; -/*#define LOOPBACK_TEST */ - -extern int register_wimax_device(struct phy_dev *phy_dev, struct device *pdev); -extern int gdm_wimax_send_tx(struct sk_buff *skb, struct net_device *dev); -extern void unregister_wimax_device(struct phy_dev *phy_dev); +int register_wimax_device(struct phy_dev *phy_dev, struct device *pdev); +int gdm_wimax_send_tx(struct sk_buff *skb, struct net_device *dev); +void unregister_wimax_device(struct phy_dev *phy_dev); #endif diff --git a/drivers/staging/gdm72xx/hci.h b/drivers/staging/gdm72xx/hci.h index 0e0676622f1d..2485a3799123 100644 --- a/drivers/staging/gdm72xx/hci.h +++ b/drivers/staging/gdm72xx/hci.h @@ -18,18 +18,18 @@ #define HCI_VALUE_OFFS (HCI_HEADER_SIZE) #define HCI_MAX_PACKET 2048 #define HCI_MAX_PARAM (HCI_MAX_PACKET-HCI_HEADER_SIZE) -#define HCI_MAX_TLV 32 +#define HCI_MAX_TLV 32 /* CMD-EVT */ /* Category 0 */ -#define WIMAX_RESET 0x0000 -#define WIMAX_SET_INFO 0x0001 -#define WIMAX_GET_INFO 0x0002 +#define WIMAX_RESET 0x0000 +#define WIMAX_SET_INFO 0x0001 +#define WIMAX_GET_INFO 0x0002 #define WIMAX_GET_INFO_RESULT 0x8003 -#define WIMAX_RADIO_OFF 0x0004 -#define WIMAX_RADIO_ON 0x0006 -#define WIMAX_WIMAX_RESET 0x0007 /* Is this still here */ +#define WIMAX_RADIO_OFF 0x0004 +#define WIMAX_RADIO_ON 0x0006 +#define WIMAX_WIMAX_RESET 0x0007 /* Is this still here */ /* Category 1 */ #define WIMAX_NET_ENTRY 0x0100 @@ -40,26 +40,22 @@ #define WIMAX_EXIT_IDLE 0x0106 #define WIMAX_MODE_CHANGE 0x8108 #define WIMAX_HANDOVER 0x8109 /* obsolete */ - -#define WIMAX_SCAN 0x010d +#define WIMAX_SCAN 0x010d #define WIMAX_SCAN_COMPLETE 0x810e #define WIMAX_SCAN_RESULT 0x810f - #define WIMAX_CONNECT 0x0110 #define WIMAX_CONNECT_START 0x8111 -#define WIMAX_CONNECT_COMPLETE 0x8112 +#define WIMAX_CONNECT_COMPLETE 0x8112 #define WIMAX_ASSOC_START 0x8113 -#define WIMAX_ASSOC_COMPLETE 0x8114 +#define WIMAX_ASSOC_COMPLETE 0x8114 #define WIMAX_DISCONN_IND 0x8115 #define WIMAX_ENTRY_IND 0x8116 #define WIMAX_HO_START 0x8117 #define WIMAX_HO_COMPLETE 0x8118 -#define WIMAX_RADIO_STATE_IND 0x8119 +#define WIMAX_RADIO_STATE_IND 0x8119 #define WIMAX_IP_RENEW_IND 0x811a - -#define WIMAX_DISCOVER_NSP 0x011d +#define WIMAX_DISCOVER_NSP 0x011d #define WIMAX_DISCOVER_NSP_RESULT 0x811e - #define WIMAX_SDU_TX_FLOW 0x8125 /* Category 2 */ @@ -71,34 +67,33 @@ #define WIMAX_TX_SDU_AGGR 0x0205 /* Category 3 */ -#define WIMAX_DM_CMD 0x030a -#define WIMAX_DM_RSP 0x830b - -#define WIMAX_CLI_CMD 0x030c -#define WIMAX_CLI_RSP 0x830d +#define WIMAX_DM_CMD 0x030a +#define WIMAX_DM_RSP 0x830b -#define WIMAX_DL_IMAGE 0x0310 -#define WIMAX_DL_IMAGE_STATUS 0x8311 -#define WIMAX_UL_IMAGE 0x0312 -#define WIMAX_UL_IMAGE_RESULT 0x8313 -#define WIMAX_UL_IMAGE_STATUS 0x0314 +#define WIMAX_CLI_CMD 0x030c +#define WIMAX_CLI_RSP 0x830d -#define WIMAX_EVT_MODEM_REPORT 0x8325 +#define WIMAX_DL_IMAGE 0x0310 +#define WIMAX_DL_IMAGE_STATUS 0x8311 +#define WIMAX_UL_IMAGE 0x0312 +#define WIMAX_UL_IMAGE_RESULT 0x8313 +#define WIMAX_UL_IMAGE_STATUS 0x0314 +#define WIMAX_EVT_MODEM_REPORT 0x8325 /* Category 0xF */ -#define WIMAX_FSM_UPDATE 0x8F01 -#define WIMAX_IF_UPDOWN 0x8F02 - #define WIMAX_IF_UP 1 - #define WIMAX_IF_DOWN 2 +#define WIMAX_FSM_UPDATE 0x8F01 +#define WIMAX_IF_UPDOWN 0x8F02 +#define WIMAX_IF_UP 1 +#define WIMAX_IF_DOWN 2 /* WIMAX mode */ -#define W_NULL 0 -#define W_STANDBY 1 -#define W_OOZ 2 -#define W_AWAKE 3 -#define W_IDLE 4 -#define W_SLEEP 5 -#define W_WAIT 6 +#define W_NULL 0 +#define W_STANDBY 1 +#define W_OOZ 2 +#define W_AWAKE 3 +#define W_IDLE 4 +#define W_SLEEP 5 +#define W_WAIT 6 #define W_NET_ENTRY_RNG 0x80 #define W_NET_ENTRY_SBC 0x81 @@ -113,8 +108,8 @@ #define W_NET_ENTRY_DSX_FAIL 0x1104000 /* Scan Type */ -#define W_SCAN_ALL_CHANNEL 0 -#define W_SCAN_ALL_SUBSCRIPTION 1 +#define W_SCAN_ALL_CHANNEL 0 +#define W_SCAN_ALL_SUBSCRIPTION 1 #define W_SCAN_SPECIFIED_SUBSCRIPTION 2 /* @@ -126,7 +121,7 @@ * */ #define TLV_L(x) (((x) >> 16) & 0xff) -#define TLV_T(x) ((x) & 0xff) +#define TLV_T(x) ((x) & 0xff) #define TLV_COMPOSITE(x) ((x) >> 31) /* GENERAL */ @@ -141,7 +136,6 @@ #define T_OOZ_SCAN_INTERVAL (0x08 | (4 << 16)) #define T_IMEI (0x09 | (8 << 16)) #define T_PID (0x0a | (12 << 16)) - #define T_CAPABILITY (0x1a | (4 << 16)) #define T_RELEASE_NUMBER (0x1b | (4 << 16)) #define T_DRIVER_REVISION (0x1c | (4 << 16)) @@ -150,19 +144,16 @@ #define T_PHY_HW_REVISION (0x1f | (4 << 16)) /* HANDOVER */ -#define T_SCAN_INTERVAL (0x20 | (1 << 16)) - +#define T_SCAN_INTERVAL (0x20 | (1 << 16)) #define T_RSC_RETAIN_TIME (0x2f | (2 << 16)) /* SLEEP */ #define T_TYPE1_ISW (0x40 | (1 << 16)) - #define T_SLP_START_TO (0x4a | (2 << 16)) /* IDLE */ #define T_IDLE_MODE_TO (0x50 | (2 << 16)) - -#define T_IDLE_START_TO (0x54 | (2 << 16)) +#define T_IDLE_START_TO (0x54 | (2 << 16)) /* MONITOR */ #define T_RSSI (0x60 | (1 << 16)) @@ -180,7 +171,7 @@ #define T_CS_TYPE (0xa6 | (2 << 16)) #define T_VENDOR_NAME (0xa7 | (0 << 16)) #define T_MOD_NAME (0xa8 | (0 << 16)) -#define T_PACKET_FILTER (0xa9 | (1 << 16)) +#define T_PACKET_FILTER (0xa9 | (1 << 16)) #define T_NSP_CHANGE_COUNT (0xaa | (4 << 16)) #define T_RADIO_STATE (0xab | (1 << 16)) #define T_URI_CONTACT_TYPE (0xac | (1 << 16)) diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index af7f1c1d0b5c..9bf00e683f13 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c @@ -56,7 +56,7 @@ static void netlink_rcv_cb(struct sk_buff *skb) nlh = (struct nlmsghdr *)skb->data; if (skb->len < nlh->nlmsg_len || - nlh->nlmsg_len > ND_MAX_MSG_LEN) { + nlh->nlmsg_len > ND_MAX_MSG_LEN) { netdev_err(skb->dev, "Invalid length (%d,%d)\n", skb->len, nlh->nlmsg_len); return; @@ -75,8 +75,9 @@ static void netlink_rcv_cb(struct sk_buff *skb) netdev_err(skb->dev, "dev_get_by_index(%d) is not found.\n", ifindex); - } else + } else { netdev_err(skb->dev, "Unregistered Callback\n"); + } } } @@ -88,7 +89,7 @@ static void netlink_rcv(struct sk_buff *skb) } struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type, - void *msg, int len)) + void *msg, int len)) { struct sock *sock; struct netlink_kernel_cfg cfg = { @@ -144,9 +145,9 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) ret = netlink_broadcast(sock, skb, 0, group+1, GFP_ATOMIC); - if (!ret) + if (!ret) { return len; - else { + } else { if (ret != -ESRCH) { pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n", group, type, len, ret); diff --git a/drivers/staging/gdm72xx/netlink_k.h b/drivers/staging/gdm72xx/netlink_k.h index 1dffaa6156e4..b6caac16b3d3 100644 --- a/drivers/staging/gdm72xx/netlink_k.h +++ b/drivers/staging/gdm72xx/netlink_k.h @@ -16,8 +16,8 @@ #include <linux/netdevice.h> #include <net/sock.h> -struct sock *netlink_init(int unit, - void (*cb)(struct net_device *dev, u16 type, void *msg, int len)); +struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type, + void *msg, int len)); void netlink_exit(struct sock *sock); int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len); diff --git a/drivers/staging/gdm72xx/sdio_boot.c b/drivers/staging/gdm72xx/sdio_boot.c index cbe5dcfc2ac9..2c02842ac5da 100644 --- a/drivers/staging/gdm72xx/sdio_boot.c +++ b/drivers/staging/gdm72xx/sdio_boot.c @@ -41,11 +41,11 @@ static u8 *tx_buf; static int ack_ready(struct sdio_func *func) { - unsigned long start = jiffies; + unsigned long wait = jiffies + HZ; u8 val; int ret; - while ((jiffies - start) < HZ) { + while (time_before(jiffies, wait)) { val = sdio_readb(func, 0x13, &ret); if (val & 0x01) return 1; diff --git a/drivers/staging/gdm72xx/sdio_boot.h b/drivers/staging/gdm72xx/sdio_boot.h index 373ac28063c6..045c1f450539 100644 --- a/drivers/staging/gdm72xx/sdio_boot.h +++ b/drivers/staging/gdm72xx/sdio_boot.h @@ -16,6 +16,6 @@ struct sdio_func; -extern int sdio_boot(struct sdio_func *func); +int sdio_boot(struct sdio_func *func); #endif /* __SDIO_BOOT_H__ */ diff --git a/drivers/staging/gdm72xx/usb_boot.c b/drivers/staging/gdm72xx/usb_boot.c index 0d45eb680be5..d59bac872ffe 100644 --- a/drivers/staging/gdm72xx/usb_boot.c +++ b/drivers/staging/gdm72xx/usb_boot.c @@ -67,6 +67,7 @@ struct fw_info { static void array_le32_to_cpu(u32 *arr, int num) { int i; + for (i = 0; i < num; i++, arr++) *arr = __le32_to_cpu(*arr); } @@ -79,7 +80,7 @@ static int gdm_wibro_send(struct usb_device *usbdev, void *data, int len) int actual; ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), data, len, - &actual, 1000); + &actual, 1000); if (ret < 0) { dev_err(&usbdev->dev, "Error : usb_bulk_msg ( result = %d )\n", @@ -95,7 +96,7 @@ static int gdm_wibro_recv(struct usb_device *usbdev, void *data, int len) int actual; ret = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, 2), data, len, - &actual, 5000); + &actual, 5000); if (ret < 0) { dev_err(&usbdev->dev, @@ -106,8 +107,8 @@ static int gdm_wibro_recv(struct usb_device *usbdev, void *data, int len) } static int download_image(struct usb_device *usbdev, - const struct firmware *firm, - loff_t pos, u32 img_len, u32 magic_num) + const struct firmware *firm, + loff_t pos, u32 img_len, u32 magic_num) { struct dn_header h; int ret = 0; @@ -169,14 +170,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid) memcpy(&hdr, firm->data, sizeof(hdr)); array_le32_to_cpu((u32 *)&hdr, 19); -#if 0 - if (hdr.magic_code != 0x10767fff) { - dev_err(&usbdev->dev, "Invalid magic code 0x%08x\n", - hdr.magic_code); - ret = -EINVAL; - goto out; - } -#endif + if (hdr.count > MAX_IMG_CNT) { dev_err(&usbdev->dev, "Too many images. %d\n", hdr.count); ret = -EINVAL; @@ -201,14 +195,6 @@ int usb_boot(struct usb_device *usbdev, u16 pid) memcpy(&fw_info, firm->data + pos, sizeof(fw_info)); array_le32_to_cpu((u32 *)&fw_info, 8); -#if 0 - if ((fw_info.id & 0xfffff000) != 0x10767000) { - dev_err(&usbdev->dev, "Invalid FW id. 0x%08x\n", - fw_info.id); - ret = -EIO; - goto out; - } -#endif if ((fw_info.id & 0xffff) != pid) continue; @@ -219,8 +205,8 @@ int usb_boot(struct usb_device *usbdev, u16 pid) goto out; } - ret = download_image(usbdev, firm, pos, - fw_info.kernel_len, DN_KERNEL_MAGIC_NUMBER); + ret = download_image(usbdev, firm, pos, fw_info.kernel_len, + DN_KERNEL_MAGIC_NUMBER); if (ret < 0) goto out; dev_info(&usbdev->dev, "GCT: Kernel download success.\n"); @@ -231,7 +217,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid) goto out; } ret = download_image(usbdev, firm, pos, fw_info.rootfs_len, - DN_ROOTFS_MAGIC_NUMBER); + DN_ROOTFS_MAGIC_NUMBER); if (ret < 0) goto out; dev_info(&usbdev->dev, "GCT: Filesystem download success.\n"); @@ -276,7 +262,7 @@ out: } static int em_download_image(struct usb_device *usbdev, const char *img_name, - char *type_string) + char *type_string) { char *buf = NULL; loff_t pos = 0; @@ -347,11 +333,8 @@ out: static int em_fw_reset(struct usb_device *usbdev) { - int ret; - /*Send ZLP*/ - ret = gdm_wibro_send(usbdev, NULL, 0); - return ret; + return gdm_wibro_send(usbdev, NULL, 0); } int usb_emergency(struct usb_device *usbdev) diff --git a/drivers/staging/gdm72xx/usb_boot.h b/drivers/staging/gdm72xx/usb_boot.h index c715cd3cd300..05308e253050 100644 --- a/drivers/staging/gdm72xx/usb_boot.h +++ b/drivers/staging/gdm72xx/usb_boot.h @@ -16,7 +16,7 @@ struct usb_device; -extern int usb_boot(struct usb_device *usbdev, u16 pid); -extern int usb_emergency(struct usb_device *usbdev); +int usb_boot(struct usb_device *usbdev, u16 pid); +int usb_emergency(struct usb_device *usbdev); #endif /* __USB_BOOT_H__ */ diff --git a/drivers/staging/gdm72xx/usb_ids.h b/drivers/staging/gdm72xx/usb_ids.h index b34616b7203f..1a61b3599765 100644 --- a/drivers/staging/gdm72xx/usb_ids.h +++ b/drivers/staging/gdm72xx/usb_ids.h @@ -29,7 +29,7 @@ .idVendor = (vend), .idProduct = (prod), .bInterfaceClass = (intf) #define EMERGENCY_PID 0x720f -#define BL_PID_MASK 0xffc0 +#define BL_PID_MASK 0xffc0 #define USB_DEVICE_BOOTLOADER(vid, pid) \ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \ diff --git a/drivers/staging/gdm72xx/wm_ioctl.h b/drivers/staging/gdm72xx/wm_ioctl.h index 9f46e06f2303..d022c6ca0e23 100644 --- a/drivers/staging/gdm72xx/wm_ioctl.h +++ b/drivers/staging/gdm72xx/wm_ioctl.h @@ -19,10 +19,10 @@ #define NETLINK_WIMAX 31 -#define SIOCWMIOCTL SIOCDEVPRIVATE +#define SIOCWMIOCTL SIOCDEVPRIVATE -#define SIOCG_DATA 0x8D10 -#define SIOCS_DATA 0x8D11 +#define SIOCG_DATA 0x8D10 +#define SIOCS_DATA 0x8D11 enum { SIOC_DATA_FSM, @@ -34,7 +34,7 @@ enum { SIOC_DATA_END }; -#define SIOC_DATA_MAX 16 +#define SIOC_DATA_MAX 16 /* FSM */ enum { @@ -67,23 +67,21 @@ enum { }; struct fsm_s { - int m_status; /*main status*/ - int c_status; /*connection status*/ - int d_status; /*oma-dm status*/ + int m_status; /*main status*/ + int c_status; /*connection status*/ + int d_status; /*oma-dm status*/ }; struct data_s { - int size; + int size; void *buf; }; struct wm_req_s { union { - char ifrn_name[IFNAMSIZ]; + char ifrn_name[IFNAMSIZ]; } ifr_ifrn; - unsigned short cmd; - unsigned short data_id; struct data_s data; @@ -91,7 +89,7 @@ struct wm_req_s { }; #ifndef ifr_name -#define ifr_name ifr_ifrn.ifrn_name +#define ifr_name ifr_ifrn.ifrn_name #endif #endif |