Skip to content

Commit

Permalink
dt/net: Eliminate users of of_platform_{,un}register_driver
Browse files Browse the repository at this point in the history
Get rid of users of of_platform_driver in drivers/net.  The
of_platform_{,un}register_driver functions are going away, so the
users need to be converted to using the platform_bus_type directly.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
Grant Likely committed Feb 28, 2011
1 parent f07eb22 commit 7488876
Show file tree
Hide file tree
Showing 26 changed files with 123 additions and 128 deletions.
15 changes: 9 additions & 6 deletions drivers/net/can/mscan/mpc5xxx_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,9 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
}
#endif /* CONFIG_PPC_MPC512x */

static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev,
const struct of_device_id *id)
static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
{
struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
struct mpc5xxx_can_data *data;
struct device_node *np = ofdev->dev.of_node;
struct net_device *dev;
struct mscan_priv *priv;
Expand All @@ -259,6 +258,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev,
int irq, mscan_clksrc = 0;
int err = -ENOMEM;

if (!ofdev->dev.of_match)
return -EINVAL;
data = (struct mpc5xxx_can_data *)of_dev->dev.of_match->data;

base = of_iomap(np, 0);
if (!base) {
dev_err(&ofdev->dev, "couldn't ioremap\n");
Expand Down Expand Up @@ -391,7 +394,7 @@ static struct of_device_id __devinitdata mpc5xxx_can_table[] = {
{},
};

static struct of_platform_driver mpc5xxx_can_driver = {
static struct platform_driver mpc5xxx_can_driver = {
.driver = {
.name = "mpc5xxx_can",
.owner = THIS_MODULE,
Expand All @@ -407,13 +410,13 @@ static struct of_platform_driver mpc5xxx_can_driver = {

static int __init mpc5xxx_can_init(void)
{
return of_register_platform_driver(&mpc5xxx_can_driver);
return platform_driver_register(&mpc5xxx_can_driver);
}
module_init(mpc5xxx_can_init);

static void __exit mpc5xxx_can_exit(void)
{
return of_unregister_platform_driver(&mpc5xxx_can_driver);
platform_driver_unregister(&mpc5xxx_can_driver);
};
module_exit(mpc5xxx_can_exit);

Expand Down
9 changes: 4 additions & 5 deletions drivers/net/can/sja1000/sja1000_of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ static int __devexit sja1000_ofp_remove(struct platform_device *ofdev)
return 0;
}

static int __devinit sja1000_ofp_probe(struct platform_device *ofdev,
const struct of_device_id *id)
static int __devinit sja1000_ofp_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct net_device *dev;
Expand Down Expand Up @@ -210,7 +209,7 @@ static struct of_device_id __devinitdata sja1000_ofp_table[] = {
};
MODULE_DEVICE_TABLE(of, sja1000_ofp_table);

static struct of_platform_driver sja1000_ofp_driver = {
static struct platform_driver sja1000_ofp_driver = {
.driver = {
.owner = THIS_MODULE,
.name = DRV_NAME,
Expand All @@ -222,12 +221,12 @@ static struct of_platform_driver sja1000_ofp_driver = {

static int __init sja1000_ofp_init(void)
{
return of_register_platform_driver(&sja1000_ofp_driver);
return platform_driver_register(&sja1000_ofp_driver);
}
module_init(sja1000_ofp_init);

static void __exit sja1000_ofp_exit(void)
{
return of_unregister_platform_driver(&sja1000_ofp_driver);
return platform_driver_unregister(&sja1000_ofp_driver);
};
module_exit(sja1000_ofp_exit);
13 changes: 6 additions & 7 deletions drivers/net/fec_mpc52xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,7 @@ static const struct net_device_ops mpc52xx_fec_netdev_ops = {
/* OF Driver */
/* ======================================================================== */

static int __devinit
mpc52xx_fec_probe(struct platform_device *op, const struct of_device_id *match)
static int __devinit mpc52xx_fec_probe(struct platform_device *op)
{
int rv;
struct net_device *ndev;
Expand Down Expand Up @@ -1049,7 +1048,7 @@ static struct of_device_id mpc52xx_fec_match[] = {

MODULE_DEVICE_TABLE(of, mpc52xx_fec_match);

static struct of_platform_driver mpc52xx_fec_driver = {
static struct platform_driver mpc52xx_fec_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
Expand All @@ -1073,21 +1072,21 @@ mpc52xx_fec_init(void)
{
#ifdef CONFIG_FEC_MPC52xx_MDIO
int ret;
ret = of_register_platform_driver(&mpc52xx_fec_mdio_driver);
ret = platform_driver_register(&mpc52xx_fec_mdio_driver);
if (ret) {
printk(KERN_ERR DRIVER_NAME ": failed to register mdio driver\n");
return ret;
}
#endif
return of_register_platform_driver(&mpc52xx_fec_driver);
return platform_driver_register(&mpc52xx_fec_driver);
}

static void __exit
mpc52xx_fec_exit(void)
{
of_unregister_platform_driver(&mpc52xx_fec_driver);
platform_driver_unregister(&mpc52xx_fec_driver);
#ifdef CONFIG_FEC_MPC52xx_MDIO
of_unregister_platform_driver(&mpc52xx_fec_mdio_driver);
platform_driver_unregister(&mpc52xx_fec_mdio_driver);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/fec_mpc52xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,6 @@ struct mpc52xx_fec {
#define FEC_XMIT_FSM_ENABLE_CRC 0x01000000


extern struct of_platform_driver mpc52xx_fec_mdio_driver;
extern struct platform_driver mpc52xx_fec_mdio_driver;

#endif /* __DRIVERS_NET_MPC52XX_FEC_H__ */
5 changes: 2 additions & 3 deletions drivers/net/fec_mpc52xx_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ static int mpc52xx_fec_mdio_write(struct mii_bus *bus, int phy_id, int reg,
data | FEC_MII_WRITE_FRAME);
}

static int mpc52xx_fec_mdio_probe(struct platform_device *of,
const struct of_device_id *match)
static int mpc52xx_fec_mdio_probe(struct platform_device *of)
{
struct device *dev = &of->dev;
struct device_node *np = of->dev.of_node;
Expand Down Expand Up @@ -145,7 +144,7 @@ static struct of_device_id mpc52xx_fec_mdio_match[] = {
};
MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match);

struct of_platform_driver mpc52xx_fec_mdio_driver = {
struct platform_driver mpc52xx_fec_mdio_driver = {
.driver = {
.name = "mpc5200b-fec-phy",
.owner = THIS_MODULE,
Expand Down
16 changes: 9 additions & 7 deletions drivers/net/fs_enet/fs_enet-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,7 @@ static const struct net_device_ops fs_enet_netdev_ops = {
#endif
};

static int __devinit fs_enet_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit fs_enet_probe(struct platform_device *ofdev)
{
struct net_device *ndev;
struct fs_enet_private *fep;
Expand All @@ -1008,11 +1007,14 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev,
const u8 *mac_addr;
int privsize, len, ret = -ENODEV;

if (!ofdev->dev.of_match)
return -EINVAL;

fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
if (!fpi)
return -ENOMEM;

if (!IS_FEC(match)) {
if (!IS_FEC(ofdev->dev.of_match)) {
data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
if (!data || len != 4)
goto out_free_fpi;
Expand Down Expand Up @@ -1047,7 +1049,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev,
fep->dev = &ofdev->dev;
fep->ndev = ndev;
fep->fpi = fpi;
fep->ops = match->data;
fep->ops = ofdev->dev.of_match->data;

ret = fep->ops->setup_data(ndev);
if (ret)
Expand Down Expand Up @@ -1156,7 +1158,7 @@ static struct of_device_id fs_enet_match[] = {
};
MODULE_DEVICE_TABLE(of, fs_enet_match);

static struct of_platform_driver fs_enet_driver = {
static struct platform_driver fs_enet_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "fs_enet",
Expand All @@ -1168,12 +1170,12 @@ static struct of_platform_driver fs_enet_driver = {

static int __init fs_init(void)
{
return of_register_platform_driver(&fs_enet_driver);
return platform_driver_register(&fs_enet_driver);
}

static void __exit fs_cleanup(void)
{
of_unregister_platform_driver(&fs_enet_driver);
platform_driver_unregister(&fs_enet_driver);
}

#ifdef CONFIG_NET_POLL_CONTROLLER
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/fs_enet/mii-bitbang.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
return 0;
}

static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
{
struct mii_bus *new_bus;
struct bb_info *bitbang;
Expand Down Expand Up @@ -223,7 +222,7 @@ static struct of_device_id fs_enet_mdio_bb_match[] = {
};
MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match);

static struct of_platform_driver fs_enet_bb_mdio_driver = {
static struct platform_driver fs_enet_bb_mdio_driver = {
.driver = {
.name = "fsl-bb-mdio",
.owner = THIS_MODULE,
Expand All @@ -235,12 +234,12 @@ static struct of_platform_driver fs_enet_bb_mdio_driver = {

static int fs_enet_mdio_bb_init(void)
{
return of_register_platform_driver(&fs_enet_bb_mdio_driver);
return platform_driver_register(&fs_enet_bb_mdio_driver);
}

static void fs_enet_mdio_bb_exit(void)
{
of_unregister_platform_driver(&fs_enet_bb_mdio_driver);
platform_driver_unregister(&fs_enet_bb_mdio_driver);
}

module_init(fs_enet_mdio_bb_init);
Expand Down
15 changes: 9 additions & 6 deletions drivers/net/fs_enet/mii-fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,18 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus)
return 0;
}

static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
{
struct resource res;
struct mii_bus *new_bus;
struct fec_info *fec;
int (*get_bus_freq)(struct device_node *) = match->data;
int (*get_bus_freq)(struct device_node *);
int ret = -ENOMEM, clock, speed;

if (!ofdev->dev.of_match)
return -EINVAL;
get_bus_freq = ofdev->dev.of_match->data;

new_bus = mdiobus_alloc();
if (!new_bus)
goto out;
Expand Down Expand Up @@ -221,7 +224,7 @@ static struct of_device_id fs_enet_mdio_fec_match[] = {
};
MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match);

static struct of_platform_driver fs_enet_fec_mdio_driver = {
static struct platform_driver fs_enet_fec_mdio_driver = {
.driver = {
.name = "fsl-fec-mdio",
.owner = THIS_MODULE,
Expand All @@ -233,12 +236,12 @@ static struct of_platform_driver fs_enet_fec_mdio_driver = {

static int fs_enet_mdio_fec_init(void)
{
return of_register_platform_driver(&fs_enet_fec_mdio_driver);
return platform_driver_register(&fs_enet_fec_mdio_driver);
}

static void fs_enet_mdio_fec_exit(void)
{
of_unregister_platform_driver(&fs_enet_fec_mdio_driver);
platform_driver_unregister(&fs_enet_fec_mdio_driver);
}

module_init(fs_enet_mdio_fec_init);
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/fsl_pq_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
#endif


static int fsl_pq_mdio_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int fsl_pq_mdio_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct device_node *tbi;
Expand Down Expand Up @@ -471,7 +470,7 @@ static struct of_device_id fsl_pq_mdio_match[] = {
};
MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);

static struct of_platform_driver fsl_pq_mdio_driver = {
static struct platform_driver fsl_pq_mdio_driver = {
.driver = {
.name = "fsl-pq_mdio",
.owner = THIS_MODULE,
Expand All @@ -483,13 +482,13 @@ static struct of_platform_driver fsl_pq_mdio_driver = {

int __init fsl_pq_mdio_init(void)
{
return of_register_platform_driver(&fsl_pq_mdio_driver);
return platform_driver_register(&fsl_pq_mdio_driver);
}
module_init(fsl_pq_mdio_init);

void fsl_pq_mdio_exit(void)
{
of_unregister_platform_driver(&fsl_pq_mdio_driver);
platform_driver_unregister(&fsl_pq_mdio_driver);
}
module_exit(fsl_pq_mdio_exit);
MODULE_LICENSE("GPL");
12 changes: 5 additions & 7 deletions drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id);
static void adjust_link(struct net_device *dev);
static void init_registers(struct net_device *dev);
static int init_phy(struct net_device *dev);
static int gfar_probe(struct platform_device *ofdev,
const struct of_device_id *match);
static int gfar_probe(struct platform_device *ofdev);
static int gfar_remove(struct platform_device *ofdev);
static void free_skb_resources(struct gfar_private *priv);
static void gfar_set_multi(struct net_device *dev);
Expand Down Expand Up @@ -957,8 +956,7 @@ static void gfar_detect_errata(struct gfar_private *priv)

/* Set up the ethernet device structure, private data,
* and anything else we need before we start */
static int gfar_probe(struct platform_device *ofdev,
const struct of_device_id *match)
static int gfar_probe(struct platform_device *ofdev)
{
u32 tempval;
struct net_device *dev = NULL;
Expand Down Expand Up @@ -3256,7 +3254,7 @@ static struct of_device_id gfar_match[] =
MODULE_DEVICE_TABLE(of, gfar_match);

/* Structure for a device driver */
static struct of_platform_driver gfar_driver = {
static struct platform_driver gfar_driver = {
.driver = {
.name = "fsl-gianfar",
.owner = THIS_MODULE,
Expand All @@ -3269,12 +3267,12 @@ static struct of_platform_driver gfar_driver = {

static int __init gfar_init(void)
{
return of_register_platform_driver(&gfar_driver);
return platform_driver_register(&gfar_driver);
}

static void __exit gfar_exit(void)
{
of_unregister_platform_driver(&gfar_driver);
platform_driver_unregister(&gfar_driver);
}

module_init(gfar_init);
Expand Down
Loading

0 comments on commit 7488876

Please sign in to comment.