Re: [PATCH 3/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.

2015-02-09 Thread Bas Peters
2015-02-08 12:15 GMT+01:00 Sergei Shtylyov :
> Hello.
>
> On 2/8/2015 12:55 AM, Bas Peters wrote:
>
>> This patch removes assignment of variables in if conditions,
>> as specified in CodingStyle.
>
>
>> Signed-off-by: Bas Peters 
>> ---
>>   drivers/usb/core/hcd.c | 15 ++-
>>   1 file changed, 10 insertions(+), 5 deletions(-)
>
>
>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
>> index 11cee55..37c40d1 100644
>> --- a/drivers/usb/core/hcd.c
>> +++ b/drivers/usb/core/hcd.c
>
> [...]
>>
>> @@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
>> /* "reset" is misnamed; its role is now one-time init. the
>> controller
>>  * should already have been reset (and boot firmware kicked off
>> etc).
>>  */
>> -   if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0)
>> {
>> +   retval = hcd->driver->reset(hcd);
>
>
>This will crash if 'hcd->driver->reset' is NULL (which is only checked
> below).
>
>> +   if (hcd->driver->reset && retval < 0) {
>
>
>It wasn't equivalent change anyway as the right part of && is only
> executed if the left part is true.

I'll fix this and your other comments and resend.

>
> WBR, Sergei
>

With kind regards,

Bas
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.

2015-02-09 Thread Bas Peters
2015-02-09 3:15 GMT+01:00 Peter Chen :
> On Sat, Feb 07, 2015 at 10:55:01PM +0100, Bas Peters wrote:
>> This patch removes assignment of variables in if conditions in
>> accordance witht the CodingStyle.
>
> %s/witht/with

Typo, my bad. Should I fix the commit message and resend?

>
>>
>> Signed-off-by: Bas Peters 
>> ---
>>  drivers/usb/core/devio.c | 15 ++-
>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
>> index 0b59731..ea3c737 100644
>> --- a/drivers/usb/core/devio.c
>> +++ b/drivers/usb/core/devio.c
>> @@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
>> __user *arg)
>>   ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
>>   if (ret)
>>   return ret;
>> - if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
>> + tbuf = kmalloc(len1, GFP_KERNEL);
>> + if (!tbuf) {
>>   ret = -ENOMEM;
>>   goto done;
>>   }
>> @@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
>> __user *arg)
>>
>>   if (copy_from_user(&setintf, arg, sizeof(setintf)))
>>   return -EFAULT;
>> - if ((ret = checkintf(ps, setintf.interface)))
>> + ret = checkintf(ps, setintf.interface);
>> + if (ret)
>>   return ret;
>>
>>   destroy_async_on_interface(ps, setintf.interface);
>> @@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
>> struct usbdevfs_urb *uurb
>>   number_of_packets = uurb->number_of_packets;
>>   isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
>>  number_of_packets;
>> - if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
>> + isopkt = kmalloc(isofrmlen, GFP_KERNEL);
>> + if (!isopkt)
>>   return -ENOMEM;
>>   if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
>>   ret = -EFAULT;
>> @@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state 
>> *ps, void __user *arg)
>>
>>   if (get_user(ifnum, (unsigned int __user *)arg))
>>   return -EFAULT;
>> - if ((ret = releaseintf(ps, ifnum)) < 0)
>> + ret = releaseintf(ps, ifnum);
>> + if (ret < 0)
>>   return ret;
>>   destroy_async_on_interface (ps, ifnum);
>>   return 0;
>> @@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
>> usbdevfs_ioctl *ctl)
>>   struct usb_driver   *driver = NULL;
>>
>>   /* alloc buffer */
>> - if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) {
>> + size = _IOC_SIZE(ctl->ioctl_code);
>> + if (size > 0) {
>>   buf = kmalloc(size, GFP_KERNEL);
>>   if (buf == NULL)
>>   return -ENOMEM;
>> --
>> 2.1.0
>>
>
> --
>
> Best Regards,
> Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] drivers: usb: storage: fix some checkpatch errors

2015-02-07 Thread Bas Peters
This patchset adresses checkpatch errors in a few of the files in usb
storage. More to follow.

Bas Peters (3):
  drivers: usb: storage: alauda.c: properly place braces after function 
   declarations
  drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes
  drivers: usb: storage: datafab.c: clean up a variety of checkpatch
errors.

 drivers/usb/storage/alauda.c|  15 ++-
 drivers/usb/storage/cypress_atacb.c |  17 ++--
 drivers/usb/storage/datafab.c   | 183 ++--
 3 files changed, 111 insertions(+), 104 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes

2015-02-07 Thread Bas Peters
Fixes errors thrown by checkpatch over a space issue and the
incorrect indentation of a switch statement.

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/cypress_atacb.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c 
b/drivers/usb/storage/cypress_atacb.c
index 8514a2d..b3466d1 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -96,13 +96,13 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */
goto invalid_fld;
/* check protocol */
-   switch((save_cmnd[1] >> 1) & 0xf) {
-   case 3: /*no DATA */
-   case 4: /* PIO in */
-   case 5: /* PIO out */
-   break;
-   default:
-   goto invalid_fld;
+   switch ((save_cmnd[1] >> 1) & 0xf) {
+   case 3: /*no DATA */
+   case 4: /* PIO in */
+   case 5: /* PIO out */
+   break;
+   default:
+   goto invalid_fld;
}
 
/* first build the ATACB command */
@@ -132,8 +132,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
|| save_cmnd[11])
goto invalid_fld;
}
-   }
-   else { /* ATA12 */
+   } else { /* ATA12 */
srb->cmnd[ 6] = save_cmnd[3]; /* features */
srb->cmnd[ 7] = save_cmnd[4]; /* sector count */
srb->cmnd[ 8] = save_cmnd[5]; /* lba low */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] drivers: usb: storage: alauda.c: properly place braces after function declarations

2015-02-07 Thread Bas Peters
This patch places braces on a new line following function declarations.

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/alauda.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 62c2d9d..4b55ab6 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -207,7 +207,8 @@ static struct alauda_card_info alauda_card_ids[] = {
{ 0,}
 };
 
-static struct alauda_card_info *alauda_card_find_id(unsigned char id) {
+static struct alauda_card_info *alauda_card_find_id(unsigned char id)
+{
int i;
 
for (i = 0; alauda_card_ids[i].id != 0; i++)
@@ -223,7 +224,8 @@ static struct alauda_card_info 
*alauda_card_find_id(unsigned char id) {
 static unsigned char parity[256];
 static unsigned char ecc2[256];
 
-static void nand_init_ecc(void) {
+static void nand_init_ecc(void)
+{
int i, j, a;
 
parity[0] = 0;
@@ -247,7 +249,8 @@ static void nand_init_ecc(void) {
 }
 
 /* compute 3-byte ecc on 256 bytes */
-static void nand_compute_ecc(unsigned char *data, unsigned char *ecc) {
+static void nand_compute_ecc(unsigned char *data, unsigned char *ecc)
+{
int i, j, a;
unsigned char par = 0, bit, bits[8] = {0};
 
@@ -270,11 +273,13 @@ static void nand_compute_ecc(unsigned char *data, 
unsigned char *ecc) {
ecc[2] = ecc2[par];
 }
 
-static int nand_compare_ecc(unsigned char *data, unsigned char *ecc) {
+static int nand_compare_ecc(unsigned char *data, unsigned char *ecc)
+{
return (data[0] == ecc[0] && data[1] == ecc[1] && data[2] == ecc[2]);
 }
 
-static void nand_store_ecc(unsigned char *data, unsigned char *ecc) {
+static void nand_store_ecc(unsigned char *data, unsigned char *ecc)
+{
memcpy(data, ecc, 3);
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] drivers: usb: storage: datafab.c: clean up a variety of checkpatch errors.

2015-02-07 Thread Bas Peters
This patch cleans up a variety of checkpatch errors:

Bunch of space issues.
C99 comments converted to /* */ format.
Some switch statement indentations.
"foo * bar" -> "foo *bar"

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/datafab.c | 183 +-
 1 file changed, 93 insertions(+), 90 deletions(-)

diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 7b17c21..78f867d 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -10,7 +10,7 @@
  *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
  *   which I used as a template for this driver.
  *
- *   Some bugfixes and scatter-gather code by Gregory P. Smith 
+ *   Some bugfixes and scatter-gather code by Gregory P. Smith
  *   (greg-...@electricrain.com)
  *
  *   Fix for media change by Joerg Schneider (j...@joergschneider.com)
@@ -35,8 +35,8 @@
 
 /*
  * This driver attempts to support USB CompactFlash reader/writer devices
- * based on Datafab USB-to-ATA chips.  It was specifically developed for the 
- * Datafab MDCFE-B USB CompactFlash reader but has since been found to work 
+ * based on Datafab USB-to-ATA chips.  It was specifically developed for the
+ * Datafab MDCFE-B USB CompactFlash reader but has since been found to work
  * with a variety of Datafab-based devices from a number of manufacturers.
  * I've received a report of this driver working with a Datafab-based
  * SmartMedia device though please be aware that I'm personally unable to
@@ -153,11 +153,12 @@ static int datafab_read_data(struct us_data *us,
unsigned int sg_offset = 0;
struct scatterlist *sg = NULL;
 
-   // we're working in LBA mode.  according to the ATA spec, 
-   // we can support up to 28-bit addressing.  I don't know if Datafab
-   // supports beyond 24-bit addressing.  It's kind of hard to test 
-   // since it requires > 8GB CF card.
-   //
+   /* we're working in LBA mode.  according to the ATA spec,
+* we can support up to 28-bit addressing.  I don't know if Datafab
+* supports beyond 24-bit addressing.  It's kind of hard to test
+* since it requires > 8GB CF card.
+*/
+
if (sectors > 0x0FFF)
return USB_STOR_TRANSPORT_ERROR;
 
@@ -169,9 +170,10 @@ static int datafab_read_data(struct us_data *us,
 
totallen = sectors * info->ssize;
 
-   // Since we don't read more than 64 KB at a time, we have to create
-   // a bounce buffer and move the data a piece at a time between the
-   // bounce buffer and the actual transfer buffer.
+   /* Since we don't read more than 64 KB at a time, we have to create
+* a bounce buffer and move the data a piece at a time between the
+* bounce buffer and the actual transfer buffer.
+*/
 
alloclen = min(totallen, 65536u);
buffer = kmalloc(alloclen, GFP_NOIO);
@@ -179,8 +181,9 @@ static int datafab_read_data(struct us_data *us,
return USB_STOR_TRANSPORT_ERROR;
 
do {
-   // loop, never allocate or transfer more than 64k at once
-   // (min(128k, 255*info->ssize) is the real limit)
+   /* loop, never allocate or transfer more than 64k at once
+* (min(128k, 255*info->ssize) is the real limit)
+*/
 
len = min(totallen, alloclen);
thistime = (len / info->ssize) & 0xff;
@@ -196,17 +199,17 @@ static int datafab_read_data(struct us_data *us,
command[6] = 0x20;
command[7] = 0x01;
 
-   // send the read command
+   /* send the read command */
result = datafab_bulk_write(us, command, 8);
if (result != USB_STOR_XFER_GOOD)
goto leave;
 
-   // read the result
+   /* read the result */
result = datafab_bulk_read(us, buffer, len);
if (result != USB_STOR_XFER_GOOD)
goto leave;
 
-   // Store the data in the transfer buffer
+   /* Store the data in the transfer buffer */
usb_stor_access_xfer_buf(buffer, len, us->srb,
 &sg, &sg_offset, TO_XFER_BUF);
 
@@ -237,11 +240,11 @@ static int datafab_write_data(struct us_data *us,
unsigned int sg_offset = 0;
struct scatterlist *sg = NULL;
 
-   // we're working in LBA mode.  according to the ATA spec, 
-   // we can support up to 28-bit addressing.  I don't know if Datafab
-   // supports beyond 24-bit addressing.  It's kind of hard to test 
-   // since it requires > 8GB CF card.
-   //
+   /* we're working in LBA mode.  according to the ATA spec,
+* 

[PATCH V2 0/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses many checkpatch errors found in the act2000 driver. 

Bas Peters (7):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.
  drivers: isdn: act2000: capi.c: add macro \ and fix brace

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c| 10 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 42 insertions(+), 26 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] drivers: isdn: act2000: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of if conditions, which is not in
accordance with the CodingStyle.
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
spin_lock_irqsave(&card->lock, flags);
if (chan->fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (chan->fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
switch (chan->fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (strlen(c->parm.num)) {
if (card->ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l2prot = (c->arg >> 8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING "L3 protocol unknown\n");
return -1;
}
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l3prot = (c->arg >> 8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan->fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(act2000_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "act2000: (

[PATCH 0/6] drivers: usb: core: fix various checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses various checkpatch errors found when running the
checkpatch script on the directory.

Bas Peters (6):
  drivers: usb: core: devio.c: remove assignment of variables in if
conditions.
  drivers: usb: core: devio.c: fix whitespace errors thrown by
checkpatch.pl
  drivers: usb: core: hcd.c: remove assignment of variables in if
conditions.
  drivers: usb: core: hub.c: remove NULL initialization of static
variables.
  drivers: usb: core: hub.c: remove assignment of variables in if
conditions.
  drivers: usb: core: endpoint.c: fix trivial whitespace issue

 drivers/usb/core/devio.c| 76 -
 drivers/usb/core/endpoint.c |  2 +-
 drivers/usb/core/hcd.c  | 15 ++---
 drivers/usb/core/hub.c  | 11 ---
 4 files changed, 58 insertions(+), 46 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg->msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card->interface.rcvcallb_skb(card->myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING "actcapi: alloc_skb failed\n");
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb->data;
char *t = tmp;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/7] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Bas Peters
This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.

---
 drivers/isdn/act2000/capi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 5d677e6..0043b3c 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else
+   } else {\
m = NULL;   \
+   }   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(&card->lock, flags);
if (!(card->sbuf)) {
-   if ((card->sbuf = skb_dequeue(&card->sndq))) {
+   card->sbuf = skb_dequeue(&card->sndq);
+   if (card->sbuf) {
card->ack_msg = card->sbuf->data;
msg = (actcapi_msg *)card->sbuf->data;
if ((msg->hdr.cmd.cmd == 0x86) &&
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
if (card->flags & ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p->eaz == eaz)
-   return (p->msn);
+   return p->msn;
p = p->next;
}
return ("\0");
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(&cdef, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c->driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   "act2000: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   "act2000: if_writecmd called with invalid driverId!\n");
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   "act2000: if_readstatus called with invalid driverId!\n");
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   "act2000: if_sendbuf called with invalid driverId!\n");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in if conditions, in accordance with the CodingStyle.

2015-02-07 Thread Bas Peters
Please discard all these e-mails, something went wrong and I sent the
wrong directory of patches.

2015-02-07 22:54 GMT+01:00 Bas Peters :
> Signed-off-by: Bas Peters 
> ---
>  drivers/isdn/isdnloop/isdnloop.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/isdn/isdnloop/isdnloop.c 
> b/drivers/isdn/isdnloop/isdnloop.c
> index 5a4da94..af96317 100644
> --- a/drivers/isdn/isdnloop/isdnloop.c
> +++ b/drivers/isdn/isdnloop/isdnloop.c
> @@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
> isdn_ctrl cmd;
>
> while (card->sndcount[ch]) {
> -   if ((skb = skb_dequeue(&card->bqueue[ch]))) {
> +   skb = skb_dequeue(&card->bqueue[ch]);
> +   if (skb) {
> len = skb->len;
> card->sndcount[ch] -= len;
> ack = *(skb->head); /* used as scratch area */
> @@ -317,7 +318,8 @@ isdnloop_polldchan(unsigned long data)
> u_char *p;
> isdn_ctrl cmd;
>
> -   if ((skb = skb_dequeue(&card->dqueue)))
> +   skb = skb_dequeue(&card->dqueue);
> +   if (skb)
> avail = skb->len;
> else
> avail = 0;
> @@ -471,8 +473,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch)
>  {
> struct sk_buff *skb;
> int len = strlen(s) + ((ch >= 0) ? 3 : 0);
> -
> -   if (!(skb = dev_alloc_skb(len))) {
> +   skb = dev_alloc_skb(len);
> +   if (!skb) {
> printk(KERN_WARNING "isdnloop: Out of memory in 
> isdnloop_fake\n");
> return 1;
> }
> @@ -1439,8 +1441,8 @@ isdnloop_initcard(char *id)
>  {
> isdnloop_card *card;
> int i;
> -
> -   if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
> +   card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
> +   if (!card) {
> printk(KERN_WARNING
>"isdnloop: (%s) Could not allocate card-struct.\n", 
> id);
> return (isdnloop_card *) 0;
> @@ -1489,8 +1491,8 @@ static int
>  isdnloop_addcard(char *id1)
>  {
> isdnloop_card *card;
> -
> -   if (!(card = isdnloop_initcard(id1))) {
> +   card = isdnloop_initcard(id1);
> +   if (!card) {
> return -EIO;
> }
> printk(KERN_INFO
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] drivers: usb: core: hub.c: remove NULL initialization of static variables.

2015-02-07 Thread Bas Peters
NULL initialization of static variables is unnecessary as GCC kindly does
this for us.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aeb50bb..82983d9 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -49,7 +49,7 @@ static void hub_event(struct work_struct *work);
 DEFINE_MUTEX(usb_port_peer_mutex);
 
 /* cycle leds on hubs that aren't blinking for attention */
-static bool blinkenlights = 0;
+static bool blinkenlights;
 module_param (blinkenlights, bool, S_IRUGO);
 MODULE_PARM_DESC (blinkenlights, "true to cycle leds on hubs");
 
@@ -78,7 +78,7 @@ MODULE_PARM_DESC(initial_descriptor_timeout,
  * otherwise the new scheme is used.  If that fails and "use_both_schemes"
  * is set, then the driver will make another attempt, using the other scheme.
  */
-static bool old_scheme_first = 0;
+static bool old_scheme_first;
 module_param(old_scheme_first, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(old_scheme_first,
 "start with the old device initialization scheme");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
This patch removes assignment of variables in if conditions,
as specified in CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hcd.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 11cee55..37c40d1 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2683,15 +2683,18 @@ int usb_add_hcd(struct usb_hcd *hcd,
 * bottom up so that hcds can customize the root hubs before hub_wq
 * starts talking to them.  (Note, bus id is assigned early too.)
 */
-   if ((retval = hcd_buffer_create(hcd)) != 0) {
+   retval = hcd_buffer_create(hcd);
+   if (retval != 0) {
dev_dbg(hcd->self.controller, "pool alloc failed\n");
goto err_create_buf;
}
 
-   if ((retval = usb_register_bus(&hcd->self)) < 0)
+   retval = usb_register_bus(&hcd->self);
+   if (retval < 0)
goto err_register_bus;
 
-   if ((rhdev = usb_alloc_dev(NULL, &hcd->self, 0)) == NULL) {
+   rhdev = usb_alloc_dev(NULL, &hcd->self, 0);
+   if (rhdev == NULL) {
dev_err(hcd->self.controller, "unable to allocate root hub\n");
retval = -ENOMEM;
goto err_allocate_root_hub;
@@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
/* "reset" is misnamed; its role is now one-time init. the controller
 * should already have been reset (and boot firmware kicked off etc).
 */
-   if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) {
+   retval = hcd->driver->reset(hcd);
+   if (hcd->driver->reset && retval < 0) {
dev_err(hcd->self.controller, "can't setup: %d\n", retval);
goto err_hcd_driver_setup;
}
@@ -2765,7 +2769,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
}
 
/* starting here, usbcore will pay attention to this root hub */
-   if ((retval = register_root_hub(hcd)) != 0)
+   retval = register_root_hub(hcd);
+   if (retval != 0)
goto err_register_root_hub;
 
retval = sysfs_create_group(&rhdev->dev.kobj, &usb_bus_attr_group);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] drivers: usb: core: endpoint.c: fix trivial whitespace issue

2015-02-07 Thread Bas Peters
Changes space-based indentation to tab-based indentation.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/endpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 39a2402..101983b 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -51,7 +51,7 @@ static ssize_t wMaxPacketSize_show(struct device *dev,
 {
struct ep_device *ep = to_ep_device(dev);
return sprintf(buf, "%04x\n",
-   usb_endpoint_maxp(ep->desc) & 0x07ff);
+   usb_endpoint_maxp(ep->desc) & 0x07ff);
 }
 static DEVICE_ATTR_RO(wMaxPacketSize);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] drivers: usb: core: devio.c: fix whitespace errors thrown by checkpatch.pl

2015-02-07 Thread Bas Peters
This patch fixes errors generated by checkpatch.pl relating to
whitespace issues.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/devio.c | 61 
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index ea3c737..7c932d9 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs 
traffic");
 #define snoop(dev, format, arg...) \
do {\
if (usbfs_snoop)\
-   dev_info(dev , format , ## arg);\
+   dev_info(dev, format, ## arg);  \
} while (0)
 
 enum snoop_when {
@@ -1320,7 +1320,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0;
 
u = 0;
-   switch(uurb->type) {
+   switch (uurb->type) {
case USBDEVFS_URB_TYPE_CONTROL:
if (!usb_endpoint_xfer_control(&ep->desc))
return -EINVAL;
@@ -1944,38 +1944,39 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
retval = -EHOSTUNREACH;
else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno)))
retval = -EINVAL;
-   else switch (ctl->ioctl_code) {
-
-   /* disconnect kernel driver from interface */
-   case USBDEVFS_DISCONNECT:
-   if (intf->dev.driver) {
-   driver = to_usb_driver(intf->dev.driver);
-   dev_dbg(&intf->dev, "disconnect by usbfs\n");
-   usb_driver_release_interface(driver, intf);
-   } else
-   retval = -ENODATA;
-   break;
+   else
+   switch (ctl->ioctl_code) {
+
+   /* disconnect kernel driver from interface */
+   case USBDEVFS_DISCONNECT:
+   if (intf->dev.driver) {
+   driver = to_usb_driver(intf->dev.driver);
+   dev_dbg(&intf->dev, "disconnect by usbfs\n");
+   usb_driver_release_interface(driver, intf);
+   } else
+   retval = -ENODATA;
+   break;
 
-   /* let kernel drivers try to (re)bind to the interface */
-   case USBDEVFS_CONNECT:
-   if (!intf->dev.driver)
-   retval = device_attach(&intf->dev);
-   else
-   retval = -EBUSY;
-   break;
+   /* let kernel drivers try to (re)bind to the interface */
+   case USBDEVFS_CONNECT:
+   if (!intf->dev.driver)
+   retval = device_attach(&intf->dev);
+   else
+   retval = -EBUSY;
+   break;
 
-   /* talk directly to the interface's driver */
-   default:
-   if (intf->dev.driver)
-   driver = to_usb_driver(intf->dev.driver);
-   if (driver == NULL || driver->unlocked_ioctl == NULL) {
-   retval = -ENOTTY;
-   } else {
-   retval = driver->unlocked_ioctl(intf, ctl->ioctl_code, 
buf);
-   if (retval == -ENOIOCTLCMD)
+   /* talk directly to the interface's driver */
+   default:
+   if (intf->dev.driver)
+   driver = to_usb_driver(intf->dev.driver);
+   if (driver == NULL || driver->unlocked_ioctl == NULL) {
retval = -ENOTTY;
+   } else {
+   retval = driver->unlocked_ioctl(intf, 
ctl->ioctl_code, buf);
+   if (retval == -ENOIOCTLCMD)
+   retval = -ENOTTY;
+   }
}
-   }
 
/* cleanup and return */
if (retval >= 0
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] drivers: usb: core: hub.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
As specified in the CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hub.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 82983d9..9afe8b0 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -671,8 +671,8 @@ resubmit:
if (hub->quiescing)
return;
 
-   if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
-   && status != -ENODEV && status != -EPERM)
+   status = usb_submit_urb (hub->urb, GFP_ATOMIC);
+   if (status != 0 && status != -ENODEV && status != -EPERM)
dev_err (hub->intfdev, "resubmit --> %d\n", status);
 }
 
@@ -795,7 +795,8 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
 * since each TT has "at least two" buffers that can need it (and
 * there can be many TTs per hub).  even if they're uncommon.
 */
-   if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) {
+   clear = kmalloc (sizeof *clear, GFP_ATOMIC);
+   if (clear == NULL) {
dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
/* FIXME recover somehow ... RESET_TT? */
return -ENOMEM;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
This patch removes assignment of variables in if conditions in
accordance witht the CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/devio.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 0b59731..ea3c737 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
__user *arg)
ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
if (ret)
return ret;
-   if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
+   tbuf = kmalloc(len1, GFP_KERNEL);
+   if (!tbuf) {
ret = -ENOMEM;
goto done;
}
@@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
__user *arg)
 
if (copy_from_user(&setintf, arg, sizeof(setintf)))
return -EFAULT;
-   if ((ret = checkintf(ps, setintf.interface)))
+   ret = checkintf(ps, setintf.interface);
+   if (ret)
return ret;
 
destroy_async_on_interface(ps, setintf.interface);
@@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
number_of_packets = uurb->number_of_packets;
isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
   number_of_packets;
-   if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
+   isopkt = kmalloc(isofrmlen, GFP_KERNEL);
+   if (!isopkt)
return -ENOMEM;
if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
ret = -EFAULT;
@@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state 
*ps, void __user *arg)
 
if (get_user(ifnum, (unsigned int __user *)arg))
return -EFAULT;
-   if ((ret = releaseintf(ps, ifnum)) < 0)
+   ret = releaseintf(ps, ifnum);
+   if (ret < 0)
return ret;
destroy_async_on_interface (ps, ifnum);
return 0;
@@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
struct usb_driver   *driver = NULL;
 
/* alloc buffer */
-   if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) {
+   size = _IOC_SIZE(ctl->ioctl_code);
+   if (size > 0) {
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.

Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card->xlen[channel] = 0;
card->sndcount[channel] = 0;
-   if ((skb = card->xskb[channel])) {
+   skb = card->xskb[channel];
+   if (skb) {
card->xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch & 2);
if (!eflag) {
-   if ((cnt = card->rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card->rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING "icn: 
receive out of memory\n");
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{"BCON_",  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{"BDIS_",  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING "icn: Could not allocate code buffer\n");
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card->doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card->doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card->doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card->other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c->driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   "icn: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   "icn: if_writecmd called with invalid driverId!\n");
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(c

Re: [PATCH V2 0/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters :
> This patchset adresses many checkpatch errors found in the act2000 driver.
>
> Bas Peters (7):
>   drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
>   drivers: isdn: act2000: capi.c: fix checkpatch errors
>   drivers: isdn: act2000: remove assignments of variables in if
> conditions
>   drivers: isdn: act2000: module.c: remove NULL-initialization of static
> variable.
>   drivers: isdn: act2000: module.c: remove parenthesres around return
>  values.
>   drivers: isdn: act2000: fix wrongly positioned brace.
>   drivers: isdn: act2000: capi.c: add macro \ and fix brace
>
>  drivers/isdn/act2000/act2000_isa.c | 11 +
>  drivers/isdn/act2000/capi.c| 10 +---
>  drivers/isdn/act2000/module.c  | 47 
> +++---
>  3 files changed, 42 insertions(+), 26 deletions(-)
>
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include 
 #include 
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters :
> This patch adresses various checkpatch errors:
> 3 assignments in if conditions
> 1 return value enclosed in parenthesis
>
> Signed-off-by: Bas Peters 
> ---
>  drivers/isdn/act2000/act2000_isa.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/isdn/act2000/act2000_isa.c 
> b/drivers/isdn/act2000/act2000_isa.c
> index b5fad29..048507e 100644
> --- a/drivers/isdn/act2000/act2000_isa.c
> +++ b/drivers/isdn/act2000/act2000_isa.c
> @@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
> int serial = 0;
>
> found = 0;
> -   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
> +   reg = inb(portbase + ISA_COR);
> +   if (reg != 0xff) {
> outb(reg | ISA_COR_RESET, portbase + ISA_COR);
> mdelay(10);
> outb(reg, portbase + ISA_COR);
> @@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
> while (1) {
> spin_lock_irqsave(&card->lock, flags);
> if (!(card->sbuf)) {
> -   if ((card->sbuf = skb_dequeue(&card->sndq))) {
> +   card->sbuf = skb_dequeue(&card->sndq);
> +   if (card->sbuf) {
> card->ack_msg = card->sbuf->data;
> msg = (actcapi_msg *)card->sbuf->data;
> if ((msg->hdr.cmd.cmd == 0x86) &&
> @@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
> printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
> return -EPROTO;
> }
> -   if ((p = strchr(fid.revision, '\n')))
> +   p = strchr(fid.revision, '\n');
> +   if (p)
> *p = '\0';
> printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
> if (card->flags & ACT2000_FLAGS_IVALID) {
> @@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
> __user *cb)
> }
> kfree(buf);
> msleep_interruptible(500);
> -   return (act2000_isa_getid(card));
> +   return act2000_isa_getid(card);
>  }
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in if conditions, in accordance with the CodingStyle.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/isdnloop/isdnloop.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index 5a4da94..af96317 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
isdn_ctrl cmd;
 
while (card->sndcount[ch]) {
-   if ((skb = skb_dequeue(&card->bqueue[ch]))) {
+   skb = skb_dequeue(&card->bqueue[ch]);
+   if (skb) {
len = skb->len;
card->sndcount[ch] -= len;
ack = *(skb->head); /* used as scratch area */
@@ -317,7 +318,8 @@ isdnloop_polldchan(unsigned long data)
u_char *p;
isdn_ctrl cmd;
 
-   if ((skb = skb_dequeue(&card->dqueue)))
+   skb = skb_dequeue(&card->dqueue);
+   if (skb)
avail = skb->len;
else
avail = 0;
@@ -471,8 +473,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch)
 {
struct sk_buff *skb;
int len = strlen(s) + ((ch >= 0) ? 3 : 0);
-
-   if (!(skb = dev_alloc_skb(len))) {
+   skb = dev_alloc_skb(len);
+   if (!skb) {
printk(KERN_WARNING "isdnloop: Out of memory in 
isdnloop_fake\n");
return 1;
}
@@ -1439,8 +1441,8 @@ isdnloop_initcard(char *id)
 {
isdnloop_card *card;
int i;
-
-   if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "isdnloop: (%s) Could not allocate card-struct.\n", id);
return (isdnloop_card *) 0;
@@ -1489,8 +1491,8 @@ static int
 isdnloop_addcard(char *id1)
 {
isdnloop_card *card;
-
-   if (!(card = isdnloop_initcard(id1))) {
+   card = isdnloop_initcard(id1);
+   if (!card) {
return -EIO;
}
printk(KERN_INFO
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] Fix checkpatch errors in drivers/isdn/isdnloop

2015-02-07 Thread Bas Peters
This patchset adresses various checkpatch errors in the abovementioned driver.

Bas Peters (3):
  drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in
if conditions, in accordance with the CodingStyle.
  drivers: isdn: isdnloop: isdnloop.c: Fix brace positions according to 
   CodingStyle specifications.
  drivers: isdn: isdnloop: isdnloop.c: Remove parenthesis around return 
   values, as specified in CodingStyle.

 drivers/isdn/isdnloop/isdnloop.c | 64 +++-
 1 file changed, 30 insertions(+), 34 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html