diff mbox series

[net-next,v2,1/3] net: mdio: Add helper functions for accessing MDIO devices

Message ID 20211022155914.3347672-1-sean.anderson@seco.com (mailing list archive)
State Accepted
Commit 0ebecb2644c834d8a69f07c5d44a130835950171
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2,1/3] net: mdio: Add helper functions for accessing MDIO devices | expand

Checks

Context Check Description
netdev/cover_letter warning Series does not have a cover letter
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 615 this patch: 615
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 516 this patch: 516
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Sean Anderson Oct. 22, 2021, 3:59 p.m. UTC
This adds some helpers for accessing non-phy MDIO devices. They are
analogous to phy_(read|write|modify), except that they take an mdio_device
and not a phy_device.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---
This patch was originally submitted as [1].

[1] https://lore.kernel.org/netdev/20211004191527.1610759-15-sean.anderson@seco.com/

(no changes since v1)

 include/linux/mdio.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Russell King (Oracle) Oct. 22, 2021, 4:14 p.m. UTC | #1
On Fri, Oct 22, 2021 at 11:59:12AM -0400, Sean Anderson wrote:
> This adds some helpers for accessing non-phy MDIO devices. They are
> analogous to phy_(read|write|modify), except that they take an mdio_device
> and not a phy_device.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks.
patchwork-bot+netdevbpf@kernel.org Oct. 24, 2021, 12:50 p.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 22 Oct 2021 11:59:12 -0400 you wrote:
> This adds some helpers for accessing non-phy MDIO devices. They are
> analogous to phy_(read|write|modify), except that they take an mdio_device
> and not a phy_device.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
> This patch was originally submitted as [1].
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/3] net: mdio: Add helper functions for accessing MDIO devices
    https://git.kernel.org/netdev/net-next/c/0ebecb2644c8
  - [net-next,v2,2/3] net: phylink: Convert some users of mdiobus_* to mdiodev_*
    https://git.kernel.org/netdev/net-next/c/c8fb89a7a7d1
  - [net-next,v2,3/3] net: Convert more users of mdiobus_* to mdiodev_*
    https://git.kernel.org/netdev/net-next/c/65aa371ea52a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index f622888a4ba8..9f3587a61e14 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -352,6 +352,30 @@  int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask,
 int mdiobus_modify_changed(struct mii_bus *bus, int addr, u32 regnum,
 			   u16 mask, u16 set);
 
+static inline int mdiodev_read(struct mdio_device *mdiodev, u32 regnum)
+{
+	return mdiobus_read(mdiodev->bus, mdiodev->addr, regnum);
+}
+
+static inline int mdiodev_write(struct mdio_device *mdiodev, u32 regnum,
+				u16 val)
+{
+	return mdiobus_write(mdiodev->bus, mdiodev->addr, regnum, val);
+}
+
+static inline int mdiodev_modify(struct mdio_device *mdiodev, u32 regnum,
+				 u16 mask, u16 set)
+{
+	return mdiobus_modify(mdiodev->bus, mdiodev->addr, regnum, mask, set);
+}
+
+static inline int mdiodev_modify_changed(struct mdio_device *mdiodev,
+					 u32 regnum, u16 mask, u16 set)
+{
+	return mdiobus_modify_changed(mdiodev->bus, mdiodev->addr, regnum,
+				      mask, set);
+}
+
 static inline u32 mdiobus_c45_addr(int devad, u16 regnum)
 {
 	return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum;