aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-04-10 10:29:04 +0000
committerJonas Gorski <jogo@openwrt.org>2015-04-10 10:29:04 +0000
commit4e826d8303d305027bcfd726372a6cc2cf381d74 (patch)
tree3f32e3d0e152d88b3739189bdcfb78c1e740a631 /target
parent61885f95f07ee2a10d5165470e091bfec7fdc4ff (diff)
downloadupstream-4e826d8303d305027bcfd726372a6cc2cf381d74.tar.gz
upstream-4e826d8303d305027bcfd726372a6cc2cf381d74.tar.bz2
upstream-4e826d8303d305027bcfd726372a6cc2cf381d74.zip
b53: clean up code to match kernel style better
* properly enclose macro arguments in paranthesis on use * remove trailing white space * convert C99 // comments * add missing blank lines after declaration * remove braces from single statement blocks * split lines > 80 chars (except for one) Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 45356
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_common.c16
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c3
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_priv.h2
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_regs.h8
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_spi.c7
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_srab.c7
6 files changed, 23 insertions, 20 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index e44d1945ee..d2bb51ab4a 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -525,7 +525,8 @@ static int b53_switch_reset(struct b53_device *dev)
return -EINVAL;
}
}
- } else if ((is531x5(dev) || is5301x(dev)) && dev->sw_dev.cpu_port == B53_CPU_PORT) {
+ } else if ((is531x5(dev) || is5301x(dev)) &&
+ dev->sw_dev.cpu_port == B53_CPU_PORT) {
u8 mii_port_override;
b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
@@ -1161,7 +1162,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
.alias = "bcm53011",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -1174,7 +1175,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
.alias = "bcm53011",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -1187,7 +1188,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
.alias = "bcm53011",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -1200,7 +1201,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
.alias = "bcm53018",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -1213,7 +1214,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
.alias = "bcm53019",
.vlans = 4096,
.enabled_ports = 0x1f,
- .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+ .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
.vta_regs = B53_VTA_REGS,
.duplex_reg = B53_DUPLEX_STAT_GE,
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -1307,7 +1308,8 @@ static int b53_switch_init(struct b53_device *dev)
dev->reset_gpio = b53_switch_get_reset_gpio(dev);
if (dev->reset_gpio >= 0) {
- ret = devm_gpio_request_one(dev->dev, dev->reset_gpio, GPIOF_OUT_INIT_HIGH, "robo_reset");
+ ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
+ GPIOF_OUT_INIT_HIGH, "robo_reset");
if (ret)
return ret;
}
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
index b8681660cc..ab1895e9b5 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
@@ -221,9 +221,8 @@ static int b53_mmap_remove(struct platform_device *pdev)
{
struct b53_device *dev = platform_get_drvdata(pdev);
- if (dev) {
+ if (dev)
b53_switch_remove(dev);
- }
return 0;
}
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index bc9b53368b..4336fdba66 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -150,7 +150,7 @@ static inline int is63xx(struct b53_device *dev)
return 0;
#endif
}
-
+
static inline int is5301x(struct b53_device *dev)
{
return dev->chip_id == BCM53010_DEVICE_ID ||
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
index 7e50bb4e67..534170832a 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
@@ -31,12 +31,12 @@
#define B53_MEM_ACCESS_PAGE 0x08 /* Memory access */
/* PHY Registers */
-#define B53_PORT_MII_PAGE(i) (0x10 + i) /* Port i MII Registers */
+#define B53_PORT_MII_PAGE(i) (0x10 + (i)) /* Port i MII Registers */
#define B53_IM_PORT_PAGE 0x18 /* Inverse MII Port (to EMAC) */
#define B53_ALL_PORT_PAGE 0x19 /* All ports MII (broadcast) */
/* MIB registers */
-#define B53_MIB_PAGE(i) (0x20 + i)
+#define B53_MIB_PAGE(i) (0x20 + (i))
/* Quality of Service (QoS) Registers */
#define B53_QOS_PAGE 0x30
@@ -58,7 +58,7 @@
*************************************************************************/
/* Port Control Register (8 bit) */
-#define B53_PORT_CTRL(i) (0x00 + i)
+#define B53_PORT_CTRL(i) (0x00 + (i))
#define PORT_CTRL_RX_DISABLE BIT(0)
#define PORT_CTRL_TX_DISABLE BIT(1)
#define PORT_CTRL_RX_BCST_EN BIT(2) /* Broadcast RX (P8 only) */
@@ -109,7 +109,7 @@
* Please note that not all ports are available on every hardware, e.g. BCM5301X
* don't include overriding port 6, BCM63xx also have some limitations.
*/
-#define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + i)
+#define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + (i))
#define GMII_PO_LINK BIT(0)
#define GMII_PO_FULL_DUPLEX BIT(1) /* 0 = Half Duplex */
#define GMII_PO_SPEED_S 2
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c b/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
index 8c6b171e75..469a8ddde3 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
@@ -86,6 +86,7 @@ static inline int b53_spi_set_page(struct spi_device *spi, u8 page)
static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page)
{
int ret = b53_spi_clear_status(spi);
+
if (ret)
return ret;
@@ -144,6 +145,7 @@ static int b53_spi_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
static int b53_spi_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
{
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 2);
+
if (!ret)
*val = le16_to_cpu(*val);
@@ -153,6 +155,7 @@ static int b53_spi_read16(struct b53_device *dev, u8 page, u8 reg, u16 *val)
static int b53_spi_read32(struct b53_device *dev, u8 page, u8 reg, u32 *val)
{
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 4);
+
if (!ret)
*val = le32_to_cpu(*val);
@@ -174,6 +177,7 @@ static int b53_spi_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
static int b53_spi_read64(struct b53_device *dev, u8 page, u8 reg, u64 *val)
{
int ret = b53_spi_read(dev, page, reg, (u8 *)val, 8);
+
if (!ret)
*val = le64_to_cpu(*val);
@@ -303,9 +307,8 @@ static int b53_spi_remove(struct spi_device *spi)
{
struct b53_device *dev = spi_get_drvdata(spi);
- if (dev) {
+ if (dev)
b53_switch_remove(dev);
- }
return 0;
}
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c b/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c
index a68e27540a..012daa3a51 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c
@@ -96,7 +96,7 @@ static int b53_srab_op(struct b53_device *dev, u8 page, u8 reg, u32 op)
B53_SRAB_CMDSTAT_GORDYN |
op;
writel(cmdstat, regs + B53_SRAB_CMDSTAT);
-
+
/* check if operation completed */
for (i = 0; i < 5; ++i) {
cmdstat = readl(regs + B53_SRAB_CMDSTAT);
@@ -189,7 +189,7 @@ static int b53_srab_read48(struct b53_device *dev, u8 page, u8 reg, u64 *val)
*val = readl(regs + B53_SRAB_RD_L);
*val += ((u64)readl(regs + B53_SRAB_RD_H) & 0xffff) << 32;
-
+
err:
b53_srab_release_grant(dev);
@@ -358,9 +358,8 @@ static int b53_srab_remove(struct platform_device *pdev)
{
struct b53_device *dev = platform_get_drvdata(pdev);
- if (dev) {
+ if (dev)
b53_switch_remove(dev);
- }
return 0;
}