summaryrefslogtreecommitdiff
path: root/drivers/staging/gdm724x/gdm_usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/gdm724x/gdm_usb.c')
-rw-r--r--drivers/staging/gdm724x/gdm_usb.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index ed1a12f50..92ea1a16a 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -63,7 +63,7 @@ static void do_rx(struct work_struct *work);
static int gdm_usb_recv(void *priv_dev,
int (*cb)(void *cb_data,
- void *data, int len, int context),
+ void *data, int len, int context),
void *cb_data,
int context);
@@ -80,7 +80,7 @@ static int request_mac_address(struct lte_udev *udev)
hci->data[0] = MAC_ADDRESS;
ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), buf, 5,
- &actual, 1000);
+ &actual, 1000);
udev->request_mac_addr = 1;
@@ -92,7 +92,7 @@ static struct usb_tx *alloc_tx_struct(int len)
struct usb_tx *t = NULL;
int ret = 0;
- t = kzalloc(sizeof(struct usb_tx), GFP_ATOMIC);
+ t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (!t) {
ret = -ENOMEM;
goto out;
@@ -125,7 +125,7 @@ static struct usb_tx_sdu *alloc_tx_sdu_struct(void)
{
struct usb_tx_sdu *t_sdu;
- t_sdu = kzalloc(sizeof(struct usb_tx_sdu), GFP_KERNEL);
+ t_sdu = kzalloc(sizeof(*t_sdu), GFP_KERNEL);
if (!t_sdu)
return NULL;
@@ -183,7 +183,7 @@ static struct usb_rx *alloc_rx_struct(void)
struct usb_rx *r = NULL;
int ret = 0;
- r = kmalloc(sizeof(struct usb_rx), GFP_KERNEL);
+ r = kmalloc(sizeof(*r), GFP_KERNEL);
if (!r) {
ret = -ENOMEM;
goto out;
@@ -338,7 +338,7 @@ static int init_usb(struct lte_udev *udev)
for (i = 0; i < MAX_NUM_SDU_BUF; i++) {
t_sdu = alloc_tx_sdu_struct();
- if (t_sdu == NULL) {
+ if (!t_sdu) {
ret = -ENOMEM;
goto fail;
}
@@ -347,9 +347,9 @@ static int init_usb(struct lte_udev *udev)
tx->avail_count++;
}
- for (i = 0; i < MAX_RX_SUBMIT_COUNT*2; i++) {
+ for (i = 0; i < MAX_RX_SUBMIT_COUNT * 2; i++) {
r = alloc_rx_struct();
- if (r == NULL) {
+ if (!r) {
ret = -ENOMEM;
goto fail;
}
@@ -367,7 +367,7 @@ fail:
static int set_mac_address(u8 *data, void *arg)
{
- struct phy_dev *phy_dev = (struct phy_dev *)arg;
+ struct phy_dev *phy_dev = arg;
struct lte_udev *udev = phy_dev->priv_dev;
struct tlv *tlv = (struct tlv *)data;
u8 mac_address[ETH_ALEN] = {0, };
@@ -376,7 +376,7 @@ static int set_mac_address(u8 *data, void *arg)
memcpy(mac_address, tlv->data, tlv->len);
if (register_lte_device(phy_dev,
- &udev->intf->dev, mac_address) < 0)
+ &udev->intf->dev, mac_address) < 0)
pr_err("register lte device failed\n");
udev->request_mac_addr = 0;
@@ -406,12 +406,12 @@ static void do_rx(struct work_struct *work)
break;
}
r = list_entry(rx->to_host_list.next,
- struct usb_rx, to_host_list);
+ struct usb_rx, to_host_list);
list_del(&r->to_host_list);
spin_unlock_irqrestore(&rx->to_host_lock, flags);
- phy_dev = (struct phy_dev *)r->cb_data;
- udev = (struct lte_udev *)phy_dev->priv_dev;
+ phy_dev = r->cb_data;
+ udev = phy_dev->priv_dev;
hci = (struct hci_packet *)r->buf;
cmd_evt = gdm_dev16_to_cpu(&udev->gdm_ed, hci->cmd_evt);
@@ -481,7 +481,7 @@ static void gdm_usb_rcv_complete(struct urb *urb)
} else {
if (urb->status && udev->usb_state == PM_NORMAL)
dev_err(&urb->dev->dev, "%s: urb status error %d\n",
- __func__, urb->status);
+ __func__, urb->status);
put_rx_struct(rx, r);
}
@@ -491,7 +491,7 @@ static void gdm_usb_rcv_complete(struct urb *urb)
static int gdm_usb_recv(void *priv_dev,
int (*cb)(void *cb_data,
- void *data, int len, int context),
+ void *data, int len, int context),
void *cb_data,
int context)
{
@@ -576,7 +576,7 @@ static int send_tx_packet(struct usb_device *usbdev, struct usb_tx *t, u32 len)
{
int ret = 0;
- if (!(len%512))
+ if (!(len % 512))
len++;
usb_fill_bulk_urb(t->urb,
@@ -682,7 +682,7 @@ static void do_tx(struct work_struct *work)
}
t = alloc_tx_struct(TX_BUF_SIZE);
- if (t == NULL) {
+ if (!t) {
spin_unlock_irqrestore(&tx->lock, flags);
return;
}
@@ -711,8 +711,8 @@ static void do_tx(struct work_struct *work)
#define SDU_PARAM_LEN 12
static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
- unsigned int dftEpsId, unsigned int epsId,
- void (*cb)(void *data), void *cb_data,
+ unsigned int dftEpsId, unsigned int epsId,
+ void (*cb)(void *data), void *cb_data,
int dev_idx, int nic_type)
{
struct lte_udev *udev = priv_dev;
@@ -732,7 +732,7 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
t_sdu = get_tx_sdu_struct(tx, &no_spc);
spin_unlock_irqrestore(&tx->lock, flags);
- if (t_sdu == NULL) {
+ if (!t_sdu) {
pr_err("sdu send - free list empty\n");
return TX_NO_SPC;
}
@@ -745,7 +745,7 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
} else {
send_len = len - ETH_HLEN;
send_len += SDU_PARAM_LEN;
- memcpy(sdu->data, data+ETH_HLEN, len-ETH_HLEN);
+ memcpy(sdu->data, data + ETH_HLEN, len - ETH_HLEN);
}
sdu->len = gdm_cpu_to_dev16(&udev->gdm_ed, send_len);
@@ -769,7 +769,7 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
}
static int gdm_usb_hci_send(void *priv_dev, void *data, int len,
- void (*cb)(void *data), void *cb_data)
+ void (*cb)(void *data), void *cb_data)
{
struct lte_udev *udev = priv_dev;
struct tx_cxt *tx = &udev->tx;
@@ -782,7 +782,7 @@ static int gdm_usb_hci_send(void *priv_dev, void *data, int len,
}
t = alloc_tx_struct(len);
- if (t == NULL) {
+ if (!t) {
pr_err("hci_send - out of memory\n");
return -ENOMEM;
}
@@ -810,7 +810,7 @@ static struct gdm_endian *gdm_usb_get_endian(void *priv_dev)
}
static int gdm_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
+ const struct usb_device_id *id)
{
int ret = 0;
struct phy_dev *phy_dev = NULL;
@@ -830,11 +830,11 @@ static int gdm_usb_probe(struct usb_interface *intf,
return -ENODEV;
}
- phy_dev = kzalloc(sizeof(struct phy_dev), GFP_KERNEL);
+ phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
if (!phy_dev)
return -ENOMEM;
- udev = kzalloc(sizeof(struct lte_udev), GFP_KERNEL);
+ udev = kzalloc(sizeof(*udev), GFP_KERNEL);
if (!udev) {
ret = -ENOMEM;
goto err_udev;
@@ -1006,11 +1006,11 @@ static int __init gdm_usb_lte_init(void)
}
usb_tx_wq = create_workqueue("usb_tx_wq");
- if (usb_tx_wq == NULL)
+ if (!usb_tx_wq)
return -1;
usb_rx_wq = create_workqueue("usb_rx_wq");
- if (usb_rx_wq == NULL)
+ if (!usb_rx_wq)
return -1;
return usb_register(&gdm_usb_lte_driver);