[U-Boot] [PATCH 1/5] net: mdio: Add mdio_free() and mdio_unregister() API

Joe Hershberger joe.hershberger at gmail.com
Fri Sep 11 00:30:52 CEST 2015


Hi Bin,

On Fri, Sep 4, 2015 at 9:53 AM, Bin Meng <bmeng.cn at gmail.com> wrote:
> Currently there is no API to uninitialize mdio. Add two APIs for this.

Is this causing some failure in the short term? The plan is to move
eth phy support to driver model in the next year. If it is not needed
for a device to function then it would be nice to not spend effort on
this API.

If it is needed short term, then the approach looks fine.

Cheers,
-Joe

> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
>
>  common/miiphyutil.c | 19 +++++++++++++++++++
>  include/miiphy.h    |  2 ++
>  2 files changed, 21 insertions(+)
>
> diff --git a/common/miiphyutil.c b/common/miiphyutil.c
> index c88c28a..e499b58 100644
> --- a/common/miiphyutil.c
> +++ b/common/miiphyutil.c
> @@ -152,6 +152,11 @@ struct mii_dev *mdio_alloc(void)
>         return bus;
>  }
>
> +void mdio_free(struct mii_dev *bus)
> +{
> +       free(bus);
> +}
> +
>  int mdio_register(struct mii_dev *bus)
>  {
>         if (!bus || !bus->name || !bus->read || !bus->write)
> @@ -173,6 +178,20 @@ int mdio_register(struct mii_dev *bus)
>         return 0;
>  }
>
> +int mdio_unregister(struct mii_dev *bus)
> +{
> +       if (!bus)
> +               return 0;
> +
> +       /* delete it from the list */
> +       list_del(&bus->link);
> +
> +       if (current_mii == bus)
> +               current_mii = NULL;
> +
> +       return 0;
> +}
> +
>  void mdio_list_devices(void)
>  {
>         struct list_head *entry;
> diff --git a/include/miiphy.h b/include/miiphy.h
> index 088797e..af12274 100644
> --- a/include/miiphy.h
> +++ b/include/miiphy.h
> @@ -59,7 +59,9 @@ struct phy_device *mdio_phydev_for_ethname(const char *devname);
>  void miiphy_listdev(void);
>
>  struct mii_dev *mdio_alloc(void);
> +void mdio_free(struct mii_dev *bus);
>  int mdio_register(struct mii_dev *bus);
> +int mdio_unregister(struct mii_dev *bus);
>  void mdio_list_devices(void);
>
>  #ifdef CONFIG_BITBANGMII
> --
> 1.8.2.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list