Return value of mii_bus->write()
Subsystems (2)
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
Quoted 12 lines · Buday Csaba
I am preparing a patch to eliminate kernel-doc warnings in
mdio_device.candmdio_bus.cI have ran into an ambiguity: what is
mii_bus->write()supposed to return on success?Documentation/networking/phy.txtdoes not give any information about it, neither does the kdoc ininclude/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 fromwrite().
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.
Quoted 7 lines
Is there any other implementation that allows positive return values for success? Should it be mentioned in kernel-doc?
Thanks,
Csaba
Quoted 8 lines · Heiner Kallweit
Quoted 7 lines · Buday Csaba
I am preparing a patch to eliminate kernel-doc warnings in
mdio_device.candmdio_bus.cI have ran into an ambiguity: what is
mii_bus->write()supposed to return on success?Documentation/networking/phy.txtdoes not give any information about it, neither does the kdoc ininclude/linux/phy.h.
Quoted 9 lines
Quoted 5 lines
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 fromwrite().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