U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@mailbox.org>
To: Paul Barker <paul.barker.ct@bp.renesas.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	u-boot@lists.denx.de
Cc: Christian Marangi <ansuelsmth@gmail.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jerome Forissier <jerome.forissier@linaro.org>,
	Jim Liu <JJLIU0@nuvoton.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Mario Six <mario.six@gdsys.cc>,
	Michal Simek <michal.simek@amd.com>,
	Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
	Ramon Fried <rfried.dev@gmail.com>,
	Simon Glass <sjg@chromium.org>,
	Sughosh Ganu <sughosh.ganu@linaro.org>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v3 15/23] net: ravb: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks
Date: Tue, 4 Mar 2025 00:13:30 +0100	[thread overview]
Message-ID: <2fdff05d-32c8-4267-83ce-e04e484ea6ac@mailbox.org> (raw)
In-Reply-To: <b97cc5fc-b622-419c-a556-655de50a4312@bp.renesas.com>

On 2/28/25 2:28 PM, Paul Barker wrote:
> On 22/02/2025 20:33, Marek Vasut wrote:
>> Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks
>> currently listed in bb_miiphy_buses[] array. This is a temporary
>> duplication of assignment to avoid breakage, which will be removed
>> in follow up patches. At this point, the bb_miiphy callbacks can
>> reach these accessors by doing container_of() on struct mii_dev.
>>
>> Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
>> ---
>> Cc: Christian Marangi <ansuelsmth@gmail.com>
>> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>> Cc: Jerome Forissier <jerome.forissier@linaro.org>
>> Cc: Jim Liu <JJLIU0@nuvoton.com>
>> Cc: Joe Hershberger <joe.hershberger@ni.com>
>> Cc: Mario Six <mario.six@gdsys.cc>
>> Cc: Michal Simek <michal.simek@amd.com>
>> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
>> Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
>> Cc: Ramon Fried <rfried.dev@gmail.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
>> Cc: Tom Rini <trini@konsulko.com>
>> Cc: u-boot@lists.denx.de
>> ---
>> V2: No change
>> V3: Add RB from Paul
>> ---
>>   drivers/net/ravb.c | 19 ++++++++++++++++---
>>   1 file changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
>> index 381cf250ea2..0018b694ec1 100644
>> --- a/drivers/net/ravb.c
>> +++ b/drivers/net/ravb.c
>> @@ -553,6 +553,7 @@ static int ravb_probe(struct udevice *dev)
>>   {
>>   	struct eth_pdata *pdata = dev_get_plat(dev);
>>   	struct ravb_priv *eth = dev_get_priv(dev);
>> +	struct bb_miiphy_bus *bb_miiphy;
>>   	struct mii_dev *mdiodev;
>>   	void __iomem *iobase;
>>   	int ret;
>> @@ -564,17 +565,29 @@ static int ravb_probe(struct udevice *dev)
>>   	if (ret < 0)
>>   		goto err_mdio_alloc;
>>   
>> -	mdiodev = mdio_alloc();
>> -	if (!mdiodev) {
>> +	bb_miiphy = bb_miiphy_alloc();
>> +	if (!bb_miiphy) {
>>   		ret = -ENOMEM;
>>   		goto err_mdio_alloc;
>>   	}
>>   
>> +	mdiodev = &bb_miiphy->mii;
>> +
>>   	mdiodev->read = bb_miiphy_read;
>>   	mdiodev->write = bb_miiphy_write;
>>   	bb_miiphy_buses[0].priv = eth;
>>   	snprintf(mdiodev->name, sizeof(mdiodev->name), dev->name);
>>   
>> +	/* Copy the bus accessors, name and private data */
>> +	bb_miiphy->mdio_active = ravb_bb_mdio_active;
>> +	bb_miiphy->mdio_tristate = ravb_bb_mdio_tristate;
>> +	bb_miiphy->set_mdio = ravb_bb_set_mdio;
>> +	bb_miiphy->get_mdio = ravb_bb_get_mdio;
>> +	bb_miiphy->set_mdc = ravb_bb_set_mdc;
>> +	bb_miiphy->delay = ravb_bb_delay;
>> +	strlcpy(bb_miiphy->name, "ravb", MDIO_NAME_LEN);
>> +	bb_miiphy->priv = eth;
>> +
>>   	ret = mdio_register(mdiodev);
>>   	if (ret < 0)
>>   		goto err_mdio_register;
>> @@ -599,7 +612,7 @@ static int ravb_probe(struct udevice *dev)
>>   err_mdio_reset:
>>   	clk_release_bulk(&eth->clks);
>>   err_mdio_register:
>> -	mdio_free(mdiodev);
>> +	bb_miiphy_free(bb_miiphy);
>>   err_mdio_alloc:
>>   	unmap_physmem(eth->iobase, MAP_NOCACHE);
>>   	return ret;
> 
> Marek,
> 
> I've rebased my RZ/G2L Ethernet patches on top of this series and as
> part of tidying things up I spotted an issue that I'd missed -
> ravb_remove() still calls mdio_free(eth->bus). The error paths in the
> probe functions have been converted but the remove functions were
> missed. It should instead use something like:
> 
>      struct bb_miiphy_bus *bus = container_of(eth->bus, struct bb_miiphy_bus, mii);
>      bb_miiphy_free(bus);
> 
> The same applies to the following two patches (sh_eth.c & designware.c).
This should be fixed in

[PATCH 01/11] net: miiphybb: Split off struct bb_miiphy_bus_ops

  reply	other threads:[~2025-03-03 23:13 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-22 20:33 [PATCH v3 00/23] net: miiphybb: Get rid of global bb_miiphy_buses[] Marek Vasut
2025-02-22 20:33 ` [PATCH v3 01/23] net: ravb: Drop empty init callback Marek Vasut
2025-02-22 20:33 ` [PATCH v3 02/23] net: sh_eth: " Marek Vasut
2025-02-22 20:33 ` [PATCH v3 03/23] net: designware: Drop NULL priv assignment Marek Vasut
2025-02-22 20:33 ` [PATCH v3 04/23] net: ravb: Reorder bb_miiphy functions Marek Vasut
2025-02-22 20:33 ` [PATCH v3 05/23] net: sh_eth: " Marek Vasut
2025-02-26 17:08   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 06/23] arm: mvebu: a38x: " Marek Vasut
2025-02-26 17:09   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 07/23] net: designware: " Marek Vasut
2025-02-26 17:10   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 08/23] arm: mvebu: a38x: Call bb_miiphy init directly in driver probe Marek Vasut
2025-02-26 17:12   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 09/23] net: miiphybb: Drop bb_miiphy_init() and .init callback Marek Vasut
2025-02-22 20:33 ` [PATCH v3 10/23] net: designware: Drop bus index Marek Vasut
2025-02-26 17:15   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 11/23] net: designware: Extract bbmiiphy initialization into dedicated function Marek Vasut
2025-02-26 17:16   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 12/23] net: miiphy: Introduce mdio_init() Marek Vasut
2025-02-22 20:33 ` [PATCH v3 13/23] net: miiphybb: Introduce bb_miiphy_alloc()/bb_miiphy_free() wrappers Marek Vasut
2025-02-22 20:33 ` [PATCH v3 14/23] arm: mvebu: a38x: Allocate bb_miiphy using bb_miiphy_alloc() and fill in callbacks Marek Vasut
2025-02-26 17:18   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 15/23] net: ravb: " Marek Vasut
2025-02-28 13:28   ` Paul Barker
2025-03-03 23:13     ` Marek Vasut [this message]
2025-02-22 20:33 ` [PATCH v3 16/23] net: sh_eth: " Marek Vasut
2025-02-26 17:19   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 17/23] net: designware: " Marek Vasut
2025-02-26 17:19   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 18/23] net: miiphybb: Use container_of() in bb_miiphy_getbus() Marek Vasut
2025-02-22 20:33 ` [PATCH v3 19/23] net: miiphybb: Drop name field from struct bb_miiphy_bus Marek Vasut
2025-02-22 20:33 ` [PATCH v3 20/23] arm: mvebu: a38x: Drop use of miiphy_get_dev_by_name() Marek Vasut
2025-02-26 17:20   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 21/23] net: ravb: " Marek Vasut
2025-02-22 20:33 ` [PATCH v3 22/23] net: sh_eth: " Marek Vasut
2025-02-26 17:20   ` Paul Barker
2025-02-22 20:33 ` [PATCH v3 23/23] net: miiphybb: Drop bb_miiphy_buses and bb_miiphy_buses_num Marek Vasut
2025-02-26  8:51 ` [PATCH v3 00/23] net: miiphybb: Get rid of global bb_miiphy_buses[] Paul Barker
2025-02-26 12:43   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fdff05d-32c8-4267-83ce-e04e484ea6ac@mailbox.org \
    --to=marek.vasut@mailbox.org \
    --cc=JJLIU0@nuvoton.com \
    --cc=ansuelsmth@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=iwamatsu@nigauri.org \
    --cc=jerome.forissier@linaro.org \
    --cc=joe.hershberger@ni.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mario.six@gdsys.cc \
    --cc=michal.simek@amd.com \
    --cc=paul.barker.ct@bp.renesas.com \
    --cc=rfried.dev@gmail.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox