Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59af81a1 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'module_phy_driver'



Johan Hovold says:

====================
net: phy: add module_phy_driver macro

Add module_phy_driver macro that can be used by PHY drivers that only
calls phy_driver_register or phy_drivers_register (and the corresponding
unregister functions) in their module init (and exit).

This allows us to eliminate a lot of boilerplate code.

Split in three patches (actual macro and two driver change classes) in
order to facilitate review.
====================

Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c647cc3f 50fd7150
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -1468,20 +1468,7 @@ static struct phy_driver amd_xgbe_phy_driver[] = {
	},
};

static int __init amd_xgbe_phy_init(void)
{
	return phy_drivers_register(amd_xgbe_phy_driver,
				    ARRAY_SIZE(amd_xgbe_phy_driver));
}

static void __exit amd_xgbe_phy_exit(void)
{
	phy_drivers_unregister(amd_xgbe_phy_driver,
			       ARRAY_SIZE(amd_xgbe_phy_driver));
}

module_init(amd_xgbe_phy_init);
module_exit(amd_xgbe_phy_exit);
module_phy_driver(amd_xgbe_phy_driver);

static struct mdio_device_id __maybe_unused amd_xgbe_phy_ids[] = {
	{ XGBE_PHY_ID, XGBE_PHY_MASK },
+3 −14
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ static int am79c_config_intr(struct phy_device *phydev)
	return err;
}

static struct phy_driver am79c_driver = {
static struct phy_driver am79c_driver[] = { {
	.phy_id		= PHY_ID_AM79C874,
	.name		= "AM79C874",
	.phy_id_mask	= 0xfffffff0,
@@ -73,20 +73,9 @@ static struct phy_driver am79c_driver = {
	.ack_interrupt	= am79c_ack_interrupt,
	.config_intr	= am79c_config_intr,
	.driver		= { .owner = THIS_MODULE,},
};

static int __init am79c_init(void)
{
	return phy_driver_register(&am79c_driver);
}

static void __exit am79c_exit(void)
{
	phy_driver_unregister(&am79c_driver);
}
} };

module_init(am79c_init);
module_exit(am79c_exit);
module_phy_driver(am79c_driver);

static struct mdio_device_id __maybe_unused amd_tbl[] = {
	{ PHY_ID_AM79C874, 0xfffffff0 },
+1 −13
Original line number Diff line number Diff line
@@ -352,19 +352,7 @@ static struct phy_driver at803x_driver[] = {
	},
} };

static int __init atheros_init(void)
{
	return phy_drivers_register(at803x_driver,
				    ARRAY_SIZE(at803x_driver));
}

static void __exit atheros_exit(void)
{
	phy_drivers_unregister(at803x_driver, ARRAY_SIZE(at803x_driver));
}

module_init(atheros_init);
module_exit(atheros_exit);
module_phy_driver(at803x_driver);

static struct mdio_device_id __maybe_unused atheros_tbl[] = {
	{ ATH8030_PHY_ID, 0xffffffef },
+1 −14
Original line number Diff line number Diff line
@@ -100,20 +100,7 @@ static struct phy_driver bcm63xx_driver[] = {
	.driver		= { .owner = THIS_MODULE },
} };

static int __init bcm63xx_phy_init(void)
{
	return phy_drivers_register(bcm63xx_driver,
		ARRAY_SIZE(bcm63xx_driver));
}

static void __exit bcm63xx_phy_exit(void)
{
	phy_drivers_unregister(bcm63xx_driver,
		ARRAY_SIZE(bcm63xx_driver));
}

module_init(bcm63xx_phy_init);
module_exit(bcm63xx_phy_exit);
module_phy_driver(bcm63xx_driver);

static struct mdio_device_id __maybe_unused bcm63xx_tbl[] = {
	{ 0x00406000, 0xfffffc00 },
+1 −14
Original line number Diff line number Diff line
@@ -416,20 +416,7 @@ static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = {
	{ }
};

static int __init bcm7xxx_phy_init(void)
{
	return phy_drivers_register(bcm7xxx_driver,
			ARRAY_SIZE(bcm7xxx_driver));
}

static void __exit bcm7xxx_phy_exit(void)
{
	phy_drivers_unregister(bcm7xxx_driver,
			ARRAY_SIZE(bcm7xxx_driver));
}

module_init(bcm7xxx_phy_init);
module_exit(bcm7xxx_phy_exit);
module_phy_driver(bcm7xxx_driver);

MODULE_DEVICE_TABLE(mdio, bcm7xxx_tbl);

Loading