DSA: Fix checkpatch.pl output for DSA drivers
Subsystems (3)
v2 cover DSA: Fix checkpatch.pl output for DSA drivers
This set of patches performs routine maintenance on the DSA drivers by removing all checkpatch.pl errors.
These patches do the following things:
* Switch to network-style comments
* Convert msleep calls to timeout/usleep_range calls
* Convert printk calls to netdev_info calls
* Fix whitespace issues
Changes from V1 of the patch include:
(Joe Perches Review)
* Change comment style to one-line for comments
that can be reduced to one-line
* Fix spelling of "Priority"
* Remove device name from netdev_info
* Coalesce netdev_info lines to one format line
(Ben Hutchings Review)
* Replace repeated usleep_range calls with
timeouts/usleep_range calls.
Thanks,
Barry
Barry Grussling (4):
DSA: Convert DSA comments to network-style comments
DSA: Convert repeated msleep calls to timeouts
DSA: Convert printk calls to netdev_info calls
DSA: Convert spaces to tabs where appropriate
drivers/net/dsa/mv88e6060.c | 54 ++++++-------- drivers/net/dsa/mv88e6123_61_65.c | 125 +++++++++++--------------------- drivers/net/dsa/mv88e6131.c | 114 ++++++++++-------------------- drivers/net/dsa/mv88e6xxx.c | 141 +++++++++++++++---------------------- drivers/net/dsa/mv88e6xxx.h | 11 ++- 5 files changed, 162 insertions(+), 283 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/4 DSA: Convert DSA comments to network-style comments
From: Barry Grussling <[email protected]>
Convert DSA driver comments to network-style comments as reported by checkpatch.pl. Fix spelling error.
--- drivers/net/dsa/mv88e6060.c | 31 +++------- drivers/net/dsa/mv88e6123_61_65.c | 113 +++++++++++-------------------------- drivers/net/dsa/mv88e6131.c | 102 ++++++++++----------------------- drivers/net/dsa/mv88e6xxx.c | 70 ++++++----------------- drivers/net/dsa/mv88e6xxx.h | 9 +-- 5 files changed, 93 insertions(+), 232 deletions(-)
drivers/net/dsa/mv88e6060.c +9 -22
@@ -67,27 +67,19 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds)int i;int ret; -/* -* Set all ports to the disabled state. -*/ +/* Set all ports to the disabled state. */ for (i =0 ; i <6 ; i++) { ret =REG_READ (REG_PORT (i),0x04 );REG_WRITE (REG_PORT (i),0x04 , ret &0xfffc ); } -/* -* Wait for transmit queues to drain. -*/ +/* Wait for transmit queues to drain. */ msleep (2 ); -/* -* Reset the switch. -*/ +/* Reset the switch. */ REG_WRITE (REG_GLOBAL ,0x0a ,0xa130 ); -/* -* Wait up to one second for reset to complete. -*/ +/* Wait up to one second for reset to complete. */ for (i =0 ; i <1000 ; i++) { ret =REG_READ (REG_GLOBAL ,0x00 );if ((ret &0x8000 ) ==0x0000 )
@@ -103,15 +95,13 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds)static int mv88e6060_setup_global (struct dsa_switch *ds) { -/* -* Disable discarding of frames with excessive collisions, +/* Disable discarding of frames with excessive collisions, * set the maximum frame size to 1536 bytes, and mask all * interrupt sources. */ REG_WRITE (REG_GLOBAL ,0x04 ,0x0800 ); -/* -* Enable automatic address learning, set the address +/* Enable automatic address learning, set the address * database size to 1024 entries, and set the default aging * time to 5 minutes. */
@@ -124,16 +114,14 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p) {int addr =REG_PORT (p); -/* -* Do not force flow control, disable Ingress and Egress +/* Do not force flow control, disable Ingress and Egress * Header tagging, disable VLAN tunneling, and set the port * state to Forwarding. Additionally, if this is the CPU * port, enable Ingress and Egress Trailer tagging mode. */ REG_WRITE (addr,0x04 ,dsa_is_cpu_port (ds, p) ?0x4103 :0x0003 ); -/* -* Port based VLAN map: give each port its own address +/* Port based VLAN map: give each port its own address * database, allow the CPU port to talk to each of the 'real' * ports, and allow each of the 'real' ports to only talk to * the CPU port.
@@ -144,8 +132,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p) ds->phys_port_mask : (1 << ds->dst->cpu_port))); -/* -* Port Association Vector: when learning source addresses +/* Port Association Vector: when learning source addresses * of packets, add the address to the address database using * a port bitmap that has only the bit for this port set and * the other bits clear.
drivers/net/dsa/mv88e6123_61_65.c +33 -80
255 lines not on this page · raw message
drivers/net/dsa/mv88e6131.c +30 -72
243 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx.c +18 -52
158 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx.h +3 -6
@@ -16,16 +16,14 @@#define REG_GLOBAL2 0x1cstruct mv88e6xxx_priv_state { -/* -* When using multi-chip addressing, this mutex protects +/* When using multi-chip addressing, this mutex protects * access to the indirect access registers. (In single-chip * mode, this mutex is effectively useless.) */ struct mutex smi_mutex;#ifdef CONFIG_NET_DSA_MV88E6XXX_NEED_PPU -/* -* Handles automatic disabling and re-enabling of the PHY +/* Handles automatic disabling and re-enabling of the PHY * polling unit. */ struct mutex ppu_mutex;
@@ -34,8 +32,7 @@ struct mv88e6xxx_priv_state {struct timer_list ppu_timer;#endif -/* -* This mutex serialises access to the statistics unit. +/* This mutex serialises access to the statistics unit. * Hold this mutex over snapshot + dump sequences. */ struct mutex stats_mutex;
Signature · 1 line
1.7.9.5
PATCH v2 2/4 DSA: Convert repeated msleep calls to timeouts
In reply to Barry GrusslingFrom: Barry Grussling <[email protected]>
Convert DSA msleep calls to timeout/usleep_range calls as reported by checkpatch.pl.
--- drivers/net/dsa/mv88e6060.c | 12 ++++++++---- drivers/net/dsa/mv88e6123_61_65.c | 12 ++++++++---- drivers/net/dsa/mv88e6131.c | 12 ++++++++---- drivers/net/dsa/mv88e6xxx.c | 16 ++++++++++------ 4 files changed, 34 insertions(+), 18 deletions(-)
drivers/net/dsa/mv88e6060.c +8 -4
@@ -8,6 +8,8 @@* (at your option) any later version. */ +#include <linux/delay.h> +#include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h>
@@ -66,6 +68,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) {int i;int ret; +unsigned long timeout;/* Set all ports to the disabled state. */ for (i =0 ; i <6 ; i++) {
@@ -74,20 +77,21 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds) }/* Wait for transmit queues to drain. */ -msleep (2 ); +usleep_range (2000 ,4000 );/* Reset the switch. */ REG_WRITE (REG_GLOBAL ,0x0a ,0xa130 );/* Wait up to one second for reset to complete. */ -for (i =0 ; i <1000 ; i++) { + timeout = jiffies +1 *HZ ; +while (time_before (jiffies, timeout)) { ret =REG_READ (REG_GLOBAL ,0x00 );if ((ret &0x8000 ) ==0x0000 )break ; -msleep (1 ); +usleep_range (1000 ,2000 ); } -if (i ==1000 ) +if (time_after (jiffies, timeout))return -ETIMEDOUT ;return 0 ;
drivers/net/dsa/mv88e6123_61_65.c +8 -4
@@ -8,6 +8,8 @@* (at your option) any later version. */ +#include <linux/delay.h> +#include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h>
@@ -50,6 +52,7 @@ static int mv88e6123_61_65_switch_reset(struct dsa_switch *ds) {int i;int ret; +unsigned long timeout;/* Set all ports to the disabled state. */ for (i =0 ; i <8 ; i++) {
@@ -58,20 +61,21 @@ static int mv88e6123_61_65_switch_reset(struct dsa_switch *ds) }/* Wait for transmit queues to drain. */ -msleep (2 ); +usleep_range (2000 ,4000 );/* Reset the switch. */ REG_WRITE (REG_GLOBAL ,0x04 ,0xc400 );/* Wait up to one second for reset to complete. */ -for (i =0 ; i <1000 ; i++) { + timeout = jiffies +1 *HZ ; +while (time_before (jiffies, timeout)) { ret =REG_READ (REG_GLOBAL ,0x00 );if ((ret &0xc800 ) ==0xc800 )break ; -msleep (1 ); +usleep_range (1000 ,2000 ); } -if (i ==1000 ) +if (time_after (jiffies, timeout))return -ETIMEDOUT ;return 0 ;
drivers/net/dsa/mv88e6131.c +8 -4
@@ -8,6 +8,8 @@* (at your option) any later version. */ +#include <linux/delay.h> +#include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h>
@@ -42,6 +44,7 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) {int i;int ret; +unsigned long timeout;/* Set all ports to the disabled state. */ for (i =0 ; i <11 ; i++) {
@@ -50,20 +53,21 @@ static int mv88e6131_switch_reset(struct dsa_switch *ds) }/* Wait for transmit queues to drain. */ -msleep (2 ); +usleep_range (2000 ,4000 );/* Reset the switch. */ REG_WRITE (REG_GLOBAL ,0x04 ,0xc400 );/* Wait up to one second for reset to complete. */ -for (i =0 ; i <1000 ; i++) { + timeout = jiffies +1 *HZ ; +while (time_before (jiffies, timeout)) { ret =REG_READ (REG_GLOBAL ,0x00 );if ((ret &0xc800 ) ==0xc800 )break ; -msleep (1 ); +usleep_range (1000 ,2000 ); } -if (i ==1000 ) +if (time_after (jiffies, timeout))return -ETIMEDOUT ;return 0 ;
drivers/net/dsa/mv88e6xxx.c +10 -6
@@ -8,6 +8,8 @@* (at your option) any later version. */ +#include <linux/delay.h> +#include <linux/jiffies.h> #include <linux/list.h> #include <linux/module.h> #include <linux/netdevice.h>
@@ -196,14 +198,15 @@ int mv88e6xxx_phy_write(struct dsa_switch *ds, int addr, int regnum, u16 val)static int mv88e6xxx_ppu_disable (struct dsa_switch *ds) {int ret; -int i; +unsigned long timeout; ret =REG_READ (REG_GLOBAL ,0x04 );REG_WRITE (REG_GLOBAL ,0x04 , ret & ~0x4000 ); -for (i =0 ; i <1000 ; i++) { + timeout = jiffies +1 *HZ ; +while (time_before (jiffies, timeout)) { ret =REG_READ (REG_GLOBAL ,0x00 ); -msleep (1 ); +usleep_range (1000 ,2000 );if ((ret &0xc000 ) !=0xc000 )return 0 ; }
@@ -214,14 +217,15 @@ static int mv88e6xxx_ppu_disable(struct dsa_switch *ds)static int mv88e6xxx_ppu_enable (struct dsa_switch *ds) {int ret; -int i; +unsigned long timeout; ret =REG_READ (REG_GLOBAL ,0x04 );REG_WRITE (REG_GLOBAL ,0x04 , ret |0x4000 ); -for (i =0 ; i <1000 ; i++) { + timeout = jiffies +1 *HZ ; +while (time_before (jiffies, timeout)) { ret =REG_READ (REG_GLOBAL ,0x00 ); -msleep (1 ); +usleep_range (1000 ,2000 );if ((ret &0xc000 ) ==0xc000 )return 0 ; }
Signature · 1 line
1.7.9.5
PATCH v2 3/4 DSA: Convert printk calls to netdev_info calls
In reply to Barry GrusslingFrom: Barry Grussling <[email protected]>
Convert DSA printk calls to netdev_info calls as recommended by checkpatch.pl.
--- drivers/net/dsa/mv88e6060.c | 11 ++++++----- drivers/net/dsa/mv88e6xxx.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-)
drivers/net/dsa/mv88e6060.c +6 -5
@@ -236,7 +236,7 @@ static void mv88e6060_poll_link(struct dsa_switch *ds)if (!link) {if (netif_carrier_ok (dev)) { -printk (KERN_INFO "%s: link down\n" , dev->name); +netdev_info (dev,"link down\n" );netif_carrier_off (dev); }continue ;
@@ -247,10 +247,11 @@ static void mv88e6060_poll_link(struct dsa_switch *ds) fc = ((port_status &0xc000 ) ==0xc000 ) ?1 :0 ;if (!netif_carrier_ok (dev)) { -printk (KERN_INFO "%s: link up, %d Mb/s, %s duplex, " -"flow control %sabled\n" , dev->name, - speed, duplex ?"full" :"half" , - fc ?"en" :"dis" ); +netdev_info (dev, +"link up, %d Mb/s, %s duplex, flow control %sabled\n" , + speed, + duplex ?"full" :"half" , + fc ?"en" :"dis" );netif_carrier_on (dev); } }
drivers/net/dsa/mv88e6xxx.c +6 -5
@@ -356,7 +356,7 @@ void mv88e6xxx_poll_link(struct dsa_switch *ds)if (!link) {if (netif_carrier_ok (dev)) { -printk (KERN_INFO "%s: link down\n" , dev->name); +netdev_info (dev,"link down\n" );netif_carrier_off (dev); }continue ;
@@ -380,10 +380,11 @@ void mv88e6xxx_poll_link(struct dsa_switch *ds) fc = (port_status &0x8000 ) ?1 :0 ;if (!netif_carrier_ok (dev)) { -printk (KERN_INFO "%s: link up, %d Mb/s, %s duplex, " -"flow control %sabled\n" , dev->name, - speed, duplex ?"full" :"half" , - fc ?"en" :"dis" ); +netdev_info (dev, +"link up, %d Mb/s, %s duplex, flow control %sabled\n" , + speed, + duplex ?"full" :"half" , + fc ?"en" :"dis" );netif_carrier_on (dev); } }
Signature · 1 line
1.7.9.5
PATCH v2 4/4 DSA: Convert spaces to tabs where appropriate
In reply to Barry GrusslingFrom: Barry Grussling <[email protected]>
Fix DSA whitespace issues reported by checkpatch.pl
--- drivers/net/dsa/mv88e6xxx.c | 44 +++++++++++++++++++++---------------------- drivers/net/dsa/mv88e6xxx.h | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-)
drivers/net/dsa/mv88e6xxx.c +22 -22
@@ -205,10 +205,10 @@ static int mv88e6xxx_ppu_disable(struct dsa_switch *ds) timeout = jiffies +1 *HZ ;while (time_before (jiffies, timeout)) { - ret =REG_READ (REG_GLOBAL ,0x00 ); + ret =REG_READ (REG_GLOBAL ,0x00 );usleep_range (1000 ,2000 ); -if ((ret &0xc000 ) !=0xc000 ) -return 0 ; +if ((ret &0xc000 ) !=0xc000 ) +return 0 ; }return -ETIMEDOUT ;
@@ -224,10 +224,10 @@ static int mv88e6xxx_ppu_enable(struct dsa_switch *ds) timeout = jiffies +1 *HZ ;while (time_before (jiffies, timeout)) { - ret =REG_READ (REG_GLOBAL ,0x00 ); + ret =REG_READ (REG_GLOBAL ,0x00 );usleep_range (1000 ,2000 ); -if ((ret &0xc000 ) ==0xc000 ) -return 0 ; +if ((ret &0xc000 ) ==0xc000 ) +return 0 ; }return -ETIMEDOUT ;
@@ -239,11 +239,11 @@ static void mv88e6xxx_ppu_reenable_work(struct work_struct *ugly) ps = container_of(ugly, struct mv88e6xxx_priv_state, ppu_work);if (mutex_trylock (&ps->ppu_mutex)) { -struct dsa_switch *ds = ((struct dsa_switch *)ps) -1 ; +struct dsa_switch *ds = ((struct dsa_switch *)ps) -1 ; -if (mv88e6xxx_ppu_enable (ds) ==0 ) - ps->ppu_disabled =0 ; -mutex_unlock (&ps->ppu_mutex); +if (mv88e6xxx_ppu_enable (ds) ==0 ) + ps->ppu_disabled =0 ; +mutex_unlock (&ps->ppu_mutex); } }
@@ -267,15 +267,15 @@ static int mv88e6xxx_ppu_access_get(struct dsa_switch *ds)* it. */ if (!ps->ppu_disabled) { - ret =mv88e6xxx_ppu_disable (ds); -if (ret <0 ) { -mutex_unlock (&ps->ppu_mutex); -return ret; - } - ps->ppu_disabled =1 ; + ret =mv88e6xxx_ppu_disable (ds); +if (ret <0 ) { +mutex_unlock (&ps->ppu_mutex); +return ret; + } + ps->ppu_disabled =1 ; }else { -del_timer (&ps->ppu_timer); - ret =0 ; +del_timer (&ps->ppu_timer); + ret =0 ; }return ret;
@@ -307,8 +307,8 @@ int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum) ret =mv88e6xxx_ppu_access_get (ds);if (ret >=0 ) { - ret =mv88e6xxx_reg_read (ds, addr, regnum); -mv88e6xxx_ppu_access_put (ds); + ret =mv88e6xxx_reg_read (ds, addr, regnum); +mv88e6xxx_ppu_access_put (ds); }return ret;
@@ -321,8 +321,8 @@ int mv88e6xxx_phy_write_ppu(struct dsa_switch *ds, int addr, ret =mv88e6xxx_ppu_access_get (ds);if (ret >=0 ) { - ret =mv88e6xxx_reg_write (ds, addr, regnum, val); -mv88e6xxx_ppu_access_put (ds); + ret =mv88e6xxx_reg_write (ds, addr, regnum, val); +mv88e6xxx_ppu_access_put (ds); }return ret;
drivers/net/dsa/mv88e6xxx.h +1 -1
@@ -49,7 +49,7 @@ struct mv88e6xxx_hw_stat {int __mv88e6xxx_reg_read (struct mii_bus *bus,int sw_addr,int addr,int reg);int mv88e6xxx_reg_read (struct dsa_switch *ds,int addr,int reg);int __mv88e6xxx_reg_write (struct mii_bus *bus,int sw_addr,int addr, -int reg,u16 val); +int reg,u16 val);int mv88e6xxx_reg_write (struct dsa_switch *ds,int addr,int reg,u16 val);int mv88e6xxx_config_prio (struct dsa_switch *ds);int mv88e6xxx_set_addr_direct (struct dsa_switch *ds,u8 *addr);
Signature · 1 line
1.7.9.5
David Miller
maintainerFrom: Barry Grussling <[email protected]>
Date: Tue, 8 Jan 2013 18:05:52 -0800
Quoted 8 lines
This set of patches performs routine maintenance on the DSA drivers by removing all checkpatch.pl errors.
These patches do the following things:
* Switch to network-style comments
* Convert msleep calls to timeout/usleep_range calls
* Convert printk calls tonetdev_infocalls
* Fix whitespace issues
All applied, thanks.