[U-Boot] [PATCH 3/6] net: mii: Use spatch to update miiphy_register
Bin Meng
bmeng.cn at gmail.com
Mon Apr 11 06:23:44 CEST 2016
Hi Joe,
On Mon, Apr 4, 2016 at 5:07 PM, Joe Hershberger <joe.hershberger at ni.com> wrote:
> Run scripts/coccinelle/net/mdio_register.cocci on the U-Boot code base.
Looks we need more manual nits fixes after running the scripts. See below.
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
>
> arch/mips/mach-au1x00/au1x00_eth.c | 27 +++++++++++++++-------
> arch/powerpc/cpu/mpc8260/ether_fcc.c | 13 +++++++++--
> arch/powerpc/cpu/mpc85xx/ether_fcc.c | 13 +++++++++--
> arch/powerpc/cpu/mpc8xx/fec.c | 38 +++++++++++++++++++-----------
> board/gdsys/405ep/io.c | 13 +++++++++--
> board/gdsys/405ep/iocon.c | 27 ++++++++++++++++++----
> board/gdsys/405ex/io64.c | 26 +++++++++++++++++----
> board/gdsys/mpc8308/hrcon.c | 27 ++++++++++++++++++----
> board/gdsys/mpc8308/strider.c | 27 ++++++++++++++++++----
> drivers/net/4xx_enet.c | 13 +++++++++--
> drivers/net/armada100_fec.c | 35 +++++++++++++++++++---------
> drivers/net/at91_emac.c | 30 ++++++++++++++++--------
> drivers/net/bfin_mac.c | 24 +++++++++++++++----
> drivers/net/davinci_emac.c | 27 ++++++++++++++++++----
> drivers/net/eepro100.c | 36 +++++++++++++++++++----------
> drivers/net/enc28j60.c | 28 ++++++++++++++++------
> drivers/net/ep93xx_eth.c | 45 +++++++++++++++++++++++++-----------
> drivers/net/fsl_mcdmafec.c | 13 +++++++++--
> drivers/net/ftmac110.c | 37 ++++++++++++++++++++---------
> drivers/net/lpc32xx_eth.c | 31 ++++++++++++++++++-------
> drivers/net/macb.c | 32 +++++++++++++++++--------
> drivers/net/mcffec.c | 13 +++++++++--
> drivers/net/mpc512x_fec.c | 34 ++++++++++++++++++++-------
> drivers/net/mpc5xxx_fec.c | 34 ++++++++++++++++++++-------
> drivers/net/mvgbe.c | 35 ++++++++++++++++++++--------
> drivers/net/sh_eth.c | 12 +++++++++-
> drivers/net/smc911x.c | 33 ++++++++++++++++++++------
> drivers/qe/uec.c | 34 ++++++++++++++++++---------
> 28 files changed, 572 insertions(+), 185 deletions(-)
>
> diff --git a/arch/mips/mach-au1x00/au1x00_eth.c b/arch/mips/mach-au1x00/au1x00_eth.c
> index 9216860..1e823bd 100644
> --- a/arch/mips/mach-au1x00/au1x00_eth.c
> +++ b/arch/mips/mach-au1x00/au1x00_eth.c
> @@ -73,9 +73,10 @@ mac_fifo_t mac_fifo[NO_OF_FIFOS];
> #define MAX_WAIT 1000
>
> #if defined(CONFIG_CMD_MII)
> -int au1x00_miiphy_read(const char *devname, unsigned char addr,
> - unsigned char reg, unsigned short * value)
> +int au1x00_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg
> + )
nits: moving ) to the line above. Please fix this globally.
> {
> + unsigned short value = 0;
> volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL);
> volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA);
> u32 mii_control;
> @@ -102,12 +103,13 @@ int au1x00_miiphy_read(const char *devname, unsigned char addr,
> return -1;
> }
> }
> - *value = *mii_data_reg;
> - return 0;
> + value = *mii_data_reg;
> + return value;
> }
>
> -int au1x00_miiphy_write(const char *devname, unsigned char addr,
> - unsigned char reg, unsigned short value)
> +int au1x00_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg,
> + u16 value
> + )
> {
> volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL);
> volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA);
> @@ -290,8 +292,17 @@ int au1x00_enet_initialize(bd_t *bis){
> eth_register(dev);
>
> #if defined(CONFIG_CMD_MII)
> - miiphy_register(dev->name,
> - au1x00_miiphy_read, au1x00_miiphy_write);
> + int retval;
nits: adding one blank line to separate. Please fix this globally.
> + struct mii_dev *mdiodev = mdio_alloc();
> + if (!mdiodev)
> + return -ENOMEM;
> + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
> + mdiodev->read = au1x00_miiphy_read;
> + mdiodev->write = au1x00_miiphy_write;
> +
> + retval = mdio_register(mdiodev);
> + if (retval < 0)
> + return retval;
> #endif
>
> return 1;
[snip]
Otherwise,
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
Regards,
Bin
More information about the U-Boot
mailing list