2015-02-07 21:54:25

by Bas Peters

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

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


2015-02-07 21:54:30

by Bas Peters

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

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

Signed-off-by: Bas Peters <[email protected]>
---
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

2015-02-07 22:01:00

by Bas Peters

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

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 <[email protected]>
---
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

2015-02-07 21:54:35

by Bas Peters

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

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: (%s) Could not allocate card-struct.\n", id);
return;
--
2.1.0

2015-02-07 21:54:37

by Bas Peters

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

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

2015-02-07 21:54:41

by Bas Peters

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

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

2015-02-07 21:54:48

by Bas Peters

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

Trivial, but why not? :)

Signed-off-by: Bas Peters <[email protected]>
---
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

2015-02-07 21:54:46

by Bas Peters

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

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

2015-02-07 21:56:54

by Bas Peters

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

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

2015-02-07 21:54:51

by Bas Peters

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

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 <[email protected]>
---
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

2015-02-07 21:54:59

by Bas Peters

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

Signed-off-by: Bas Peters <[email protected]>
---
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

2015-02-07 21:54:57

by Bas Peters

[permalink] [raw]
Subject: [PATCH 0/3] Fix checkpatch errors in drivers/isdn/isdnloop

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

2015-02-07 21:55:34

by Bas Peters

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

Signed-off-by: Bas Peters <[email protected]>
---
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

2015-02-07 21:56:06

by Bas Peters

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

Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters <[email protected]>:
> 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
>

2015-02-07 21:56:18

by Bas Peters

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

Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters <[email protected]>:
> This patch adresses various checkpatch errors:
> 3 assignments in if conditions
> 1 return value enclosed in parenthesis
>
> Signed-off-by: Bas Peters <[email protected]>
> ---
> 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
>

2015-02-07 21:57:29

by Bas Peters

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

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 <[email protected]>:
> Signed-off-by: Bas Peters <[email protected]>
> ---
> 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
>