* [Question] Return value of mii_bus->write()
@ 2025-11-21 6:31 Buday Csaba
2025-11-21 6:53 ` Heiner Kallweit
0 siblings, 1 reply; 3+ messages in thread
From: Buday Csaba @ 2025-11-21 6:31 UTC (permalink / raw)
To: netdev
I am preparing a patch to eliminate kernel-doc warnings in mdio_device.c
and mdio_bus.c
I have ran into an ambiguity: what is mii_bus->write() supposed to
return on success? Documentation/networking/phy.txt does not give any
information about it, neither does the kdoc in include/linux/phy.h.
It is clear that 0 is treated as success, and a negative indicates
failure. The reference implementation also follows this convention.
But the code in mdio_bus.c, for example: __mdiobus_modify_changed(),
seems to also expect positive return values from write().
Is there any other implementation that allows positive return
values for success? Should it be mentioned in kernel-doc?
Thanks,
Csaba
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question] Return value of mii_bus->write()
2025-11-21 6:31 [Question] Return value of mii_bus->write() Buday Csaba
@ 2025-11-21 6:53 ` Heiner Kallweit
2025-11-21 7:15 ` Buday Csaba
0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2025-11-21 6:53 UTC (permalink / raw)
To: Buday Csaba, netdev
On 11/21/2025 7:31 AM, Buday Csaba wrote:
> I am preparing a patch to eliminate kernel-doc warnings in mdio_device.c
> and mdio_bus.c
>
> I have ran into an ambiguity: what is mii_bus->write() supposed to
> return on success? Documentation/networking/phy.txt does not give any
> information about it, neither does the kdoc in include/linux/phy.h.
>
> It is clear that 0 is treated as success, and a negative indicates
> failure. The reference implementation also follows this convention.
> But the code in mdio_bus.c, for example: __mdiobus_modify_changed(),
> seems to also expect positive return values from write().
>
I think you misread the code. __mdiobus_modify_changed() returns
a positive value in case new and old value differ, but __mdiobus_write()
never returns a positive value.
> Is there any other implementation that allows positive return
> values for success? Should it be mentioned in kernel-doc?
>
> Thanks,
> Csaba
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [Question] Return value of mii_bus->write()
2025-11-21 6:53 ` Heiner Kallweit
@ 2025-11-21 7:15 ` Buday Csaba
0 siblings, 0 replies; 3+ messages in thread
From: Buday Csaba @ 2025-11-21 7:15 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: netdev
On Fri, Nov 21, 2025 at 07:53:21AM +0100, Heiner Kallweit wrote:
> On 11/21/2025 7:31 AM, Buday Csaba wrote:
> > I am preparing a patch to eliminate kernel-doc warnings in mdio_device.c
> > and mdio_bus.c
> >
> > I have ran into an ambiguity: what is mii_bus->write() supposed to
> > return on success? Documentation/networking/phy.txt does not give any
> > information about it, neither does the kdoc in include/linux/phy.h.
> >
> > It is clear that 0 is treated as success, and a negative indicates
> > failure. The reference implementation also follows this convention.
> > But the code in mdio_bus.c, for example: __mdiobus_modify_changed(),
> > seems to also expect positive return values from write().
> >
> I think you misread the code. __mdiobus_modify_changed() returns
> a positive value in case new and old value differ, but __mdiobus_write()
> never returns a positive value.
>
That is right, thank you!
Csaba
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-21 7:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 6:31 [Question] Return value of mii_bus->write() Buday Csaba
2025-11-21 6:53 ` Heiner Kallweit
2025-11-21 7:15 ` Buday Csaba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).