Skip to contentSkip to conversation

Coding style correction on some drivers that use Generic HDLC

PATCH In review Rudy Matela 6 participants 9 messages Dec 9, 2009 – Dec 10, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

 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(-)
drivers/net/wan/cosa.c +5 -5
index b36bf96..f0bd70f 100644
@@ -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;
drivers/net/wan/hdlc_cisco.c +4 -4
index f1bff98..1ceccf1 100644
@@ -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));
drivers/net/wan/hdlc_x25.c +2 -2
index aa9248f..6e1ca25 100644
@@ -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);
Acked-by on v1 1/1
#1 lore raw

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.

-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

Signature · 5 lines
| 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
#2 lore raw
Quoted 17 lines · Jan Yenya Kasprzak

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.

-Yenya

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

Quoted 8 lines
:  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

#3 lore raw
Quoted 14 lines · walter harms
Quoted 10 lines · Jan Yenya Kasprzak

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.

Quoted 8 lines

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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 6 lines · Rudy Matela
Quoted 3 lines

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.

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.
maintainer
#5 lore raw

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

Quoted 9 lines · Rudy Matela
Quoted 7 lines
Quoted 4 lines

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. :-)

Quoted 6 lines

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.

maintainer
#6 lore raw
In reply to Rudy Matela
Quoted 9 lines · Rudy Matela

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

---

 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?

Signature · 1 line
Krzysztof Halasa
#7 lore raw
Quoted 6 lines · Krzysztof Halasa
Quoted 6 lines

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

---

Quoted 8 lines
Quoted 3 lines
 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.

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.
maintainer
#8 lore raw
Quoted 4 lines · Jiri Kosina
Quoted 3 lines
Quoted 3 lines
 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.

Signature · 1 line
Krzysztof Halasa