Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
From: Bas Peters @ 2015-02-07 19:05 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, sergei.shtylyov,
	Bas Peters
In-Reply-To: <1423335929-24926-1-git-send-email-baspeters93@gmail.com>

This patch adresses various checkpatch errors:
	3 assignments in if conditions
	1 return value enclosed in parenthesis

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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

^ permalink raw reply related

* [PATCH V2 0/7] drivers: isdn: act2000: fix checkpatch errors.
From: Bas Peters @ 2015-02-07 19:05 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, sergei.shtylyov,
	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

^ permalink raw reply

* Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors
From: Sergei Shtylyov @ 2015-02-07 18:25 UTC (permalink / raw)
  To: Bas Peters, Julia Lawall
  Cc: isdn@linux-pingi.de, David Miller, netdev, linux-kernel
In-Reply-To: <CAOgR63dhGA4ULSACOSCBnU+uG_bMbegYY62o1etmRjo31BO9wQ@mail.gmail.com>

On 02/07/2015 09:08 PM, Bas Peters wrote:

    Please don't top-post.

> I must have missed something. I fixed it on my end. Do I now resend
> the entire patchset or just this particular patch?

    The entire patch set, at least DaveM wants it this way.

> regards,

> Bas

WBR, Sergei

^ permalink raw reply

* Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors
From: Bas Peters @ 2015-02-07 18:08 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Sergei Shtylyov, isdn@linux-pingi.de, David Miller, netdev,
	linux-kernel
In-Reply-To: <alpine.DEB.2.02.1502071902060.2050@localhost6.localdomain6>

I must have missed something. I fixed it on my end. Do I now resend
the entire patchset or just this particular patch?

regards,

Bas

2015-02-07 19:02 GMT+01:00 Julia Lawall <julia.lawall@lip6.fr>:
> On Sat, 7 Feb 2015, Sergei Shtylyov wrote:
>
>> Hello.
>>
>> On 02/07/2015 08:06 PM, Bas Peters wrote:
>>
>> > 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 <baspeters93@gmail.com>
>> > ---
>> >   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
>
> It looks like a \ was lost on this line.  It should have caused a compiler
> error.
>
> julia
>
>> > +                   m = NULL;                               \
>>
>>    Documentation/CodingStyle has an extra rule for such case: *else* branch
>> should also have {} since *if* branch has {}.
>>
>> [...]
>>
>> WNR, Sergei
>>
>>

^ permalink raw reply

* Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors
From: Julia Lawall @ 2015-02-07 18:02 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Bas Peters, isdn, julia.lawall, davem, netdev, linux-kernel
In-Reply-To: <54D650BF.5000400@cogentembedded.com>

On Sat, 7 Feb 2015, Sergei Shtylyov wrote:

> Hello.
> 
> On 02/07/2015 08:06 PM, Bas Peters wrote:
> 
> > 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 <baspeters93@gmail.com>
> > ---
> >   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

It looks like a \ was lost on this line.  It should have caused a compiler 
error.

julia

> > +			m = NULL;				\
> 
>    Documentation/CodingStyle has an extra rule for such case: *else* branch
> should also have {} since *if* branch has {}.
> 
> [...]
> 
> WNR, Sergei
> 
> 

^ permalink raw reply

* Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors
From: Bas Peters @ 2015-02-07 18:02 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: isdn@linux-pingi.de, julia.lawall, David Miller, netdev,
	linux-kernel
In-Reply-To: <54D650BF.5000400@cogentembedded.com>

Thanks, will take that into account in future patches.

With kind regards,

Bas

2015-02-07 18:51 GMT+01:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 02/07/2015 08:06 PM, Bas Peters wrote:
>
>> 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 <baspeters93@gmail.com>
>> ---
>>   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;                               \
>
>
>    Documentation/CodingStyle has an extra rule for such case: *else* branch
> should also have {} since *if* branch has {}.
>
> [...]
>
> WNR, Sergei
>

^ permalink raw reply

* Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors
From: Sergei Shtylyov @ 2015-02-07 17:51 UTC (permalink / raw)
  To: Bas Peters, isdn; +Cc: julia.lawall, davem, netdev, linux-kernel
In-Reply-To: <1423328797-17865-3-git-send-email-baspeters93@gmail.com>

Hello.

On 02/07/2015 08:06 PM, Bas Peters wrote:

> 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 <baspeters93@gmail.com>
> ---
>   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;				\

    Documentation/CodingStyle has an extra rule for such case: *else* branch 
should also have {} since *if* branch has {}.

[...]

WNR, Sergei

^ permalink raw reply

* Re: [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.
From: Sergei Shtylyov @ 2015-02-07 17:46 UTC (permalink / raw)
  To: Bas Peters, isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel
In-Reply-To: <1423324566-5538-3-git-send-email-baspeters93@gmail.com>

Hello.

Citing the checkpatch.pl errors would be helpful here.

You also forgot to sign off on the patch, so it can't be applied.

WBR, Sergei

^ permalink raw reply

* [PATCH 6/6] drivers: isdn: act2000: fix wrongly positioned brace.
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423328797-17865-1-git-send-email-baspeters93@gmail.com>

Trivial, but why not? :)

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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 <linux/slab.h>
 #include <linux/init.h>
 
-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

^ permalink raw reply related

* [PATCH 5/6] drivers: isdn: act2000: module.c: remove parenthesres around return values.
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423328797-17865-1-git-send-email-baspeters93@gmail.com>

return is not a function, therefore parentheses are not needed.

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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

^ permalink raw reply related

* [PATCH 4/6] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423328797-17865-1-git-send-email-baspeters93@gmail.com>

GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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

^ permalink raw reply related

* [PATCH 3/6] drivers: isdn: act2000: module.c: remove assignments of variables in if conditions
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423328797-17865-1-git-send-email-baspeters93@gmail.com>

This patch removes all assignments of variables in if conditions in module.c.

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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: (%s) Could not allocate card-struct.\n", id);
 		return;
-- 
2.1.0

^ permalink raw reply related

* [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423328797-17865-1-git-send-email-baspeters93@gmail.com>

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 <baspeters93@gmail.com>
---
 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

^ permalink raw reply related

* [PATCH 1/6] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423328797-17865-1-git-send-email-baspeters93@gmail.com>

This patch adresses various checkpatch errors:
	3 assignments in if conditions
	1 return value enclosed in parenthesis

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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

^ permalink raw reply related

* [PATCH 0/6] drivers: isdn: act2000: fix a variety of checkpatch errors.
From: Bas Peters @ 2015-02-07 17:06 UTC (permalink / raw)
  To: isdn; +Cc: julia.lawall, davem, netdev, linux-kernel, Bas Peters

This patchset tackles a variety of checkpatch errors. Some apparent errors were ommitted because fixing them would in no way contribute to readability.

Signed-off-by: Bas Peters <baspeters93@gmail.com>

Bas Peters (6):
  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/act2000_isa.c | 11 +++++----
 drivers/isdn/act2000/capi.c        |  9 +++++---
 drivers/isdn/act2000/module.c      | 47 +++++++++++++++++++++++---------------
 3 files changed, 41 insertions(+), 26 deletions(-)

-- 
2.1.0

^ permalink raw reply

* Re: [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.
From: Bas Peters @ 2015-02-07 16:13 UTC (permalink / raw)
  To: Varka Bhadram
  Cc: isdn@linux-pingi.de, dan.carpenter, David Miller, netdev,
	linux-kernel
In-Reply-To: <54D638A2.4040808@gmail.com>

Sorry, will fix and send again.

2015-02-07 17:09 GMT+01:00 Varka Bhadram <varkabhadram@gmail.com>:
> Hi,
>
> On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:
>
> Missed Signed-off-by line...
>
>
>> ---
>>   drivers/isdn/icn/icn.h | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>
>
> --
> Thanks,
> Varka Bhadram.
>

^ permalink raw reply

* [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.
From: Bas Peters @ 2015-02-07 16:12 UTC (permalink / raw)
  To: isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423325563-11412-1-git-send-email-baspeters93@gmail.com>

Signed-off-by: Bas Peters <baspeters93@gmail.com>
---
 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

^ permalink raw reply related

* [PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors
From: Bas Peters @ 2015-02-07 16:12 UTC (permalink / raw)
  To: isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423325563-11412-1-git-send-email-baspeters93@gmail.com>

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 <baspeters93@gmail.com>
---
 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 (!(card->flags & ICN_FLAGS_RUNNING))
 			return -ENODEV;
-		return (icn_readstatus(buf, len, card));
+		return icn_readstatus(buf, len, card);
 	}
 	printk(KERN_ERR
 	       "icn: if_readstatus called with invalid driverId!\n");
@@ -1503,7 +1508,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb)
 	if (card) {
 		if (!(card->flags & ICN_FLAGS_RUNNING))
 			return -ENODEV;
-		return (icn_sendbuf(channel, ack, skb, card));
+		return icn_sendbuf(channel, ack, skb, card);
 	}
 	printk(KERN_ERR
 	       "icn: if_sendbuf called with invalid driverId!\n");
@@ -1520,7 +1525,8 @@ icn_initcard(int port, char *id)
 	icn_card *card;
 	int i;
 
-	if (!(card = kzalloc(sizeof(icn_card), GFP_KERNEL))) {
+	card = kzalloc(sizeof(icn_card), GFP_KERNEL);
+	if (!card) {
 		printk(KERN_WARNING
 		       "icn: (%s) Could not allocate card-struct.\n", id);
 		return (icn_card *) 0;
@@ -1568,7 +1574,8 @@ icn_addcard(int port, char *id1, char *id2)
 	icn_card *card;
 	icn_card *card2;
 
-	if (!(card = icn_initcard(port, id1))) {
+	card = icn_initcard(port, id1);
+	if (!card) {
 		return -EIO;
 	}
 	if (!strlen(id2)) {
@@ -1577,7 +1584,8 @@ icn_addcard(int port, char *id1, char *id2)
 		       card->interface.id, port);
 		return 0;
 	}
-	if (!(card2 = icn_initcard(port, id2))) {
+	card2 = icn_initcard(port, id2);
+	if (!card2) {
 		printk(KERN_INFO
 		       "icn: (%s) half ICN-4B, port 0x%x added\n", id2, port);
 		return 0;
@@ -1611,13 +1619,14 @@ icn_setup(char *line)
 	if (str && *str) {
 		strcpy(sid, str);
 		icn_id = sid;
-		if ((p = strchr(sid, ','))) {
+		p = strchr(sid, ',');
+		if (p) {
 			*p++ = 0;
 			strcpy(sid2, p);
 			icn_id2 = sid2;
 		}
 	}
-	return (1);
+	return 1;
 }
 __setup("icn=", icn_setup);
 #endif /* MODULE */
@@ -1634,7 +1643,8 @@ static int __init icn_init(void)
 	dev.firstload = 1;
 	spin_lock_init(&dev.devlock);
 
-	if ((p = strchr(revision, ':'))) {
+	p = strchr(revision, ':');
+	if (p) {
 		strncpy(rev, p + 1, 20);
 		rev[20] = '\0';
 		p = strchr(rev, '$');
@@ -1644,7 +1654,7 @@ static int __init icn_init(void)
 		strcpy(rev, " ??? ");
 	printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev,
 	       dev.memaddr);
-	return (icn_addcard(portbase, icn_id, icn_id2));
+	return icn_addcard(portbase, icn_id, icn_id2);
 }
 
 static void __exit icn_exit(void)
-- 
2.1.0

^ permalink raw reply related

* [PATCH 0/2] drivers: isdn: icn: fix checkpatch errors
From: Bas Peters @ 2015-02-07 16:12 UTC (permalink / raw)
  To: isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel, 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

^ permalink raw reply

* Re: [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.
From: Varka Bhadram @ 2015-02-07 16:09 UTC (permalink / raw)
  To: Bas Peters, isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel
In-Reply-To: <1423324566-5538-3-git-send-email-baspeters93@gmail.com>

Hi,

On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:

Missed Signed-off-by line...

> ---
>   drivers/isdn/icn/icn.h | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>   

-- 
Thanks,
Varka Bhadram.

^ permalink raw reply

* Re: [PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors
From: Varka Bhadram @ 2015-02-07 16:07 UTC (permalink / raw)
  To: Bas Peters, isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel
In-Reply-To: <1423324566-5538-2-git-send-email-baspeters93@gmail.com>

Hi,

On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:
> This patch cleans up various trivial checkpatch errors such as variable
> declarations in if statements, return values in parenthesis and a
> wrongly placed brace.

Missed Signed-off-by line.

> ---
>   drivers/isdn/icn/icn.c | 52 ++++++++++++++++++++++++++++++--------------------
>   1 file changed, 31 insertions(+), 21 deletions(-)

-- 
Thanks,
Varka Bhadram.

^ permalink raw reply

* [PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.
From: Bas Peters @ 2015-02-07 15:56 UTC (permalink / raw)
  To: isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423324566-5538-1-git-send-email-baspeters93@gmail.com>

---
 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

^ permalink raw reply related

* [PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors
From: Bas Peters @ 2015-02-07 15:56 UTC (permalink / raw)
  To: isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel, Bas Peters
In-Reply-To: <1423324566-5538-1-git-send-email-baspeters93@gmail.com>

This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.
---
 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 (!(card->flags & ICN_FLAGS_RUNNING))
 			return -ENODEV;
-		return (icn_readstatus(buf, len, card));
+		return icn_readstatus(buf, len, card);
 	}
 	printk(KERN_ERR
 	       "icn: if_readstatus called with invalid driverId!\n");
@@ -1503,7 +1508,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb)
 	if (card) {
 		if (!(card->flags & ICN_FLAGS_RUNNING))
 			return -ENODEV;
-		return (icn_sendbuf(channel, ack, skb, card));
+		return icn_sendbuf(channel, ack, skb, card);
 	}
 	printk(KERN_ERR
 	       "icn: if_sendbuf called with invalid driverId!\n");
@@ -1520,7 +1525,8 @@ icn_initcard(int port, char *id)
 	icn_card *card;
 	int i;
 
-	if (!(card = kzalloc(sizeof(icn_card), GFP_KERNEL))) {
+	card = kzalloc(sizeof(icn_card), GFP_KERNEL);
+	if (!card) {
 		printk(KERN_WARNING
 		       "icn: (%s) Could not allocate card-struct.\n", id);
 		return (icn_card *) 0;
@@ -1568,7 +1574,8 @@ icn_addcard(int port, char *id1, char *id2)
 	icn_card *card;
 	icn_card *card2;
 
-	if (!(card = icn_initcard(port, id1))) {
+	card = icn_initcard(port, id1);
+	if (!card) {
 		return -EIO;
 	}
 	if (!strlen(id2)) {
@@ -1577,7 +1584,8 @@ icn_addcard(int port, char *id1, char *id2)
 		       card->interface.id, port);
 		return 0;
 	}
-	if (!(card2 = icn_initcard(port, id2))) {
+	card2 = icn_initcard(port, id2);
+	if (!card2) {
 		printk(KERN_INFO
 		       "icn: (%s) half ICN-4B, port 0x%x added\n", id2, port);
 		return 0;
@@ -1611,13 +1619,14 @@ icn_setup(char *line)
 	if (str && *str) {
 		strcpy(sid, str);
 		icn_id = sid;
-		if ((p = strchr(sid, ','))) {
+		p = strchr(sid, ',');
+		if (p) {
 			*p++ = 0;
 			strcpy(sid2, p);
 			icn_id2 = sid2;
 		}
 	}
-	return (1);
+	return 1;
 }
 __setup("icn=", icn_setup);
 #endif /* MODULE */
@@ -1634,7 +1643,8 @@ static int __init icn_init(void)
 	dev.firstload = 1;
 	spin_lock_init(&dev.devlock);
 
-	if ((p = strchr(revision, ':'))) {
+	p = strchr(revision, ':');
+	if (p) {
 		strncpy(rev, p + 1, 20);
 		rev[20] = '\0';
 		p = strchr(rev, '$');
@@ -1644,7 +1654,7 @@ static int __init icn_init(void)
 		strcpy(rev, " ??? ");
 	printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev,
 	       dev.memaddr);
-	return (icn_addcard(portbase, icn_id, icn_id2));
+	return icn_addcard(portbase, icn_id, icn_id2);
 }
 
 static void __exit icn_exit(void)
-- 
2.1.0

^ permalink raw reply related

* [PATCH 0/2] drivers: isdn: icn: fix checkpatch errors
From: Bas Peters @ 2015-02-07 15:56 UTC (permalink / raw)
  To: isdn; +Cc: dan.carpenter, davem, netdev, linux-kernel, 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

^ permalink raw reply

* Re: Ethernet: how to disable gigabit support
From: Bruno Prémont @ 2015-02-07 14:35 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, Florian Fainelli, netdev
In-Reply-To: <20150206135706.GB25683@amd>

On Fri, 06 February 2015 Pavel Machek wrote:
> On Thu 2015-02-05 14:44:55, Florian Fainelli wrote:
> > On 05/02/15 12:25, Pavel Machek wrote:
> > > This happened on more than one project: there's gigabit-capable chip,
> > > but the connector is not designed for gigabit speed.
> > > 
> > > I'd like to have speed autonegotiation, but not offer gigabit (as it
> > > will not work).
> > > 
> > > Is there way to do that without hacking the kernel? Should mii-tool do
> > > that?
> > 
> > Since you use the PHY library, you should be able to do something like
> > this in your PHY driver prior to starting the PHY state machine:
> > 
> > phydev->supported &= PHY_BASIC_FEATURES (effectively masking Gigabit
> > capability)
> 
> Thanks, that did the trick.
> 								Pavel
> (But still it would be nice to have a generic way of doing this,
> using something like mii-tool.)

You can use ethtool to do so:

  ethtool -s ethX advertise 0x0f

c.f. man ethtool:
  advertise N
    Sets the speed and duplex advertised by autonegotiation. The argument is
    a hexadecimal value using one or a combination of the following values:

      0x001     10 Half
      0x002     10 Full
      0x004     100 Half
      0x008     100 Full
      0x010     1000 Half        (not supported by IEEE standards)
      0x020     1000 Full
      0x8000    2500 Full        (not supported by IEEE standards)
      0x1000    10000 Full
      0x20000   20000MLD2 Full   (not supported by IEEE standards)
      0x40000   20000KR2 Full    (not supported by IEEE standards)

Bruno

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox