[U-Boot] [PATCH 4/6] net: mii: Changes not made by spatch

Bin Meng bmeng.cn at gmail.com
Mon Apr 11 06:23:47 CEST 2016


Hi Joe,

On Mon, Apr 4, 2016 at 5:07 PM, Joe Hershberger <joe.hershberger at ni.com> wrote:
> If the functions passed to the registration function are not in the same
> C file (extern) then spatch will not handle the dependent changes.
>
> Make those changes manually.
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
>
>  arch/m68k/include/asm/fec.h      |  9 +++++----
>  arch/powerpc/cpu/ppc4xx/miiphy.c | 11 ++++-------
>  drivers/net/4xx_enet.c           |  7 +++----
>  drivers/net/bcm-sf2-eth-gmac.c   | 18 +++++++-----------
>  drivers/net/bcm-sf2-eth.c        | 12 +++++++++++-
>  drivers/net/bcm-sf2-eth.h        |  8 ++++----
>  drivers/net/mcfmii.c             | 19 ++++++-------------
>  drivers/net/phy/miiphybb.c       | 25 ++++++++-----------------
>  include/miiphy.h                 |  7 +++----
>  9 files changed, 51 insertions(+), 65 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

But one nits below.

> diff --git a/arch/m68k/include/asm/fec.h b/arch/m68k/include/asm/fec.h
> index 6856aac..2799293 100644
> --- a/arch/m68k/include/asm/fec.h
> +++ b/arch/m68k/include/asm/fec.h
> @@ -15,6 +15,8 @@
>  #ifndef        fec_h
>  #define        fec_h
>
> +#include <phy.h>
> +
>  /* Buffer descriptors used FEC.
>  */
>  typedef struct cpm_buf_desc {
> @@ -341,10 +343,9 @@ int fecpin_setclear(struct eth_device *dev, int setclear);
>  void __mii_init(void);
>  uint mii_send(uint mii_cmd);
>  int mii_discover_phy(struct eth_device *dev);
> -int mcffec_miiphy_read(const char *devname, unsigned char addr,
> -                      unsigned char reg, unsigned short *value);
> -int mcffec_miiphy_write(const char *devname, unsigned char addr,
> -                       unsigned char reg, unsigned short value);
> +int mcffec_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg);
> +int mcffec_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg,
> +                       u16 value);
>  #endif
>
>  #endif                         /* fec_h */
> diff --git a/arch/powerpc/cpu/ppc4xx/miiphy.c b/arch/powerpc/cpu/ppc4xx/miiphy.c
> index 10147de..f0fc098 100644
> --- a/arch/powerpc/cpu/ppc4xx/miiphy.c
> +++ b/arch/powerpc/cpu/ppc4xx/miiphy.c
> @@ -318,8 +318,7 @@ static int emac_miiphy_command(u8 addr, u8 reg, int cmd, u16 value)
>         return 0;
>  }
>
> -int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char reg,
> -                        unsigned short *value)
> +int emac4xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg)
>  {
>         unsigned long sta_reg;
>         unsigned long emac_reg;
> @@ -330,17 +329,15 @@ int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char
>                 return -1;
>
>         sta_reg = in_be32((void *)EMAC0_STACR + emac_reg);
> -       *value = sta_reg >> 16;
> -
> -       return 0;
> +       return sta_reg >> 16;
>  }
>
>  /***********************************************************/
>  /* write a phy reg and return the value with a rc          */
>  /***********************************************************/
>
> -int emac4xx_miiphy_write (const char *devname, unsigned char addr, unsigned char reg,
> -                         unsigned short value)
> +int emac4xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg,
> +                        u16 value)
>  {
>         return emac_miiphy_command(addr, reg, EMAC_STACR_WRITE, value);
>  }
> diff --git a/drivers/net/4xx_enet.c b/drivers/net/4xx_enet.c
> index 6fe8ba6..a083024 100644
> --- a/drivers/net/4xx_enet.c
> +++ b/drivers/net/4xx_enet.c
> @@ -283,10 +283,9 @@ static void mal_err (struct eth_device *dev, unsigned long isr,
>  static void emac_err (struct eth_device *dev, unsigned long isr);
>
>  extern int phy_setup_aneg (char *devname, unsigned char addr);
> -extern int emac4xx_miiphy_read (const char *devname, unsigned char addr,
> -               unsigned char reg, unsigned short *value);
> -extern int emac4xx_miiphy_write (const char *devname, unsigned char addr,
> -               unsigned char reg, unsigned short value);
> +int emac4xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg);
> +int emac4xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg,
> +                        u16 value);
>
>  int board_emac_count(void);
>
> diff --git a/drivers/net/bcm-sf2-eth-gmac.c b/drivers/net/bcm-sf2-eth-gmac.c
> index 977feec..f2853cf 100644
> --- a/drivers/net/bcm-sf2-eth-gmac.c
> +++ b/drivers/net/bcm-sf2-eth-gmac.c
> @@ -596,12 +596,10 @@ bool gmac_mii_busywait(unsigned int timeout)
>         return tmp & (1 << GMAC_MII_BUSY_SHIFT);
>  }
>
> -int gmac_miiphy_read(const char *devname, unsigned char phyaddr,
> -                       unsigned char reg, unsigned short *value)
> +int gmac_miiphy_read(struct mii_dev *bus, int phyaddr, int devad, int reg)
>  {
>         uint32_t tmp = 0;
> -
> -       (void)devname;
> +       u16 value = 0;
>
>         /* Busy wait timeout is 1ms */
>         if (gmac_mii_busywait(1000)) {
> @@ -621,18 +619,16 @@ int gmac_miiphy_read(const char *devname, unsigned char phyaddr,
>                 return -1;
>         }
>
> -       *value = readl(GMAC_MII_DATA_ADDR) & 0xffff;
> -       debug("MII read data 0x%x\n", *value);
> -       return 0;
> +       value = readl(GMAC_MII_DATA_ADDR) & 0xffff;
> +       debug("MII read data 0x%x\n", value);
> +       return value;
>  }
>
> -int gmac_miiphy_write(const char *devname, unsigned char phyaddr,
> -                        unsigned char reg, unsigned short value)
> +int gmac_miiphy_write(struct mii_dev *bus, int phyaddr, int devad, int reg,
> +                     u16 value)
>  {
>         uint32_t tmp = 0;
>
> -       (void)devname;
> -
>         /* Busy wait timeout is 1ms */
>         if (gmac_mii_busywait(1000)) {
>                 error("%s: Prepare MII write: MII/MDIO busy\n", __func__);
> diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c
> index eab4c1f..8f22492 100644
> --- a/drivers/net/bcm-sf2-eth.c
> +++ b/drivers/net/bcm-sf2-eth.c
> @@ -244,7 +244,17 @@ int bcm_sf2_eth_register(bd_t *bis, u8 dev_num)
>         eth_register(dev);
>
>  #ifdef CONFIG_CMD_MII
> -       miiphy_register(dev->name, eth->miiphy_read, eth->miiphy_write);
> +       int retval;

nits: should have a blank line here.

> +       struct mii_dev *mdiodev = mdio_alloc();
> +       if (!mdiodev)
> +               return -ENOMEM;
> +       strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
> +       mdiodev->read = eth->miiphy_read;
> +       mdiodev->write = eth->miiphy_write;
> +
> +       retval = mdio_register(mdiodev);
> +       if (retval < 0)
> +               return retval;
>  #endif
>
>         /* Initialization */

[snip]

Regards,
Bin


More information about the U-Boot mailing list