diff mbox series

[38/41] net: phy: Drop static phy_drivers list

Message ID 20230319170317.27711-38-marek.vasut+renesas@mailbox.org
State Accepted
Commit 8728d4c032571a8569af14d09d18bf444c30e446
Delegated to: Ramon Fried
Headers show
Series [01/41] net: phy: aquantia: Staticize PHY driver entries | expand

Commit Message

Marek Vasut March 19, 2023, 5:03 p.m. UTC
The static phy_drivers list is superseded by linker list of struct phy_drivers
now that all drivers have been converted to the later. Drop the phy_drivers
list as well as list_head from struct phy_driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: "Ariel D'Alessandro" <ariel.dalessandro@collabora.com>
Cc: "Cédric Le Goater" <clg@kaod.org>
Cc: "Marek Behún" <kabel@kernel.org>
Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
Cc: Haolin Li <li.haolin@qq.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Josua Mayer <josua@solid-run.com>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Nate Drude <nate.d@variscite.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Radu Pirea <radu-nicolae.pirea@oss.nxp.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Cc: Stefan Roese <sr@denx.de>
Cc: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: u-boot-amlogic@groups.io
---
 drivers/net/phy/phy.c | 26 ++------------------------
 include/phy.h         |  2 --
 2 files changed, 2 insertions(+), 26 deletions(-)

Comments

Ramon Fried April 1, 2023, 6:47 p.m. UTC | #1
On Sun, Mar 19, 2023 at 7:05 PM Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> The static phy_drivers list is superseded by linker list of struct phy_drivers
> now that all drivers have been converted to the later. Drop the phy_drivers
> list as well as list_head from struct phy_driver.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: "Ariel D'Alessandro" <ariel.dalessandro@collabora.com>
> Cc: "Cédric Le Goater" <clg@kaod.org>
> Cc: "Marek Behún" <kabel@kernel.org>
> Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
> Cc: Haolin Li <li.haolin@qq.com>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Josua Mayer <josua@solid-run.com>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Michael Trimarchi <michael@amarulasolutions.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Nate Drude <nate.d@variscite.com>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Radu Pirea <radu-nicolae.pirea@oss.nxp.com>
> Cc: Ramon Fried <rfried.dev@gmail.com>
> Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> Cc: Stefan Roese <sr@denx.de>
> Cc: T Karthik Reddy <t.karthik.reddy@xilinx.com>
> Cc: Tim Harvey <tharvey@gateworks.com>
> Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
> Cc: u-boot-amlogic@groups.io
> ---
>  drivers/net/phy/phy.c | 26 ++------------------------
>  include/phy.h         |  2 --
>  2 files changed, 2 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index bd9c576f459..f4aa1f664cb 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -463,8 +463,6 @@ U_BOOT_PHY_DRIVER(genphy) = {
>         .shutdown       = genphy_shutdown,
>  };
>
> -static LIST_HEAD(phy_drivers);
> -
>  #ifdef CONFIG_NEEDS_MANUAL_RELOC
>  static void phy_drv_reloc(struct phy_driver *drv)
>  {
> @@ -493,16 +491,6 @@ int phy_init(void)
>         const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
>         struct phy_driver *drv, *ll_entry;
>
> -       /*
> -        * The pointers inside phy_drivers also needs to be updated incase of
> -        * manual reloc, without which these points to some invalid
> -        * pre reloc address and leads to invalid accesses, hangs.
> -        */
> -       struct list_head *head = &phy_drivers;
> -
> -       head->next = (void *)head->next + gd->reloc_off;
> -       head->prev = (void *)head->prev + gd->reloc_off;
> -
>         /* Perform manual relocation on linker list based PHY drivers */
>         ll_entry = ll_entry_start(struct phy_driver, phy_driver);
>         for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++)
> @@ -514,9 +502,6 @@ int phy_init(void)
>
>  int phy_register(struct phy_driver *drv)
>  {
> -       INIT_LIST_HEAD(&drv->list);
> -       list_add_tail(&drv->list, &phy_drivers);
> -
>  #ifdef CONFIG_NEEDS_MANUAL_RELOC
>         phy_drv_reloc(drv);
>  #endif
> @@ -575,16 +560,9 @@ static struct phy_driver *generic_for_phy(struct phy_device *phydev)
>  static struct phy_driver *get_phy_driver(struct phy_device *phydev)
>  {
>         const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
> -       struct phy_driver *ll_entry;
> -       struct list_head *entry;
>         int phy_id = phydev->phy_id;
> -       struct phy_driver *drv = NULL;
> -
> -       list_for_each(entry, &phy_drivers) {
> -               drv = list_entry(entry, struct phy_driver, list);
> -               if ((drv->uid & drv->mask) == (phy_id & drv->mask))
> -                       return drv;
> -       }
> +       struct phy_driver *ll_entry;
> +       struct phy_driver *drv;
>
>         ll_entry = ll_entry_start(struct phy_driver, phy_driver);
>         for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++)
> diff --git a/include/phy.h b/include/phy.h
> index 5f4967cb150..5e8ae5e29aa 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -125,8 +125,6 @@ struct phy_driver {
>         int (*write_mmd)(struct phy_device *phydev, int devad, int reg,
>                          u16 val);
>
> -       struct list_head list;
> -
>         /* driver private data */
>         ulong data;
>  };
> --
> 2.39.2
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index bd9c576f459..f4aa1f664cb 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -463,8 +463,6 @@  U_BOOT_PHY_DRIVER(genphy) = {
 	.shutdown	= genphy_shutdown,
 };
 
-static LIST_HEAD(phy_drivers);
-
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 static void phy_drv_reloc(struct phy_driver *drv)
 {
@@ -493,16 +491,6 @@  int phy_init(void)
 	const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
 	struct phy_driver *drv, *ll_entry;
 
-	/*
-	 * The pointers inside phy_drivers also needs to be updated incase of
-	 * manual reloc, without which these points to some invalid
-	 * pre reloc address and leads to invalid accesses, hangs.
-	 */
-	struct list_head *head = &phy_drivers;
-
-	head->next = (void *)head->next + gd->reloc_off;
-	head->prev = (void *)head->prev + gd->reloc_off;
-
 	/* Perform manual relocation on linker list based PHY drivers */
 	ll_entry = ll_entry_start(struct phy_driver, phy_driver);
 	for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++)
@@ -514,9 +502,6 @@  int phy_init(void)
 
 int phy_register(struct phy_driver *drv)
 {
-	INIT_LIST_HEAD(&drv->list);
-	list_add_tail(&drv->list, &phy_drivers);
-
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	phy_drv_reloc(drv);
 #endif
@@ -575,16 +560,9 @@  static struct phy_driver *generic_for_phy(struct phy_device *phydev)
 static struct phy_driver *get_phy_driver(struct phy_device *phydev)
 {
 	const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
-	struct phy_driver *ll_entry;
-	struct list_head *entry;
 	int phy_id = phydev->phy_id;
-	struct phy_driver *drv = NULL;
-
-	list_for_each(entry, &phy_drivers) {
-		drv = list_entry(entry, struct phy_driver, list);
-		if ((drv->uid & drv->mask) == (phy_id & drv->mask))
-			return drv;
-	}
+	struct phy_driver *ll_entry;
+	struct phy_driver *drv;
 
 	ll_entry = ll_entry_start(struct phy_driver, phy_driver);
 	for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++)
diff --git a/include/phy.h b/include/phy.h
index 5f4967cb150..5e8ae5e29aa 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -125,8 +125,6 @@  struct phy_driver {
 	int (*write_mmd)(struct phy_device *phydev, int devad, int reg,
 			 u16 val);
 
-	struct list_head list;
-
 	/* driver private data */
 	ulong data;
 };