include/linux/mdio.h
Source file repositories/reference/linux-study-clean/include/linux/mdio.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mdio.h- Extension
.h- Size
- 23179 bytes
- Lines
- 706
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
uapi/linux/mdio.hlinux/bitfield.hlinux/mod_devicetable.h
Detected Declarations
struct gpio_descstruct mii_busstruct reset_controlstruct mdio_devicestruct mdio_driver_commonstruct mdio_driverstruct mdio_if_infostruct ethtool_cmdstruct ethtool_pauseparamenum mdio_mutex_lock_classfunction mdiodev_set_drvdatafunction mdio_device_getfunction mdio_device_putfunction mdio_phy_id_is_c45function mdio_phy_id_prtadfunction mdio_phy_id_devadfunction mdio45_ethtool_ksettings_get_npagefunction Capabilityfunction Advertismentfunction Advertisementfunction linkmode_adv_to_mii_10gbt_adv_tfunction mii_10gbt_stat_mod_linkmode_lpa_tfunction mii_t1_adv_l_mod_linkmode_tfunction mii_t1_adv_m_mod_linkmode_tfunction linkmode_adv_to_mii_t1_adv_l_tfunction linkmode_adv_to_mii_t1_adv_m_tfunction mii_eee_cap1_mod_linkmode_tfunction mii_eee_cap2_mod_linkmode_sup_tfunction mii_eee_cap2_mod_linkmode_adv_tfunction linkmode_to_mii_eee_cap1_tfunction linkmode_to_mii_eee_cap2_tfunction mii_10base_t1_adv_mod_linkmode_tfunction linkmode_adv_to_mii_10base_t1_tfunction mii_c73_mod_linkmodefunction __mdiodev_readfunction __mdiodev_writefunction __mdiodev_modifyfunction __mdiodev_modify_changedfunction mdiodev_readfunction mdiodev_writefunction mdiodev_modifyfunction mdiodev_modify_changedfunction __mdiodev_c45_readfunction __mdiodev_c45_writefunction mdiodev_c45_modifyfunction mdiodev_c45_modify_changedfunction mdiodev_c45_readfunction mdiodev_c45_write
Annotated Snippet
int (*bus_match)(struct device *dev, const struct device_driver *drv);
void (*device_free)(struct mdio_device *mdiodev);
void (*device_remove)(struct mdio_device *mdiodev);
/* Bus address of the MDIO device (0-31) */
int addr;
int flags;
int reset_state;
struct gpio_desc *reset_gpio;
struct reset_control *reset_ctrl;
unsigned int reset_assert_delay;
unsigned int reset_deassert_delay;
};
#define to_mdio_device(__dev) container_of_const(__dev, struct mdio_device, dev)
/* struct mdio_driver_common: Common to all MDIO drivers */
struct mdio_driver_common {
struct device_driver driver;
int flags;
};
#define MDIO_DEVICE_FLAG_PHY 1
#define to_mdio_common_driver(__drv_c) container_of_const(__drv_c, struct mdio_driver_common, \
driver)
/* struct mdio_driver: Generic MDIO driver */
struct mdio_driver {
struct mdio_driver_common mdiodrv;
/*
* Called during discovery. Used to set
* up device-specific structures, if any
*/
int (*probe)(struct mdio_device *mdiodev);
/* Clears up any memory if needed */
void (*remove)(struct mdio_device *mdiodev);
/* Quiesces the device on system shutdown, turns off interrupts etc */
void (*shutdown)(struct mdio_device *mdiodev);
};
#define to_mdio_driver(__drv_m) container_of_const(to_mdio_common_driver(__drv_m), \
struct mdio_driver, mdiodrv)
/* device driver data */
static inline void mdiodev_set_drvdata(struct mdio_device *mdio, void *data)
{
dev_set_drvdata(&mdio->dev, data);
}
static inline void *mdiodev_get_drvdata(struct mdio_device *mdio)
{
return dev_get_drvdata(&mdio->dev);
}
void mdio_device_free(struct mdio_device *mdiodev);
struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);
int mdio_device_register(struct mdio_device *mdiodev);
void mdio_device_remove(struct mdio_device *mdiodev);
void mdio_device_reset(struct mdio_device *mdiodev, int value);
int mdio_driver_register(struct mdio_driver *drv);
void mdio_driver_unregister(struct mdio_driver *drv);
static inline void mdio_device_get(struct mdio_device *mdiodev)
{
get_device(&mdiodev->dev);
}
static inline void mdio_device_put(struct mdio_device *mdiodev)
{
mdio_device_free(mdiodev);
}
static inline bool mdio_phy_id_is_c45(int phy_id)
{
return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
}
static inline __u16 mdio_phy_id_prtad(int phy_id)
{
return (phy_id & MDIO_PHY_ID_PRTAD) >> 5;
}
static inline __u16 mdio_phy_id_devad(int phy_id)
{
return phy_id & MDIO_PHY_ID_DEVAD;
}
Annotation
- Immediate include surface: `uapi/linux/mdio.h`, `linux/bitfield.h`, `linux/mod_devicetable.h`.
- Detected declarations: `struct gpio_desc`, `struct mii_bus`, `struct reset_control`, `struct mdio_device`, `struct mdio_driver_common`, `struct mdio_driver`, `struct mdio_if_info`, `struct ethtool_cmd`, `struct ethtool_pauseparam`, `enum mdio_mutex_lock_class`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.