Re: [PATCH 1/1] Staging: iio: meter: ade7854-i2c: code style improvements

2015-02-13 Thread Sudip Mukherjee
On Thu, Feb 12, 2015 at 10:49:46PM -0800, Tolga Ceylan wrote:
> Code reformatting based on checkpatch.pl with --strict:
> 1) Lines over 80 characters were fixed
> 2) Alignment should match open paranthesis cases corrected
> 3) Comparison to NULL rewritten as !indio_dev

you are doing three different types of changes here. one patch should have only 
one type of change.

regards
sudip
> 
> Signed-off-by: Tolga Ceylan 
> ---
>  drivers/staging/iio/meter/ade7854-i2c.c | 39 
> +
>  1 file changed, 20 insertions(+), 19 deletions(-)
> 
>  
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
Corrections based on checkpatch.pl with --strict.
1) Lines over 80 were corrected
2) Alignment should match open paranthesis cases corrected
3) Comparisons such as if (x == NULL) rewritten as if (!x)
4) CamelCase variables renamed
5) Missing spaces between operators added
6) Unnecessary blank lines removed
7) in mem alloc arguments sizeof(struct foo) rewritten as sizeof(*foo_obj)

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/gdm724x/gdm_endian.c |  9 +++
 drivers/staging/gdm724x/gdm_endian.h |  4 +--
 drivers/staging/gdm724x/gdm_lte.c| 42 ++---
 drivers/staging/gdm724x/gdm_lte.h| 14 +-
 drivers/staging/gdm724x/gdm_mux.c| 27 +--
 drivers/staging/gdm724x/gdm_mux.h|  4 +--
 drivers/staging/gdm724x/gdm_tty.c|  7 +++--
 drivers/staging/gdm724x/gdm_tty.h|  6 ++---
 drivers/staging/gdm724x/gdm_usb.c| 52 ++--
 drivers/staging/gdm724x/gdm_usb.h|  6 ++---
 drivers/staging/gdm724x/hci_packet.h |  5 ++--
 drivers/staging/gdm724x/netlink_k.c  | 13 -
 drivers/staging/gdm724x/netlink_k.h  |  3 ++-
 13 files changed, 93 insertions(+), 99 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_endian.c 
b/drivers/staging/gdm724x/gdm_endian.c
index f6cc90a..032aafa 100644
--- a/drivers/staging/gdm724x/gdm_endian.c
+++ b/drivers/staging/gdm724x/gdm_endian.c
@@ -31,7 +31,6 @@ void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian)
ed->host_ed = ENDIANNESS_LITTLE;
else
ed->host_ed = ENDIANNESS_BIG;
-
 }
 
 u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
@@ -39,7 +38,7 @@ u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
if (ed->dev_ed == ed->host_ed)
return x;
 
-   return Endian16_Swap(x);
+   return ENDIAN16_SWAP(x);
 }
 
 u16 gdm_dev16_to_cpu(struct gdm_endian *ed, u16 x)
@@ -47,7 +46,7 @@ u16 gdm_dev16_to_cpu(struct gdm_endian *ed, u16 x)
if (ed->dev_ed == ed->host_ed)
return x;
 
-   return Endian16_Swap(x);
+   return ENDIAN16_SWAP(x);
 }
 
 u32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
@@ -55,7 +54,7 @@ u32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
if (ed->dev_ed == ed->host_ed)
return x;
 
-   return Endian32_Swap(x);
+   return ENDIAN32_SWAP(x);
 }
 
 u32 gdm_dev32_to_cpu(struct gdm_endian *ed, u32 x)
@@ -63,5 +62,5 @@ u32 gdm_dev32_to_cpu(struct gdm_endian *ed, u32 x)
if (ed->dev_ed == ed->host_ed)
return x;
 
-   return Endian32_Swap(x);
+   return ENDIAN32_SWAP(x);
 }
diff --git a/drivers/staging/gdm724x/gdm_endian.h 
b/drivers/staging/gdm724x/gdm_endian.h
index 9b2531f..12e3fb0 100644
--- a/drivers/staging/gdm724x/gdm_endian.h
+++ b/drivers/staging/gdm724x/gdm_endian.h
@@ -16,11 +16,11 @@
 
 #include 
 
-#define Endian16_Swap(value) \
+#define ENDIAN16_SWAP(value) \
u16)((value) & 0x00FF)) << 8) | \
 (((u16)((value) & 0xFF00)) >> 8))
 
-#define Endian32_Swap(value) \
+#define ENDIAN32_SWAP(value) \
u32)((value) & 0x00FF)) << 24) | \
 (((u32)((value) & 0xFF00)) << 8) | \
 (((u32)((value) & 0x00FF)) >> 8) | \
diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 7c4a77b..7a86184 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -162,11 +162,11 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, 
u32 nic_type)
skb_reserve(skb_out, NET_IP_ALIGN);
 
memcpy(skb_put(skb_out, mac_header_len), mac_header_data,
-   mac_header_len);
+  mac_header_len);
memcpy(skb_put(skb_out, sizeof(struct arphdr)), arp_out,
-   sizeof(struct arphdr));
+  sizeof(struct arphdr));
memcpy(skb_put(skb_out, sizeof(struct arpdata)), arp_data_out,
-   sizeof(struct arpdata));
+  sizeof(struct arpdata));
 
skb_out->protocol = ((struct ethhdr *)mac_header_data)->h_proto;
skb_out->dev = skb_in->dev;
@@ -300,13 +300,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, 
u32 nic_type)
memcpy(&ipv6_out, ipv6_in, sizeof(struct ipv6hdr));
memcpy(ipv6_out.saddr.in6_u.u6_addr8, &na.target_address, 16);
memcpy(ipv6_out.daddr.in6_u.u6_addr8,
-   ipv6_in->saddr.in6_u.u6_addr8, 16);
+  ipv6_in->saddr.in6_u.u6_addr8, 16);
ipv6_out.payload_len = htons(sizeof(struct icmp6hdr) +
sizeof(struct neighbour_advertisement));
 
memcpy(icmp_na, &icmp6_out, sizeof(struct icmp6hdr));
memcpy(icmp_na + sizeof(struct icmp6hdr), &na,
-   sizeof(struct neighbour_advertisement));
+  sizeof(struct neighbour_advertisement));
 
icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out,
  

[PATCH] [media] staging: dt3155v4l: Switch to using managed resource with devm_

2015-02-13 Thread Kiran Padwal
This patch uses managed resource APIs to allocate memory
in order to simplify the driver unload or failure cases

Signed-off-by: Kiran Padwal 
---
 drivers/staging/media/dt3155v4l/dt3155v4l.c |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c 
b/drivers/staging/media/dt3155v4l/dt3155v4l.c
index 293ffda..e60a53e 100644
--- a/drivers/staging/media/dt3155v4l/dt3155v4l.c
+++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c
@@ -901,14 +901,13 @@ dt3155_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (err)
return -ENODEV;
-   pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+   pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
return -ENOMEM;
pd->vdev = video_device_alloc();
-   if (!pd->vdev) {
-   err = -ENOMEM;
-   goto err_video_device_alloc;
-   }
+   if (!pd->vdev)
+   return -ENOMEM;
+
*pd->vdev = dt3155_vdev;
pci_set_drvdata(pdev, pd);/* for use in dt3155_remove() */
video_set_drvdata(pd->vdev, pd);  /* for use in video_fops */
@@ -951,8 +950,7 @@ err_req_region:
pci_disable_device(pdev);
 err_enable_dev:
video_device_release(pd->vdev);
-err_video_device_alloc:
-   kfree(pd);
+
return err;
 }
 
@@ -970,7 +968,6 @@ dt3155_remove(struct pci_dev *pdev)
 * video_device_release() is invoked automatically
 * see: struct video_device dt3155_vdev
 */
-   kfree(pd);
 }
 
 static const struct pci_device_id pci_ids[] = {
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Staging: gdm724x: code style improvements

2015-02-13 Thread Dan Carpenter
On Fri, Feb 13, 2015 at 12:56:03AM -0800, Tolga Ceylan wrote:
> Corrections based on checkpatch.pl with --strict.
> 1) Lines over 80 were corrected
> 2) Alignment should match open paranthesis cases corrected
> 3) Comparisons such as if (x == NULL) rewritten as if (!x)
> 4) CamelCase variables renamed
> 5) Missing spaces between operators added
> 6) Unnecessary blank lines removed
> 7) in mem alloc arguments sizeof(struct foo) rewritten as sizeof(*foo_obj)
> 

You're doing too many things at one.  This should probably be split into
7 patches.


>  u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> @@ -39,7 +38,7 @@ u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
>   if (ed->dev_ed == ed->host_ed)
>   return x;
>  
> - return Endian16_Swap(x);
> + return ENDIAN16_SWAP(x);
>  }

All the changes are good except these.  We have standard macros
cpu_to_be16()/le16() and back for these.

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Ralink 6570 / Mediatek MT7601STA (was Re: Addition of a wifi kernel module to the linux source tree)

2015-02-13 Thread Jakub KiciƄski
On Tue, 10 Feb 2015 14:57:53 +0530, Parth Sane wrote:
> A few months earlier I had requested addition of the MT7601 WiFi
> dongle module into the kernel. I was told that the needful would be
> done in the rt2x00 driver. Could you guys update me with the status?

There is a new mac80211-based driver for MT7601U:

https://github.com/kuba-moo/mt7601u/graphs/traffic

I'm still working on it but I hope to have it mainlined for 3.21.


kuba
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] dgnc: Use ccflags -y instead of EXTRA_CFLAGS

2015-02-13 Thread Cass May
checkpatch fix

Signed-off-by: Cass May 
---
 drivers/staging/dgnc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile
index b69f7b6..d70323e 100644
--- a/drivers/staging/dgnc/Makefile
+++ b/drivers/staging/dgnc/Makefile
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"
+ccflags-y += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"
 
 obj-$(CONFIG_DGNC) += dgnc.o
 
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] dgnc: Use ccflags -y instead of EXTRA_CFLAGS

2015-02-13 Thread Cass May
Correction to syntax error in previous patch version. Apologies.

Signed-off-by: Cass May 
---
 drivers/staging/dgnc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile
index b69f7b6..a278900 100644
--- a/drivers/staging/dgnc/Makefile
+++ b/drivers/staging/dgnc/Makefile
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"
+ccflags-y := -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"
 
 obj-$(CONFIG_DGNC) += dgnc.o
 
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8188eu: Fix possible leak in rtl88eu_download_fw()

2015-02-13 Thread Christian Engelmayer
Function rtl88eu_download_fw() may leak the memory of the already requested
firmware data due to direct returns in the error paths. Ensure cleanup by
using a centralized exit path. Detected by Coverity CID 1269127.

Signed-off-by: Christian Engelmayer 
---
Compile tested only. Applies against branch staging-next.
---
 drivers/staging/rtl8188eu/hal/fw.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
b/drivers/staging/rtl8188eu/hal/fw.c
index 3b2875481fc5..1b57ca49af5f 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -201,17 +201,19 @@ int rtl88eu_download_fw(struct adapter *adapt)
if (fw->size > FW_8188E_SIZE) {
dev_err(device, "Firmware size exceed 0x%X. Check it.\n",
 FW_8188E_SIZE);
-   return -1;
+   err = -1;
+   goto exit;
}
 
pfwdata = kzalloc(FW_8188E_SIZE, GFP_KERNEL);
-   if (!pfwdata)
-   return -ENOMEM;
+   if (!pfwdata) {
+   err = -ENOMEM;
+   goto exit;
+   }
 
rtlhal->pfirmware = pfwdata;
memcpy(rtlhal->pfirmware, fw->data, fw->size);
rtlhal->fwsize = fw->size;
-   release_firmware(fw);
 
fwsize = rtlhal->fwsize;
pfwheader = (struct rtl92c_firmware_header *)pfwdata;
@@ -232,5 +234,7 @@ int rtl88eu_download_fw(struct adapter *adapt)
 
err = _rtl88e_fw_free_to_go(adapt);
 
+exit:
+   release_firmware(fw);
return err;
 }
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Staging: iio: meter: ade7854-i2c: code style improvements

2015-02-13 Thread Tolga Ceylan
On Fri, Feb 13, 2015 at 12:27 AM, Sudip Mukherjee
 wrote:
>
> you are doing three different types of changes here. one patch should have 
> only one type of change.
>
> regards
> sudip

Thank you, I'll split this up and resubmit.

Regards,
Tolga
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
On Fri, Feb 13, 2015 at 1:05 AM, Dan Carpenter  wrote:
>
> You're doing too many things at one.  This should probably be split into
> 7 patches.

I will split this up and resubmit.

>
>
>>  u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
>> @@ -39,7 +38,7 @@ u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
>>   if (ed->dev_ed == ed->host_ed)
>>   return x;
>>
>> - return Endian16_Swap(x);
>> + return ENDIAN16_SWAP(x);
>>  }
>
> All the changes are good except these.  We have standard macros
> cpu_to_be16()/le16() and back for these.
>
> regards,
> dan carpenter

Thanks, I'll skip this one.

Regards,
Tolga Ceylan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] dgnc: Use ccflags -y instead of EXTRA_CFLAGS

2015-02-13 Thread Dan Carpenter
On Fri, Feb 13, 2015 at 08:01:36PM +, Cass May wrote:
> Correction to syntax error in previous patch version. Apologies.
> 

Put that stuff under the --- cut off line and not in the permanent
kernel git log.

Changelog is missing.  checkpatch.pl by itself is not sufficient
justification.  Why did the authors of checkpatch think this way is
better?

> Signed-off-by: Cass May 
> ---
>  drivers/staging/dgnc/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile
> index b69f7b6..a278900 100644
> --- a/drivers/staging/dgnc/Makefile
> +++ b/drivers/staging/dgnc/Makefile
> @@ -1,4 +1,4 @@
> -EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"
> +ccflags-y := -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\"

This isn't the right fix.  Is this stuff even needed?  Hopefully, not
but please check and resend a different fix.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] ion: improve ion_phys error message

2015-02-13 Thread Mitchel Humpherys
Clients often get confused when ion_phys errors out due to some heap
being used that they didn't expect.  Add the heap name and heap type to
the error message to make it more obvious.

Signed-off-by: Mitchel Humpherys 
---
 drivers/staging/android/ion/ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 296d347660fc..966b7fdc9ecf 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -566,8 +566,8 @@ int ion_phys(struct ion_client *client, struct ion_handle 
*handle,
buffer = handle->buffer;
 
if (!buffer->heap->ops->phys) {
-   pr_err("%s: ion_phys is not implemented by this heap.\n",
-  __func__);
+   pr_err("%s: ion_phys is not implemented by this heap (name=%s, 
type=%d).\n",
+   __func__, buffer->heap->name, buffer->heap->type);
mutex_unlock(&client->lock);
return -ENODEV;
}
-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/5] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
Corrections based on checkpatch.pl with --strict.
Added missing spaces between operators.

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/gdm724x/gdm_lte.c   |  6 +++---
 drivers/staging/gdm724x/gdm_mux.c   |  4 ++--
 drivers/staging/gdm724x/gdm_mux.h   |  4 ++--
 drivers/staging/gdm724x/gdm_tty.c   |  2 +-
 drivers/staging/gdm724x/gdm_usb.c   |  6 +++---
 drivers/staging/gdm724x/gdm_usb.h   |  6 +++---
 drivers/staging/gdm724x/netlink_k.c | 10 +-
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 7c4a77b..dab5ba7 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -724,12 +724,12 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev 
*phy_dev, char *buf, int len)
if (index < MAX_NIC_TYPE) {
dev = phy_dev->dev[index];
gdm_lte_netif_rx(dev, (char *)sdu->data,
-   (int)(hci_len-12), nic_type);
+   (int)(hci_len - 12), nic_type);
} else {
pr_err("rx sdu invalid nic_type :%x\n", nic_type);
}
 
-   data += ((hci_len+3) & 0xfffc) + HCI_HEADER_SIZE;
+   data += ((hci_len + 3) & 0xfffc) + HCI_HEADER_SIZE;
}
 }
 
@@ -850,7 +850,7 @@ static void form_mac_address(u8 *dev_addr, u8 *nic_src, u8 
*nic_dest,
/* The last byte of the mac address
 * should be less than or equal to 0xFC
 */
-   dev_addr[ETH_ALEN-1] += index;
+   dev_addr[ETH_ALEN - 1] += index;
 
/* Create random nic src and copy the first
 * 3 bytes to be the same as dev_addr
diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index d1ab996..826b537 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -391,8 +391,8 @@ static int gdm_mux_send(void *priv_dev, void *data, int 
len, int tty_index,
mux_header->payload_size = __cpu_to_le32((u32)len);
mux_header->packet_type = __cpu_to_le16(packet_type[tty_index]);
 
-   memcpy(t->buf+MUX_HEADER_SIZE, data, len);
-   memset(t->buf+MUX_HEADER_SIZE+len, 0, dummy_cnt);
+   memcpy(t->buf + MUX_HEADER_SIZE, data, len);
+   memset(t->buf + MUX_HEADER_SIZE + len, 0, dummy_cnt);
 
t->len = total_len;
t->callback = cb;
diff --git a/drivers/staging/gdm724x/gdm_mux.h 
b/drivers/staging/gdm724x/gdm_mux.h
index 3d50383..0871b8f 100644
--- a/drivers/staging/gdm724x/gdm_mux.h
+++ b/drivers/staging/gdm724x/gdm_mux.h
@@ -27,8 +27,8 @@
 
 #define START_FLAG 0xA512485A
 #define MUX_HEADER_SIZE 14
-#define MUX_TX_MAX_SIZE (1024*10)
-#define MUX_RX_MAX_SIZE (1024*30)
+#define MUX_TX_MAX_SIZE (1024 * 10)
+#define MUX_RX_MAX_SIZE (1024 * 30)
 #define AT_PKT_TYPE 0xF011
 #define DM_PKT_TYPE 0xF010
 
diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 001348c..f8c18a9 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -193,7 +193,7 @@ static int gdm_tty_write(struct tty_struct *tty, const 
unsigned char *buf,
sending_len = remain > MUX_TX_MAX_SIZE ? MUX_TX_MAX_SIZE :
 remain;
gdm_tty_send(gdm,
-(void *)(buf+sent_len),
+(void *)(buf + sent_len),
 sending_len,
 gdm->index,
 gdm_tty_send_complete,
diff --git a/drivers/staging/gdm724x/gdm_usb.c 
b/drivers/staging/gdm724x/gdm_usb.c
index d2a3b35..f4a2824 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -347,7 +347,7 @@ 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) {
ret = -ENOMEM;
@@ -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,
@@ -744,7 +744,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);
diff --git a/drivers/staging/gdm724x/gdm_usb.h 
b/drivers/staging/gdm724x/gdm_usb.h
index e6486e7..ffb3d99 100644
--- a/drivers/staging/gdm724x/gdm_usb.h
+++ b/drivers/staging/gdm724x/gdm_usb.h
@@ -26,10 +26,10 @@

[PATCH 5/5] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
Unnecessary blank lines removed

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/gdm724x/gdm_endian.c | 1 -
 drivers/staging/gdm724x/gdm_mux.c| 5 -
 drivers/staging/gdm724x/gdm_tty.c| 1 -
 drivers/staging/gdm724x/gdm_tty.h| 1 -
 drivers/staging/gdm724x/hci_packet.h | 1 -
 5 files changed, 9 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_endian.c 
b/drivers/staging/gdm724x/gdm_endian.c
index f6cc90a..4044453 100644
--- a/drivers/staging/gdm724x/gdm_endian.c
+++ b/drivers/staging/gdm724x/gdm_endian.c
@@ -31,7 +31,6 @@ void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian)
ed->host_ed = ENDIANNESS_LITTLE;
else
ed->host_ed = ENDIANNESS_BIG;
-
 }
 
 u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index 522f3cd..7584d7a 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -48,7 +48,6 @@ static const struct usb_device_id id_table[] = {
{}
 };
 
-
 MODULE_DEVICE_TABLE(usb, id_table);
 
 static int packet_type_to_index(u16 packetType)
@@ -150,7 +149,6 @@ static void put_rx_struct(struct rx_cxt *rx, struct mux_rx 
*r)
spin_unlock_irqrestore(&rx->free_list_lock, flags);
 }
 
-
 static int up_to_host(struct mux_rx *r)
 {
struct mux_dev *mux_dev = (struct mux_dev *)r->mux_dev;
@@ -477,7 +475,6 @@ static void release_usb(struct mux_dev *mux_dev)
spin_unlock_irqrestore(&rx->to_host_lock, flags);
 }
 
-
 static int init_usb(struct mux_dev *mux_dev)
 {
struct mux_rx *r;
@@ -615,7 +612,6 @@ static int gdm_mux_suspend(struct usb_interface *intf, 
pm_message_t pm_msg)
 
mux_dev->usb_state = PM_SUSPEND;
 
-
spin_lock_irqsave(&rx->submit_list_lock, flags);
list_for_each_entry_safe(r, r_next, &rx->rx_submit_list,
 rx_submit_list) {
@@ -663,7 +659,6 @@ static struct usb_driver gdm_mux_driver = {
 
 static int __init gdm_usb_mux_init(void)
 {
-
mux_rx_wq = create_workqueue("mux_rx_wq");
if (!mux_rx_wq) {
pr_err("work queue create fail\n");
diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index 3b9bf07..60b52a3 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -225,7 +225,6 @@ int register_lte_tty_device(struct tty_dev *tty_dev, struct 
device *device)
int j;
 
for (i = 0; i < TTY_MAX_COUNT; i++) {
-
gdm = kmalloc(sizeof(*gdm), GFP_KERNEL);
if (!gdm)
return -ENOMEM;
diff --git a/drivers/staging/gdm724x/gdm_tty.h 
b/drivers/staging/gdm724x/gdm_tty.h
index 297438b..195c590 100644
--- a/drivers/staging/gdm724x/gdm_tty.h
+++ b/drivers/staging/gdm724x/gdm_tty.h
@@ -17,7 +17,6 @@
 #include 
 #include 
 
-
 #define TTY_MAX_COUNT  2
 
 #define MAX_ISSUE_NUM 3
diff --git a/drivers/staging/gdm724x/hci_packet.h 
b/drivers/staging/gdm724x/hci_packet.h
index 7fba8a6..46e0fc4 100644
--- a/drivers/staging/gdm724x/hci_packet.h
+++ b/drivers/staging/gdm724x/hci_packet.h
@@ -89,5 +89,4 @@ struct hci_connect_ind {
u32 connect;
 } __packed;
 
-
 #endif /* _HCI_PACKET_H_ */
-- 
2.3.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/5] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
In memory allocation (kzalloc, kmalloc) arguments
sizeof(struct foo) rewritten as sizeof(*foo_obj).

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/gdm724x/gdm_mux.c |  8 
 drivers/staging/gdm724x/gdm_tty.c |  2 +-
 drivers/staging/gdm724x/gdm_usb.c | 10 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index b025a49..522f3cd 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -67,7 +67,7 @@ static struct mux_tx *alloc_mux_tx(int len)
 {
struct mux_tx *t = NULL;
 
-   t = kzalloc(sizeof(struct mux_tx), GFP_ATOMIC);
+   t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (!t)
return NULL;
 
@@ -96,7 +96,7 @@ static struct mux_rx *alloc_mux_rx(void)
 {
struct mux_rx *r = NULL;
 
-   r = kzalloc(sizeof(struct mux_rx), GFP_KERNEL);
+   r = kzalloc(sizeof(*r), GFP_KERNEL);
if (!r)
return NULL;
 
@@ -529,11 +529,11 @@ static int gdm_mux_probe(struct usb_interface *intf,
if (bInterfaceNumber != 2)
return -ENODEV;
 
-   mux_dev = kzalloc(sizeof(struct mux_dev), GFP_KERNEL);
+   mux_dev = kzalloc(sizeof(*mux_dev), GFP_KERNEL);
if (!mux_dev)
return -ENOMEM;
 
-   tty_dev = kzalloc(sizeof(struct tty_dev), GFP_KERNEL);
+   tty_dev = kzalloc(sizeof(*tty_dev), GFP_KERNEL);
if (!tty_dev) {
ret = -ENOMEM;
goto err_free_mux;
diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index b593525..3b9bf07 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -226,7 +226,7 @@ int register_lte_tty_device(struct tty_dev *tty_dev, struct 
device *device)
 
for (i = 0; i < TTY_MAX_COUNT; i++) {
 
-   gdm = kmalloc(sizeof(struct gdm), GFP_KERNEL);
+   gdm = kmalloc(sizeof(*gdm), GFP_KERNEL);
if (!gdm)
return -ENOMEM;
 
diff --git a/drivers/staging/gdm724x/gdm_usb.c 
b/drivers/staging/gdm724x/gdm_usb.c
index 36fe1b4..e81b266 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -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;
@@ -829,11 +829,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;
-- 
2.3.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/5] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
Comparisons such as if (x == NULL) rewritten as if (!x)

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/gdm724x/gdm_lte.c |  6 +++---
 drivers/staging/gdm724x/gdm_mux.c |  4 ++--
 drivers/staging/gdm724x/gdm_tty.c |  2 +-
 drivers/staging/gdm724x/gdm_usb.c | 14 +++---
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 2c3931b..7a86184 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -775,7 +775,7 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
   hci->cmd_evt);
 
dev = phy_dev->dev[0];
-   if (dev == NULL)
+   if (!dev)
return 0;
 
switch (cmd_evt) {
@@ -889,7 +889,7 @@ int register_lte_device(struct phy_dev *phy_dev,
/* Allocate netdev */
net = alloc_netdev(sizeof(struct nic), pdn_dev_name,
   NET_NAME_UNKNOWN, ether_setup);
-   if (net == NULL) {
+   if (!net) {
pr_err("alloc_netdev failed\n");
ret = -ENOMEM;
goto err;
@@ -938,7 +938,7 @@ void unregister_lte_device(struct phy_dev *phy_dev)
 
for (index = 0; index < MAX_NIC_TYPE; index++) {
net = phy_dev->dev[index];
-   if (net == NULL)
+   if (!net)
continue;
 
unregister_netdev(net);
diff --git a/drivers/staging/gdm724x/gdm_mux.c 
b/drivers/staging/gdm724x/gdm_mux.c
index 9b5e6b8..b025a49 100644
--- a/drivers/staging/gdm724x/gdm_mux.c
+++ b/drivers/staging/gdm724x/gdm_mux.c
@@ -495,7 +495,7 @@ static int init_usb(struct mux_dev *mux_dev)
 
for (i = 0; i < MAX_ISSUE_NUM * 2; i++) {
r = alloc_mux_rx();
-   if (r == NULL) {
+   if (!r) {
ret = -ENOMEM;
break;
}
@@ -665,7 +665,7 @@ static int __init gdm_usb_mux_init(void)
 {
 
mux_rx_wq = create_workqueue("mux_rx_wq");
-   if (mux_rx_wq == NULL) {
+   if (!mux_rx_wq) {
pr_err("work queue create fail\n");
return -1;
}
diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index f8c18a9..b593525 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -88,7 +88,7 @@ static int gdm_tty_install(struct tty_driver *driver, struct 
tty_struct *tty)
 
mutex_lock(&gdm_table_lock);
gdm = gdm_table[i][j];
-   if (gdm == NULL) {
+   if (!gdm) {
mutex_unlock(&gdm_table_lock);
return -ENODEV;
}
diff --git a/drivers/staging/gdm724x/gdm_usb.c 
b/drivers/staging/gdm724x/gdm_usb.c
index 786c177..36fe1b4 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -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;
}
@@ -349,7 +349,7 @@ static int init_usb(struct lte_udev *udev)
 
for (i = 0; i < MAX_RX_SUBMIT_COUNT * 2; i++) {
r = alloc_rx_struct();
-   if (r == NULL) {
+   if (!r) {
ret = -ENOMEM;
goto fail;
}
@@ -681,7 +681,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;
}
@@ -731,7 +731,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;
}
@@ -781,7 +781,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;
}
@@ -1005,11 +1005,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);
-- 
2.3.0


[PATCH 2/5] Staging: gdm724x: code style improvements

2015-02-13 Thread Tolga Ceylan
Alignment should match open paranthesis cases corrected

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/gdm724x/gdm_lte.c   | 32 
 drivers/staging/gdm724x/gdm_lte.h   | 14 +++---
 drivers/staging/gdm724x/gdm_mux.c   |  5 +++--
 drivers/staging/gdm724x/gdm_usb.c   | 18 +-
 drivers/staging/gdm724x/netlink_k.c |  3 ++-
 drivers/staging/gdm724x/netlink_k.h |  4 ++--
 6 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index dab5ba7..2c3931b 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -162,11 +162,11 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, 
u32 nic_type)
skb_reserve(skb_out, NET_IP_ALIGN);
 
memcpy(skb_put(skb_out, mac_header_len), mac_header_data,
-   mac_header_len);
+  mac_header_len);
memcpy(skb_put(skb_out, sizeof(struct arphdr)), arp_out,
-   sizeof(struct arphdr));
+  sizeof(struct arphdr));
memcpy(skb_put(skb_out, sizeof(struct arpdata)), arp_data_out,
-   sizeof(struct arpdata));
+  sizeof(struct arpdata));
 
skb_out->protocol = ((struct ethhdr *)mac_header_data)->h_proto;
skb_out->dev = skb_in->dev;
@@ -300,13 +300,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, 
u32 nic_type)
memcpy(&ipv6_out, ipv6_in, sizeof(struct ipv6hdr));
memcpy(ipv6_out.saddr.in6_u.u6_addr8, &na.target_address, 16);
memcpy(ipv6_out.daddr.in6_u.u6_addr8,
-   ipv6_in->saddr.in6_u.u6_addr8, 16);
+  ipv6_in->saddr.in6_u.u6_addr8, 16);
ipv6_out.payload_len = htons(sizeof(struct icmp6hdr) +
sizeof(struct neighbour_advertisement));
 
memcpy(icmp_na, &icmp6_out, sizeof(struct icmp6hdr));
memcpy(icmp_na + sizeof(struct icmp6hdr), &na,
-   sizeof(struct neighbour_advertisement));
+  sizeof(struct neighbour_advertisement));
 
icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out,
(u16 *)icmp_na, sizeof(icmp_na));
@@ -326,13 +326,13 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, 
u32 nic_type)
skb_reserve(skb_out, NET_IP_ALIGN);
 
memcpy(skb_put(skb_out, mac_header_len), mac_header_data,
-   mac_header_len);
+  mac_header_len);
memcpy(skb_put(skb_out, sizeof(struct ipv6hdr)), &ipv6_out,
-   sizeof(struct ipv6hdr));
+  sizeof(struct ipv6hdr));
memcpy(skb_put(skb_out, sizeof(struct icmp6hdr)), &icmp6_out,
-   sizeof(struct icmp6hdr));
+  sizeof(struct icmp6hdr));
memcpy(skb_put(skb_out, sizeof(struct neighbour_advertisement)), &na,
-   sizeof(struct neighbour_advertisement));
+  sizeof(struct neighbour_advertisement));
 
skb_out->protocol = ((struct ethhdr *)mac_header_data)->h_proto;
skb_out->dev = skb_in->dev;
@@ -530,7 +530,7 @@ static int gdm_lte_event_send(struct net_device *dev, char 
*buf, int len)
 }
 
 static void gdm_lte_event_rcv(struct net_device *dev, u16 type,
-   void *msg, int len)
+ void *msg, int len)
 {
struct nic *nic = netdev_priv(dev);
 
@@ -572,7 +572,7 @@ static u8 find_dev_index(u32 nic_type)
 }
 
 static void gdm_lte_netif_rx(struct net_device *dev, char *buf,
-   int len, int flagged_nic_type)
+int len, int flagged_nic_type)
 {
u32 nic_type;
struct nic *nic;
@@ -697,9 +697,9 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
u8 index;
 
hci_len = gdm_dev16_to_cpu(phy_dev->get_endian(phy_dev->priv_dev),
-   multi_sdu->len);
+  multi_sdu->len);
num_packet = gdm_dev16_to_cpu(phy_dev->get_endian(phy_dev->priv_dev),
-   multi_sdu->num_packet);
+ multi_sdu->num_packet);
 
for (i = 0; i < num_packet; i++) {
sdu = (struct sdu *)data;
@@ -724,7 +724,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
if (index < MAX_NIC_TYPE) {
dev = phy_dev->dev[index];
gdm_lte_netif_rx(dev, (char *)sdu->data,
-   (int)(hci_len - 12), nic_type);
+(int)(hci_len - 12), nic_type);
} else {
pr_err("rx sdu invalid nic_type :%x\n", nic_type);
}
@@ -772,7 +772,7 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, 
char *buf, int len)