diff mbox series

[U-Boot] net: sh-eth: Fix coding style checked by checkpatch.pl

Message ID 20171130230800.14576-1-iwamatsu@nigauri.org
State Accepted
Commit 9474aac
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: sh-eth: Fix coding style checked by checkpatch.pl | expand

Commit Message

Nobuhiro Iwamatsu Nov. 30, 2017, 11:08 p.m. UTC
This fixes the chord style checked by checkpatch.pl.
Details of change details are as follows:

 - Fix typo
    Change from alligned to aligned.
 - Remove whitespace before ','
 - Add spaces preferred around that '|'
 - Fix missing a blank line after declarations
 - Remove space after a cast declaration
 - Fix format of block comments
 - Add a blank line after function/struct/union/enum declarations

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 drivers/net/sh_eth.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

Comments

Joe Hershberger Dec. 5, 2017, 8:39 p.m. UTC | #1
On Thu, Nov 30, 2017 at 5:08 PM, Nobuhiro Iwamatsu <iwamatsu@nigauri.org> wrote:
> This fixes the chord style checked by checkpatch.pl.
> Details of change details are as follows:
>
>  - Fix typo
>     Change from alligned to aligned.
>  - Remove whitespace before ','
>  - Add spaces preferred around that '|'
>  - Fix missing a blank line after declarations
>  - Remove space after a cast declaration
>  - Fix format of block comments
>  - Add a blank line after function/struct/union/enum declarations
>
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Jan. 2, 2018, 8:26 p.m. UTC | #2
Hi Nobuhiro,

On Thu, Nov 30, 2017 at 5:08 PM, Nobuhiro Iwamatsu <iwamatsu@nigauri.org> wrote:
> This fixes the chord style checked by checkpatch.pl.
> Details of change details are as follows:
>
>  - Fix typo
>     Change from alligned to aligned.
>  - Remove whitespace before ','
>  - Add spaces preferred around that '|'
>  - Fix missing a blank line after declarations
>  - Remove space after a cast declaration
>  - Fix format of block comments
>  - Add a blank line after function/struct/union/enum declarations
>
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> ---
>  drivers/net/sh_eth.c | 29 ++++++++++++++++++-----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
> index 970d730e56..5c6278069c 100644
> --- a/drivers/net/sh_eth.c
> +++ b/drivers/net/sh_eth.c
> @@ -67,7 +67,7 @@ int sh_eth_send(struct eth_device *dev, void *packet, int len)
>
>         /* packet must be a 4 byte boundary */
>         if ((int)packet & 3) {
> -               printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n"
> +               printf(SHETHER_NAME ": %s: packet not 4 byte aligned\n"
>                                 , __func__);
>                 ret = -EFAULT;
>                 goto err;
> @@ -222,8 +222,10 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
>         cur_tx_desc--;
>         cur_tx_desc->td0 |= TD_TDLE;
>
> -       /* Point the controller to the tx descriptor list. Must use physical
> -          addresses */
> +       /*
> +        * Point the controller to the tx descriptor list. Must use physical
> +        * addresses
> +        */
>         sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDLAR);
>  #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
>         sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDFAR);
> @@ -237,7 +239,7 @@ err:
>
>  static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
>  {
> -       int port = eth->port, i , ret = 0;
> +       int port = eth->port, i, ret = 0;
>         u32 alloc_desc_size = NUM_RX_DESC * sizeof(struct rx_desc_s);
>         struct sh_eth_info *port_info = &eth->port_info[port];
>         struct rx_desc_s *cur_rx_desc;
> @@ -283,7 +285,7 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
>              i < NUM_RX_DESC; cur_rx_desc++, rx_buf += MAX_BUF_SIZE, i++) {
>                 cur_rx_desc->rd0 = RD_RACT;
>                 cur_rx_desc->rd1 = MAX_BUF_SIZE << 16;
> -               cur_rx_desc->rd2 = (u32) ADDR_TO_PHY(rx_buf);
> +               cur_rx_desc->rd2 = (u32)ADDR_TO_PHY(rx_buf);
>         }
>
>         /* Mark the end of the descriptors */
> @@ -465,11 +467,14 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
>         /* Check if full duplex mode is supported by the phy */
>         if (phy->duplex) {
>                 printf("Full\n");
> -               sh_eth_write(eth, val | (ECMR_CHG_DM|ECMR_RE|ECMR_TE|ECMR_DM),
> +               sh_eth_write(eth,
> +                            val | (ECMR_CHG_DM | ECMR_RE | ECMR_TE | ECMR_DM),
>                              ECMR);
>         } else {
>                 printf("Half\n");
> -               sh_eth_write(eth, val | (ECMR_CHG_DM|ECMR_RE|ECMR_TE), ECMR);
> +               sh_eth_write(eth,
> +                            val | (ECMR_CHG_DM | ECMR_RE | ECMR_TE),
> +                            ECMR);
>         }
>
>         return ret;
> @@ -524,6 +529,7 @@ err:
>  void sh_eth_halt(struct eth_device *dev)
>  {
>         struct sh_eth_dev *eth = dev->priv;
> +
>         sh_eth_stop(eth);
>  }
>
> @@ -532,6 +538,7 @@ int sh_eth_initialize(bd_t *bd)
>         int ret = 0;
>         struct sh_eth_dev *eth = NULL;
>         struct eth_device *dev = NULL;
> +       struct mii_dev *mdiodev;
>
>         eth = (struct sh_eth_dev *)malloc(sizeof(struct sh_eth_dev));
>         if (!eth) {
> @@ -566,16 +573,15 @@ int sh_eth_initialize(bd_t *bd)
>         eth_register(dev);
>
>         bb_miiphy_buses[0].priv = eth;
> -       int retval;
> -       struct mii_dev *mdiodev = mdio_alloc();
> +       mdiodev = mdio_alloc();
>         if (!mdiodev)
>                 return -ENOMEM;
>         strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
>         mdiodev->read = bb_miiphy_read;
>         mdiodev->write = bb_miiphy_write;
>
> -       retval = mdio_register(mdiodev);
> -       if (retval < 0)
> +       retl = mdio_register(mdiodev);

It seems you never compiled this. The compiler tells you that it
should be "ret", not "retl".

> +       if (ret < 0)
>                 return retval;

This should be "ret", not "retval".

I'll fix these up inline.

-Joe

>
>         if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr))
> @@ -670,4 +676,5 @@ struct bb_miiphy_bus bb_miiphy_buses[] = {
>                 .delay          = sh_eth_bb_delay,
>         }
>  };
> +
>  int bb_miiphy_buses_num = ARRAY_SIZE(bb_miiphy_buses);
Joe Hershberger Jan. 22, 2018, 4:54 p.m. UTC | #3
Hi Nobuhiro,

https://patchwork.ozlabs.org/patch/843225/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 970d730e56..5c6278069c 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -67,7 +67,7 @@  int sh_eth_send(struct eth_device *dev, void *packet, int len)
 
 	/* packet must be a 4 byte boundary */
 	if ((int)packet & 3) {
-		printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n"
+		printf(SHETHER_NAME ": %s: packet not 4 byte aligned\n"
 				, __func__);
 		ret = -EFAULT;
 		goto err;
@@ -222,8 +222,10 @@  static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
 	cur_tx_desc--;
 	cur_tx_desc->td0 |= TD_TDLE;
 
-	/* Point the controller to the tx descriptor list. Must use physical
-	   addresses */
+	/*
+	 * Point the controller to the tx descriptor list. Must use physical
+	 * addresses
+	 */
 	sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDLAR);
 #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
 	sh_eth_write(eth, ADDR_TO_PHY(port_info->tx_desc_base), TDFAR);
@@ -237,7 +239,7 @@  err:
 
 static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
 {
-	int port = eth->port, i , ret = 0;
+	int port = eth->port, i, ret = 0;
 	u32 alloc_desc_size = NUM_RX_DESC * sizeof(struct rx_desc_s);
 	struct sh_eth_info *port_info = &eth->port_info[port];
 	struct rx_desc_s *cur_rx_desc;
@@ -283,7 +285,7 @@  static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
 	     i < NUM_RX_DESC; cur_rx_desc++, rx_buf += MAX_BUF_SIZE, i++) {
 		cur_rx_desc->rd0 = RD_RACT;
 		cur_rx_desc->rd1 = MAX_BUF_SIZE << 16;
-		cur_rx_desc->rd2 = (u32) ADDR_TO_PHY(rx_buf);
+		cur_rx_desc->rd2 = (u32)ADDR_TO_PHY(rx_buf);
 	}
 
 	/* Mark the end of the descriptors */
@@ -465,11 +467,14 @@  static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd)
 	/* Check if full duplex mode is supported by the phy */
 	if (phy->duplex) {
 		printf("Full\n");
-		sh_eth_write(eth, val | (ECMR_CHG_DM|ECMR_RE|ECMR_TE|ECMR_DM),
+		sh_eth_write(eth,
+			     val | (ECMR_CHG_DM | ECMR_RE | ECMR_TE | ECMR_DM),
 			     ECMR);
 	} else {
 		printf("Half\n");
-		sh_eth_write(eth, val | (ECMR_CHG_DM|ECMR_RE|ECMR_TE), ECMR);
+		sh_eth_write(eth,
+			     val | (ECMR_CHG_DM | ECMR_RE | ECMR_TE),
+			     ECMR);
 	}
 
 	return ret;
@@ -524,6 +529,7 @@  err:
 void sh_eth_halt(struct eth_device *dev)
 {
 	struct sh_eth_dev *eth = dev->priv;
+
 	sh_eth_stop(eth);
 }
 
@@ -532,6 +538,7 @@  int sh_eth_initialize(bd_t *bd)
 	int ret = 0;
 	struct sh_eth_dev *eth = NULL;
 	struct eth_device *dev = NULL;
+	struct mii_dev *mdiodev;
 
 	eth = (struct sh_eth_dev *)malloc(sizeof(struct sh_eth_dev));
 	if (!eth) {
@@ -566,16 +573,15 @@  int sh_eth_initialize(bd_t *bd)
 	eth_register(dev);
 
 	bb_miiphy_buses[0].priv = eth;
-	int retval;
-	struct mii_dev *mdiodev = mdio_alloc();
+	mdiodev = mdio_alloc();
 	if (!mdiodev)
 		return -ENOMEM;
 	strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
 	mdiodev->read = bb_miiphy_read;
 	mdiodev->write = bb_miiphy_write;
 
-	retval = mdio_register(mdiodev);
-	if (retval < 0)
+	retl = mdio_register(mdiodev);
+	if (ret < 0)
 		return retval;
 
 	if (!eth_env_get_enetaddr("ethaddr", dev->enetaddr))
@@ -670,4 +676,5 @@  struct bb_miiphy_bus bb_miiphy_buses[] = {
 		.delay		= sh_eth_bb_delay,
 	}
 };
+
 int bb_miiphy_buses_num = ARRAY_SIZE(bb_miiphy_buses);