2009-12-09 14:38:34

by Rudy Matela

[permalink] [raw]
Subject: [PATCH] Coding style correction on some drivers that use Generic HDLC

Added a space separating some if/switch/while keywords from the following
parenthesis to conform to the CodingStyle.

Signed-off-by: Rudy Matela <[email protected]>
---

drivers/net/wan/cosa.c | 10 +++++-----
drivers/net/wan/hdlc_cisco.c | 8 ++++----
drivers/net/wan/hdlc_x25.c | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index b36bf96..f0bd70f 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -811,7 +811,7 @@ static ssize_t cosa_read(struct file *file,
cosa_enable_rx(chan);
spin_lock_irqsave(&cosa->lock, flags);
add_wait_queue(&chan->rxwaitq, &wait);
- while(!chan->rx_status) {
+ while (!chan->rx_status) {
current->state = TASK_INTERRUPTIBLE;
spin_unlock_irqrestore(&cosa->lock, flags);
schedule();
@@ -896,7 +896,7 @@ static ssize_t cosa_write(struct file *file,

spin_lock_irqsave(&cosa->lock, flags);
add_wait_queue(&chan->txwaitq, &wait);
- while(!chan->tx_status) {
+ while (!chan->tx_status) {
current->state = TASK_INTERRUPTIBLE;
spin_unlock_irqrestore(&cosa->lock, flags);
schedule();
@@ -1153,7 +1153,7 @@ static int cosa_ioctl_common(struct cosa_data *cosa,
struct channel_data *channel, unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
- switch(cmd) {
+ switch (cmd) {
case COSAIORSET: /* Reset the device */
if (!capable(CAP_NET_ADMIN))
return -EACCES;
@@ -1704,7 +1704,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status)
spin_unlock_irqrestore(&cosa->lock, flags);
return;
}
- while(1) {
+ while (1) {
cosa->txchan++;
i++;
if (cosa->txchan >= cosa->nchannels)
@@ -2010,7 +2010,7 @@ again:
static void debug_status_in(struct cosa_data *cosa, int status)
{
char *s;
- switch(status & SR_CMD_FROM_SRP_MASK) {
+ switch (status & SR_CMD_FROM_SRP_MASK) {
case SR_UP_REQUEST:
s = "RX_REQ";
break;
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index f1bff98..1ceccf1 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -141,7 +141,7 @@ static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev)
data->address != CISCO_UNICAST)
return cpu_to_be16(ETH_P_HDLC);

- switch(data->protocol) {
+ switch (data->protocol) {
case cpu_to_be16(ETH_P_IP):
case cpu_to_be16(ETH_P_IPX):
case cpu_to_be16(ETH_P_IPV6):
@@ -190,7 +190,7 @@ static int cisco_rx(struct sk_buff *skb)
cisco_data = (struct cisco_packet*)(skb->data + sizeof
(struct hdlc_header));

- switch(ntohl (cisco_data->type)) {
+ switch (ntohl (cisco_data->type)) {
case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */
in_dev = dev->ip_ptr;
addr = 0;
@@ -245,8 +245,8 @@ static int cisco_rx(struct sk_buff *skb)

dev_kfree_skb_any(skb);
return NET_RX_SUCCESS;
- } /* switch(keepalive type) */
- } /* switch(protocol) */
+ } /* switch (keepalive type) */
+ } /* switch (protocol) */

printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name,
ntohs(data->protocol));
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
index aa9248f..6e1ca25 100644
--- a/drivers/net/wan/hdlc_x25.c
+++ b/drivers/net/wan/hdlc_x25.c
@@ -202,10 +202,10 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
return 0; /* return protocol only, no settable parameters */

case IF_PROTO_X25:
- if(!capable(CAP_NET_ADMIN))
+ if (!capable(CAP_NET_ADMIN))
return -EPERM;

- if(dev->flags & IFF_UP)
+ if (dev->flags & IFF_UP)
return -EBUSY;

result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);


2009-12-09 15:22:06

by Jan Kasprzak

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

Rudy Matela wrote:
: Added a space separating some if/switch/while keywords from the following
: parenthesis to conform to the CodingStyle.

Hello,

I am not sure whether it is necessary to fix formating mistakes in
a driver which is in deep freeze and the hardware is not produced anymore,
but whatever.

Acked-By: Jan "Yenya" Kasprzak <[email protected]>

-Yenya

: Signed-off-by: Rudy Matela <[email protected]>
: ---
:
: drivers/net/wan/cosa.c | 10 +++++-----
: drivers/net/wan/hdlc_cisco.c | 8 ++++----
: drivers/net/wan/hdlc_x25.c | 4 ++--
: 3 files changed, 11 insertions(+), 11 deletions(-)
:
: diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
: index b36bf96..f0bd70f 100644

--
| Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839 Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/ Journal: http://www.fi.muni.cz/~kas/blog/ |
Please don't top post and in particular don't attach entire digests to your
mail or we'll all soon be using bittorrent to read the list. --Alan Cox

2009-12-09 15:43:42

by walter harms

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC



Jan Yenya Kasprzak schrieb:
> Rudy Matela wrote:
> : Added a space separating some if/switch/while keywords from the following
> : parenthesis to conform to the CodingStyle.
>
> Hello,
>
> I am not sure whether it is necessary to fix formating mistakes in
> a driver which is in deep freeze and the hardware is not produced anymore,
> but whatever.
>
> Acked-By: Jan "Yenya" Kasprzak <[email protected]>
>
> -Yenya
>
> : Signed-off-by: Rudy Matela <[email protected]>
> : ---
> :
> : drivers/net/wan/cosa.c | 10 +++++-----
> : drivers/net/wan/hdlc_cisco.c | 8 ++++----
> : drivers/net/wan/hdlc_x25.c | 4 ++--
> : 3 files changed, 11 insertions(+), 11 deletions(-)
> :
> : diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
> : index b36bf96..f0bd70f 100644
>

It is ok until the driver is removed, if this "issue" is not fixed it will
trigger any check-coding-style and generate new patches. Since it involves
no code changes it is harmless.

re,
wh

2009-12-09 16:41:02

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

Rudy Matela <[email protected]> writes:

> Added a space separating some if/switch/while keywords from the following
> parenthesis to conform to the CodingStyle.
>
> Signed-off-by: Rudy Matela <[email protected]>
> ---
>
> drivers/net/wan/cosa.c | 10 +++++-----
> drivers/net/wan/hdlc_cisco.c | 8 ++++----
> drivers/net/wan/hdlc_x25.c | 4 ++--

Ack from me, though a subset may already be in David Miller's tree.
Git merge can handle it without problems I guess.

Who is to commit this?
--
Krzysztof Halasa

2009-12-09 21:09:55

by Rudy Matela

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

On Wed, Dec 9, 2009 at 12:43, walter harms <[email protected]> wrote:
>
>
> Jan Yenya Kasprzak schrieb:
>> Rudy Matela wrote:
>> : Added a space separating some if/switch/while keywords from the following
>> : parenthesis to conform to the CodingStyle.
>>
>> ? ? ? Hello,
>>
>> ? ? ? I am not sure whether it is necessary to fix formating mistakes in
>> a driver which is in deep freeze and the hardware is not produced anymore,
>> but whatever.
>>
>
> It is ok until the driver is removed, if this "issue" is not fixed it will
> trigger any check-coding-style and generate new patches. Since it involves
> no code changes it is harmless.
>
> re,
> ?wh
>
>

Hello to all,

Sould I keep sending coding style corrections to the Linux Kernel?
I'm trying to help, but if i'm just being annoying, please tell me and
I can try to contribute in a better way. :-)

Regards,
Rudy

2009-12-09 23:24:51

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

On Wed, 9 Dec 2009, Krzysztof Halasa wrote:

> > Added a space separating some if/switch/while keywords from the following
> > parenthesis to conform to the CodingStyle.
> >
> > Signed-off-by: Rudy Matela <[email protected]>
> > ---
> >
> > drivers/net/wan/cosa.c | 10 +++++-----
> > drivers/net/wan/hdlc_cisco.c | 8 ++++----
> > drivers/net/wan/hdlc_x25.c | 4 ++--
>
> Ack from me, though a subset may already be in David Miller's tree.
> Git merge can handle it without problems I guess.
>
> Who is to commit this?

I will take care of it once the currently undergoing merging is done.

--
Jiri Kosina
SUSE Labs, Novell Inc.

2009-12-09 23:26:56

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

On Wed, 9 Dec 2009, Rudy Matela wrote:

> > It is ok until the driver is removed, if this "issue" is not fixed it
> > will trigger any check-coding-style and generate new patches. Since it
> > involves no code changes it is harmless.
> Sould I keep sending coding style corrections to the Linux Kernel?
> I'm trying to help, but if i'm just being annoying, please tell me and
> I can try to contribute in a better way. :-)

Coding style corrections (if they really improve readability of the code),
comment fixes (if they really make grepping for things better or make the
whole text more understandable) are welcome and I will happily merge them.

What I usually don't merge are purely whitespace "fixes", which don't
really fix anything in fact.

--
Jiri Kosina
SUSE Labs, Novell Inc.

2009-12-10 00:40:31

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

From: Jiri Kosina <[email protected]>
Date: Thu, 10 Dec 2009 00:26:57 +0100 (CET)

> On Wed, 9 Dec 2009, Rudy Matela wrote:
>
>> > It is ok until the driver is removed, if this "issue" is not fixed it
>> > will trigger any check-coding-style and generate new patches. Since it
>> > involves no code changes it is harmless.
>> Sould I keep sending coding style corrections to the Linux Kernel?
>> I'm trying to help, but if i'm just being annoying, please tell me and
>> I can try to contribute in a better way. :-)
>
> Coding style corrections (if they really improve readability of the code),
> comment fixes (if they really make grepping for things better or make the
> whole text more understandable) are welcome and I will happily merge them.
>
> What I usually don't merge are purely whitespace "fixes", which don't
> really fix anything in fact.

I think the whitespace ones here are extremely valuable, the code is
amazingly annoying to read as it is.

It boils down to this:

foo() is a C function call

foo () is a C operation like 'if', 'while' etc.

and people's brains are wired to this association.

2009-12-10 17:41:50

by Krzysztof Halasa

[permalink] [raw]
Subject: Re: [PATCH] Coding style correction on some drivers that use Generic HDLC

Jiri Kosina <[email protected]> writes:

>> > drivers/net/wan/cosa.c | 10 +++++-----
>> > drivers/net/wan/hdlc_cisco.c | 8 ++++----
>> > drivers/net/wan/hdlc_x25.c | 4 ++--
> I will take care of it once the currently undergoing merging is done.

Thanks.
--
Krzysztof Halasa