2011-02-23 04:33:41

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 00/15] Remove last remains of of_platform_bus_type

This series finally removes all the remaining users of the
of_platform_{,un}register_driver() functions that used to be sued with
the of_platform_bus_type. All the cool kids are using the platform
bus now. At the end of this series the ugly stop-gap shim code is finally
removed.

g.

---

Grant Likely (15):
dt/powerpc: move of_bus_type infrastructure to ibmebus
dt: add a match table pointer to struct device
dt/powerpc: Eliminate users of of_platform_{,un}register_driver
dt/sparc: Eliminate users of of_platform_{,un}register_driver
leds/leds-gpio: merge platform_driver with of_platform_driver
dt: xilinx_hwicap: merge platform and of_platform driver bindings
dt: uartlite: merge platform and of_platform driver bindings
dt/spi: Eliminate users of of_platform_{,un}register_driver
dt/sound: Eliminate users of of_platform_{,un}register_driver
dt/net: Eliminate users of of_platform_{,un}register_driver
dt/video: Eliminate users of of_platform_{,un}register_driver
dt/usb: Eliminate users of of_platform_{,un}register_driver
dt/serial: Eliminate users of of_platform_{,un}register_driver
dt: Eliminate of_platform_{,un}register_driver
dt: eliminate of_platform_driver shim code


arch/powerpc/kernel/ibmebus.c | 404 ++++++++++++++++++++++
arch/powerpc/kernel/of_platform.c | 7
arch/powerpc/platforms/52xx/mpc52xx_gpio.c | 14 -
arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 10 -
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 11 -
arch/powerpc/platforms/82xx/ep8248e.c | 7
arch/powerpc/platforms/83xx/suspend.c | 14 -
arch/powerpc/platforms/cell/axon_msi.c | 11 -
arch/powerpc/platforms/pasemi/gpio_mdio.c | 9
arch/powerpc/sysdev/axonram.c | 11 -
arch/powerpc/sysdev/bestcomm/bestcomm.c | 9
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 9
arch/powerpc/sysdev/fsl_msi.c | 13 -
arch/powerpc/sysdev/fsl_pmc.c | 7
arch/powerpc/sysdev/fsl_rio.c | 7
arch/powerpc/sysdev/pmi.c | 9
arch/powerpc/sysdev/qe_lib/qe.c | 7
arch/sparc/include/asm/parport.h | 6
arch/sparc/kernel/apc.c | 7
arch/sparc/kernel/auxio_64.c | 7
arch/sparc/kernel/central.c | 14 -
arch/sparc/kernel/chmc.c | 19 -
arch/sparc/kernel/pci_fire.c | 7
arch/sparc/kernel/pci_psycho.c | 7
arch/sparc/kernel/pci_sabre.c | 9
arch/sparc/kernel/pci_schizo.c | 11 -
arch/sparc/kernel/pci_sun4v.c | 7
arch/sparc/kernel/pmc.c | 7
arch/sparc/kernel/power.c | 6
arch/sparc/kernel/time_32.c | 6
arch/sparc/kernel/time_64.c | 18 -
drivers/ata/pata_mpc52xx.c | 8
drivers/ata/pata_of_platform.c | 9
drivers/ata/sata_dwc_460ex.c | 9
drivers/ata/sata_fsl.c | 9
drivers/atm/fore200e.c | 17 +
drivers/block/xsysace.c | 11 -
drivers/char/hw_random/n2-drv.c | 16 -
drivers/char/hw_random/pasemi-rng.c | 9
drivers/char/ipmi/ipmi_si_intf.c | 18 +
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 129 +++----
drivers/crypto/amcc/crypto4xx_core.c | 9
drivers/crypto/n2_core.c | 20 -
drivers/crypto/talitos.c | 9
drivers/dma/fsldma.c | 14 -
drivers/dma/mpc512x_dma.c | 9
drivers/dma/ppc4xx/adma.c | 11 -
drivers/edac/mpc85xx_edac.c | 27 +
drivers/edac/ppc4xx_edac.c | 23 -
drivers/hwmon/ultra45_env.c | 9
drivers/i2c/busses/i2c-cpm.c | 9
drivers/i2c/busses/i2c-ibm_iic.c | 9
drivers/i2c/busses/i2c-mpc.c | 22 -
drivers/input/misc/sparcspkr.c | 22 +
drivers/input/serio/i8042-sparcio.h | 8
drivers/input/serio/xilinx_ps2.c | 9
drivers/leds/leds-gpio.c | 206 +++++------
drivers/macintosh/smu.c | 7
drivers/macintosh/therm_pm72.c | 8
drivers/macintosh/therm_windtunnel.c | 9
drivers/media/video/fsl-viu.c | 9
drivers/mmc/host/sdhci-of-core.c | 12 -
drivers/mtd/maps/physmap_of.c | 15 -
drivers/mtd/maps/sun_uflash.c | 8
drivers/mtd/nand/fsl_upm.c | 9
drivers/mtd/nand/mpc5121_nfc.c | 9
drivers/mtd/nand/ndfc.c | 9
drivers/mtd/nand/pasemi_nand.c | 9
drivers/mtd/nand/socrates_nand.c | 9
drivers/net/can/mscan/mpc5xxx_can.c | 15 -
drivers/net/can/sja1000/sja1000_of_platform.c | 9
drivers/net/fec_mpc52xx.c | 13 -
drivers/net/fec_mpc52xx.h | 2
drivers/net/fec_mpc52xx_phy.c | 5
drivers/net/fs_enet/fs_enet-main.c | 16 -
drivers/net/fs_enet/mii-bitbang.c | 9
drivers/net/fs_enet/mii-fec.c | 15 -
drivers/net/fsl_pq_mdio.c | 9
drivers/net/gianfar.c | 12 -
drivers/net/greth.c | 8
drivers/net/ibm_newemac/core.c | 9
drivers/net/ibm_newemac/mal.c | 9
drivers/net/ibm_newemac/rgmii.c | 9
drivers/net/ibm_newemac/tah.c | 9
drivers/net/ibm_newemac/zmii.c | 9
drivers/net/ll_temac_main.c | 9
drivers/net/myri_sbus.c | 8
drivers/net/niu.c | 11 -
drivers/net/phy/mdio-gpio.c | 9
drivers/net/sunbmac.c | 9
drivers/net/sunhme.c | 14 -
drivers/net/sunlance.c | 8
drivers/net/sunqe.c | 8
drivers/net/ucc_geth.c | 8
drivers/net/xilinx_emaclite.c | 9
drivers/of/device.c | 34 --
drivers/of/platform.c | 461 -------------------------
drivers/parport/parport_sunbpp.c | 8
drivers/pcmcia/electra_cf.c | 9
drivers/pcmcia/m8xx_pcmcia.c | 9
drivers/rtc/rtc-mpc5121.c | 9
drivers/sbus/char/bbc_i2c.c | 9
drivers/sbus/char/display7seg.c | 9
drivers/sbus/char/envctrl.c | 9
drivers/sbus/char/flash.c | 9
drivers/sbus/char/uctrl.c | 9
drivers/scsi/qlogicpti.c | 14 -
drivers/scsi/sun_esp.c | 8
drivers/spi/mpc512x_psc_spi.c | 9
drivers/spi/mpc52xx_psc_spi.c | 9
drivers/spi/mpc52xx_spi.c | 9
drivers/spi/spi_fsl_espi.c | 11 -
drivers/spi/spi_fsl_lib.c | 3
drivers/spi/spi_fsl_lib.h | 3
drivers/spi/spi_fsl_spi.c | 11 -
drivers/spi/spi_ppc4xx.c | 9
drivers/tty/serial/apbuart.c | 11 -
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 9
drivers/tty/serial/mpc52xx_uart.c | 13 -
drivers/tty/serial/of_serial.c | 14 -
drivers/tty/serial/sunhv.c | 8
drivers/tty/serial/sunsab.c | 8
drivers/tty/serial/sunsu.c | 6
drivers/tty/serial/sunzilog.c | 10 -
drivers/tty/serial/uartlite.c | 103 +-----
drivers/tty/serial/ucc_uart.c | 9
drivers/usb/gadget/fsl_qe_udc.c | 14 -
drivers/usb/host/ehci-hcd.c | 12 -
drivers/usb/host/ehci-ppc-of.c | 9
drivers/usb/host/ehci-xilinx-of.c | 6
drivers/usb/host/fhci-hcd.c | 9
drivers/usb/host/isp1760-if.c | 9
drivers/usb/host/ohci-hcd.c | 6
drivers/usb/host/ohci-ppc-of.c | 9
drivers/video/bw2.c | 8
drivers/video/cg14.c | 8
drivers/video/cg3.c | 9
drivers/video/cg6.c | 9
drivers/video/ffb.c | 9
drivers/video/fsl-diu-fb.c | 9
drivers/video/leo.c | 9
drivers/video/mb862xx/mb862xxfb.c | 9
drivers/video/p9100.c | 8
drivers/video/platinumfb.c | 9
drivers/video/sunxvr1000.c | 9
drivers/video/tcx.c | 9
drivers/video/xilinxfb.c | 11 -
drivers/watchdog/cpwd.c | 9
drivers/watchdog/gef_wdt.c | 9
drivers/watchdog/mpc8xxx_wdt.c | 15 -
drivers/watchdog/riowd.c | 9
include/linux/device.h | 1
include/linux/of_device.h | 5
include/linux/of_platform.h | 18 -
sound/soc/fsl/fsl_dma.c | 9
sound/soc/fsl/fsl_ssi.c | 9
sound/soc/fsl/mpc5200_dma.c | 24 +
sound/soc/fsl/mpc5200_psc_ac97.c | 9
sound/soc/fsl/mpc5200_psc_i2s.c | 9
sound/sparc/amd7930.c | 8
sound/sparc/cs4231.c | 16 -
sound/sparc/dbri.c | 8
162 files changed, 1278 insertions(+), 1627 deletions(-)

--
Signature


2011-02-23 04:34:06

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 05/15] leds/leds-gpio: merge platform_driver with of_platform_driver

Both interfaces can be driven with the same driver, and
of_platform_driver is getting removed. This patch merges the two
driver registrations.

Signed-off-by: Grant Likely <[email protected]>
---
drivers/leds/leds-gpio.c | 206 +++++++++++++++++++---------------------------
1 files changed, 83 insertions(+), 123 deletions(-)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 4d9fa38..c4efece 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -14,6 +14,8 @@
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
+#include <linux/of_platform.h>
+#include <linux/of_gpio.h>
#include <linux/slab.h>
#include <linux/workqueue.h>

@@ -151,96 +153,34 @@ static void delete_gpio_led(struct gpio_led_data *led)
gpio_free(led->gpio);
}

-#ifdef CONFIG_LEDS_GPIO_PLATFORM
-static int __devinit gpio_led_probe(struct platform_device *pdev)
-{
- struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
- struct gpio_led_data *leds_data;
- int i, ret = 0;
-
- if (!pdata)
- return -EBUSY;
-
- leds_data = kzalloc(sizeof(struct gpio_led_data) * pdata->num_leds,
- GFP_KERNEL);
- if (!leds_data)
- return -ENOMEM;
-
- for (i = 0; i < pdata->num_leds; i++) {
- ret = create_gpio_led(&pdata->leds[i], &leds_data[i],
- &pdev->dev, pdata->gpio_blink_set);
- if (ret < 0)
- goto err;
- }
-
- platform_set_drvdata(pdev, leds_data);
-
- return 0;
-
-err:
- for (i = i - 1; i >= 0; i--)
- delete_gpio_led(&leds_data[i]);
-
- kfree(leds_data);
-
- return ret;
-}
+struct gpio_leds_priv {
+ int num_leds;
+ struct gpio_led_data leds[];
+};

-static int __devexit gpio_led_remove(struct platform_device *pdev)
+static inline int sizeof_gpio_leds_priv(int num_leds)
{
- int i;
- struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
- struct gpio_led_data *leds_data;
-
- leds_data = platform_get_drvdata(pdev);
-
- for (i = 0; i < pdata->num_leds; i++)
- delete_gpio_led(&leds_data[i]);
-
- kfree(leds_data);
-
- return 0;
+ return sizeof(struct gpio_leds_priv) +
+ (sizeof(struct gpio_led_data) * num_leds);
}

-static struct platform_driver gpio_led_driver = {
- .probe = gpio_led_probe,
- .remove = __devexit_p(gpio_led_remove),
- .driver = {
- .name = "leds-gpio",
- .owner = THIS_MODULE,
- },
-};
-
-MODULE_ALIAS("platform:leds-gpio");
-#endif /* CONFIG_LEDS_GPIO_PLATFORM */
-
/* Code to create from OpenFirmware platform devices */
#ifdef CONFIG_LEDS_GPIO_OF
-#include <linux/of_platform.h>
-#include <linux/of_gpio.h>
-
-struct gpio_led_of_platform_data {
- int num_leds;
- struct gpio_led_data led_data[];
-};
-
-static int __devinit of_gpio_leds_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
{
struct device_node *np = ofdev->dev.of_node, *child;
- struct gpio_led_of_platform_data *pdata;
+ struct gpio_leds_priv *priv;
int count = 0, ret;

- /* count LEDs defined by this device, so we know how much to allocate */
+ /* count LEDs in this device, so we know how much to allocate */
for_each_child_of_node(np, child)
count++;
if (!count)
- return 0; /* or ENODEV? */
+ return NULL;

- pdata = kzalloc(sizeof(*pdata) + sizeof(struct gpio_led_data) * count,
- GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
+ priv = kzalloc(sizeof_gpio_leds_priv(count), GFP_KERNEL);
+ if (!priv)
+ return NULL;

for_each_child_of_node(np, child) {
struct gpio_led led = {};
@@ -256,13 +196,13 @@ static int __devinit of_gpio_leds_probe(struct platform_device *ofdev,
if (state) {
if (!strcmp(state, "keep"))
led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
- else if(!strcmp(state, "on"))
+ else if (!strcmp(state, "on"))
led.default_state = LEDS_GPIO_DEFSTATE_ON;
else
led.default_state = LEDS_GPIO_DEFSTATE_OFF;
}

- ret = create_gpio_led(&led, &pdata->led_data[pdata->num_leds++],
+ ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
&ofdev->dev, NULL);
if (ret < 0) {
of_node_put(child);
@@ -270,78 +210,98 @@ static int __devinit of_gpio_leds_probe(struct platform_device *ofdev,
}
}

- dev_set_drvdata(&ofdev->dev, pdata);
-
- return 0;
+ return priv;

err:
for (count = pdata->num_leds - 2; count >= 0; count--)
delete_gpio_led(&pdata->led_data[count]);
+ kfree(priv);
+ return NULL;
+}

- kfree(pdata);
+static const struct of_device_id of_gpio_leds_match[] = {
+ { .compatible = "gpio-leds", },
+ {},
+};
+#else
+static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
+{
+ return NULL;
+}
+#define of_gpio_leds_match NULL
+#endif

- return ret;
+
+static int __devinit gpio_led_probe(struct platform_device *pdev)
+{
+ struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
+ struct gpio_leds_priv *priv;
+ int i, ret = 0;
+
+ if (pdata && pdata->num_leds) {
+ priv = kzalloc(sizeof_gpio_leds_priv(pdata->num_leds),
+ GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ priv->num_leds = pdata->num_leds;
+ for (i = 0; i < priv->num_leds; i++) {
+ ret = create_gpio_led(&pdata->leds[i],
+ &priv->leds[i],
+ &pdev->dev, pdata->gpio_blink_set);
+ if (ret < 0) {
+ /* On failure: unwind the led creations */
+ for (i = i - 1; i >= 0; i--)
+ delete_gpio_led(&priv->leds[i]);
+ kfree(priv);
+ return ret;
+ }
+ }
+ } else {
+ priv = gpio_leds_create_of(pdev);
+ if (!priv)
+ return -ENODEV;
+ }
+
+ platform_set_drvdata(pdev, priv);
+
+ return 0;
}

-static int __devexit of_gpio_leds_remove(struct platform_device *ofdev)
+static int __devexit gpio_led_remove(struct platform_device *pdev)
{
- struct gpio_led_of_platform_data *pdata = dev_get_drvdata(&ofdev->dev);
+ struct gpio_leds_priv *priv = dev_get_drvdata(&pdev->dev);
int i;

- for (i = 0; i < pdata->num_leds; i++)
- delete_gpio_led(&pdata->led_data[i]);
-
- kfree(pdata);
+ for (i = 0; i < priv->num_leds; i++)
+ delete_gpio_led(&priv->leds[i]);

- dev_set_drvdata(&ofdev->dev, NULL);
+ dev_set_drvdata(&pdev->dev, NULL);
+ kfree(priv);

return 0;
}

-static const struct of_device_id of_gpio_leds_match[] = {
- { .compatible = "gpio-leds", },
- {},
-};
-
-static struct of_platform_driver of_gpio_leds_driver = {
- .driver = {
- .name = "of_gpio_leds",
- .owner = THIS_MODULE,
+static struct platform_driver gpio_led_driver = {
+ .probe = gpio_led_probe,
+ .remove = __devexit_p(gpio_led_remove),
+ .driver = {
+ .name = "leds-gpio",
+ .owner = THIS_MODULE,
.of_match_table = of_gpio_leds_match,
},
- .probe = of_gpio_leds_probe,
- .remove = __devexit_p(of_gpio_leds_remove),
};
-#endif
+
+MODULE_ALIAS("platform:leds-gpio");

static int __init gpio_led_init(void)
{
- int ret = 0;
-
-#ifdef CONFIG_LEDS_GPIO_PLATFORM
- ret = platform_driver_register(&gpio_led_driver);
- if (ret)
- return ret;
-#endif
-#ifdef CONFIG_LEDS_GPIO_OF
- ret = of_register_platform_driver(&of_gpio_leds_driver);
-#endif
-#ifdef CONFIG_LEDS_GPIO_PLATFORM
- if (ret)
- platform_driver_unregister(&gpio_led_driver);
-#endif
-
- return ret;
+ return platform_driver_register(&gpio_led_driver);
}

static void __exit gpio_led_exit(void)
{
-#ifdef CONFIG_LEDS_GPIO_PLATFORM
platform_driver_unregister(&gpio_led_driver);
-#endif
-#ifdef CONFIG_LEDS_GPIO_OF
- of_unregister_platform_driver(&of_gpio_leds_driver);
-#endif
}

module_init(gpio_led_init);

2011-02-23 04:34:13

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and of_platform driver bindings

of_platform_driver is getting removed, and a single platform_driver
can now support both devicetree and non-devicetree use cases. This
patch merges the two driver registrations.

Signed-off-by: Grant Likely <[email protected]>
---
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 129 +++++++++++-----------------
1 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 9f2272e..a55e877 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -714,20 +714,29 @@ static int __devexit hwicap_remove(struct device *dev)
return 0; /* success */
}

-static int __devinit hwicap_drv_probe(struct platform_device *pdev)
+#ifdef CONFIG_OF
+static int __devinit hwicap_of_probe(struct platform_device *op)
{
- struct resource *res;
- const struct config_registers *regs;
+ struct resource res;
+ const unsigned int *id;
const char *family;
+ int rc;
+ const struct hwicap_driver_config *config = op->dev.of_match->data;
+ const struct config_registers *regs;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
+
+ rc = of_address_to_resource(op->dev.of_node, 0, &res);
+ if (rc) {
+ dev_err(&op->dev, "invalid address\n");
+ return rc;
+ }
+
+ id = of_get_property(op->dev.of_node, "port-number", NULL);

/* It's most likely that we're using V4, if the family is not
specified */
regs = &v4_config_registers;
- family = pdev->dev.platform_data;
+ family = of_get_property(op->dev.of_node, "xlnx,family", NULL);

if (family) {
if (!strcmp(family, "virtex2p")) {
@@ -738,54 +747,33 @@ static int __devinit hwicap_drv_probe(struct platform_device *pdev)
regs = &v5_config_registers;
}
}
-
- return hwicap_setup(&pdev->dev, pdev->id, res,
- &buffer_icap_config, regs);
+ return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
+ regs);
}
-
-static int __devexit hwicap_drv_remove(struct platform_device *pdev)
+#else
+static inline int hwicap_of_probe(struct platform_device *op)
{
- return hwicap_remove(&pdev->dev);
+ return -EINVAL;
}
+#endif /* CONFIG_OF */

-static struct platform_driver hwicap_platform_driver = {
- .probe = hwicap_drv_probe,
- .remove = hwicap_drv_remove,
- .driver = {
- .owner = THIS_MODULE,
- .name = DRIVER_NAME,
- },
-};
-
-/* ---------------------------------------------------------------------
- * OF bus binding
- */
-
-#if defined(CONFIG_OF)
-static int __devinit
-hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit hwicap_drv_probe(struct platform_device *pdev)
{
- struct resource res;
- const unsigned int *id;
- const char *family;
- int rc;
- const struct hwicap_driver_config *config = match->data;
+ struct resource *res;
const struct config_registers *regs;
+ const char *family;

- dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match);
-
- rc = of_address_to_resource(op->dev.of_node, 0, &res);
- if (rc) {
- dev_err(&op->dev, "invalid address\n");
- return rc;
- }
+ if (pdev->dev.of_match)
+ return hwicap_of_probe(pdev);

- id = of_get_property(op->dev.of_node, "port-number", NULL);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;

/* It's most likely that we're using V4, if the family is not
specified */
regs = &v4_config_registers;
- family = of_get_property(op->dev.of_node, "xlnx,family", NULL);
+ family = pdev->dev.platform_data;

if (family) {
if (!strcmp(family, "virtex2p")) {
@@ -796,15 +784,17 @@ hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
regs = &v5_config_registers;
}
}
- return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
- regs);
+
+ return hwicap_setup(&pdev->dev, pdev->id, res,
+ &buffer_icap_config, regs);
}

-static int __devexit hwicap_of_remove(struct platform_device *op)
+static int __devexit hwicap_drv_remove(struct platform_device *pdev)
{
- return hwicap_remove(&op->dev);
+ return hwicap_remove(&pdev->dev);
}

+#ifdef CONFIG_OF
/* Match table for of_platform binding */
static const struct of_device_id __devinitconst hwicap_of_match[] = {
{ .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config},
@@ -812,33 +802,23 @@ static const struct of_device_id __devinitconst hwicap_of_match[] = {
{},
};
MODULE_DEVICE_TABLE(of, hwicap_of_match);
+#else
+#define hwicap_of_match NULL
+#endif

-static struct of_platform_driver hwicap_of_driver = {
- .probe = hwicap_of_probe,
- .remove = __devexit_p(hwicap_of_remove),
+static struct platform_driver hwicap_platform_driver = {
+ .probe = hwicap_drv_probe,
+ .remove = hwicap_drv_remove,
.driver = {
- .name = DRIVER_NAME,
.owner = THIS_MODULE,
+ .name = DRIVER_NAME,
.of_match_table = hwicap_of_match,
},
};

-/* Registration helpers to keep the number of #ifdefs to a minimum */
-static inline int __init hwicap_of_register(void)
-{
- pr_debug("hwicap: calling of_register_platform_driver()\n");
- return of_register_platform_driver(&hwicap_of_driver);
-}
-
-static inline void __exit hwicap_of_unregister(void)
-{
- of_unregister_platform_driver(&hwicap_of_driver);
-}
-#else /* CONFIG_OF */
-/* CONFIG_OF not enabled; do nothing helpers */
-static inline int __init hwicap_of_register(void) { return 0; }
-static inline void __exit hwicap_of_unregister(void) { }
-#endif /* CONFIG_OF */
+/* ---------------------------------------------------------------------
+ * OF bus binding
+ */

static int __init hwicap_module_init(void)
{
@@ -856,21 +836,12 @@ static int __init hwicap_module_init(void)
return retval;

retval = platform_driver_register(&hwicap_platform_driver);
-
- if (retval)
- goto failed1;
-
- retval = hwicap_of_register();
-
if (retval)
- goto failed2;
+ goto failed;

return retval;

- failed2:
- platform_driver_unregister(&hwicap_platform_driver);
-
- failed1:
+ failed:
unregister_chrdev_region(devt, HWICAP_DEVICES);

return retval;
@@ -884,8 +855,6 @@ static void __exit hwicap_module_cleanup(void)

platform_driver_unregister(&hwicap_platform_driver);

- hwicap_of_unregister();
-
unregister_chrdev_region(devt, HWICAP_DEVICES);
}

2011-02-23 04:34:25

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 08/15] dt/spi: Eliminate users of of_platform_{, un}register_driver

Get rid of users of of_platform_driver in drivers/spi. 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 <[email protected]>
---
drivers/spi/mpc512x_psc_spi.c | 9 ++++-----
drivers/spi/mpc52xx_psc_spi.c | 9 ++++-----
drivers/spi/mpc52xx_spi.c | 9 ++++-----
drivers/spi/spi_fsl_espi.c | 11 +++++------
drivers/spi/spi_fsl_lib.c | 3 +--
drivers/spi/spi_fsl_lib.h | 3 +--
drivers/spi/spi_fsl_spi.c | 11 +++++------
drivers/spi/spi_ppc4xx.c | 9 ++++-----
8 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/mpc512x_psc_spi.c
index 77d9e7e..6a5b423 100644
--- a/drivers/spi/mpc512x_psc_spi.c
+++ b/drivers/spi/mpc512x_psc_spi.c
@@ -507,8 +507,7 @@ static int __devexit mpc512x_psc_spi_do_remove(struct device *dev)
return 0;
}

-static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op)
{
const u32 *regaddr_p;
u64 regaddr64, size64;
@@ -551,7 +550,7 @@ static struct of_device_id mpc512x_psc_spi_of_match[] = {

MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match);

-static struct of_platform_driver mpc512x_psc_spi_of_driver = {
+static struct platform_driver mpc512x_psc_spi_of_driver = {
.probe = mpc512x_psc_spi_of_probe,
.remove = __devexit_p(mpc512x_psc_spi_of_remove),
.driver = {
@@ -563,13 +562,13 @@ static struct of_platform_driver mpc512x_psc_spi_of_driver = {

static int __init mpc512x_psc_spi_init(void)
{
- return of_register_platform_driver(&mpc512x_psc_spi_of_driver);
+ return platform_driver_register(&mpc512x_psc_spi_of_driver);
}
module_init(mpc512x_psc_spi_init);

static void __exit mpc512x_psc_spi_exit(void)
{
- of_unregister_platform_driver(&mpc512x_psc_spi_of_driver);
+ platform_driver_unregister(&mpc512x_psc_spi_of_driver);
}
module_exit(mpc512x_psc_spi_exit);

diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 8a904c1..e30baf0 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -450,8 +450,7 @@ free_master:
return ret;
}

-static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op)
{
const u32 *regaddr_p;
u64 regaddr64, size64;
@@ -503,7 +502,7 @@ static const struct of_device_id mpc52xx_psc_spi_of_match[] = {

MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match);

-static struct of_platform_driver mpc52xx_psc_spi_of_driver = {
+static struct platform_driver mpc52xx_psc_spi_of_driver = {
.probe = mpc52xx_psc_spi_of_probe,
.remove = __devexit_p(mpc52xx_psc_spi_of_remove),
.driver = {
@@ -515,13 +514,13 @@ static struct of_platform_driver mpc52xx_psc_spi_of_driver = {

static int __init mpc52xx_psc_spi_init(void)
{
- return of_register_platform_driver(&mpc52xx_psc_spi_of_driver);
+ return platform_driver_register(&mpc52xx_psc_spi_of_driver);
}
module_init(mpc52xx_psc_spi_init);

static void __exit mpc52xx_psc_spi_exit(void)
{
- of_unregister_platform_driver(&mpc52xx_psc_spi_of_driver);
+ platform_driver_unregister(&mpc52xx_psc_spi_of_driver);
}
module_exit(mpc52xx_psc_spi_exit);

diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
index 84439f6..015a974 100644
--- a/drivers/spi/mpc52xx_spi.c
+++ b/drivers/spi/mpc52xx_spi.c
@@ -390,8 +390,7 @@ static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m)
/*
* OF Platform Bus Binding
*/
-static int __devinit mpc52xx_spi_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc52xx_spi_probe(struct platform_device *op)
{
struct spi_master *master;
struct mpc52xx_spi *ms;
@@ -556,7 +555,7 @@ static const struct of_device_id mpc52xx_spi_match[] __devinitconst = {
};
MODULE_DEVICE_TABLE(of, mpc52xx_spi_match);

-static struct of_platform_driver mpc52xx_spi_of_driver = {
+static struct platform_driver mpc52xx_spi_of_driver = {
.driver = {
.name = "mpc52xx-spi",
.owner = THIS_MODULE,
@@ -568,13 +567,13 @@ static struct of_platform_driver mpc52xx_spi_of_driver = {

static int __init mpc52xx_spi_init(void)
{
- return of_register_platform_driver(&mpc52xx_spi_of_driver);
+ return platform_driver_register(&mpc52xx_spi_of_driver);
}
module_init(mpc52xx_spi_init);

static void __exit mpc52xx_spi_exit(void)
{
- of_unregister_platform_driver(&mpc52xx_spi_of_driver);
+ platform_driver_unregister(&mpc52xx_spi_of_driver);
}
module_exit(mpc52xx_spi_exit);

diff --git a/drivers/spi/spi_fsl_espi.c b/drivers/spi/spi_fsl_espi.c
index a99e233..900e921 100644
--- a/drivers/spi/spi_fsl_espi.c
+++ b/drivers/spi/spi_fsl_espi.c
@@ -685,8 +685,7 @@ static int of_fsl_espi_get_chipselects(struct device *dev)
return 0;
}

-static int __devinit of_fsl_espi_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid)
+static int __devinit of_fsl_espi_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
@@ -695,7 +694,7 @@ static int __devinit of_fsl_espi_probe(struct platform_device *ofdev,
struct resource irq;
int ret = -ENOMEM;

- ret = of_mpc8xxx_spi_probe(ofdev, ofid);
+ ret = of_mpc8xxx_spi_probe(ofdev);
if (ret)
return ret;

@@ -736,7 +735,7 @@ static const struct of_device_id of_fsl_espi_match[] = {
};
MODULE_DEVICE_TABLE(of, of_fsl_espi_match);

-static struct of_platform_driver fsl_espi_driver = {
+static struct platform_driver fsl_espi_driver = {
.driver = {
.name = "fsl_espi",
.owner = THIS_MODULE,
@@ -748,13 +747,13 @@ static struct of_platform_driver fsl_espi_driver = {

static int __init fsl_espi_init(void)
{
- return of_register_platform_driver(&fsl_espi_driver);
+ return platform_driver_register(&fsl_espi_driver);
}
module_init(fsl_espi_init);

static void __exit fsl_espi_exit(void)
{
- of_unregister_platform_driver(&fsl_espi_driver);
+ platform_driver_unregister(&fsl_espi_driver);
}
module_exit(fsl_espi_exit);

diff --git a/drivers/spi/spi_fsl_lib.c b/drivers/spi/spi_fsl_lib.c
index 5cd741f..ff59f42 100644
--- a/drivers/spi/spi_fsl_lib.c
+++ b/drivers/spi/spi_fsl_lib.c
@@ -189,8 +189,7 @@ int __devexit mpc8xxx_spi_remove(struct device *dev)
return 0;
}

-int __devinit of_mpc8xxx_spi_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid)
+int __devinit of_mpc8xxx_spi_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
diff --git a/drivers/spi/spi_fsl_lib.h b/drivers/spi/spi_fsl_lib.h
index 281e060..57f28db 100644
--- a/drivers/spi/spi_fsl_lib.h
+++ b/drivers/spi/spi_fsl_lib.h
@@ -118,7 +118,6 @@ extern const char *mpc8xxx_spi_strmode(unsigned int flags);
extern int mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
unsigned int irq);
extern int mpc8xxx_spi_remove(struct device *dev);
-extern int of_mpc8xxx_spi_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid);
+extern int of_mpc8xxx_spi_probe(struct platform_device *ofdev)

#endif /* __SPI_FSL_LIB_H__ */
diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c
index 7ca52d3..ad317c3 100644
--- a/drivers/spi/spi_fsl_spi.c
+++ b/drivers/spi/spi_fsl_spi.c
@@ -1042,8 +1042,7 @@ static int of_fsl_spi_free_chipselects(struct device *dev)
return 0;
}

-static int __devinit of_fsl_spi_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid)
+static int __devinit of_fsl_spi_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
@@ -1052,7 +1051,7 @@ static int __devinit of_fsl_spi_probe(struct platform_device *ofdev,
struct resource irq;
int ret = -ENOMEM;

- ret = of_mpc8xxx_spi_probe(ofdev, ofid);
+ ret = of_mpc8xxx_spi_probe(ofdev)
if (ret)
return ret;

@@ -1100,7 +1099,7 @@ static const struct of_device_id of_fsl_spi_match[] = {
};
MODULE_DEVICE_TABLE(of, of_fsl_spi_match);

-static struct of_platform_driver of_fsl_spi_driver = {
+static struct platform_driver of_fsl_spi_driver = {
.driver = {
.name = "fsl_spi",
.owner = THIS_MODULE,
@@ -1177,13 +1176,13 @@ static void __exit legacy_driver_unregister(void) {}
static int __init fsl_spi_init(void)
{
legacy_driver_register();
- return of_register_platform_driver(&of_fsl_spi_driver);
+ return platform_driver_register(&of_fsl_spi_driver);
}
module_init(fsl_spi_init);

static void __exit fsl_spi_exit(void)
{
- of_unregister_platform_driver(&of_fsl_spi_driver);
+ platform_driver_unregister(&of_fsl_spi_driver);
legacy_driver_unregister();
}
module_exit(fsl_spi_exit);
diff --git a/drivers/spi/spi_ppc4xx.c b/drivers/spi/spi_ppc4xx.c
index 80e172d..2a298c0 100644
--- a/drivers/spi/spi_ppc4xx.c
+++ b/drivers/spi/spi_ppc4xx.c
@@ -390,8 +390,7 @@ static void free_gpios(struct ppc4xx_spi *hw)
/*
* platform_device layer stuff...
*/
-static int __init spi_ppc4xx_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __init spi_ppc4xx_of_probe(struct platform_device *op)
{
struct ppc4xx_spi *hw;
struct spi_master *master;
@@ -586,7 +585,7 @@ static const struct of_device_id spi_ppc4xx_of_match[] = {

MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match);

-static struct of_platform_driver spi_ppc4xx_of_driver = {
+static struct platform_driver spi_ppc4xx_of_driver = {
.probe = spi_ppc4xx_of_probe,
.remove = __exit_p(spi_ppc4xx_of_remove),
.driver = {
@@ -598,13 +597,13 @@ static struct of_platform_driver spi_ppc4xx_of_driver = {

static int __init spi_ppc4xx_init(void)
{
- return of_register_platform_driver(&spi_ppc4xx_of_driver);
+ return platform_driver_register(&spi_ppc4xx_of_driver);
}
module_init(spi_ppc4xx_init);

static void __exit spi_ppc4xx_exit(void)
{
- of_unregister_platform_driver(&spi_ppc4xx_of_driver);
+ platform_driver_unregister(&spi_ppc4xx_of_driver);
}
module_exit(spi_ppc4xx_exit);

2011-02-23 04:34:28

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 09/15] dt/sound: Eliminate users of of_platform_{, un}register_driver

Get rid of users of of_platform_driver in drivers/sound. 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 <[email protected]>
---
sound/soc/fsl/fsl_dma.c | 9 ++++-----
sound/soc/fsl/fsl_ssi.c | 9 ++++-----
sound/soc/fsl/mpc5200_dma.c | 24 +++++++++++-------------
sound/soc/fsl/mpc5200_psc_ac97.c | 9 ++++-----
sound/soc/fsl/mpc5200_psc_i2s.c | 9 ++++-----
sound/sparc/amd7930.c | 8 ++++----
sound/sparc/cs4231.c | 16 ++++++++--------
sound/sparc/dbri.c | 8 ++++----
8 files changed, 43 insertions(+), 49 deletions(-)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 4cf98c0..15dac0f 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -896,8 +896,7 @@ static struct snd_pcm_ops fsl_dma_ops = {
.pointer = fsl_dma_pointer,
};

-static int __devinit fsl_soc_dma_probe(struct platform_device *pdev,
- const struct of_device_id *match)
+static int __devinit fsl_soc_dma_probe(struct platform_device *pdev)
{
struct dma_object *dma;
struct device_node *np = pdev->dev.of_node;
@@ -979,7 +978,7 @@ static const struct of_device_id fsl_soc_dma_ids[] = {
};
MODULE_DEVICE_TABLE(of, fsl_soc_dma_ids);

-static struct of_platform_driver fsl_soc_dma_driver = {
+static struct platform_driver fsl_soc_dma_driver = {
.driver = {
.name = "fsl-pcm-audio",
.owner = THIS_MODULE,
@@ -993,12 +992,12 @@ static int __init fsl_soc_dma_init(void)
{
pr_info("Freescale Elo DMA ASoC PCM Driver\n");

- return of_register_platform_driver(&fsl_soc_dma_driver);
+ return platform_driver_register(&fsl_soc_dma_driver);
}

static void __exit fsl_soc_dma_exit(void)
{
- of_unregister_platform_driver(&fsl_soc_dma_driver);
+ platform_driver_unregister(&fsl_soc_dma_driver);
}

module_init(fsl_soc_dma_init);
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 4cc167a..313e0cc 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -624,8 +624,7 @@ static void make_lowercase(char *s)
}
}

-static int __devinit fsl_ssi_probe(struct platform_device *pdev,
- const struct of_device_id *match)
+static int __devinit fsl_ssi_probe(struct platform_device *pdev)
{
struct fsl_ssi_private *ssi_private;
int ret = 0;
@@ -774,7 +773,7 @@ static const struct of_device_id fsl_ssi_ids[] = {
};
MODULE_DEVICE_TABLE(of, fsl_ssi_ids);

-static struct of_platform_driver fsl_ssi_driver = {
+static struct platform_driver fsl_ssi_driver = {
.driver = {
.name = "fsl-ssi-dai",
.owner = THIS_MODULE,
@@ -788,12 +787,12 @@ static int __init fsl_ssi_init(void)
{
printk(KERN_INFO "Freescale Synchronous Serial Interface (SSI) ASoC Driver\n");

- return of_register_platform_driver(&fsl_ssi_driver);
+ return platform_driver_register(&fsl_ssi_driver);
}

static void __exit fsl_ssi_exit(void)
{
- of_unregister_platform_driver(&fsl_ssi_driver);
+ platform_driver_unregister(&fsl_ssi_driver);
}

module_init(fsl_ssi_init);
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index f92dca0..fff695c 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -368,8 +368,7 @@ static struct snd_soc_platform_driver mpc5200_audio_dma_platform = {
.pcm_free = &psc_dma_free,
};

-static int mpc5200_hpcd_probe(struct of_device *op,
- const struct of_device_id *match)
+static int mpc5200_hpcd_probe(struct of_device *op)
{
phys_addr_t fifo;
struct psc_dma *psc_dma;
@@ -511,32 +510,31 @@ static int mpc5200_hpcd_remove(struct of_device *op)
}

static struct of_device_id mpc5200_hpcd_match[] = {
- {
- .compatible = "fsl,mpc5200-pcm",
- },
+ { .compatible = "fsl,mpc5200-pcm", },
{}
};
MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match);

-static struct of_platform_driver mpc5200_hpcd_of_driver = {
- .owner = THIS_MODULE,
- .name = "mpc5200-pcm-audio",
- .match_table = mpc5200_hpcd_match,
+static struct platform_driver mpc5200_hpcd_of_driver = {
.probe = mpc5200_hpcd_probe,
.remove = mpc5200_hpcd_remove,
+ .dev = {
+ .owner = THIS_MODULE,
+ .name = "mpc5200-pcm-audio",
+ .of_match_table = mpc5200_hpcd_match,
+ }
};

static int __init mpc5200_hpcd_init(void)
{
- return of_register_platform_driver(&mpc5200_hpcd_of_driver);
+ return platform_driver_register(&mpc5200_hpcd_of_driver);
}
+module_init(mpc5200_hpcd_init);

static void __exit mpc5200_hpcd_exit(void)
{
- of_unregister_platform_driver(&mpc5200_hpcd_of_driver);
+ platform_driver_unregister(&mpc5200_hpcd_of_driver);
}
-
-module_init(mpc5200_hpcd_init);
module_exit(mpc5200_hpcd_exit);

MODULE_AUTHOR("Grant Likely <[email protected]>");
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 40acc8e..ad36b09 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -272,8 +272,7 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
* - Probe/remove operations
* - OF device match table
*/
-static int __devinit psc_ac97_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit psc_ac97_of_probe(struct platform_device *op)
{
int rc;
struct snd_ac97 ac97;
@@ -316,7 +315,7 @@ static struct of_device_id psc_ac97_match[] __devinitdata = {
};
MODULE_DEVICE_TABLE(of, psc_ac97_match);

-static struct of_platform_driver psc_ac97_driver = {
+static struct platform_driver psc_ac97_driver = {
.probe = psc_ac97_of_probe,
.remove = __devexit_p(psc_ac97_of_remove),
.driver = {
@@ -332,13 +331,13 @@ static struct of_platform_driver psc_ac97_driver = {
*/
static int __init psc_ac97_init(void)
{
- return of_register_platform_driver(&psc_ac97_driver);
+ return platform_driver_register(&psc_ac97_driver);
}
module_init(psc_ac97_init);

static void __exit psc_ac97_exit(void)
{
- of_unregister_platform_driver(&psc_ac97_driver);
+ platform_driver_unregister(&psc_ac97_driver);
}
module_exit(psc_ac97_exit);

diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 9018fa5..87cf2a5 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -150,8 +150,7 @@ static struct snd_soc_dai_driver psc_i2s_dai[] = {{
* - Probe/remove operations
* - OF device match table
*/
-static int __devinit psc_i2s_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit psc_i2s_of_probe(struct platform_device *op)
{
int rc;
struct psc_dma *psc_dma;
@@ -213,7 +212,7 @@ static struct of_device_id psc_i2s_match[] __devinitdata = {
};
MODULE_DEVICE_TABLE(of, psc_i2s_match);

-static struct of_platform_driver psc_i2s_driver = {
+static struct platform_driver psc_i2s_driver = {
.probe = psc_i2s_of_probe,
.remove = __devexit_p(psc_i2s_of_remove),
.driver = {
@@ -229,13 +228,13 @@ static struct of_platform_driver psc_i2s_driver = {
*/
static int __init psc_i2s_init(void)
{
- return of_register_platform_driver(&psc_i2s_driver);
+ return platform_driver_register(&psc_i2s_driver);
}
module_init(psc_i2s_init);

static void __exit psc_i2s_exit(void)
{
- of_unregister_platform_driver(&psc_i2s_driver);
+ platform_driver_unregister(&psc_i2s_driver);
}
module_exit(psc_i2s_exit);

diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index f8bcfc3..ad7d4d7 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -1002,7 +1002,7 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
return 0;
}

-static int __devinit amd7930_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit amd7930_sbus_probe(struct platform_device *op)
{
struct resource *rp = &op->resource[0];
static int dev_num;
@@ -1064,7 +1064,7 @@ static const struct of_device_id amd7930_match[] = {
{},
};

-static struct of_platform_driver amd7930_sbus_driver = {
+static struct platform_driver amd7930_sbus_driver = {
.driver = {
.name = "audio",
.owner = THIS_MODULE,
@@ -1075,7 +1075,7 @@ static struct of_platform_driver amd7930_sbus_driver = {

static int __init amd7930_init(void)
{
- return of_register_platform_driver(&amd7930_sbus_driver);
+ return platform_driver_register(&amd7930_sbus_driver);
}

static void __exit amd7930_exit(void)
@@ -1092,7 +1092,7 @@ static void __exit amd7930_exit(void)

amd7930_list = NULL;

- of_unregister_platform_driver(&amd7930_sbus_driver);
+ platform_driver_unregister(&amd7930_sbus_driver);
}

module_init(amd7930_init);
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index c276086..0e618f8 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1856,7 +1856,7 @@ static int __devinit snd_cs4231_sbus_create(struct snd_card *card,
return 0;
}

-static int __devinit cs4231_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit cs4231_sbus_probe(struct platform_device *op)
{
struct resource *rp = &op->resource[0];
struct snd_card *card;
@@ -2048,7 +2048,7 @@ static int __devinit snd_cs4231_ebus_create(struct snd_card *card,
return 0;
}

-static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit cs4231_ebus_probe(struct platform_device *op)
{
struct snd_card *card;
int err;
@@ -2072,16 +2072,16 @@ static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct
}
#endif

-static int __devinit cs4231_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit cs4231_probe(struct platform_device *op)
{
#ifdef EBUS_SUPPORT
if (!strcmp(op->dev.of_node->parent->name, "ebus"))
- return cs4231_ebus_probe(op, match);
+ return cs4231_ebus_probe(op);
#endif
#ifdef SBUS_SUPPORT
if (!strcmp(op->dev.of_node->parent->name, "sbus") ||
!strcmp(op->dev.of_node->parent->name, "sbi"))
- return cs4231_sbus_probe(op, match);
+ return cs4231_sbus_probe(op);
#endif
return -ENODEV;
}
@@ -2108,7 +2108,7 @@ static const struct of_device_id cs4231_match[] = {

MODULE_DEVICE_TABLE(of, cs4231_match);

-static struct of_platform_driver cs4231_driver = {
+static struct platform_driver cs4231_driver = {
.driver = {
.name = "audio",
.owner = THIS_MODULE,
@@ -2120,12 +2120,12 @@ static struct of_platform_driver cs4231_driver = {

static int __init cs4231_init(void)
{
- return of_register_platform_driver(&cs4231_driver);
+ return platform_driver_register(&cs4231_driver);
}

static void __exit cs4231_exit(void)
{
- of_unregister_platform_driver(&cs4231_driver);
+ platform_driver_unregister(&cs4231_driver);
}

module_init(cs4231_init);
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 39cd5d6..73f9cba 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2592,7 +2592,7 @@ static void snd_dbri_free(struct snd_dbri *dbri)
(void *)dbri->dma, dbri->dma_dvma);
}

-static int __devinit dbri_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit dbri_probe(struct platform_device *op)
{
struct snd_dbri *dbri;
struct resource *rp;
@@ -2686,7 +2686,7 @@ static const struct of_device_id dbri_match[] = {

MODULE_DEVICE_TABLE(of, dbri_match);

-static struct of_platform_driver dbri_sbus_driver = {
+static struct platform_driver dbri_sbus_driver = {
.driver = {
.name = "dbri",
.owner = THIS_MODULE,
@@ -2699,12 +2699,12 @@ static struct of_platform_driver dbri_sbus_driver = {
/* Probe for the dbri chip and then attach the driver. */
static int __init dbri_init(void)
{
- return of_register_platform_driver(&dbri_sbus_driver);
+ return platform_driver_register(&dbri_sbus_driver);
}

static void __exit dbri_exit(void)
{
- of_unregister_platform_driver(&dbri_sbus_driver);
+ platform_driver_unregister(&dbri_sbus_driver);
}

module_init(dbri_init);

2011-02-23 04:34:36

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 10/15] dt/net: Eliminate users of of_platform_{, un}register_driver

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 <[email protected]>
---
drivers/net/can/mscan/mpc5xxx_can.c | 15 +++++++++------
drivers/net/can/sja1000/sja1000_of_platform.c | 9 ++++-----
drivers/net/fec_mpc52xx.c | 13 ++++++-------
drivers/net/fec_mpc52xx.h | 2 +-
drivers/net/fec_mpc52xx_phy.c | 5 ++---
drivers/net/fs_enet/fs_enet-main.c | 16 +++++++++-------
drivers/net/fs_enet/mii-bitbang.c | 9 ++++-----
drivers/net/fs_enet/mii-fec.c | 15 +++++++++------
drivers/net/fsl_pq_mdio.c | 9 ++++-----
drivers/net/gianfar.c | 12 +++++-------
drivers/net/greth.c | 8 ++++----
drivers/net/ibm_newemac/core.c | 9 ++++-----
drivers/net/ibm_newemac/mal.c | 9 ++++-----
drivers/net/ibm_newemac/rgmii.c | 9 ++++-----
drivers/net/ibm_newemac/tah.c | 9 ++++-----
drivers/net/ibm_newemac/zmii.c | 9 ++++-----
drivers/net/ll_temac_main.c | 9 ++++-----
drivers/net/myri_sbus.c | 8 ++++----
drivers/net/niu.c | 11 +++++------
drivers/net/phy/mdio-gpio.c | 9 ++++-----
drivers/net/sunbmac.c | 9 ++++-----
drivers/net/sunhme.c | 14 +++++++++-----
drivers/net/sunlance.c | 8 ++++----
drivers/net/sunqe.c | 8 ++++----
drivers/net/ucc_geth.c | 8 ++++----
drivers/net/xilinx_emaclite.c | 9 ++++-----
26 files changed, 123 insertions(+), 128 deletions(-)

diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 312b9c8..c0a1bc5 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -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;
@@ -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");
@@ -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,
@@ -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);

diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 09c3e9d..9793df6 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -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;
@@ -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,
@@ -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);
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 50c1213..9f81b1a 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -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;
@@ -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,
@@ -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
}

diff --git a/drivers/net/fec_mpc52xx.h b/drivers/net/fec_mpc52xx.h
index a227a52..41d2dff 100644
--- a/drivers/net/fec_mpc52xx.h
+++ b/drivers/net/fec_mpc52xx.h
@@ -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__ */
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
index 0b4cb6f..360a578 100644
--- a/drivers/net/fec_mpc52xx_phy.c
+++ b/drivers/net/fec_mpc52xx_phy.c
@@ -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;
@@ -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,
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 7a1f3d0..24cb953 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -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;
@@ -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;
@@ -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)
@@ -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",
@@ -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
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 3cda2b5..ad29754 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -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;
@@ -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,
@@ -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);
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index dbb9c48..7e840d3 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -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;
@@ -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,
@@ -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);
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index 8d3a2cc..52f4e8a 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -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;
@@ -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,
@@ -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");
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 5ed8f9f..ccb231c 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -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);
@@ -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;
@@ -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,
@@ -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);
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index fdb0333..396ff7d 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -1411,7 +1411,7 @@ error:
}

/* Initialize the GRETH MAC */
-static int __devinit greth_of_probe(struct platform_device *ofdev, const struct of_device_id *match)
+static int __devinit greth_of_probe(struct platform_device *ofdev)
{
struct net_device *dev;
struct greth_private *greth;
@@ -1646,7 +1646,7 @@ static struct of_device_id greth_of_match[] = {

MODULE_DEVICE_TABLE(of, greth_of_match);

-static struct of_platform_driver greth_of_driver = {
+static struct platform_driver greth_of_driver = {
.driver = {
.name = "grlib-greth",
.owner = THIS_MODULE,
@@ -1658,12 +1658,12 @@ static struct of_platform_driver greth_of_driver = {

static int __init greth_init(void)
{
- return of_register_platform_driver(&greth_of_driver);
+ return platform_driver_register(&greth_of_driver);
}

static void __exit greth_cleanup(void)
{
- of_unregister_platform_driver(&greth_of_driver);
+ platform_driver_unregister(&greth_of_driver);
}

module_init(greth_init);
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 6d9275c..3bb990b 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2719,8 +2719,7 @@ static const struct net_device_ops emac_gige_netdev_ops = {
.ndo_change_mtu = emac_change_mtu,
};

-static int __devinit emac_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit emac_probe(struct platform_device *ofdev)
{
struct net_device *ndev;
struct emac_instance *dev;
@@ -2994,7 +2993,7 @@ static struct of_device_id emac_match[] =
};
MODULE_DEVICE_TABLE(of, emac_match);

-static struct of_platform_driver emac_driver = {
+static struct platform_driver emac_driver = {
.driver = {
.name = "emac",
.owner = THIS_MODULE,
@@ -3069,7 +3068,7 @@ static int __init emac_init(void)
rc = tah_init();
if (rc)
goto err_rgmii;
- rc = of_register_platform_driver(&emac_driver);
+ rc = platform_driver_register(&emac_driver);
if (rc)
goto err_tah;

@@ -3091,7 +3090,7 @@ static void __exit emac_exit(void)
{
int i;

- of_unregister_platform_driver(&emac_driver);
+ platform_driver_unregister(&emac_driver);

tah_exit();
rgmii_exit();
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index d5717e2..d268f40 100644
--- a/drivers/net/ibm_newemac/mal.c
+++ b/drivers/net/ibm_newemac/mal.c
@@ -517,8 +517,7 @@ void *mal_dump_regs(struct mal_instance *mal, void *buf)
return regs + 1;
}

-static int __devinit mal_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit mal_probe(struct platform_device *ofdev)
{
struct mal_instance *mal;
int err = 0, i, bd_size;
@@ -789,7 +788,7 @@ static struct of_device_id mal_platform_match[] =
{},
};

-static struct of_platform_driver mal_of_driver = {
+static struct platform_driver mal_of_driver = {
.driver = {
.name = "mcmal",
.owner = THIS_MODULE,
@@ -801,10 +800,10 @@ static struct of_platform_driver mal_of_driver = {

int __init mal_init(void)
{
- return of_register_platform_driver(&mal_of_driver);
+ return platform_driver_register(&mal_of_driver);
}

void mal_exit(void)
{
- of_unregister_platform_driver(&mal_of_driver);
+ platform_driver_unregister(&mal_of_driver);
}
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
index dd61798..4fa53f3 100644
--- a/drivers/net/ibm_newemac/rgmii.c
+++ b/drivers/net/ibm_newemac/rgmii.c
@@ -228,8 +228,7 @@ void *rgmii_dump_regs(struct platform_device *ofdev, void *buf)
}


-static int __devinit rgmii_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit rgmii_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct rgmii_instance *dev;
@@ -318,7 +317,7 @@ static struct of_device_id rgmii_match[] =
{},
};

-static struct of_platform_driver rgmii_driver = {
+static struct platform_driver rgmii_driver = {
.driver = {
.name = "emac-rgmii",
.owner = THIS_MODULE,
@@ -330,10 +329,10 @@ static struct of_platform_driver rgmii_driver = {

int __init rgmii_init(void)
{
- return of_register_platform_driver(&rgmii_driver);
+ return platform_driver_register(&rgmii_driver);
}

void rgmii_exit(void)
{
- of_unregister_platform_driver(&rgmii_driver);
+ platform_driver_unregister(&rgmii_driver);
}
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c
index 299aa49..8ead6a9 100644
--- a/drivers/net/ibm_newemac/tah.c
+++ b/drivers/net/ibm_newemac/tah.c
@@ -87,8 +87,7 @@ void *tah_dump_regs(struct platform_device *ofdev, void *buf)
return regs + 1;
}

-static int __devinit tah_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit tah_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct tah_instance *dev;
@@ -165,7 +164,7 @@ static struct of_device_id tah_match[] =
{},
};

-static struct of_platform_driver tah_driver = {
+static struct platform_driver tah_driver = {
.driver = {
.name = "emac-tah",
.owner = THIS_MODULE,
@@ -177,10 +176,10 @@ static struct of_platform_driver tah_driver = {

int __init tah_init(void)
{
- return of_register_platform_driver(&tah_driver);
+ return platform_driver_register(&tah_driver);
}

void tah_exit(void)
{
- of_unregister_platform_driver(&tah_driver);
+ platform_driver_unregister(&tah_driver);
}
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c
index 34ed6ee..97449e7 100644
--- a/drivers/net/ibm_newemac/zmii.c
+++ b/drivers/net/ibm_newemac/zmii.c
@@ -231,8 +231,7 @@ void *zmii_dump_regs(struct platform_device *ofdev, void *buf)
return regs + 1;
}

-static int __devinit zmii_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit zmii_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct zmii_instance *dev;
@@ -312,7 +311,7 @@ static struct of_device_id zmii_match[] =
{},
};

-static struct of_platform_driver zmii_driver = {
+static struct platform_driver zmii_driver = {
.driver = {
.name = "emac-zmii",
.owner = THIS_MODULE,
@@ -324,10 +323,10 @@ static struct of_platform_driver zmii_driver = {

int __init zmii_init(void)
{
- return of_register_platform_driver(&zmii_driver);
+ return platform_driver_register(&zmii_driver);
}

void zmii_exit(void)
{
- of_unregister_platform_driver(&zmii_driver);
+ platform_driver_unregister(&zmii_driver);
}
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index f35554d..b7948cc 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -952,8 +952,7 @@ static const struct attribute_group temac_attr_group = {
.attrs = temac_device_attrs,
};

-static int __devinit
-temac_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit temac_of_probe(struct platform_device *op)
{
struct device_node *np;
struct temac_local *lp;
@@ -1123,7 +1122,7 @@ static struct of_device_id temac_of_match[] __devinitdata = {
};
MODULE_DEVICE_TABLE(of, temac_of_match);

-static struct of_platform_driver temac_of_driver = {
+static struct platform_driver temac_of_driver = {
.probe = temac_of_probe,
.remove = __devexit_p(temac_of_remove),
.driver = {
@@ -1135,13 +1134,13 @@ static struct of_platform_driver temac_of_driver = {

static int __init temac_init(void)
{
- return of_register_platform_driver(&temac_of_driver);
+ return platform_driver_register(&temac_of_driver);
}
module_init(temac_init);

static void __exit temac_exit(void)
{
- of_unregister_platform_driver(&temac_of_driver);
+ platform_driver_unregister(&temac_of_driver);
}
module_exit(temac_exit);

diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 4846e13..a761076 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -926,7 +926,7 @@ static const struct net_device_ops myri_ops = {
.ndo_validate_addr = eth_validate_addr,
};

-static int __devinit myri_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit myri_sbus_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
static unsigned version_printed;
@@ -1160,7 +1160,7 @@ static const struct of_device_id myri_sbus_match[] = {

MODULE_DEVICE_TABLE(of, myri_sbus_match);

-static struct of_platform_driver myri_sbus_driver = {
+static struct platform_driver myri_sbus_driver = {
.driver = {
.name = "myri",
.owner = THIS_MODULE,
@@ -1172,12 +1172,12 @@ static struct of_platform_driver myri_sbus_driver = {

static int __init myri_sbus_init(void)
{
- return of_register_platform_driver(&myri_sbus_driver);
+ return platform_driver_register(&myri_sbus_driver);
}

static void __exit myri_sbus_exit(void)
{
- of_unregister_platform_driver(&myri_sbus_driver);
+ platform_driver_unregister(&myri_sbus_driver);
}

module_init(myri_sbus_init);
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 2541321..54cb250 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -10033,8 +10033,7 @@ static const struct niu_ops niu_phys_ops = {
.unmap_single = niu_phys_unmap_single,
};

-static int __devinit niu_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit niu_of_probe(struct platform_device *op)
{
union niu_parent_id parent_id;
struct net_device *dev;
@@ -10194,7 +10193,7 @@ static const struct of_device_id niu_match[] = {
};
MODULE_DEVICE_TABLE(of, niu_match);

-static struct of_platform_driver niu_of_driver = {
+static struct platform_driver niu_of_driver = {
.driver = {
.name = "niu",
.owner = THIS_MODULE,
@@ -10215,14 +10214,14 @@ static int __init niu_init(void)
niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT);

#ifdef CONFIG_SPARC64
- err = of_register_platform_driver(&niu_of_driver);
+ err = platform_driver_register(&niu_of_driver);
#endif

if (!err) {
err = pci_register_driver(&niu_pci_driver);
#ifdef CONFIG_SPARC64
if (err)
- of_unregister_platform_driver(&niu_of_driver);
+ platform_driver_unregister(&niu_of_driver);
#endif
}

@@ -10233,7 +10232,7 @@ static void __exit niu_exit(void)
{
pci_unregister_driver(&niu_pci_driver);
#ifdef CONFIG_SPARC64
- of_unregister_platform_driver(&niu_of_driver);
+ platform_driver_unregister(&niu_of_driver);
#endif
}

diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index f62c7b7..47c8339 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -188,8 +188,7 @@ static int __devexit mdio_gpio_remove(struct platform_device *pdev)

#ifdef CONFIG_OF_GPIO

-static int __devinit mdio_ofgpio_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit mdio_ofgpio_probe(struct platform_device *ofdev)
{
struct mdio_gpio_platform_data *pdata;
struct mii_bus *new_bus;
@@ -240,7 +239,7 @@ static struct of_device_id mdio_ofgpio_match[] = {
};
MODULE_DEVICE_TABLE(of, mdio_ofgpio_match);

-static struct of_platform_driver mdio_ofgpio_driver = {
+static struct platform_driver mdio_ofgpio_driver = {
.driver = {
.name = "mdio-gpio",
.owner = THIS_MODULE,
@@ -252,12 +251,12 @@ static struct of_platform_driver mdio_ofgpio_driver = {

static inline int __init mdio_ofgpio_init(void)
{
- return of_register_platform_driver(&mdio_ofgpio_driver);
+ return platform_driver_register(&mdio_ofgpio_driver);
}

static inline void __exit mdio_ofgpio_exit(void)
{
- of_unregister_platform_driver(&mdio_ofgpio_driver);
+ platform_driver_unregister(&mdio_ofgpio_driver);
}
#else
static inline int __init mdio_ofgpio_init(void) { return 0; }
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 0a6a5ce..aa47658 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -1242,8 +1242,7 @@ fail_and_cleanup:
/* QEC can be the parent of either QuadEthernet or a BigMAC. We want
* the latter.
*/
-static int __devinit bigmac_sbus_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit bigmac_sbus_probe(struct platform_device *op)
{
struct device *parent = op->dev.parent;
struct platform_device *qec_op;
@@ -1289,7 +1288,7 @@ static const struct of_device_id bigmac_sbus_match[] = {

MODULE_DEVICE_TABLE(of, bigmac_sbus_match);

-static struct of_platform_driver bigmac_sbus_driver = {
+static struct platform_driver bigmac_sbus_driver = {
.driver = {
.name = "sunbmac",
.owner = THIS_MODULE,
@@ -1301,12 +1300,12 @@ static struct of_platform_driver bigmac_sbus_driver = {

static int __init bigmac_init(void)
{
- return of_register_platform_driver(&bigmac_sbus_driver);
+ return platform_driver_register(&bigmac_sbus_driver);
}

static void __exit bigmac_exit(void)
{
- of_unregister_platform_driver(&bigmac_sbus_driver);
+ platform_driver_unregister(&bigmac_sbus_driver);
}

module_init(bigmac_init);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 55bbb9c..eb4f59f 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3237,11 +3237,15 @@ static void happy_meal_pci_exit(void)
#endif

#ifdef CONFIG_SBUS
-static int __devinit hme_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit hme_sbus_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
const char *model = of_get_property(dp, "model", NULL);
- int is_qfe = (match->data != NULL);
+ int is_qfe;
+
+ if (!op->dev.of_match)
+ return -EINVAL;
+ is_qfe = (op->dev.of_match->data != NULL);

if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe"))
is_qfe = 1;
@@ -3292,7 +3296,7 @@ static const struct of_device_id hme_sbus_match[] = {

MODULE_DEVICE_TABLE(of, hme_sbus_match);

-static struct of_platform_driver hme_sbus_driver = {
+static struct platform_driver hme_sbus_driver = {
.driver = {
.name = "hme",
.owner = THIS_MODULE,
@@ -3306,7 +3310,7 @@ static int __init happy_meal_sbus_init(void)
{
int err;

- err = of_register_platform_driver(&hme_sbus_driver);
+ err = platform_driver_register(&hme_sbus_driver);
if (!err)
err = quattro_sbus_register_irqs();

@@ -3315,7 +3319,7 @@ static int __init happy_meal_sbus_init(void)

static void happy_meal_sbus_exit(void)
{
- of_unregister_platform_driver(&hme_sbus_driver);
+ platform_driver_unregister(&hme_sbus_driver);
quattro_sbus_free_irqs();

while (qfe_sbus_list) {
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 767e1e2..32a5c7f 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1495,7 +1495,7 @@ fail:
return -ENODEV;
}

-static int __devinit sunlance_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit sunlance_sbus_probe(struct platform_device *op)
{
struct platform_device *parent = to_platform_device(op->dev.parent);
struct device_node *parent_dp = parent->dev.of_node;
@@ -1536,7 +1536,7 @@ static const struct of_device_id sunlance_sbus_match[] = {

MODULE_DEVICE_TABLE(of, sunlance_sbus_match);

-static struct of_platform_driver sunlance_sbus_driver = {
+static struct platform_driver sunlance_sbus_driver = {
.driver = {
.name = "sunlance",
.owner = THIS_MODULE,
@@ -1550,12 +1550,12 @@ static struct of_platform_driver sunlance_sbus_driver = {
/* Find all the lance cards on the system and initialize them */
static int __init sparc_lance_init(void)
{
- return of_register_platform_driver(&sunlance_sbus_driver);
+ return platform_driver_register(&sunlance_sbus_driver);
}

static void __exit sparc_lance_exit(void)
{
- of_unregister_platform_driver(&sunlance_sbus_driver);
+ platform_driver_unregister(&sunlance_sbus_driver);
}

module_init(sparc_lance_init);
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 9536b2f..18ecdc3 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -941,7 +941,7 @@ fail:
return res;
}

-static int __devinit qec_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit qec_sbus_probe(struct platform_device *op)
{
return qec_ether_init(op);
}
@@ -976,7 +976,7 @@ static const struct of_device_id qec_sbus_match[] = {

MODULE_DEVICE_TABLE(of, qec_sbus_match);

-static struct of_platform_driver qec_sbus_driver = {
+static struct platform_driver qec_sbus_driver = {
.driver = {
.name = "qec",
.owner = THIS_MODULE,
@@ -988,12 +988,12 @@ static struct of_platform_driver qec_sbus_driver = {

static int __init qec_init(void)
{
- return of_register_platform_driver(&qec_sbus_driver);
+ return platform_driver_register(&qec_sbus_driver);
}

static void __exit qec_exit(void)
{
- of_unregister_platform_driver(&qec_sbus_driver);
+ platform_driver_unregister(&qec_sbus_driver);

while (root_qec_dev) {
struct sunqec *next = root_qec_dev->next_module;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 715e7b4..ef04105 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3740,7 +3740,7 @@ static const struct net_device_ops ucc_geth_netdev_ops = {
#endif
};

-static int ucc_geth_probe(struct platform_device* ofdev, const struct of_device_id *match)
+static int ucc_geth_probe(struct platform_device* ofdev)
{
struct device *device = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
@@ -3986,7 +3986,7 @@ static struct of_device_id ucc_geth_match[] = {

MODULE_DEVICE_TABLE(of, ucc_geth_match);

-static struct of_platform_driver ucc_geth_driver = {
+static struct platform_driver ucc_geth_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
@@ -4008,14 +4008,14 @@ static int __init ucc_geth_init(void)
memcpy(&(ugeth_info[i]), &ugeth_primary_info,
sizeof(ugeth_primary_info));

- ret = of_register_platform_driver(&ucc_geth_driver);
+ ret = platform_driver_register(&ucc_geth_driver);

return ret;
}

static void __exit ucc_geth_exit(void)
{
- of_unregister_platform_driver(&ucc_geth_driver);
+ platform_driver_unregister(&ucc_geth_driver);
}

module_init(ucc_geth_init);
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index cad66ce..2642af4 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -1101,8 +1101,7 @@ static struct net_device_ops xemaclite_netdev_ops;
* Return: 0, if the driver is bound to the Emaclite device, or
* a negative error if there is failure.
*/
-static int __devinit xemaclite_of_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit xemaclite_of_probe(struct platform_device *ofdev)
{
struct resource r_irq; /* Interrupt resources */
struct resource r_mem; /* IO mem resources */
@@ -1288,7 +1287,7 @@ static struct of_device_id xemaclite_of_match[] __devinitdata = {
};
MODULE_DEVICE_TABLE(of, xemaclite_of_match);

-static struct of_platform_driver xemaclite_of_driver = {
+static struct platform_driver xemaclite_of_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -1306,7 +1305,7 @@ static struct of_platform_driver xemaclite_of_driver = {
static int __init xemaclite_init(void)
{
/* No kernel boot options used, we just need to register the driver */
- return of_register_platform_driver(&xemaclite_of_driver);
+ return platform_driver_register(&xemaclite_of_driver);
}

/**
@@ -1314,7 +1313,7 @@ static int __init xemaclite_init(void)
*/
static void __exit xemaclite_cleanup(void)
{
- of_unregister_platform_driver(&xemaclite_of_driver);
+ platform_driver_unregister(&xemaclite_of_driver);
}

module_init(xemaclite_init);

2011-02-23 04:34:40

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 11/15] dt/video: Eliminate users of of_platform_{, un}register_driver

Get rid of users of of_platform_driver in drivers/video. 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 <[email protected]>
---
drivers/video/bw2.c | 8 ++++----
drivers/video/cg14.c | 8 ++++----
drivers/video/cg3.c | 9 ++++-----
drivers/video/cg6.c | 9 ++++-----
drivers/video/ffb.c | 9 ++++-----
drivers/video/fsl-diu-fb.c | 9 ++++-----
drivers/video/leo.c | 9 ++++-----
drivers/video/mb862xx/mb862xxfb.c | 9 ++++-----
drivers/video/p9100.c | 8 ++++----
drivers/video/platinumfb.c | 9 ++++-----
drivers/video/sunxvr1000.c | 9 ++++-----
drivers/video/tcx.c | 9 ++++-----
drivers/video/xilinxfb.c | 11 ++++-------
13 files changed, 52 insertions(+), 64 deletions(-)

diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index 4dc1346..7ba74cd 100644
--- a/drivers/video/bw2.c
+++ b/drivers/video/bw2.c
@@ -273,7 +273,7 @@ static int __devinit bw2_do_default_mode(struct bw2_par *par,
return 0;
}

-static int __devinit bw2_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit bw2_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -375,7 +375,7 @@ static const struct of_device_id bw2_match[] = {
};
MODULE_DEVICE_TABLE(of, bw2_match);

-static struct of_platform_driver bw2_driver = {
+static struct platform_driver bw2_driver = {
.driver = {
.name = "bw2",
.owner = THIS_MODULE,
@@ -390,12 +390,12 @@ static int __init bw2_init(void)
if (fb_get_options("bw2fb", NULL))
return -ENODEV;

- return of_register_platform_driver(&bw2_driver);
+ return platform_driver_register(&bw2_driver);
}

static void __exit bw2_exit(void)
{
- of_unregister_platform_driver(&bw2_driver);
+ platform_driver_unregister(&bw2_driver);
}

module_init(bw2_init);
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 2424953..e2c85b0 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -463,7 +463,7 @@ static void cg14_unmap_regs(struct platform_device *op, struct fb_info *info,
info->screen_base, info->fix.smem_len);
}

-static int __devinit cg14_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit cg14_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -595,7 +595,7 @@ static const struct of_device_id cg14_match[] = {
};
MODULE_DEVICE_TABLE(of, cg14_match);

-static struct of_platform_driver cg14_driver = {
+static struct platform_driver cg14_driver = {
.driver = {
.name = "cg14",
.owner = THIS_MODULE,
@@ -610,12 +610,12 @@ static int __init cg14_init(void)
if (fb_get_options("cg14fb", NULL))
return -ENODEV;

- return of_register_platform_driver(&cg14_driver);
+ return platform_driver_register(&cg14_driver);
}

static void __exit cg14_exit(void)
{
- of_unregister_platform_driver(&cg14_driver);
+ platform_driver_unregister(&cg14_driver);
}

module_init(cg14_init);
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index 09c0c3c..f927a7b 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -346,8 +346,7 @@ static int __devinit cg3_do_default_mode(struct cg3_par *par)
return 0;
}

-static int __devinit cg3_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit cg3_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -462,7 +461,7 @@ static const struct of_device_id cg3_match[] = {
};
MODULE_DEVICE_TABLE(of, cg3_match);

-static struct of_platform_driver cg3_driver = {
+static struct platform_driver cg3_driver = {
.driver = {
.name = "cg3",
.owner = THIS_MODULE,
@@ -477,12 +476,12 @@ static int __init cg3_init(void)
if (fb_get_options("cg3fb", NULL))
return -ENODEV;

- return of_register_platform_driver(&cg3_driver);
+ return platform_driver_register(&cg3_driver);
}

static void __exit cg3_exit(void)
{
- of_unregister_platform_driver(&cg3_driver);
+ platform_driver_unregister(&cg3_driver);
}

module_init(cg3_init);
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 2b5a970..4ffad90 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -737,8 +737,7 @@ static void cg6_unmap_regs(struct platform_device *op, struct fb_info *info,
info->fix.smem_len);
}

-static int __devinit cg6_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit cg6_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -855,7 +854,7 @@ static const struct of_device_id cg6_match[] = {
};
MODULE_DEVICE_TABLE(of, cg6_match);

-static struct of_platform_driver cg6_driver = {
+static struct platform_driver cg6_driver = {
.driver = {
.name = "cg6",
.owner = THIS_MODULE,
@@ -870,12 +869,12 @@ static int __init cg6_init(void)
if (fb_get_options("cg6fb", NULL))
return -ENODEV;

- return of_register_platform_driver(&cg6_driver);
+ return platform_driver_register(&cg6_driver);
}

static void __exit cg6_exit(void)
{
- of_unregister_platform_driver(&cg6_driver);
+ platform_driver_unregister(&cg6_driver);
}

module_init(cg6_init);
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 6739b2a..910c5e6 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -893,8 +893,7 @@ static void ffb_init_fix(struct fb_info *info)
info->fix.accel = FB_ACCEL_SUN_CREATOR;
}

-static int __devinit ffb_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit ffb_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct ffb_fbc __iomem *fbc;
@@ -1052,7 +1051,7 @@ static const struct of_device_id ffb_match[] = {
};
MODULE_DEVICE_TABLE(of, ffb_match);

-static struct of_platform_driver ffb_driver = {
+static struct platform_driver ffb_driver = {
.driver = {
.name = "ffb",
.owner = THIS_MODULE,
@@ -1067,12 +1066,12 @@ static int __init ffb_init(void)
if (fb_get_options("ffb", NULL))
return -ENODEV;

- return of_register_platform_driver(&ffb_driver);
+ return platform_driver_register(&ffb_driver);
}

static void __exit ffb_exit(void)
{
- of_unregister_platform_driver(&ffb_driver);
+ platform_driver_unregister(&ffb_driver);
}

module_init(ffb_init);
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 8bbbf08..9048f87 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1487,8 +1487,7 @@ static ssize_t show_monitor(struct device *device,
return diu_ops.show_monitor_port(machine_data->monitor_port, buf);
}

-static int __devinit fsl_diu_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit fsl_diu_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct mfb_info *mfbi;
@@ -1735,7 +1734,7 @@ static struct of_device_id fsl_diu_match[] = {
};
MODULE_DEVICE_TABLE(of, fsl_diu_match);

-static struct of_platform_driver fsl_diu_driver = {
+static struct platform_driver fsl_diu_driver = {
.driver = {
.name = "fsl_diu",
.owner = THIS_MODULE,
@@ -1797,7 +1796,7 @@ static int __init fsl_diu_init(void)
if (!coherence_data)
return -ENOMEM;
#endif
- ret = of_register_platform_driver(&fsl_diu_driver);
+ ret = platform_driver_register(&fsl_diu_driver);
if (ret) {
printk(KERN_ERR
"fsl-diu: failed to register platform driver\n");
@@ -1811,7 +1810,7 @@ static int __init fsl_diu_init(void)

static void __exit fsl_diu_exit(void)
{
- of_unregister_platform_driver(&fsl_diu_driver);
+ platform_driver_unregister(&fsl_diu_driver);
#if defined(CONFIG_NOT_COHERENT_CACHE)
vfree(coherence_data);
#endif
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index b599e5e..9e946e2 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -547,8 +547,7 @@ static void leo_unmap_regs(struct platform_device *op, struct fb_info *info,
of_iounmap(&op->resource[0], info->screen_base, 0x800000);
}

-static int __devinit leo_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit leo_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -662,7 +661,7 @@ static const struct of_device_id leo_match[] = {
};
MODULE_DEVICE_TABLE(of, leo_match);

-static struct of_platform_driver leo_driver = {
+static struct platform_driver leo_driver = {
.driver = {
.name = "leo",
.owner = THIS_MODULE,
@@ -677,12 +676,12 @@ static int __init leo_init(void)
if (fb_get_options("leofb", NULL))
return -ENODEV;

- return of_register_platform_driver(&leo_driver);
+ return platform_driver_register(&leo_driver);
}

static void __exit leo_exit(void)
{
- of_unregister_platform_driver(&leo_driver);
+ platform_driver_unregister(&leo_driver);
}

module_init(leo_init);
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c
index b1c4374..c76e663 100644
--- a/drivers/video/mb862xx/mb862xxfb.c
+++ b/drivers/video/mb862xx/mb862xxfb.c
@@ -550,8 +550,7 @@ static int mb862xx_gdc_init(struct mb862xxfb_par *par)
return 0;
}

-static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev,
- const struct of_device_id *id)
+static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct device *dev = &ofdev->dev;
@@ -717,7 +716,7 @@ static struct of_device_id __devinitdata of_platform_mb862xx_tbl[] = {
{ /* end */ }
};

-static struct of_platform_driver of_platform_mb862xxfb_driver = {
+static struct platform_driver of_platform_mb862xxfb_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
@@ -1038,7 +1037,7 @@ static int __devinit mb862xxfb_init(void)
int ret = -ENODEV;

#if defined(CONFIG_FB_MB862XX_LIME)
- ret = of_register_platform_driver(&of_platform_mb862xxfb_driver);
+ ret = platform_driver_register(&of_platform_mb862xxfb_driver);
#endif
#if defined(CONFIG_FB_MB862XX_PCI_GDC)
ret = pci_register_driver(&mb862xxfb_pci_driver);
@@ -1049,7 +1048,7 @@ static int __devinit mb862xxfb_init(void)
static void __exit mb862xxfb_exit(void)
{
#if defined(CONFIG_FB_MB862XX_LIME)
- of_unregister_platform_driver(&of_platform_mb862xxfb_driver);
+ platform_driver_unregister(&of_platform_mb862xxfb_driver);
#endif
#if defined(CONFIG_FB_MB862XX_PCI_GDC)
pci_unregister_driver(&mb862xxfb_pci_driver);
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index b6c3fc2..d57cc58 100644
--- a/drivers/video/p9100.c
+++ b/drivers/video/p9100.c
@@ -249,7 +249,7 @@ static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_no
info->fix.accel = FB_ACCEL_SUN_CGTHREE;
}

-static int __devinit p9100_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit p9100_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -352,7 +352,7 @@ static const struct of_device_id p9100_match[] = {
};
MODULE_DEVICE_TABLE(of, p9100_match);

-static struct of_platform_driver p9100_driver = {
+static struct platform_driver p9100_driver = {
.driver = {
.name = "p9100",
.owner = THIS_MODULE,
@@ -367,12 +367,12 @@ static int __init p9100_init(void)
if (fb_get_options("p9100fb", NULL))
return -ENODEV;

- return of_register_platform_driver(&p9100_driver);
+ return platform_driver_register(&p9100_driver);
}

static void __exit p9100_exit(void)
{
- of_unregister_platform_driver(&p9100_driver);
+ platform_driver_unregister(&p9100_driver);
}

module_init(p9100_init);
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index a50e197..ef532d9 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -533,8 +533,7 @@ static int __init platinumfb_setup(char *options)
#define invalidate_cache(addr)
#endif

-static int __devinit platinumfb_probe(struct platform_device* odev,
- const struct of_device_id *match)
+static int __devinit platinumfb_probe(struct platform_device* odev)
{
struct device_node *dp = odev->dev.of_node;
struct fb_info *info;
@@ -677,7 +676,7 @@ static struct of_device_id platinumfb_match[] =
{},
};

-static struct of_platform_driver platinum_driver =
+static struct platform_driver platinum_driver =
{
.driver = {
.name = "platinumfb",
@@ -697,14 +696,14 @@ static int __init platinumfb_init(void)
return -ENODEV;
platinumfb_setup(option);
#endif
- of_register_platform_driver(&platinum_driver);
+ platform_driver_register(&platinum_driver);

return 0;
}

static void __exit platinumfb_exit(void)
{
- of_unregister_platform_driver(&platinum_driver);
+ platform_driver_unregister(&platinum_driver);
}

MODULE_LICENSE("GPL");
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c
index 5dbe06a..b7f27ac 100644
--- a/drivers/video/sunxvr1000.c
+++ b/drivers/video/sunxvr1000.c
@@ -111,8 +111,7 @@ static int __devinit gfb_set_fbinfo(struct gfb_info *gp)
return 0;
}

-static int __devinit gfb_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit gfb_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -198,7 +197,7 @@ static const struct of_device_id gfb_match[] = {
};
MODULE_DEVICE_TABLE(of, ffb_match);

-static struct of_platform_driver gfb_driver = {
+static struct platform_driver gfb_driver = {
.probe = gfb_probe,
.remove = __devexit_p(gfb_remove),
.driver = {
@@ -213,12 +212,12 @@ static int __init gfb_init(void)
if (fb_get_options("gfb", NULL))
return -ENODEV;

- return of_register_platform_driver(&gfb_driver);
+ return platform_driver_register(&gfb_driver);
}

static void __exit gfb_exit(void)
{
- of_unregister_platform_driver(&gfb_driver);
+ platform_driver_unregister(&gfb_driver);
}

module_init(gfb_init);
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index 77ad279..855b719 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -362,8 +362,7 @@ static void tcx_unmap_regs(struct platform_device *op, struct fb_info *info,
info->screen_base, info->fix.smem_len);
}

-static int __devinit tcx_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit tcx_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct fb_info *info;
@@ -511,7 +510,7 @@ static const struct of_device_id tcx_match[] = {
};
MODULE_DEVICE_TABLE(of, tcx_match);

-static struct of_platform_driver tcx_driver = {
+static struct platform_driver tcx_driver = {
.driver = {
.name = "tcx",
.owner = THIS_MODULE,
@@ -526,12 +525,12 @@ static int __init tcx_init(void)
if (fb_get_options("tcxfb", NULL))
return -ENODEV;

- return of_register_platform_driver(&tcx_driver);
+ return platform_driver_register(&tcx_driver);
}

static void __exit tcx_exit(void)
{
- of_unregister_platform_driver(&tcx_driver);
+ platform_driver_unregister(&tcx_driver);
}

module_init(tcx_init);
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 68bd234..77dea01 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -404,8 +404,7 @@ static int xilinxfb_release(struct device *dev)
* OF bus binding
*/

-static int __devinit
-xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit xilinxfb_of_probe(struct platform_device *op)
{
const u32 *prop;
u32 *p;
@@ -418,8 +417,6 @@ xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match)
/* Copy with the default pdata (not a ptr reference!) */
pdata = xilinx_fb_default_pdata;

- dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match);
-
/* Allocate the driver data region */
drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
if (!drvdata) {
@@ -505,7 +502,7 @@ static struct of_device_id xilinxfb_of_match[] __devinitdata = {
};
MODULE_DEVICE_TABLE(of, xilinxfb_of_match);

-static struct of_platform_driver xilinxfb_of_driver = {
+static struct platform_driver xilinxfb_of_driver = {
.probe = xilinxfb_of_probe,
.remove = __devexit_p(xilinxfb_of_remove),
.driver = {
@@ -523,13 +520,13 @@ static struct of_platform_driver xilinxfb_of_driver = {
static int __init
xilinxfb_init(void)
{
- return of_register_platform_driver(&xilinxfb_of_driver);
+ return platform_driver_register(&xilinxfb_of_driver);
}

static void __exit
xilinxfb_cleanup(void)
{
- of_unregister_platform_driver(&xilinxfb_of_driver);
+ platform_driver_unregister(&xilinxfb_of_driver);
}

module_init(xilinxfb_init);

2011-02-23 04:34:43

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 12/15] dt/usb: Eliminate users of of_platform_{, un}register_driver

Get rid of users of of_platform_driver in drivers/usb. 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 <[email protected]>
---
drivers/usb/gadget/fsl_qe_udc.c | 14 ++++++++------
drivers/usb/host/ehci-hcd.c | 12 ++++++------
drivers/usb/host/ehci-ppc-of.c | 9 +++------
drivers/usb/host/ehci-xilinx-of.c | 6 ++----
drivers/usb/host/fhci-hcd.c | 9 ++++-----
drivers/usb/host/isp1760-if.c | 9 ++++-----
drivers/usb/host/ohci-hcd.c | 6 +++---
drivers/usb/host/ohci-ppc-of.c | 9 +++------
8 files changed, 33 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 792d5ef..aee7e3c 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2523,8 +2523,7 @@ static void qe_udc_release(struct device *dev)
}

/* Driver probe functions */
-static int __devinit qe_udc_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit qe_udc_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct qe_ep *ep;
@@ -2532,6 +2531,9 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
unsigned int i;
const void *prop;

+ if (!ofdev->dev.of_match)
+ return -EINVAL;
+
prop = of_get_property(np, "mode", NULL);
if (!prop || strcmp(prop, "peripheral"))
return -ENODEV;
@@ -2543,7 +2545,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
return -ENOMEM;
}

- udc_controller->soc_type = (unsigned long)match->data;
+ udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data;
udc_controller->usb_regs = of_iomap(np, 0);
if (!udc_controller->usb_regs) {
ret = -ENOMEM;
@@ -2768,7 +2770,7 @@ static const struct of_device_id qe_udc_match[] __devinitconst = {

MODULE_DEVICE_TABLE(of, qe_udc_match);

-static struct of_platform_driver udc_driver = {
+static struct platform_driver udc_driver = {
.driver = {
.name = (char *)driver_name,
.owner = THIS_MODULE,
@@ -2786,12 +2788,12 @@ static int __init qe_udc_init(void)
{
printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc,
DRIVER_VERSION);
- return of_register_platform_driver(&udc_driver);
+ return platform_driver_register(&udc_driver);
}

static void __exit qe_udc_exit(void)
{
- of_unregister_platform_driver(&udc_driver);
+ platform_driver_unregister(&udc_driver);
}

module_init(qe_udc_init);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 74dcf49..c4de2d7 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1306,24 +1306,24 @@ static int __init ehci_hcd_init(void)
#endif

#ifdef OF_PLATFORM_DRIVER
- retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
+ retval = platform_driver_register(&OF_PLATFORM_DRIVER);
if (retval < 0)
goto clean3;
#endif

#ifdef XILINX_OF_PLATFORM_DRIVER
- retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
+ retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER);
if (retval < 0)
goto clean4;
#endif
return retval;

#ifdef XILINX_OF_PLATFORM_DRIVER
- /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */
+ /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */
clean4:
#endif
#ifdef OF_PLATFORM_DRIVER
- of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ platform_driver_unregister(&OF_PLATFORM_DRIVER);
clean3:
#endif
#ifdef PS3_SYSTEM_BUS_DRIVER
@@ -1351,10 +1351,10 @@ module_init(ehci_hcd_init);
static void __exit ehci_hcd_cleanup(void)
{
#ifdef XILINX_OF_PLATFORM_DRIVER
- of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
+ platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER);
#endif
#ifdef OF_PLATFORM_DRIVER
- of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index ba52be4..1f09f25 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -105,8 +105,7 @@ ppc44x_enable_bmt(struct device_node *dn)
}


-static int __devinit
-ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
@@ -255,14 +254,12 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)
}


-static int ehci_hcd_ppc_of_shutdown(struct platform_device *op)
+static void ehci_hcd_ppc_of_shutdown(struct platform_device *op)
{
struct usb_hcd *hcd = dev_get_drvdata(&op->dev);

if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd);
-
- return 0;
}


@@ -275,7 +272,7 @@ static const struct of_device_id ehci_hcd_ppc_of_match[] = {
MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match);


-static struct of_platform_driver ehci_hcd_ppc_of_driver = {
+static struct platform_driver ehci_hcd_ppc_of_driver = {
.probe = ehci_hcd_ppc_of_probe,
.remove = ehci_hcd_ppc_of_remove,
.shutdown = ehci_hcd_ppc_of_shutdown,
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c
index e8f4f36..17c1b11 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -142,15 +142,13 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = {
/**
* ehci_hcd_xilinx_of_probe - Probe method for the USB host controller
* @op: pointer to the platform_device bound to the host controller
- * @match: pointer to of_device_id structure, not used
*
* This function requests resources and sets up appropriate properties for the
* host controller. Because the Xilinx USB host controller can be configured
* as HS only or HS/FS only, it checks the configuration in the device tree
* entry, and sets an appropriate value for hcd->has_tt.
*/
-static int __devinit
-ehci_hcd_xilinx_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
@@ -288,7 +286,7 @@ static const struct of_device_id ehci_hcd_xilinx_of_match[] = {
};
MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match);

-static struct of_platform_driver ehci_hcd_xilinx_of_driver = {
+static struct platform_driver ehci_hcd_xilinx_of_driver = {
.probe = ehci_hcd_xilinx_of_probe,
.remove = ehci_hcd_xilinx_of_remove,
.shutdown = ehci_hcd_xilinx_of_shutdown,
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 12fd184..b84ff7e 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -561,8 +561,7 @@ static const struct hc_driver fhci_driver = {
.hub_control = fhci_hub_control,
};

-static int __devinit of_fhci_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid)
+static int __devinit of_fhci_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *node = dev->of_node;
@@ -812,7 +811,7 @@ static const struct of_device_id of_fhci_match[] = {
};
MODULE_DEVICE_TABLE(of, of_fhci_match);

-static struct of_platform_driver of_fhci_driver = {
+static struct platform_driver of_fhci_driver = {
.driver = {
.name = "fsl,usb-fhci",
.owner = THIS_MODULE,
@@ -824,13 +823,13 @@ static struct of_platform_driver of_fhci_driver = {

static int __init fhci_module_init(void)
{
- return of_register_platform_driver(&of_fhci_driver);
+ return platform_driver_register(&of_fhci_driver);
}
module_init(fhci_module_init);

static void __exit fhci_module_exit(void)
{
- of_unregister_platform_driver(&of_fhci_driver);
+ platform_driver_unregister(&of_fhci_driver);
}
module_exit(fhci_module_exit);

diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index 3b28dbf..7ee3005 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -27,8 +27,7 @@
#endif

#ifdef CONFIG_PPC_OF
-static int of_isp1760_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int of_isp1760_probe(struct platform_device *dev)
{
struct usb_hcd *hcd;
struct device_node *dp = dev->dev.of_node;
@@ -119,7 +118,7 @@ static const struct of_device_id of_isp1760_match[] = {
};
MODULE_DEVICE_TABLE(of, of_isp1760_match);

-static struct of_platform_driver isp1760_of_driver = {
+static struct platform_driver isp1760_of_driver = {
.driver = {
.name = "nxp-isp1760",
.owner = THIS_MODULE,
@@ -398,7 +397,7 @@ static int __init isp1760_init(void)
if (!ret)
any_ret = 0;
#ifdef CONFIG_PPC_OF
- ret = of_register_platform_driver(&isp1760_of_driver);
+ ret = platform_driver_register(&isp1760_of_driver);
if (!ret)
any_ret = 0;
#endif
@@ -418,7 +417,7 @@ static void __exit isp1760_exit(void)
{
platform_driver_unregister(&isp1760_plat_driver);
#ifdef CONFIG_PPC_OF
- of_unregister_platform_driver(&isp1760_of_driver);
+ platform_driver_unregister(&isp1760_of_driver);
#endif
#ifdef CONFIG_PCI
pci_unregister_driver(&isp1761_pci_driver);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 759a12f..54240f6 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1180,7 +1180,7 @@ static int __init ohci_hcd_mod_init(void)
#endif

#ifdef OF_PLATFORM_DRIVER
- retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
+ retval = platform_driver_register(&OF_PLATFORM_DRIVER);
if (retval < 0)
goto error_of_platform;
#endif
@@ -1239,7 +1239,7 @@ static int __init ohci_hcd_mod_init(void)
error_sa1111:
#endif
#ifdef OF_PLATFORM_DRIVER
- of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ platform_driver_unregister(&OF_PLATFORM_DRIVER);
error_of_platform:
#endif
#ifdef PLATFORM_DRIVER
@@ -1287,7 +1287,7 @@ static void __exit ohci_hcd_mod_exit(void)
sa1111_driver_unregister(&SA1111_DRIVER);
#endif
#ifdef OF_PLATFORM_DRIVER
- of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+ platform_driver_unregister(&OF_PLATFORM_DRIVER);
#endif
#ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index b2c2dbf..1ca1821 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -80,8 +80,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
};


-static int __devinit
-ohci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit ohci_hcd_ppc_of_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct usb_hcd *hcd;
@@ -201,14 +200,12 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op)
return 0;
}

-static int ohci_hcd_ppc_of_shutdown(struct platform_device *op)
+static void ohci_hcd_ppc_of_shutdown(struct platform_device *op)
{
struct usb_hcd *hcd = dev_get_drvdata(&op->dev);

if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd);
-
- return 0;
}


@@ -243,7 +240,7 @@ MODULE_DEVICE_TABLE(of, ohci_hcd_ppc_of_match);
#endif


-static struct of_platform_driver ohci_hcd_ppc_of_driver = {
+static struct platform_driver ohci_hcd_ppc_of_driver = {
.probe = ohci_hcd_ppc_of_probe,
.remove = ohci_hcd_ppc_of_remove,
.shutdown = ohci_hcd_ppc_of_shutdown,

2011-02-23 04:34:48

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 13/15] dt/serial: Eliminate users of of_platform_{, un}register_driver

Get rid of users of of_platform_driver in drivers/serial. 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 <[email protected]>
---
drivers/tty/serial/apbuart.c | 11 +++++------
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 9 ++++-----
drivers/tty/serial/mpc52xx_uart.c | 13 +++++--------
drivers/tty/serial/of_serial.c | 14 ++++++++------
drivers/tty/serial/sunhv.c | 8 ++++----
drivers/tty/serial/sunsab.c | 8 ++++----
drivers/tty/serial/sunsu.c | 6 +++---
drivers/tty/serial/sunzilog.c | 10 +++++-----
drivers/tty/serial/ucc_uart.c | 9 ++++-----
9 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 095a5d5..1ab999b 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -553,8 +553,7 @@ static struct uart_driver grlib_apbuart_driver = {
/* OF Platform Driver */
/* ======================================================================== */

-static int __devinit apbuart_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit apbuart_probe(struct platform_device *op)
{
int i = -1;
struct uart_port *port = NULL;
@@ -587,7 +586,7 @@ static struct of_device_id __initdata apbuart_match[] = {
{},
};

-static struct of_platform_driver grlib_apbuart_of_driver = {
+static struct platform_driver grlib_apbuart_of_driver = {
.probe = apbuart_probe,
.driver = {
.owner = THIS_MODULE,
@@ -676,10 +675,10 @@ static int __init grlib_apbuart_init(void)
return ret;
}

- ret = of_register_platform_driver(&grlib_apbuart_of_driver);
+ ret = platform_driver_register(&grlib_apbuart_of_driver);
if (ret) {
printk(KERN_ERR
- "%s: of_register_platform_driver failed (%i)\n",
+ "%s: platform_driver_register failed (%i)\n",
__FILE__, ret);
uart_unregister_driver(&grlib_apbuart_driver);
return ret;
@@ -697,7 +696,7 @@ static void __exit grlib_apbuart_exit(void)
&grlib_apbuart_ports[i]);

uart_unregister_driver(&grlib_apbuart_driver);
- of_unregister_platform_driver(&grlib_apbuart_of_driver);
+ platform_driver_unregister(&grlib_apbuart_of_driver);
}

module_init(grlib_apbuart_init);
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index 8692ff9..a9a6a5f 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -1359,8 +1359,7 @@ static struct uart_driver cpm_reg = {

static int probe_index;

-static int __devinit cpm_uart_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit cpm_uart_probe(struct platform_device *ofdev)
{
int index = probe_index++;
struct uart_cpm_port *pinfo = &cpm_uart_ports[index];
@@ -1405,7 +1404,7 @@ static struct of_device_id cpm_uart_match[] = {
{}
};

-static struct of_platform_driver cpm_uart_driver = {
+static struct platform_driver cpm_uart_driver = {
.driver = {
.name = "cpm_uart",
.owner = THIS_MODULE,
@@ -1421,7 +1420,7 @@ static int __init cpm_uart_init(void)
if (ret)
return ret;

- ret = of_register_platform_driver(&cpm_uart_driver);
+ ret = platform_driver_register(&cpm_uart_driver);
if (ret)
uart_unregister_driver(&cpm_reg);

@@ -1430,7 +1429,7 @@ static int __init cpm_uart_init(void)

static void __exit cpm_uart_exit(void)
{
- of_unregister_platform_driver(&cpm_uart_driver);
+ platform_driver_unregister(&cpm_uart_driver);
uart_unregister_driver(&cpm_reg);
}

diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 126ec7f..a0bcd8a 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1302,8 +1302,7 @@ static struct of_device_id mpc52xx_uart_of_match[] = {
{},
};

-static int __devinit
-mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit mpc52xx_uart_of_probe(struct platform_device *op)
{
int idx = -1;
unsigned int uartclk;
@@ -1311,8 +1310,6 @@ mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *mat
struct resource res;
int ret;

- dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match);
-
/* Check validity & presence */
for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
if (mpc52xx_uart_nodes[idx] == op->dev.of_node)
@@ -1453,7 +1450,7 @@ mpc52xx_uart_of_enumerate(void)

MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);

-static struct of_platform_driver mpc52xx_uart_of_driver = {
+static struct platform_driver mpc52xx_uart_of_driver = {
.probe = mpc52xx_uart_of_probe,
.remove = mpc52xx_uart_of_remove,
#ifdef CONFIG_PM
@@ -1497,9 +1494,9 @@ mpc52xx_uart_init(void)
return ret;
}

- ret = of_register_platform_driver(&mpc52xx_uart_of_driver);
+ ret = platform_driver_register(&mpc52xx_uart_of_driver);
if (ret) {
- printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n",
+ printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
__FILE__, ret);
uart_unregister_driver(&mpc52xx_uart_driver);
return ret;
@@ -1514,7 +1511,7 @@ mpc52xx_uart_exit(void)
if (psc_ops->fifoc_uninit)
psc_ops->fifoc_uninit();

- of_unregister_platform_driver(&mpc52xx_uart_of_driver);
+ platform_driver_unregister(&mpc52xx_uart_of_driver);
uart_unregister_driver(&mpc52xx_uart_driver);
}

diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 5c7abe4..1a43197 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -80,14 +80,16 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
/*
* Try to register a serial port
*/
-static int __devinit of_platform_serial_probe(struct platform_device *ofdev,
- const struct of_device_id *id)
+static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
{
struct of_serial_info *info;
struct uart_port port;
int port_type;
int ret;

+ if (!ofdev->dev.of_match)
+ return -EINVAL;
+
if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
return -EBUSY;

@@ -95,7 +97,7 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev,
if (info == NULL)
return -ENOMEM;

- port_type = (unsigned long)id->data;
+ port_type = (unsigned long)ofdev->dev.of_match->data;
ret = of_platform_serial_setup(ofdev, port_type, &port);
if (ret)
goto out;
@@ -174,7 +176,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
{ /* end of list */ },
};

-static struct of_platform_driver of_platform_serial_driver = {
+static struct platform_driver of_platform_serial_driver = {
.driver = {
.name = "of_serial",
.owner = THIS_MODULE,
@@ -186,13 +188,13 @@ static struct of_platform_driver of_platform_serial_driver = {

static int __init of_platform_serial_init(void)
{
- return of_register_platform_driver(&of_platform_serial_driver);
+ return platform_driver_register(&of_platform_serial_driver);
}
module_init(of_platform_serial_init);

static void __exit of_platform_serial_exit(void)
{
- return of_unregister_platform_driver(&of_platform_serial_driver);
+ return platform_driver_unregister(&of_platform_serial_driver);
};
module_exit(of_platform_serial_exit);

diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index c901486..c0b7246 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -519,7 +519,7 @@ static struct console sunhv_console = {
.data = &sunhv_reg,
};

-static int __devinit hv_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit hv_probe(struct platform_device *op)
{
struct uart_port *port;
unsigned long minor;
@@ -629,7 +629,7 @@ static const struct of_device_id hv_match[] = {
};
MODULE_DEVICE_TABLE(of, hv_match);

-static struct of_platform_driver hv_driver = {
+static struct platform_driver hv_driver = {
.driver = {
.name = "hv",
.owner = THIS_MODULE,
@@ -644,12 +644,12 @@ static int __init sunhv_init(void)
if (tlb_type != hypervisor)
return -ENODEV;

- return of_register_platform_driver(&hv_driver);
+ return platform_driver_register(&hv_driver);
}

static void __exit sunhv_exit(void)
{
- of_unregister_platform_driver(&hv_driver);
+ platform_driver_unregister(&hv_driver);
}

module_init(sunhv_init);
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5b246b1..b5fa2a5 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -1006,7 +1006,7 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up,
return 0;
}

-static int __devinit sab_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit sab_probe(struct platform_device *op)
{
static int inst;
struct uart_sunsab_port *up;
@@ -1092,7 +1092,7 @@ static const struct of_device_id sab_match[] = {
};
MODULE_DEVICE_TABLE(of, sab_match);

-static struct of_platform_driver sab_driver = {
+static struct platform_driver sab_driver = {
.driver = {
.name = "sab",
.owner = THIS_MODULE,
@@ -1130,12 +1130,12 @@ static int __init sunsab_init(void)
}
}

- return of_register_platform_driver(&sab_driver);
+ return platform_driver_register(&sab_driver);
}

static void __exit sunsab_exit(void)
{
- of_unregister_platform_driver(&sab_driver);
+ platform_driver_unregister(&sab_driver);
if (sunsab_reg.nr) {
sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
}
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 551ebfe..92aa545 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -1406,7 +1406,7 @@ static enum su_type __devinit su_get_type(struct device_node *dp)
return SU_PORT_PORT;
}

-static int __devinit su_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit su_probe(struct platform_device *op)
{
static int inst;
struct device_node *dp = op->dev.of_node;
@@ -1543,7 +1543,7 @@ static const struct of_device_id su_match[] = {
};
MODULE_DEVICE_TABLE(of, su_match);

-static struct of_platform_driver su_driver = {
+static struct platform_driver su_driver = {
.driver = {
.name = "su",
.owner = THIS_MODULE,
@@ -1586,7 +1586,7 @@ static int __init sunsu_init(void)
return err;
}

- err = of_register_platform_driver(&su_driver);
+ err = platform_driver_register(&su_driver);
if (err && num_uart)
sunserial_unregister_minors(&sunsu_reg, num_uart);

diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index c1967ac..99ff9ab 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -1399,7 +1399,7 @@ static void __devinit sunzilog_init_hw(struct uart_sunzilog_port *up)

static int zilog_irq = -1;

-static int __devinit zs_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit zs_probe(struct platform_device *op)
{
static int kbm_inst, uart_inst;
int inst;
@@ -1540,7 +1540,7 @@ static const struct of_device_id zs_match[] = {
};
MODULE_DEVICE_TABLE(of, zs_match);

-static struct of_platform_driver zs_driver = {
+static struct platform_driver zs_driver = {
.driver = {
.name = "zs",
.owner = THIS_MODULE,
@@ -1576,7 +1576,7 @@ static int __init sunzilog_init(void)
goto out_free_tables;
}

- err = of_register_platform_driver(&zs_driver);
+ err = platform_driver_register(&zs_driver);
if (err)
goto out_unregister_uart;

@@ -1604,7 +1604,7 @@ out:
return err;

out_unregister_driver:
- of_unregister_platform_driver(&zs_driver);
+ platform_driver_unregister(&zs_driver);

out_unregister_uart:
if (num_sunzilog) {
@@ -1619,7 +1619,7 @@ out_free_tables:

static void __exit sunzilog_exit(void)
{
- of_unregister_platform_driver(&zs_driver);
+ platform_driver_unregister(&zs_driver);

if (zilog_irq != -1) {
struct uart_sunzilog_port *up = sunzilog_irq_chain;
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 3f4848e..ff51dae 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1194,8 +1194,7 @@ static void uart_firmware_cont(const struct firmware *fw, void *context)
release_firmware(fw);
}

-static int ucc_uart_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int ucc_uart_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
const unsigned int *iprop; /* Integer OF properties */
@@ -1485,7 +1484,7 @@ static struct of_device_id ucc_uart_match[] = {
};
MODULE_DEVICE_TABLE(of, ucc_uart_match);

-static struct of_platform_driver ucc_uart_of_driver = {
+static struct platform_driver ucc_uart_of_driver = {
.driver = {
.name = "ucc_uart",
.owner = THIS_MODULE,
@@ -1510,7 +1509,7 @@ static int __init ucc_uart_init(void)
return ret;
}

- ret = of_register_platform_driver(&ucc_uart_of_driver);
+ ret = platform_driver_register(&ucc_uart_of_driver);
if (ret)
printk(KERN_ERR
"ucc-uart: could not register platform driver\n");
@@ -1523,7 +1522,7 @@ static void __exit ucc_uart_exit(void)
printk(KERN_INFO
"Freescale QUICC Engine UART device driver unloading\n");

- of_unregister_platform_driver(&ucc_uart_of_driver);
+ platform_driver_unregister(&ucc_uart_of_driver);
uart_unregister_driver(&ucc_uart_driver);
}

2011-02-23 04:34:54

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 14/15] dt: Eliminate of_platform_{,un}register_driver

Final step to eliminate of_platform_bus_type. They're all just
platform drivers now.

Signed-off-by: Grant Likely <[email protected]>
---
drivers/ata/pata_mpc52xx.c | 8 ++++----
drivers/ata/pata_of_platform.c | 9 ++++-----
drivers/ata/sata_dwc_460ex.c | 9 ++++-----
drivers/ata/sata_fsl.c | 9 ++++-----
drivers/atm/fore200e.c | 17 ++++++++++-------
drivers/block/xsysace.c | 11 ++++-------
drivers/char/ipmi/ipmi_si_intf.c | 18 ++++++++++--------
drivers/crypto/talitos.c | 9 ++++-----
drivers/i2c/busses/i2c-cpm.c | 9 ++++-----
drivers/i2c/busses/i2c-ibm_iic.c | 9 ++++-----
drivers/i2c/busses/i2c-mpc.c | 22 +++++++++-------------
drivers/input/serio/xilinx_ps2.c | 9 ++++-----
drivers/media/video/fsl-viu.c | 9 ++++-----
drivers/mmc/host/sdhci-of-core.c | 12 ++++++++----
drivers/mtd/maps/physmap_of.c | 15 +++++++++------
drivers/mtd/maps/sun_uflash.c | 8 ++++----
drivers/mtd/nand/fsl_upm.c | 9 ++++-----
drivers/mtd/nand/mpc5121_nfc.c | 9 ++++-----
drivers/mtd/nand/ndfc.c | 9 ++++-----
drivers/mtd/nand/pasemi_nand.c | 9 ++++-----
drivers/mtd/nand/socrates_nand.c | 9 ++++-----
drivers/pcmcia/electra_cf.c | 9 ++++-----
drivers/pcmcia/m8xx_pcmcia.c | 9 ++++-----
drivers/rtc/rtc-mpc5121.c | 9 ++++-----
drivers/watchdog/cpwd.c | 9 ++++-----
drivers/watchdog/gef_wdt.c | 9 ++++-----
drivers/watchdog/mpc8xxx_wdt.c | 15 +++++++++------
drivers/watchdog/riowd.c | 9 ++++-----
28 files changed, 143 insertions(+), 154 deletions(-)

diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index d7d8026..2fcac51 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -680,7 +680,7 @@ mpc52xx_ata_remove_one(struct device *dev)
/* ======================================================================== */

static int __devinit
-mpc52xx_ata_probe(struct platform_device *op, const struct of_device_id *match)
+mpc52xx_ata_probe(struct platform_device *op)
{
unsigned int ipb_freq;
struct resource res_mem;
@@ -883,7 +883,7 @@ static struct of_device_id mpc52xx_ata_of_match[] = {
};


-static struct of_platform_driver mpc52xx_ata_of_platform_driver = {
+static struct platform_driver mpc52xx_ata_of_platform_driver = {
.probe = mpc52xx_ata_probe,
.remove = mpc52xx_ata_remove,
#ifdef CONFIG_PM
@@ -906,13 +906,13 @@ static int __init
mpc52xx_ata_init(void)
{
printk(KERN_INFO "ata: MPC52xx IDE/ATA libata driver\n");
- return of_register_platform_driver(&mpc52xx_ata_of_platform_driver);
+ return platform_driver_register(&mpc52xx_ata_of_platform_driver);
}

static void __exit
mpc52xx_ata_exit(void)
{
- of_unregister_platform_driver(&mpc52xx_ata_of_platform_driver);
+ platform_driver_unregister(&mpc52xx_ata_of_platform_driver);
}

module_init(mpc52xx_ata_init);
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 480e043..f305400 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -14,8 +14,7 @@
#include <linux/of_platform.h>
#include <linux/ata_platform.h>

-static int __devinit pata_of_platform_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
{
int ret;
struct device_node *dn = ofdev->dev.of_node;
@@ -90,7 +89,7 @@ static struct of_device_id pata_of_platform_match[] = {
};
MODULE_DEVICE_TABLE(of, pata_of_platform_match);

-static struct of_platform_driver pata_of_platform_driver = {
+static struct platform_driver pata_of_platform_driver = {
.driver = {
.name = "pata_of_platform",
.owner = THIS_MODULE,
@@ -102,13 +101,13 @@ static struct of_platform_driver pata_of_platform_driver = {

static int __init pata_of_platform_init(void)
{
- return of_register_platform_driver(&pata_of_platform_driver);
+ return platform_driver_register(&pata_of_platform_driver);
}
module_init(pata_of_platform_init);

static void __exit pata_of_platform_exit(void)
{
- of_unregister_platform_driver(&pata_of_platform_driver);
+ platform_driver_unregister(&pata_of_platform_driver);
}
module_exit(pata_of_platform_exit);

diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 6cf57c5..685a3a4 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1588,8 +1588,7 @@ static const struct ata_port_info sata_dwc_port_info[] = {
},
};

-static int sata_dwc_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int sata_dwc_probe(struct platform_device *ofdev)
{
struct sata_dwc_device *hsdev;
u32 idr, versionr;
@@ -1727,7 +1726,7 @@ static const struct of_device_id sata_dwc_match[] = {
};
MODULE_DEVICE_TABLE(of, sata_dwc_match);

-static struct of_platform_driver sata_dwc_driver = {
+static struct platform_driver sata_dwc_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
@@ -1739,12 +1738,12 @@ static struct of_platform_driver sata_dwc_driver = {

static int __init sata_dwc_init(void)
{
- return of_register_platform_driver(&sata_dwc_driver);
+ return platform_driver_register(&sata_dwc_driver);
}

static void __exit sata_dwc_exit(void)
{
- of_unregister_platform_driver(&sata_dwc_driver);
+ platform_driver_unregister(&sata_dwc_driver);
}

module_init(sata_dwc_init);
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b0214d0..b843e8e 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1293,8 +1293,7 @@ static const struct ata_port_info sata_fsl_port_info[] = {
},
};

-static int sata_fsl_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int sata_fsl_probe(struct platform_device *ofdev)
{
int retval = -ENXIO;
void __iomem *hcr_base = NULL;
@@ -1423,7 +1422,7 @@ static struct of_device_id fsl_sata_match[] = {

MODULE_DEVICE_TABLE(of, fsl_sata_match);

-static struct of_platform_driver fsl_sata_driver = {
+static struct platform_driver fsl_sata_driver = {
.driver = {
.name = "fsl-sata",
.owner = THIS_MODULE,
@@ -1439,13 +1438,13 @@ static struct of_platform_driver fsl_sata_driver = {

static int __init sata_fsl_init(void)
{
- of_register_platform_driver(&fsl_sata_driver);
+ platform_driver_register(&fsl_sata_driver);
return 0;
}

static void __exit sata_fsl_exit(void)
{
- of_unregister_platform_driver(&fsl_sata_driver);
+ platform_driver_unregister(&fsl_sata_driver);
}

MODULE_LICENSE("GPL");
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 44f7785..bdd2719 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2643,14 +2643,17 @@ fore200e_init(struct fore200e* fore200e, struct device *parent)
}

#ifdef CONFIG_SBUS
-static int __devinit fore200e_sba_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit fore200e_sba_probe(struct platform_device *op)
{
- const struct fore200e_bus *bus = match->data;
+ const struct fore200e_bus *bus;
struct fore200e *fore200e;
static int index = 0;
int err;

+ if (!op->dev.of_match)
+ return -EINVAL;
+ bus = op->dev.of_match->data;
+
fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL);
if (!fore200e)
return -ENOMEM;
@@ -2694,7 +2697,7 @@ static const struct of_device_id fore200e_sba_match[] = {
};
MODULE_DEVICE_TABLE(of, fore200e_sba_match);

-static struct of_platform_driver fore200e_sba_driver = {
+static struct platform_driver fore200e_sba_driver = {
.driver = {
.name = "fore_200e",
.owner = THIS_MODULE,
@@ -2795,7 +2798,7 @@ static int __init fore200e_module_init(void)
printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n");

#ifdef CONFIG_SBUS
- err = of_register_platform_driver(&fore200e_sba_driver);
+ err = platform_driver_register(&fore200e_sba_driver);
if (err)
return err;
#endif
@@ -2806,7 +2809,7 @@ static int __init fore200e_module_init(void)

#ifdef CONFIG_SBUS
if (err)
- of_unregister_platform_driver(&fore200e_sba_driver);
+ platform_driver_unregister(&fore200e_sba_driver);
#endif

return err;
@@ -2818,7 +2821,7 @@ static void __exit fore200e_module_cleanup(void)
pci_unregister_driver(&fore200e_pca_driver);
#endif
#ifdef CONFIG_SBUS
- of_unregister_platform_driver(&fore200e_sba_driver);
+ platform_driver_unregister(&fore200e_sba_driver);
#endif
}

diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 829161e..2c590a7 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1195,16 +1195,13 @@ static struct platform_driver ace_platform_driver = {
*/

#if defined(CONFIG_OF)
-static int __devinit
-ace_of_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit ace_of_probe(struct platform_device *op)
{
struct resource res;
resource_size_t physaddr;
const u32 *id;
int irq, bus_width, rc;

- dev_dbg(&op->dev, "ace_of_probe(%p, %p)\n", op, match);
-
/* device id */
id = of_get_property(op->dev.of_node, "port-number", NULL);

@@ -1245,7 +1242,7 @@ static const struct of_device_id ace_of_match[] __devinitconst = {
};
MODULE_DEVICE_TABLE(of, ace_of_match);

-static struct of_platform_driver ace_of_driver = {
+static struct platform_driver ace_of_driver = {
.probe = ace_of_probe,
.remove = __devexit_p(ace_of_remove),
.driver = {
@@ -1259,12 +1256,12 @@ static struct of_platform_driver ace_of_driver = {
static inline int __init ace_of_register(void)
{
pr_debug("xsysace: registering OF binding\n");
- return of_register_platform_driver(&ace_of_driver);
+ return platform_driver_register(&ace_of_driver);
}

static inline void __exit ace_of_unregister(void)
{
- of_unregister_platform_driver(&ace_of_driver);
+ platform_driver_unregister(&ace_of_driver);
}
#else /* CONFIG_OF */
/* CONFIG_OF not enabled; do nothing helpers */
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index b6ae6e9..132951d 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2556,8 +2556,7 @@ static struct pci_driver ipmi_pci_driver = {


#ifdef CONFIG_PPC_OF
-static int __devinit ipmi_of_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit ipmi_of_probe(struct platform_device *dev)
{
struct smi_info *info;
struct resource resource;
@@ -2568,6 +2567,9 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,

dev_info(&dev->dev, "probing via device tree\n");

+ if (!dev->dev.of_match)
+ return -EINVAL;
+
ret = of_address_to_resource(np, 0, &resource);
if (ret) {
dev_warn(&dev->dev, PFX "invalid address from OF\n");
@@ -2600,7 +2602,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
return -ENOMEM;
}

- info->si_type = (enum si_type) match->data;
+ info->si_type = (enum si_type) dev->dev.of_match->data;
info->addr_source = SI_DEVICETREE;
info->irq_setup = std_irq_setup;

@@ -2652,9 +2654,9 @@ static struct of_device_id ipmi_match[] =
{},
};

-static struct of_platform_driver ipmi_of_platform_driver = {
+static struct platform_driver ipmi_of_platform_driver = {
.driver = {
- .name = "ipmi",
+ .name = "of-ipmi",
.owner = THIS_MODULE,
.of_match_table = ipmi_match,
},
@@ -3396,7 +3398,7 @@ static int __devinit init_ipmi_si(void)
#endif

#ifdef CONFIG_PPC_OF
- of_register_platform_driver(&ipmi_of_platform_driver);
+ platform_driver_register(&ipmi_of_platform_driver);
of_registered = 1;
#endif

@@ -3457,7 +3459,7 @@ static int __devinit init_ipmi_si(void)

#ifdef CONFIG_PPC_OF
if (of_registered)
- of_unregister_platform_driver(&ipmi_of_platform_driver);
+ platform_driver_unregister(&ipmi_of_platform_driver);
#endif
driver_unregister(&ipmi_driver.driver);
printk(KERN_WARNING PFX
@@ -3558,7 +3560,7 @@ static void __exit cleanup_ipmi_si(void)

#ifdef CONFIG_PPC_OF
if (of_registered)
- of_unregister_platform_driver(&ipmi_of_platform_driver);
+ platform_driver_unregister(&ipmi_of_platform_driver);
#endif

mutex_lock(&smi_infos_lock);
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index b879c3f..854e263 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -2402,8 +2402,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
return t_alg;
}

-static int talitos_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int talitos_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
@@ -2580,7 +2579,7 @@ static const struct of_device_id talitos_match[] = {
};
MODULE_DEVICE_TABLE(of, talitos_match);

-static struct of_platform_driver talitos_driver = {
+static struct platform_driver talitos_driver = {
.driver = {
.name = "talitos",
.owner = THIS_MODULE,
@@ -2592,13 +2591,13 @@ static struct of_platform_driver talitos_driver = {

static int __init talitos_init(void)
{
- return of_register_platform_driver(&talitos_driver);
+ return platform_driver_register(&talitos_driver);
}
module_init(talitos_init);

static void __exit talitos_exit(void)
{
- of_unregister_platform_driver(&talitos_driver);
+ platform_driver_unregister(&talitos_driver);
}
module_exit(talitos_exit);

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index f2de3be..3a20961 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -634,8 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
cpm_muram_free(cpm->i2c_addr);
}

-static int __devinit cpm_i2c_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
{
int result, len;
struct cpm_i2c *cpm;
@@ -718,7 +717,7 @@ static const struct of_device_id cpm_i2c_match[] = {

MODULE_DEVICE_TABLE(of, cpm_i2c_match);

-static struct of_platform_driver cpm_i2c_driver = {
+static struct platform_driver cpm_i2c_driver = {
.probe = cpm_i2c_probe,
.remove = __devexit_p(cpm_i2c_remove),
.driver = {
@@ -730,12 +729,12 @@ static struct of_platform_driver cpm_i2c_driver = {

static int __init cpm_i2c_init(void)
{
- return of_register_platform_driver(&cpm_i2c_driver);
+ return platform_driver_register(&cpm_i2c_driver);
}

static void __exit cpm_i2c_exit(void)
{
- of_unregister_platform_driver(&cpm_i2c_driver);
+ platform_driver_unregister(&cpm_i2c_driver);
}

module_init(cpm_i2c_init);
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 6e3c382..e4f88dc 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -691,8 +691,7 @@ static int __devinit iic_request_irq(struct platform_device *ofdev,
/*
* Register single IIC interface
*/
-static int __devinit iic_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit iic_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct ibm_iic_private *dev;
@@ -806,7 +805,7 @@ static const struct of_device_id ibm_iic_match[] = {
{}
};

-static struct of_platform_driver ibm_iic_driver = {
+static struct platform_driver ibm_iic_driver = {
.driver = {
.name = "ibm-iic",
.owner = THIS_MODULE,
@@ -818,12 +817,12 @@ static struct of_platform_driver ibm_iic_driver = {

static int __init iic_init(void)
{
- return of_register_platform_driver(&ibm_iic_driver);
+ return platform_driver_register(&ibm_iic_driver);
}

static void __exit iic_exit(void)
{
- of_unregister_platform_driver(&ibm_iic_driver);
+ platform_driver_unregister(&ibm_iic_driver);
}

module_init(iic_init);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b74e6dc..75b984c 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -560,8 +560,7 @@ static struct i2c_adapter mpc_ops = {
.timeout = HZ,
};

-static int __devinit fsl_i2c_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit fsl_i2c_probe(struct platform_device *op)
{
struct mpc_i2c *i2c;
const u32 *prop;
@@ -569,6 +568,9 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
int result = 0;
int plen;

+ if (!op->dev.of_match)
+ return -EINVAL;
+
i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return -ENOMEM;
@@ -603,8 +605,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
clock = *prop;
}

- if (match->data) {
- struct mpc_i2c_data *data = match->data;
+ if (op->dev.of_match->data) {
+ struct mpc_i2c_data *data = op->dev.of_match->data;
data->setup(op->dev.of_node, i2c, clock, data->prescaler);
} else {
/* Backwards compatibility */
@@ -700,7 +702,7 @@ static const struct of_device_id mpc_i2c_of_match[] = {
MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);

/* Structure for a device driver */
-static struct of_platform_driver mpc_i2c_driver = {
+static struct platform_driver mpc_i2c_driver = {
.probe = fsl_i2c_probe,
.remove = __devexit_p(fsl_i2c_remove),
.driver = {
@@ -712,18 +714,12 @@ static struct of_platform_driver mpc_i2c_driver = {

static int __init fsl_i2c_init(void)
{
- int rv;
-
- rv = of_register_platform_driver(&mpc_i2c_driver);
- if (rv)
- printk(KERN_ERR DRV_NAME
- " of_register_platform_driver failed (%i)\n", rv);
- return rv;
+ return platform_driver_register(&mpc_i2c_driver);
}

static void __exit fsl_i2c_exit(void)
{
- of_unregister_platform_driver(&mpc_i2c_driver);
+ platform_driver_unregister(&mpc_i2c_driver);
}

module_init(fsl_i2c_init);
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index bb14449..7540baf 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -232,8 +232,7 @@ static void sxps2_close(struct serio *pserio)
* It returns 0, if the driver is bound to the PS/2 device, or a negative
* value if there is an error.
*/
-static int __devinit xps2_of_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit xps2_of_probe(struct platform_device *ofdev)
{
struct resource r_irq; /* Interrupt resources */
struct resource r_mem; /* IO mem resources */
@@ -361,7 +360,7 @@ static const struct of_device_id xps2_of_match[] __devinitconst = {
};
MODULE_DEVICE_TABLE(of, xps2_of_match);

-static struct of_platform_driver xps2_of_driver = {
+static struct platform_driver xps2_of_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -373,12 +372,12 @@ static struct of_platform_driver xps2_of_driver = {

static int __init xps2_init(void)
{
- return of_register_platform_driver(&xps2_of_driver);
+ return platform_driver_register(&xps2_of_driver);
}

static void __exit xps2_cleanup(void)
{
- of_unregister_platform_driver(&xps2_of_driver);
+ platform_driver_unregister(&xps2_of_driver);
}

module_init(xps2_init);
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c
index e4bba88..031af16 100644
--- a/drivers/media/video/fsl-viu.c
+++ b/drivers/media/video/fsl-viu.c
@@ -1445,8 +1445,7 @@ static struct video_device viu_template = {
.current_norm = V4L2_STD_NTSC_M,
};

-static int __devinit viu_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit viu_of_probe(struct platform_device *op)
{
struct viu_dev *viu_dev;
struct video_device *vdev;
@@ -1627,7 +1626,7 @@ static struct of_device_id mpc512x_viu_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mpc512x_viu_of_match);

-static struct of_platform_driver viu_of_platform_driver = {
+static struct platform_driver viu_of_platform_driver = {
.probe = viu_of_probe,
.remove = __devexit_p(viu_of_remove),
#ifdef CONFIG_PM
@@ -1643,12 +1642,12 @@ static struct of_platform_driver viu_of_platform_driver = {

static int __init viu_init(void)
{
- return of_register_platform_driver(&viu_of_platform_driver);
+ return platform_driver_register(&viu_of_platform_driver);
}

static void __exit viu_exit(void)
{
- of_unregister_platform_driver(&viu_of_platform_driver);
+ platform_driver_unregister(&viu_of_platform_driver);
}

module_init(viu_init);
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index dd84124..7c250e3 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -128,13 +128,17 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
const struct of_device_id *match)
{
struct device_node *np = ofdev->dev.of_node;
- struct sdhci_of_data *sdhci_of_data = match->data;
+ struct sdhci_of_data *sdhci_of_data;
struct sdhci_host *host;
struct sdhci_of_host *of_host;
const __be32 *clk;
int size;
int ret;

+ if (!ofdev->dev.of_match)
+ return -EINVAL;
+ sdhci_of_data = ofdev->dev.of_match->data;
+
if (!of_device_is_available(np))
return -ENODEV;

@@ -217,7 +221,7 @@ static const struct of_device_id sdhci_of_match[] = {
};
MODULE_DEVICE_TABLE(of, sdhci_of_match);

-static struct of_platform_driver sdhci_of_driver = {
+static struct platform_driver sdhci_of_driver = {
.driver = {
.name = "sdhci-of",
.owner = THIS_MODULE,
@@ -231,13 +235,13 @@ static struct of_platform_driver sdhci_of_driver = {

static int __init sdhci_of_init(void)
{
- return of_register_platform_driver(&sdhci_of_driver);
+ return platform_driver_register(&sdhci_of_driver);
}
module_init(sdhci_of_init);

static void __exit sdhci_of_exit(void)
{
- of_unregister_platform_driver(&sdhci_of_driver);
+ platform_driver_unregister(&sdhci_of_driver);
}
module_exit(sdhci_of_exit);

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 8506578..3db0cb0 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -216,8 +216,7 @@ static void __devinit of_free_probes(const char **probes)
}
#endif

-static int __devinit of_flash_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit of_flash_probe(struct platform_device *dev)
{
#ifdef CONFIG_MTD_PARTITIONS
const char **part_probe_types;
@@ -225,7 +224,7 @@ static int __devinit of_flash_probe(struct platform_device *dev,
struct device_node *dp = dev->dev.of_node;
struct resource res;
struct of_flash *info;
- const char *probe_type = match->data;
+ const char *probe_type;
const __be32 *width;
int err;
int i;
@@ -235,6 +234,10 @@ static int __devinit of_flash_probe(struct platform_device *dev,
struct mtd_info **mtd_list = NULL;
resource_size_t res_size;

+ if (!dev->dev.of_match)
+ return -EINVAL;
+ probe_type = dev->dev.of_match->data;
+
reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32);

/*
@@ -418,7 +421,7 @@ static struct of_device_id of_flash_match[] = {
};
MODULE_DEVICE_TABLE(of, of_flash_match);

-static struct of_platform_driver of_flash_driver = {
+static struct platform_driver of_flash_driver = {
.driver = {
.name = "of-flash",
.owner = THIS_MODULE,
@@ -430,12 +433,12 @@ static struct of_platform_driver of_flash_driver = {

static int __init of_flash_init(void)
{
- return of_register_platform_driver(&of_flash_driver);
+ return platform_driver_register(&of_flash_driver);
}

static void __exit of_flash_exit(void)
{
- of_unregister_platform_driver(&of_flash_driver);
+ platform_driver_unregister(&of_flash_driver);
}

module_init(of_flash_init);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 3582ba1..3f1cb32 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -108,7 +108,7 @@ int uflash_devinit(struct platform_device *op, struct device_node *dp)
return 0;
}

-static int __devinit uflash_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit uflash_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;

@@ -148,7 +148,7 @@ static const struct of_device_id uflash_match[] = {

MODULE_DEVICE_TABLE(of, uflash_match);

-static struct of_platform_driver uflash_driver = {
+static struct platform_driver uflash_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -160,12 +160,12 @@ static struct of_platform_driver uflash_driver = {

static int __init uflash_init(void)
{
- return of_register_platform_driver(&uflash_driver);
+ return platform_driver_register(&uflash_driver);
}

static void __exit uflash_exit(void)
{
- of_unregister_platform_driver(&uflash_driver);
+ platform_driver_unregister(&uflash_driver);
}

module_init(uflash_init);
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index efdcca9..073ee02 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -217,8 +217,7 @@ err:
return ret;
}

-static int __devinit fun_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid)
+static int __devinit fun_probe(struct platform_device *ofdev)
{
struct fsl_upm_nand *fun;
struct resource io_res;
@@ -360,7 +359,7 @@ static const struct of_device_id of_fun_match[] = {
};
MODULE_DEVICE_TABLE(of, of_fun_match);

-static struct of_platform_driver of_fun_driver = {
+static struct platform_driver of_fun_driver = {
.driver = {
.name = "fsl,upm-nand",
.owner = THIS_MODULE,
@@ -372,13 +371,13 @@ static struct of_platform_driver of_fun_driver = {

static int __init fun_module_init(void)
{
- return of_register_platform_driver(&of_fun_driver);
+ return platform_driver_register(&of_fun_driver);
}
module_init(fun_module_init);

static void __exit fun_module_exit(void)
{
- of_unregister_platform_driver(&of_fun_driver);
+ platform_driver_unregister(&of_fun_driver);
}
module_exit(fun_module_exit);

diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 469e649..c2f9543 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -650,8 +650,7 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
iounmap(prv->csreg);
}

-static int __devinit mpc5121_nfc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc5121_nfc_probe(struct platform_device *op)
{
struct device_node *rootnode, *dn = op->dev.of_node;
struct device *dev = &op->dev;
@@ -891,7 +890,7 @@ static struct of_device_id mpc5121_nfc_match[] __devinitdata = {
{},
};

-static struct of_platform_driver mpc5121_nfc_driver = {
+static struct platform_driver mpc5121_nfc_driver = {
.probe = mpc5121_nfc_probe,
.remove = __devexit_p(mpc5121_nfc_remove),
.driver = {
@@ -903,14 +902,14 @@ static struct of_platform_driver mpc5121_nfc_driver = {

static int __init mpc5121_nfc_init(void)
{
- return of_register_platform_driver(&mpc5121_nfc_driver);
+ return platform_driver_register(&mpc5121_nfc_driver);
}

module_init(mpc5121_nfc_init);

static void __exit mpc5121_nfc_cleanup(void)
{
- of_unregister_platform_driver(&mpc5121_nfc_driver);
+ platform_driver_unregister(&mpc5121_nfc_driver);
}

module_exit(mpc5121_nfc_cleanup);
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index c9ae0a5..bbe6d45 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -225,8 +225,7 @@ err:
return ret;
}

-static int __devinit ndfc_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit ndfc_probe(struct platform_device *ofdev)
{
struct ndfc_controller *ndfc = &ndfc_ctrl;
const __be32 *reg;
@@ -292,7 +291,7 @@ static const struct of_device_id ndfc_match[] = {
};
MODULE_DEVICE_TABLE(of, ndfc_match);

-static struct of_platform_driver ndfc_driver = {
+static struct platform_driver ndfc_driver = {
.driver = {
.name = "ndfc",
.owner = THIS_MODULE,
@@ -304,12 +303,12 @@ static struct of_platform_driver ndfc_driver = {

static int __init ndfc_nand_init(void)
{
- return of_register_platform_driver(&ndfc_driver);
+ return platform_driver_register(&ndfc_driver);
}

static void __exit ndfc_nand_exit(void)
{
- of_unregister_platform_driver(&ndfc_driver);
+ platform_driver_unregister(&ndfc_driver);
}

module_init(ndfc_nand_init);
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index bb277a5..5a0f1cf 100644
--- a/drivers/mtd/nand/pasemi_nand.c
+++ b/drivers/mtd/nand/pasemi_nand.c
@@ -89,8 +89,7 @@ int pasemi_device_ready(struct mtd_info *mtd)
return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR);
}

-static int __devinit pasemi_nand_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit pasemi_nand_probe(struct platform_device *ofdev)
{
struct pci_dev *pdev;
struct device_node *np = ofdev->dev.of_node;
@@ -219,7 +218,7 @@ static const struct of_device_id pasemi_nand_match[] =

MODULE_DEVICE_TABLE(of, pasemi_nand_match);

-static struct of_platform_driver pasemi_nand_driver =
+static struct latform_driver pasemi_nand_driver =
{
.driver = {
.name = (char*)driver_name,
@@ -232,13 +231,13 @@ static struct of_platform_driver pasemi_nand_driver =

static int __init pasemi_nand_init(void)
{
- return of_register_platform_driver(&pasemi_nand_driver);
+ return platform_driver_register(&pasemi_nand_driver);
}
module_init(pasemi_nand_init);

static void __exit pasemi_nand_exit(void)
{
- of_unregister_platform_driver(&pasemi_nand_driver);
+ platform_driver_unregister(&pasemi_nand_driver);
}
module_exit(pasemi_nand_exit);

diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index a8e403e..a853548 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -162,8 +162,7 @@ static const char *part_probes[] = { "cmdlinepart", NULL };
/*
* Probe for the NAND device.
*/
-static int __devinit socrates_nand_probe(struct platform_device *ofdev,
- const struct of_device_id *ofid)
+static int __devinit socrates_nand_probe(struct platform_device *ofdev)
{
struct socrates_nand_host *host;
struct mtd_info *mtd;
@@ -300,7 +299,7 @@ static const struct of_device_id socrates_nand_match[] =

MODULE_DEVICE_TABLE(of, socrates_nand_match);

-static struct of_platform_driver socrates_nand_driver = {
+static struct platform_driver socrates_nand_driver = {
.driver = {
.name = "socrates_nand",
.owner = THIS_MODULE,
@@ -312,12 +311,12 @@ static struct of_platform_driver socrates_nand_driver = {

static int __init socrates_nand_init(void)
{
- return of_register_platform_driver(&socrates_nand_driver);
+ return platform_driver_register(&socrates_nand_driver);
}

static void __exit socrates_nand_exit(void)
{
- of_unregister_platform_driver(&socrates_nand_driver);
+ platform_driver_unregister(&socrates_nand_driver);
}

module_init(socrates_nand_init);
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 546d302..6defd4a 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -181,8 +181,7 @@ static struct pccard_operations electra_cf_ops = {
.set_mem_map = electra_cf_set_mem_map,
};

-static int __devinit electra_cf_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit electra_cf_probe(struct platform_device *ofdev)
{
struct device *device = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
@@ -356,7 +355,7 @@ static const struct of_device_id electra_cf_match[] = {
};
MODULE_DEVICE_TABLE(of, electra_cf_match);

-static struct of_platform_driver electra_cf_driver = {
+static struct platform_driver electra_cf_driver = {
.driver = {
.name = (char *)driver_name,
.owner = THIS_MODULE,
@@ -368,13 +367,13 @@ static struct of_platform_driver electra_cf_driver = {

static int __init electra_cf_init(void)
{
- return of_register_platform_driver(&electra_cf_driver);
+ return platform_driver_register(&electra_cf_driver);
}
module_init(electra_cf_init);

static void __exit electra_cf_exit(void)
{
- of_unregister_platform_driver(&electra_cf_driver);
+ platform_driver_unregister(&electra_cf_driver);
}
module_exit(electra_cf_exit);

diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 0db4827..271a590 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1148,8 +1148,7 @@ static struct pccard_operations m8xx_services = {
.set_mem_map = m8xx_set_mem_map,
};

-static int __init m8xx_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __init m8xx_probe(struct platform_device *ofdev)
{
struct pcmcia_win *w;
unsigned int i, m, hwirq;
@@ -1295,7 +1294,7 @@ static const struct of_device_id m8xx_pcmcia_match[] = {

MODULE_DEVICE_TABLE(of, m8xx_pcmcia_match);

-static struct of_platform_driver m8xx_pcmcia_driver = {
+static struct platform_driver m8xx_pcmcia_driver = {
.driver = {
.name = driver_name,
.owner = THIS_MODULE,
@@ -1307,12 +1306,12 @@ static struct of_platform_driver m8xx_pcmcia_driver = {

static int __init m8xx_init(void)
{
- return of_register_platform_driver(&m8xx_pcmcia_driver);
+ return platform_driver_register(&m8xx_pcmcia_driver);
}

static void __exit m8xx_exit(void)
{
- of_unregister_platform_driver(&m8xx_pcmcia_driver);
+ platform_driver_unregister(&m8xx_pcmcia_driver);
}

module_init(m8xx_init);
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index dfcdf09..2b952c6 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -268,8 +268,7 @@ static const struct rtc_class_ops mpc5121_rtc_ops = {
.update_irq_enable = mpc5121_rtc_update_irq_enable,
};

-static int __devinit mpc5121_rtc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc5121_rtc_probe(struct platform_device *op)
{
struct mpc5121_rtc_data *rtc;
int err = 0;
@@ -364,7 +363,7 @@ static struct of_device_id mpc5121_rtc_match[] __devinitdata = {
{},
};

-static struct of_platform_driver mpc5121_rtc_driver = {
+static struct platform_driver mpc5121_rtc_driver = {
.driver = {
.name = "mpc5121-rtc",
.owner = THIS_MODULE,
@@ -376,13 +375,13 @@ static struct of_platform_driver mpc5121_rtc_driver = {

static int __init mpc5121_rtc_init(void)
{
- return of_register_platform_driver(&mpc5121_rtc_driver);
+ return platform_driver_register(&mpc5121_rtc_driver);
}
module_init(mpc5121_rtc_init);

static void __exit mpc5121_rtc_exit(void)
{
- of_unregister_platform_driver(&mpc5121_rtc_driver);
+ platform_driver_unregister(&mpc5121_rtc_driver);
}
module_exit(mpc5121_rtc_exit);

diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index eca855a..45db1d5 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -528,8 +528,7 @@ static const struct file_operations cpwd_fops = {
.llseek = no_llseek,
};

-static int __devinit cpwd_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit cpwd_probe(struct platform_device *op)
{
struct device_node *options;
const char *str_prop;
@@ -678,7 +677,7 @@ static const struct of_device_id cpwd_match[] = {
};
MODULE_DEVICE_TABLE(of, cpwd_match);

-static struct of_platform_driver cpwd_driver = {
+static struct platform_driver cpwd_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -690,12 +689,12 @@ static struct of_platform_driver cpwd_driver = {

static int __init cpwd_init(void)
{
- return of_register_platform_driver(&cpwd_driver);
+ return platform_driver_register(&cpwd_driver);
}

static void __exit cpwd_exit(void)
{
- of_unregister_platform_driver(&cpwd_driver);
+ platform_driver_unregister(&cpwd_driver);
}

module_init(cpwd_init);
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index f6bd6f1..29a7cd4 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -261,8 +261,7 @@ static struct miscdevice gef_wdt_miscdev = {
};


-static int __devinit gef_wdt_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit gef_wdt_probe(struct platform_device *dev)
{
int timeout = 10;
u32 freq;
@@ -303,7 +302,7 @@ static const struct of_device_id gef_wdt_ids[] = {
{},
};

-static struct of_platform_driver gef_wdt_driver = {
+static struct platform_driver gef_wdt_driver = {
.driver = {
.name = "gef_wdt",
.owner = THIS_MODULE,
@@ -315,12 +314,12 @@ static struct of_platform_driver gef_wdt_driver = {
static int __init gef_wdt_init(void)
{
printk(KERN_INFO "GE watchdog driver\n");
- return of_register_platform_driver(&gef_wdt_driver);
+ return platform_driver_register(&gef_wdt_driver);
}

static void __exit gef_wdt_exit(void)
{
- of_unregister_platform_driver(&gef_wdt_driver);
+ platform_driver_unregister(&gef_wdt_driver);
}

module_init(gef_wdt_init);
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 8fa213c..ea438ad 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -185,15 +185,18 @@ static struct miscdevice mpc8xxx_wdt_miscdev = {
.fops = &mpc8xxx_wdt_fops,
};

-static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)
{
int ret;
struct device_node *np = ofdev->dev.of_node;
- struct mpc8xxx_wdt_type *wdt_type = match->data;
+ struct mpc8xxx_wdt_type *wdt_type;
u32 freq = fsl_get_sys_freq();
bool enabled;

+ if (!ofdev->dev.of_match)
+ return -EINVAL;
+ wdt_type = match->data;
+
if (!freq || freq == -1)
return -EINVAL;

@@ -272,7 +275,7 @@ static const struct of_device_id mpc8xxx_wdt_match[] = {
};
MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);

-static struct of_platform_driver mpc8xxx_wdt_driver = {
+static struct platform_driver mpc8xxx_wdt_driver = {
.probe = mpc8xxx_wdt_probe,
.remove = __devexit_p(mpc8xxx_wdt_remove),
.driver = {
@@ -308,13 +311,13 @@ module_init(mpc8xxx_wdt_init_late);

static int __init mpc8xxx_wdt_init(void)
{
- return of_register_platform_driver(&mpc8xxx_wdt_driver);
+ return platform_driver_register(&mpc8xxx_wdt_driver);
}
arch_initcall(mpc8xxx_wdt_init);

static void __exit mpc8xxx_wdt_exit(void)
{
- of_unregister_platform_driver(&mpc8xxx_wdt_driver);
+ platform_driver_unregister(&mpc8xxx_wdt_driver);
}
module_exit(mpc8xxx_wdt_exit);

diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index 3faee1a..109b533 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -172,8 +172,7 @@ static struct miscdevice riowd_miscdev = {
.fops = &riowd_fops
};

-static int __devinit riowd_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit riowd_probe(struct platform_device *op)
{
struct riowd *p;
int err = -EINVAL;
@@ -238,7 +237,7 @@ static const struct of_device_id riowd_match[] = {
};
MODULE_DEVICE_TABLE(of, riowd_match);

-static struct of_platform_driver riowd_driver = {
+static struct platform_driver riowd_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -250,12 +249,12 @@ static struct of_platform_driver riowd_driver = {

static int __init riowd_init(void)
{
- return of_register_platform_driver(&riowd_driver);
+ return platform_driver_register(&riowd_driver);
}

static void __exit riowd_exit(void)
{
- of_unregister_platform_driver(&riowd_driver);
+ platform_driver_unregister(&riowd_driver);
}

module_init(riowd_init);

2011-02-23 04:34:03

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 02/15] dt: add a match table pointer to struct device

Add a new .of_match field to struct device which points at the
matching device driver .of_match_table entry when a device is probed
via the device tree

Signed-off-by: Grant Likely <[email protected]>
---
include/linux/device.h | 1 +
include/linux/of_device.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index ca5d252..8d8e267 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -441,6 +441,7 @@ struct device {
struct dev_archdata archdata;

struct device_node *of_node; /* associated device tree node */
+ const struct of_device_id *of_match; /* matching of_device_id from driver */

dev_t devt; /* dev_t, creates the sysfs "dev" */

diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 975d347..8bfe6c1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev);
* @drv: the device_driver structure to test
* @dev: the device structure to match against
*/
-static inline int of_driver_match_device(const struct device *dev,
+static inline int of_driver_match_device(struct device *dev,
const struct device_driver *drv)
{
- return of_match_device(drv->of_match_table, dev) != NULL;
+ dev->of_match = of_match_device(drv->of_match_table, dev);
+ return dev->of_match != NULL;
}

extern struct platform_device *of_dev_get(struct platform_device *dev);

2011-02-23 04:36:33

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 04/15] dt/sparc: Eliminate users of of_platform_{, un}register_driver

Get rid of old users of of_platform_driver in arch/sparc. Most
of_platform_driver users can be converted to use the platform_bus
directly.

Signed-off-by: Grant Likely <[email protected]>
---
arch/sparc/include/asm/parport.h | 6 +++---
arch/sparc/kernel/apc.c | 7 +++----
arch/sparc/kernel/auxio_64.c | 7 +++----
arch/sparc/kernel/central.c | 14 ++++++--------
arch/sparc/kernel/chmc.c | 19 ++++++++-----------
arch/sparc/kernel/pci_fire.c | 7 +++----
arch/sparc/kernel/pci_psycho.c | 7 +++----
arch/sparc/kernel/pci_sabre.c | 9 ++++-----
arch/sparc/kernel/pci_schizo.c | 11 ++++++-----
arch/sparc/kernel/pci_sun4v.c | 7 +++----
arch/sparc/kernel/pmc.c | 7 +++----
arch/sparc/kernel/power.c | 6 +++---
arch/sparc/kernel/time_32.c | 6 +++---
arch/sparc/kernel/time_64.c | 18 +++++++++---------
drivers/char/hw_random/n2-drv.c | 16 +++++++++-------
drivers/crypto/n2_core.c | 20 +++++++++-----------
drivers/hwmon/ultra45_env.c | 9 ++++-----
drivers/input/misc/sparcspkr.c | 22 ++++++++++------------
drivers/input/serio/i8042-sparcio.h | 8 ++++----
drivers/parport/parport_sunbpp.c | 8 ++++----
drivers/sbus/char/bbc_i2c.c | 9 ++++-----
drivers/sbus/char/display7seg.c | 9 ++++-----
drivers/sbus/char/envctrl.c | 9 ++++-----
drivers/sbus/char/flash.c | 9 ++++-----
drivers/sbus/char/uctrl.c | 9 ++++-----
drivers/scsi/qlogicpti.c | 14 +++++++++-----
drivers/scsi/sun_esp.c | 8 ++++----
27 files changed, 133 insertions(+), 148 deletions(-)

diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index aa4c826..cb33608 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr)
return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
}

-static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit ecpp_probe(struct platform_device *op)
{
unsigned long base = op->resource[0].start;
unsigned long config = op->resource[1].start;
@@ -235,7 +235,7 @@ static const struct of_device_id ecpp_match[] = {
{},
};

-static struct of_platform_driver ecpp_driver = {
+static struct platform_driver ecpp_driver = {
.driver = {
.name = "ecpp",
.owner = THIS_MODULE,
@@ -247,7 +247,7 @@ static struct of_platform_driver ecpp_driver = {

static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
{
- return of_register_platform_driver(&ecpp_driver);
+ return platform_driver_register(&ecpp_driver);
}

#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 52de4a9..f679c57 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -137,8 +137,7 @@ static const struct file_operations apc_fops = {

static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };

-static int __devinit apc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit apc_probe(struct platform_device *op)
{
int err;

@@ -174,7 +173,7 @@ static struct of_device_id __initdata apc_match[] = {
};
MODULE_DEVICE_TABLE(of, apc_match);

-static struct of_platform_driver apc_driver = {
+static struct platform_driver apc_driver = {
.driver = {
.name = "apc",
.owner = THIS_MODULE,
@@ -185,7 +184,7 @@ static struct of_platform_driver apc_driver = {

static int __init apc_init(void)
{
- return of_register_platform_driver(&apc_driver);
+ return platform_driver_register(&apc_driver);
}

/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 3efd3c5..2abace0 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -102,8 +102,7 @@ static struct of_device_id __initdata auxio_match[] = {

MODULE_DEVICE_TABLE(of, auxio_match);

-static int __devinit auxio_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit auxio_probe(struct platform_device *dev)
{
struct device_node *dp = dev->dev.of_node;
unsigned long size;
@@ -132,7 +131,7 @@ static int __devinit auxio_probe(struct platform_device *dev,
return 0;
}

-static struct of_platform_driver auxio_driver = {
+static struct platform_driver auxio_driver = {
.probe = auxio_probe,
.driver = {
.name = "auxio",
@@ -143,7 +142,7 @@ static struct of_platform_driver auxio_driver = {

static int __init auxio_init(void)
{
- return of_register_platform_driver(&auxio_driver);
+ return platform_driver_register(&auxio_driver);
}

/* Must be after subsys_initcall() so that busses are probed. Must
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index cfa2624..136d371 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -59,8 +59,7 @@ static int __devinit clock_board_calc_nslots(struct clock_board *p)
}
}

-static int __devinit clock_board_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit clock_board_probe(struct platform_device *op)
{
struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
int err = -ENOMEM;
@@ -148,7 +147,7 @@ static struct of_device_id __initdata clock_board_match[] = {
{},
};

-static struct of_platform_driver clock_board_driver = {
+static struct platform_driver clock_board_driver = {
.probe = clock_board_probe,
.driver = {
.name = "clock_board",
@@ -157,8 +156,7 @@ static struct of_platform_driver clock_board_driver = {
},
};

-static int __devinit fhc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit fhc_probe(struct platform_device *op)
{
struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
int err = -ENOMEM;
@@ -254,7 +252,7 @@ static struct of_device_id __initdata fhc_match[] = {
{},
};

-static struct of_platform_driver fhc_driver = {
+static struct platform_driver fhc_driver = {
.probe = fhc_probe,
.driver = {
.name = "fhc",
@@ -265,8 +263,8 @@ static struct of_platform_driver fhc_driver = {

static int __init sunfire_init(void)
{
- (void) of_register_platform_driver(&fhc_driver);
- (void) of_register_platform_driver(&clock_board_driver);
+ (void) platform_driver_register(&fhc_driver);
+ (void) platform_driver_register(&clock_board_driver);
return 0;
}

diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 08c466e..668c7be 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -392,8 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p,
}
}

-static int __devinit jbusmc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit jbusmc_probe(struct platform_device *op)
{
const struct linux_prom64_registers *mem_regs;
struct device_node *mem_node;
@@ -690,8 +689,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
chmc_read_mcreg(p, CHMCTRL_DECODE4));
}

-static int __devinit chmc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit chmc_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
unsigned long ver;
@@ -765,13 +763,12 @@ out_free:
goto out;
}

-static int __devinit us3mc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit us3mc_probe(struct platform_device *op)
{
if (mc_type == MC_TYPE_SAFARI)
- return chmc_probe(op, match);
+ return chmc_probe(op);
else if (mc_type == MC_TYPE_JBUS)
- return jbusmc_probe(op, match);
+ return jbusmc_probe(op);
return -ENODEV;
}

@@ -810,7 +807,7 @@ static const struct of_device_id us3mc_match[] = {
};
MODULE_DEVICE_TABLE(of, us3mc_match);

-static struct of_platform_driver us3mc_driver = {
+static struct platform_driver us3mc_driver = {
.driver = {
.name = "us3mc",
.owner = THIS_MODULE,
@@ -848,7 +845,7 @@ static int __init us3mc_init(void)
ret = register_dimm_printer(us3mc_dimm_printer);

if (!ret) {
- ret = of_register_platform_driver(&us3mc_driver);
+ ret = platform_driver_register(&us3mc_driver);
if (ret)
unregister_dimm_printer(us3mc_dimm_printer);
}
@@ -859,7 +856,7 @@ static void __exit us3mc_cleanup(void)
{
if (us3mc_platform()) {
unregister_dimm_printer(us3mc_dimm_printer);
- of_unregister_platform_driver(&us3mc_driver);
+ platform_driver_unregister(&us3mc_driver);
}
}

diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index efb896d..be5e244 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -455,8 +455,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
return 0;
}

-static int __devinit fire_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit fire_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct pci_pbm_info *pbm;
@@ -507,7 +506,7 @@ static struct of_device_id __initdata fire_match[] = {
{},
};

-static struct of_platform_driver fire_driver = {
+static struct platform_driver fire_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -518,7 +517,7 @@ static struct of_platform_driver fire_driver = {

static int __init fire_init(void)
{
- return of_register_platform_driver(&fire_driver);
+ return platform_driver_register(&fire_driver);
}

subsys_initcall(fire_init);
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 22eab7c..56ee745 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -503,8 +503,7 @@ static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid)

#define PSYCHO_CONFIGSPACE 0x001000000UL

-static int __devinit psycho_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit psycho_probe(struct platform_device *op)
{
const struct linux_prom64_registers *pr_regs;
struct device_node *dp = op->dev.of_node;
@@ -601,7 +600,7 @@ static struct of_device_id __initdata psycho_match[] = {
{},
};

-static struct of_platform_driver psycho_driver = {
+static struct platform_driver psycho_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -612,7 +611,7 @@ static struct of_platform_driver psycho_driver = {

static int __init psycho_init(void)
{
- return of_register_platform_driver(&psycho_driver);
+ return platform_driver_register(&psycho_driver);
}

subsys_initcall(psycho_init);
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 5c3f5ec..2857073 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -452,8 +452,7 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
sabre_scan_bus(pbm, &op->dev);
}

-static int __devinit sabre_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit sabre_probe(struct platform_device *op)
{
const struct linux_prom64_registers *pr_regs;
struct device_node *dp = op->dev.of_node;
@@ -464,7 +463,7 @@ static int __devinit sabre_probe(struct platform_device *op,
const u32 *vdma;
u64 clear_irq;

- hummingbird_p = (match->data != NULL);
+ hummingbird_p = op->dev.of_match && (op->dev.of_match->data != NULL);
if (!hummingbird_p) {
struct device_node *cpu_dp;

@@ -595,7 +594,7 @@ static struct of_device_id __initdata sabre_match[] = {
{},
};

-static struct of_platform_driver sabre_driver = {
+static struct platform_driver sabre_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -606,7 +605,7 @@ static struct of_platform_driver sabre_driver = {

static int __init sabre_init(void)
{
- return of_register_platform_driver(&sabre_driver);
+ return platform_driver_register(&sabre_driver);
}

subsys_initcall(sabre_init);
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 445a47a..6783410 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1460,10 +1460,11 @@ out_err:
return err;
}

-static int __devinit schizo_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit schizo_probe(struct platform_device *op)
{
- return __schizo_init(op, (unsigned long) match->data);
+ if (!op->dev.of_match)
+ return -EINVAL;
+ return __schizo_init(op, (unsigned long) op->dev.of_match->data);
}

/* The ordering of this table is very important. Some Tomatillo
@@ -1490,7 +1491,7 @@ static struct of_device_id __initdata schizo_match[] = {
{},
};

-static struct of_platform_driver schizo_driver = {
+static struct platform_driver schizo_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -1501,7 +1502,7 @@ static struct of_platform_driver schizo_driver = {

static int __init schizo_init(void)
{
- return of_register_platform_driver(&schizo_driver);
+ return platform_driver_register(&schizo_driver);
}

subsys_initcall(schizo_init);
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 743344a..158cd73 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -918,8 +918,7 @@ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
return 0;
}

-static int __devinit pci_sun4v_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit pci_sun4v_probe(struct platform_device *op)
{
const struct linux_prom64_registers *regs;
static int hvapi_negotiated = 0;
@@ -1008,7 +1007,7 @@ static struct of_device_id __initdata pci_sun4v_match[] = {
{},
};

-static struct of_platform_driver pci_sun4v_driver = {
+static struct platform_driver pci_sun4v_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -1019,7 +1018,7 @@ static struct of_platform_driver pci_sun4v_driver = {

static int __init pci_sun4v_init(void)
{
- return of_register_platform_driver(&pci_sun4v_driver);
+ return platform_driver_register(&pci_sun4v_driver);
}

subsys_initcall(pci_sun4v_init);
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 94536a8..93d7b44 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -51,8 +51,7 @@ static void pmc_swift_idle(void)
#endif
}

-static int __devinit pmc_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit pmc_probe(struct platform_device *op)
{
regs = of_ioremap(&op->resource[0], 0,
resource_size(&op->resource[0]), PMC_OBPNAME);
@@ -78,7 +77,7 @@ static struct of_device_id __initdata pmc_match[] = {
};
MODULE_DEVICE_TABLE(of, pmc_match);

-static struct of_platform_driver pmc_driver = {
+static struct platform_driver pmc_driver = {
.driver = {
.name = "pmc",
.owner = THIS_MODULE,
@@ -89,7 +88,7 @@ static struct of_platform_driver pmc_driver = {

static int __init pmc_init(void)
{
- return of_register_platform_driver(&pmc_driver);
+ return platform_driver_register(&pmc_driver);
}

/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 2c59f4d..cd725fe 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -33,7 +33,7 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node *
return 1;
}

-static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit power_probe(struct platform_device *op)
{
struct resource *res = &op->resource[0];
unsigned int irq = op->archdata.irqs[0];
@@ -59,7 +59,7 @@ static struct of_device_id __initdata power_match[] = {
{},
};

-static struct of_platform_driver power_driver = {
+static struct platform_driver power_driver = {
.probe = power_probe,
.driver = {
.name = "power",
@@ -70,7 +70,7 @@ static struct of_platform_driver power_driver = {

static int __init power_init(void)
{
- return of_register_platform_driver(&power_driver);
+ return platform_driver_register(&power_driver);
}

device_initcall(power_init);
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 9c743b1..23ccd73 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -142,7 +142,7 @@ static struct platform_device m48t59_rtc = {
},
};

-static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit clock_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
const char *model = of_get_property(dp, "model", NULL);
@@ -176,7 +176,7 @@ static struct of_device_id __initdata clock_match[] = {
{},
};

-static struct of_platform_driver clock_driver = {
+static struct platform_driver clock_driver = {
.probe = clock_probe,
.driver = {
.name = "rtc",
@@ -189,7 +189,7 @@ static struct of_platform_driver clock_driver = {
/* Probe for the mostek real time clock chip. */
static int __init clock_init(void)
{
- return of_register_platform_driver(&clock_driver);
+ return platform_driver_register(&clock_driver);
}
/* Must be after subsys_initcall() so that busses are probed. Must
* be before device_initcall() because things like the RTC driver
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 3bc9c99..e186279 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -419,7 +419,7 @@ static struct platform_device rtc_cmos_device = {
.num_resources = 1,
};

-static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit rtc_probe(struct platform_device *op)
{
struct resource *r;

@@ -462,7 +462,7 @@ static struct of_device_id __initdata rtc_match[] = {
{},
};

-static struct of_platform_driver rtc_driver = {
+static struct platform_driver rtc_driver = {
.probe = rtc_probe,
.driver = {
.name = "rtc",
@@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = {
.num_resources = 1,
};

-static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit bq4802_probe(struct platform_device *op)
{

printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
@@ -495,7 +495,7 @@ static struct of_device_id __initdata bq4802_match[] = {
{},
};

-static struct of_platform_driver bq4802_driver = {
+static struct platform_driver bq4802_driver = {
.probe = bq4802_probe,
.driver = {
.name = "bq4802",
@@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = {
},
};

-static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit mostek_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;

@@ -559,7 +559,7 @@ static struct of_device_id __initdata mostek_match[] = {
{},
};

-static struct of_platform_driver mostek_driver = {
+static struct platform_driver mostek_driver = {
.probe = mostek_probe,
.driver = {
.name = "mostek",
@@ -586,9 +586,9 @@ static int __init clock_init(void)
if (tlb_type == hypervisor)
return platform_device_register(&rtc_sun4v_device);

- (void) of_register_platform_driver(&rtc_driver);
- (void) of_register_platform_driver(&mostek_driver);
- (void) of_register_platform_driver(&bq4802_driver);
+ (void) platform_driver_register(&rtc_driver);
+ (void) platform_driver_register(&mostek_driver);
+ (void) platform_driver_register(&bq4802_driver);

return 0;
}
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index a3f5e38..43ac619 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -619,15 +619,17 @@ static void __devinit n2rng_driver_version(void)
pr_info("%s", version);
}

-static int __devinit n2rng_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit n2rng_probe(struct platform_device *op)
{
- int victoria_falls = (match->data != NULL);
+ int victoria_falls;
int err = -ENOMEM;
struct n2rng *np;

- n2rng_driver_version();
+ if (!op->dev.of_match)
+ return -EINVAL;
+ victoria_falls = (op->dev.of_match->data != NULL);

+ n2rng_driver_version();
np = kzalloc(sizeof(*np), GFP_KERNEL);
if (!np)
goto out;
@@ -750,7 +752,7 @@ static const struct of_device_id n2rng_match[] = {
};
MODULE_DEVICE_TABLE(of, n2rng_match);

-static struct of_platform_driver n2rng_driver = {
+static struct platform_driver n2rng_driver = {
.driver = {
.name = "n2rng",
.owner = THIS_MODULE,
@@ -762,12 +764,12 @@ static struct of_platform_driver n2rng_driver = {

static int __init n2rng_init(void)
{
- return of_register_platform_driver(&n2rng_driver);
+ return platform_driver_register(&n2rng_driver);
}

static void __exit n2rng_exit(void)
{
- of_unregister_platform_driver(&n2rng_driver);
+ platform_driver_unregister(&n2rng_driver);
}

module_init(n2rng_init);
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 80dc094..2e5b204 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -2004,8 +2004,7 @@ static void __devinit n2_spu_driver_version(void)
pr_info("%s", version);
}

-static int __devinit n2_crypto_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit n2_crypto_probe(struct platform_device *dev)
{
struct mdesc_handle *mdesc;
const char *full_name;
@@ -2116,8 +2115,7 @@ static void free_ncp(struct n2_mau *mp)
kfree(mp);
}

-static int __devinit n2_mau_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit n2_mau_probe(struct platform_device *dev)
{
struct mdesc_handle *mdesc;
const char *full_name;
@@ -2211,7 +2209,7 @@ static struct of_device_id n2_crypto_match[] = {

MODULE_DEVICE_TABLE(of, n2_crypto_match);

-static struct of_platform_driver n2_crypto_driver = {
+static struct platform_driver n2_crypto_driver = {
.driver = {
.name = "n2cp",
.owner = THIS_MODULE,
@@ -2235,7 +2233,7 @@ static struct of_device_id n2_mau_match[] = {

MODULE_DEVICE_TABLE(of, n2_mau_match);

-static struct of_platform_driver n2_mau_driver = {
+static struct platform_driver n2_mau_driver = {
.driver = {
.name = "ncp",
.owner = THIS_MODULE,
@@ -2247,20 +2245,20 @@ static struct of_platform_driver n2_mau_driver = {

static int __init n2_init(void)
{
- int err = of_register_platform_driver(&n2_crypto_driver);
+ int err = platform_driver_register(&n2_crypto_driver);

if (!err) {
- err = of_register_platform_driver(&n2_mau_driver);
+ err = platform_driver_register(&n2_mau_driver);
if (err)
- of_unregister_platform_driver(&n2_crypto_driver);
+ platform_driver_unregister(&n2_crypto_driver);
}
return err;
}

static void __exit n2_exit(void)
{
- of_unregister_platform_driver(&n2_mau_driver);
- of_unregister_platform_driver(&n2_crypto_driver);
+ platform_driver_unregister(&n2_mau_driver);
+ platform_driver_unregister(&n2_crypto_driver);
}

module_init(n2_init);
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c
index d863e13..1f36c63 100644
--- a/drivers/hwmon/ultra45_env.c
+++ b/drivers/hwmon/ultra45_env.c
@@ -234,8 +234,7 @@ static const struct attribute_group env_group = {
.attrs = env_attributes,
};

-static int __devinit env_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit env_probe(struct platform_device *op)
{
struct env *p = kzalloc(sizeof(*p), GFP_KERNEL);
int err = -ENOMEM;
@@ -299,7 +298,7 @@ static const struct of_device_id env_match[] = {
};
MODULE_DEVICE_TABLE(of, env_match);

-static struct of_platform_driver env_driver = {
+static struct platform_driver env_driver = {
.driver = {
.name = "ultra45_env",
.owner = THIS_MODULE,
@@ -311,12 +310,12 @@ static struct of_platform_driver env_driver = {

static int __init env_init(void)
{
- return of_register_platform_driver(&env_driver);
+ return platform_driver_register(&env_driver);
}

static void __exit env_exit(void)
{
- of_unregister_platform_driver(&env_driver);
+ platform_driver_unregister(&env_driver);
}

module_init(env_init);
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index 8e130bf..0122f53 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -173,18 +173,16 @@ static int __devinit sparcspkr_probe(struct device *dev)
return 0;
}

-static int sparcspkr_shutdown(struct platform_device *dev)
+static void sparcspkr_shutdown(struct platform_device *dev)
{
struct sparcspkr_state *state = dev_get_drvdata(&dev->dev);
struct input_dev *input_dev = state->input_dev;

/* turn off the speaker */
state->event(input_dev, EV_SND, SND_BELL, 0);
-
- return 0;
}

-static int __devinit bbc_beep_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit bbc_beep_probe(struct platform_device *op)
{
struct sparcspkr_state *state;
struct bbc_beep_info *info;
@@ -258,7 +256,7 @@ static const struct of_device_id bbc_beep_match[] = {
{},
};

-static struct of_platform_driver bbc_beep_driver = {
+static struct platform_driver bbc_beep_driver = {
.driver = {
.name = "bbcbeep",
.owner = THIS_MODULE,
@@ -269,7 +267,7 @@ static struct of_platform_driver bbc_beep_driver = {
.shutdown = sparcspkr_shutdown,
};

-static int __devinit grover_beep_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit grover_beep_probe(struct platform_device *op)
{
struct sparcspkr_state *state;
struct grover_beep_info *info;
@@ -340,7 +338,7 @@ static const struct of_device_id grover_beep_match[] = {
{},
};

-static struct of_platform_driver grover_beep_driver = {
+static struct platform_driver grover_beep_driver = {
.driver = {
.name = "groverbeep",
.owner = THIS_MODULE,
@@ -353,12 +351,12 @@ static struct of_platform_driver grover_beep_driver = {

static int __init sparcspkr_init(void)
{
- int err = of_register_platform_driver(&bbc_beep_driver);
+ int err = platform_driver_register(&bbc_beep_driver);

if (!err) {
- err = of_register_platform_driver(&grover_beep_driver);
+ err = platform_driver_register(&grover_beep_driver);
if (err)
- of_unregister_platform_driver(&bbc_beep_driver);
+ platform_driver_unregister(&bbc_beep_driver);
}

return err;
@@ -366,8 +364,8 @@ static int __init sparcspkr_init(void)

static void __exit sparcspkr_exit(void)
{
- of_unregister_platform_driver(&bbc_beep_driver);
- of_unregister_platform_driver(&grover_beep_driver);
+ platform_driver_unregister(&bbc_beep_driver);
+ platform_driver_unregister(&grover_beep_driver);
}

module_init(sparcspkr_init);
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index c5cc450..395a9af 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -49,7 +49,7 @@ static inline void i8042_write_command(int val)
#define OBP_PS2MS_NAME1 "kdmouse"
#define OBP_PS2MS_NAME2 "mouse"

-static int __devinit sparc_i8042_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit sparc_i8042_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;

@@ -95,7 +95,7 @@ static const struct of_device_id sparc_i8042_match[] = {
};
MODULE_DEVICE_TABLE(of, sparc_i8042_match);

-static struct of_platform_driver sparc_i8042_driver = {
+static struct platform_driver sparc_i8042_driver = {
.driver = {
.name = "i8042",
.owner = THIS_MODULE,
@@ -116,7 +116,7 @@ static int __init i8042_platform_init(void)
if (!kbd_iobase)
return -ENODEV;
} else {
- int err = of_register_platform_driver(&sparc_i8042_driver);
+ int err = platform_driver_register(&sparc_i8042_driver);
if (err)
return err;

@@ -140,7 +140,7 @@ static inline void i8042_platform_exit(void)
struct device_node *root = of_find_node_by_path("/");

if (strcmp(root->name, "SUNW,JavaStation-1"))
- of_unregister_platform_driver(&sparc_i8042_driver);
+ platform_driver_unregister(&sparc_i8042_driver);
}

#else /* !CONFIG_PCI */
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 55ba118..910c5a2 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -286,7 +286,7 @@ static struct parport_operations parport_sunbpp_ops =
.owner = THIS_MODULE,
};

-static int __devinit bpp_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit bpp_probe(struct platform_device *op)
{
struct parport_operations *ops;
struct bpp_regs __iomem *regs;
@@ -381,7 +381,7 @@ static const struct of_device_id bpp_match[] = {

MODULE_DEVICE_TABLE(of, bpp_match);

-static struct of_platform_driver bpp_sbus_driver = {
+static struct platform_driver bpp_sbus_driver = {
.driver = {
.name = "bpp",
.owner = THIS_MODULE,
@@ -393,12 +393,12 @@ static struct of_platform_driver bpp_sbus_driver = {

static int __init parport_sunbpp_init(void)
{
- return of_register_platform_driver(&bpp_sbus_driver);
+ return platform_driver_register(&bpp_sbus_driver);
}

static void __exit parport_sunbpp_exit(void)
{
- of_unregister_platform_driver(&bpp_sbus_driver);
+ platform_driver_unregister(&bpp_sbus_driver);
}

MODULE_AUTHOR("Derrick J Brashear");
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 614a5e1..5f94d22 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -361,8 +361,7 @@ fail:
extern int bbc_envctrl_init(struct bbc_i2c_bus *bp);
extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp);

-static int __devinit bbc_i2c_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit bbc_i2c_probe(struct platform_device *op)
{
struct bbc_i2c_bus *bp;
int err, index = 0;
@@ -413,7 +412,7 @@ static const struct of_device_id bbc_i2c_match[] = {
};
MODULE_DEVICE_TABLE(of, bbc_i2c_match);

-static struct of_platform_driver bbc_i2c_driver = {
+static struct platform_driver bbc_i2c_driver = {
.driver = {
.name = "bbc_i2c",
.owner = THIS_MODULE,
@@ -425,12 +424,12 @@ static struct of_platform_driver bbc_i2c_driver = {

static int __init bbc_i2c_init(void)
{
- return of_register_platform_driver(&bbc_i2c_driver);
+ return platform_driver_register(&bbc_i2c_driver);
}

static void __exit bbc_i2c_exit(void)
{
- of_unregister_platform_driver(&bbc_i2c_driver);
+ platform_driver_unregister(&bbc_i2c_driver);
}

module_init(bbc_i2c_init);
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 55f71ea..740da44 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -171,8 +171,7 @@ static struct miscdevice d7s_miscdev = {
.fops = &d7s_fops
};

-static int __devinit d7s_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit d7s_probe(struct platform_device *op)
{
struct device_node *opts;
int err = -EINVAL;
@@ -266,7 +265,7 @@ static const struct of_device_id d7s_match[] = {
};
MODULE_DEVICE_TABLE(of, d7s_match);

-static struct of_platform_driver d7s_driver = {
+static struct platform_driver d7s_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -278,12 +277,12 @@ static struct of_platform_driver d7s_driver = {

static int __init d7s_init(void)
{
- return of_register_platform_driver(&d7s_driver);
+ return platform_driver_register(&d7s_driver);
}

static void __exit d7s_exit(void)
{
- of_unregister_platform_driver(&d7s_driver);
+ platform_driver_unregister(&d7s_driver);
}

module_init(d7s_init);
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 8ce414e..be7b4e5 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -1028,8 +1028,7 @@ static int kenvctrld(void *__unused)
return 0;
}

-static int __devinit envctrl_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit envctrl_probe(struct platform_device *op)
{
struct device_node *dp;
int index, err;
@@ -1129,7 +1128,7 @@ static const struct of_device_id envctrl_match[] = {
};
MODULE_DEVICE_TABLE(of, envctrl_match);

-static struct of_platform_driver envctrl_driver = {
+static struct platform_driver envctrl_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -1141,12 +1140,12 @@ static struct of_platform_driver envctrl_driver = {

static int __init envctrl_init(void)
{
- return of_register_platform_driver(&envctrl_driver);
+ return platform_driver_register(&envctrl_driver);
}

static void __exit envctrl_exit(void)
{
- of_unregister_platform_driver(&envctrl_driver);
+ platform_driver_unregister(&envctrl_driver);
}

module_init(envctrl_init);
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 2b4b4b6..73dd4e7 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -160,8 +160,7 @@ static const struct file_operations flash_fops = {

static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops };

-static int __devinit flash_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit flash_probe(struct platform_device *op)
{
struct device_node *dp = op->dev.of_node;
struct device_node *parent;
@@ -207,7 +206,7 @@ static const struct of_device_id flash_match[] = {
};
MODULE_DEVICE_TABLE(of, flash_match);

-static struct of_platform_driver flash_driver = {
+static struct platform_driver flash_driver = {
.driver = {
.name = "flash",
.owner = THIS_MODULE,
@@ -219,12 +218,12 @@ static struct of_platform_driver flash_driver = {

static int __init flash_init(void)
{
- return of_register_platform_driver(&flash_driver);
+ return platform_driver_register(&flash_driver);
}

static void __exit flash_cleanup(void)
{
- of_unregister_platform_driver(&flash_driver);
+ platform_driver_unregister(&flash_driver);
}

module_init(flash_init);
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 1b345be..ebce963 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -348,8 +348,7 @@ static void uctrl_get_external_status(struct uctrl_driver *driver)

}

-static int __devinit uctrl_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit uctrl_probe(struct platform_device *op)
{
struct uctrl_driver *p;
int err = -ENOMEM;
@@ -425,7 +424,7 @@ static const struct of_device_id uctrl_match[] = {
};
MODULE_DEVICE_TABLE(of, uctrl_match);

-static struct of_platform_driver uctrl_driver = {
+static struct platform_driver uctrl_driver = {
.driver = {
.name = "uctrl",
.owner = THIS_MODULE,
@@ -438,12 +437,12 @@ static struct of_platform_driver uctrl_driver = {

static int __init uctrl_init(void)
{
- return of_register_platform_driver(&uctrl_driver);
+ return platform_driver_register(&uctrl_driver);
}

static void __exit uctrl_exit(void)
{
- of_unregister_platform_driver(&uctrl_driver);
+ platform_driver_unregister(&uctrl_driver);
}

module_init(uctrl_init);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 664c957..e2d45c9 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1292,15 +1292,19 @@ static struct scsi_host_template qpti_template = {
.use_clustering = ENABLE_CLUSTERING,
};

-static int __devinit qpti_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit qpti_sbus_probe(struct platform_device *op)
{
- struct scsi_host_template *tpnt = match->data;
+ struct scsi_host_template *tpnt;
struct device_node *dp = op->dev.of_node;
struct Scsi_Host *host;
struct qlogicpti *qpti;
static int nqptis;
const char *fcode;

+ if (!op->dev.of_match)
+ return -EINVAL;
+ tpnt = op->dev.of_match->data;
+
/* Sometimes Antares cards come up not completely
* setup, and we get a report of a zero IRQ.
*/
@@ -1457,7 +1461,7 @@ static const struct of_device_id qpti_match[] = {
};
MODULE_DEVICE_TABLE(of, qpti_match);

-static struct of_platform_driver qpti_sbus_driver = {
+static struct platform_driver qpti_sbus_driver = {
.driver = {
.name = "qpti",
.owner = THIS_MODULE,
@@ -1469,12 +1473,12 @@ static struct of_platform_driver qpti_sbus_driver = {

static int __init qpti_init(void)
{
- return of_register_platform_driver(&qpti_sbus_driver);
+ return platform_driver_register(&qpti_sbus_driver);
}

static void __exit qpti_exit(void)
{
- of_unregister_platform_driver(&qpti_sbus_driver);
+ platform_driver_unregister(&qpti_sbus_driver);
}

MODULE_DESCRIPTION("QlogicISP SBUS driver");
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index 193b37b..676fe9a 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -562,7 +562,7 @@ fail:
return err;
}

-static int __devinit esp_sbus_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit esp_sbus_probe(struct platform_device *op)
{
struct device_node *dma_node = NULL;
struct device_node *dp = op->dev.of_node;
@@ -632,7 +632,7 @@ static const struct of_device_id esp_match[] = {
};
MODULE_DEVICE_TABLE(of, esp_match);

-static struct of_platform_driver esp_sbus_driver = {
+static struct platform_driver esp_sbus_driver = {
.driver = {
.name = "esp",
.owner = THIS_MODULE,
@@ -644,12 +644,12 @@ static struct of_platform_driver esp_sbus_driver = {

static int __init sunesp_init(void)
{
- return of_register_platform_driver(&esp_sbus_driver);
+ return platform_driver_register(&esp_sbus_driver);
}

static void __exit sunesp_exit(void)
{
- of_unregister_platform_driver(&esp_sbus_driver);
+ platform_driver_unregister(&esp_sbus_driver);
}

MODULE_DESCRIPTION("Sun ESP SCSI driver");

2011-02-23 04:34:00

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus

arch/powerpc/kernel/ibmebus.c is the only remaining user of the
of_bus_type support code for initializing the bus and registering
drivers. All others have either been switched to the vanilla platform
bus or already have their own infrastructure.

This patch moves the functionality that ibmebus is using out of
drivers/of/{platform,device}.c and into ibmebus.c where it is actually
used. Also renames the moved symbols from of_platform_* to
ibmebus_bus_* to reflect the actual usage.

This patch is part of moving all of the of_platform_bus_type users
over to the platform_bus_type.

Signed-off-by: Grant Likely <[email protected]>
---
arch/powerpc/kernel/ibmebus.c | 404 +++++++++++++++++++++++++++++++++++++++++
drivers/of/device.c | 34 ---
drivers/of/platform.c | 393 ----------------------------------------
include/linux/of_platform.h | 6 -
4 files changed, 400 insertions(+), 437 deletions(-)

diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index f62efdf..c00d4ca 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -201,13 +201,14 @@ int ibmebus_register_driver(struct of_platform_driver *drv)
/* If the driver uses devices that ibmebus doesn't know, add them */
ibmebus_create_devices(drv->driver.of_match_table);

- return of_register_driver(drv, &ibmebus_bus_type);
+ drv->driver.bus = &ibmebus_bus_type;
+ return driver_register(&drv->driver);
}
EXPORT_SYMBOL(ibmebus_register_driver);

void ibmebus_unregister_driver(struct of_platform_driver *drv)
{
- of_unregister_driver(drv);
+ driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(ibmebus_unregister_driver);

@@ -308,15 +309,410 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
}
}

+
static struct bus_attribute ibmebus_bus_attrs[] = {
__ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
__ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
__ATTR_NULL
};

+static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
+{
+ const struct of_device_id *matches = drv->of_match_table;
+
+ if (!matches)
+ return 0;
+
+ return of_match_device(matches, dev) != NULL;
+}
+
+static int ibmebus_bus_device_probe(struct device *dev)
+{
+ int error = -ENODEV;
+ struct of_platform_driver *drv;
+ struct platform_device *of_dev;
+ const struct of_device_id *match;
+
+ drv = to_of_platform_driver(dev->driver);
+ of_dev = to_platform_device(dev);
+
+ if (!drv->probe)
+ return error;
+
+ of_dev_get(of_dev);
+
+ match = of_match_device(drv->driver.of_match_table, dev);
+ if (match)
+ error = drv->probe(of_dev, match);
+ if (error)
+ of_dev_put(of_dev);
+
+ return error;
+}
+
+static int ibmebus_bus_device_remove(struct device *dev)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+
+ if (dev->driver && drv->remove)
+ drv->remove(of_dev);
+ return 0;
+}
+
+static void ibmebus_bus_device_shutdown(struct device *dev)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+
+ if (dev->driver && drv->shutdown)
+ drv->shutdown(of_dev);
+}
+
+/*
+ * ibmebus_bus_device_attrs
+ */
+static ssize_t devspec_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *ofdev;
+
+ ofdev = to_platform_device(dev);
+ return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
+}
+
+static ssize_t name_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct platform_device *ofdev;
+
+ ofdev = to_platform_device(dev);
+ return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
+}
+
+static ssize_t modalias_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
+ buf[len] = '\n';
+ buf[len+1] = 0;
+ return len+1;
+}
+
+struct device_attribute ibmebus_bus_device_attrs[] = {
+ __ATTR_RO(devspec),
+ __ATTR_RO(name),
+ __ATTR_RO(modalias),
+ __ATTR_NULL
+};
+
+#ifdef CONFIG_PM_SLEEP
+static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+ int ret = 0;
+
+ if (dev->driver && drv->suspend)
+ ret = drv->suspend(of_dev, mesg);
+ return ret;
+}
+
+static int ibmebus_bus_legacy_resume(struct device *dev)
+{
+ struct platform_device *of_dev = to_platform_device(dev);
+ struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
+ int ret = 0;
+
+ if (dev->driver && drv->resume)
+ ret = drv->resume(of_dev);
+ return ret;
+}
+
+static int ibmebus_bus_pm_prepare(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (drv && drv->pm && drv->pm->prepare)
+ ret = drv->pm->prepare(dev);
+
+ return ret;
+}
+
+static void ibmebus_bus_pm_complete(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+
+ if (drv && drv->pm && drv->pm->complete)
+ drv->pm->complete(dev);
+}
+
+#ifdef CONFIG_SUSPEND
+
+static int ibmebus_bus_pm_suspend(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->suspend)
+ ret = drv->pm->suspend(dev);
+ } else {
+ ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->suspend_noirq)
+ ret = drv->pm->suspend_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_resume(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->resume)
+ ret = drv->pm->resume(dev);
+ } else {
+ ret = ibmebus_bus_legacy_resume(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_resume_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->resume_noirq)
+ ret = drv->pm->resume_noirq(dev);
+ }
+
+ return ret;
+}
+
+#else /* !CONFIG_SUSPEND */
+
+#define ibmebus_bus_pm_suspend NULL
+#define ibmebus_bus_pm_resume NULL
+#define ibmebus_bus_pm_suspend_noirq NULL
+#define ibmebus_bus_pm_resume_noirq NULL
+
+#endif /* !CONFIG_SUSPEND */
+
+#ifdef CONFIG_HIBERNATION
+
+static int ibmebus_bus_pm_freeze(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->freeze)
+ ret = drv->pm->freeze(dev);
+ } else {
+ ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->freeze_noirq)
+ ret = drv->pm->freeze_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_thaw(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->thaw)
+ ret = drv->pm->thaw(dev);
+ } else {
+ ret = ibmebus_bus_legacy_resume(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->thaw_noirq)
+ ret = drv->pm->thaw_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_poweroff(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->poweroff)
+ ret = drv->pm->poweroff(dev);
+ } else {
+ ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->poweroff_noirq)
+ ret = drv->pm->poweroff_noirq(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_restore(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->restore)
+ ret = drv->pm->restore(dev);
+ } else {
+ ret = ibmebus_bus_legacy_resume(dev);
+ }
+
+ return ret;
+}
+
+static int ibmebus_bus_pm_restore_noirq(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->restore_noirq)
+ ret = drv->pm->restore_noirq(dev);
+ }
+
+ return ret;
+}
+
+#else /* !CONFIG_HIBERNATION */
+
+#define ibmebus_bus_pm_freeze NULL
+#define ibmebus_bus_pm_thaw NULL
+#define ibmebus_bus_pm_poweroff NULL
+#define ibmebus_bus_pm_restore NULL
+#define ibmebus_bus_pm_freeze_noirq NULL
+#define ibmebus_bus_pm_thaw_noirq NULL
+#define ibmebus_bus_pm_poweroff_noirq NULL
+#define ibmebus_bus_pm_restore_noirq NULL
+
+#endif /* !CONFIG_HIBERNATION */
+
+static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
+ .prepare = ibmebus_bus_pm_prepare,
+ .complete = ibmebus_bus_pm_complete,
+ .suspend = ibmebus_bus_pm_suspend,
+ .resume = ibmebus_bus_pm_resume,
+ .freeze = ibmebus_bus_pm_freeze,
+ .thaw = ibmebus_bus_pm_thaw,
+ .poweroff = ibmebus_bus_pm_poweroff,
+ .restore = ibmebus_bus_pm_restore,
+ .suspend_noirq = ibmebus_bus_pm_suspend_noirq,
+ .resume_noirq = ibmebus_bus_pm_resume_noirq,
+ .freeze_noirq = ibmebus_bus_pm_freeze_noirq,
+ .thaw_noirq = ibmebus_bus_pm_thaw_noirq,
+ .poweroff_noirq = ibmebus_bus_pm_poweroff_noirq,
+ .restore_noirq = ibmebus_bus_pm_restore_noirq,
+};
+
+#define IBMEBUS_BUS_PM_OPS_PTR (&ibmebus_bus_dev_pm_ops)
+
+#else /* !CONFIG_PM_SLEEP */
+
+#define IBMEBUS_BUS_PM_OPS_PTR NULL
+
+#endif /* !CONFIG_PM_SLEEP */
+
struct bus_type ibmebus_bus_type = {
+ .name = "ibmebus",
.uevent = of_device_uevent,
- .bus_attrs = ibmebus_bus_attrs
+ .bus_attrs = ibmebus_bus_attrs,
+ .match = ibmebus_bus_bus_match,
+ .probe = ibmebus_bus_device_probe,
+ .remove = ibmebus_bus_device_remove,
+ .shutdown = ibmebus_bus_device_shutdown,
+ .dev_attrs = ibmebus_bus_device_attrs,
+ .pm = IBMEBUS_BUS_PM_OPS_PTR,
};
EXPORT_SYMBOL(ibmebus_bus_type);

@@ -326,7 +722,7 @@ static int __init ibmebus_bus_init(void)

printk(KERN_INFO "IBM eBus Device Driver\n");

- err = of_bus_type_init(&ibmebus_bus_type, "ibmebus");
+ err = bus_register(&ibmebus_bus_type);
if (err) {
printk(KERN_ERR "%s: failed to register IBM eBus.\n",
__func__);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 45d8653..62b4b32 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -47,40 +47,6 @@ void of_dev_put(struct platform_device *dev)
}
EXPORT_SYMBOL(of_dev_put);

-static ssize_t devspec_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct platform_device *ofdev;
-
- ofdev = to_platform_device(dev);
- return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
-}
-
-static ssize_t name_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct platform_device *ofdev;
-
- ofdev = to_platform_device(dev);
- return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
-}
-
-static ssize_t modalias_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
- buf[len] = '\n';
- buf[len+1] = 0;
- return len+1;
-}
-
-struct device_attribute of_platform_device_attrs[] = {
- __ATTR_RO(devspec),
- __ATTR_RO(name),
- __ATTR_RO(modalias),
- __ATTR_NULL
-};
-
int of_device_add(struct platform_device *ofdev)
{
BUG_ON(ofdev->dev.of_node == NULL);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c01cd1a..b71d0cd 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -114,399 +114,6 @@ EXPORT_SYMBOL(of_unregister_platform_driver);
#include <asm/dcr.h>
#endif

-extern struct device_attribute of_platform_device_attrs[];
-
-static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
-{
- const struct of_device_id *matches = drv->of_match_table;
-
- if (!matches)
- return 0;
-
- return of_match_device(matches, dev) != NULL;
-}
-
-static int of_platform_device_probe(struct device *dev)
-{
- int error = -ENODEV;
- struct of_platform_driver *drv;
- struct platform_device *of_dev;
- const struct of_device_id *match;
-
- drv = to_of_platform_driver(dev->driver);
- of_dev = to_platform_device(dev);
-
- if (!drv->probe)
- return error;
-
- of_dev_get(of_dev);
-
- match = of_match_device(drv->driver.of_match_table, dev);
- if (match)
- error = drv->probe(of_dev, match);
- if (error)
- of_dev_put(of_dev);
-
- return error;
-}
-
-static int of_platform_device_remove(struct device *dev)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
-
- if (dev->driver && drv->remove)
- drv->remove(of_dev);
- return 0;
-}
-
-static void of_platform_device_shutdown(struct device *dev)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
-
- if (dev->driver && drv->shutdown)
- drv->shutdown(of_dev);
-}
-
-#ifdef CONFIG_PM_SLEEP
-
-static int of_platform_legacy_suspend(struct device *dev, pm_message_t mesg)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
- int ret = 0;
-
- if (dev->driver && drv->suspend)
- ret = drv->suspend(of_dev, mesg);
- return ret;
-}
-
-static int of_platform_legacy_resume(struct device *dev)
-{
- struct platform_device *of_dev = to_platform_device(dev);
- struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
- int ret = 0;
-
- if (dev->driver && drv->resume)
- ret = drv->resume(of_dev);
- return ret;
-}
-
-static int of_platform_pm_prepare(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (drv && drv->pm && drv->pm->prepare)
- ret = drv->pm->prepare(dev);
-
- return ret;
-}
-
-static void of_platform_pm_complete(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
-
- if (drv && drv->pm && drv->pm->complete)
- drv->pm->complete(dev);
-}
-
-#ifdef CONFIG_SUSPEND
-
-static int of_platform_pm_suspend(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->suspend)
- ret = drv->pm->suspend(dev);
- } else {
- ret = of_platform_legacy_suspend(dev, PMSG_SUSPEND);
- }
-
- return ret;
-}
-
-static int of_platform_pm_suspend_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->suspend_noirq)
- ret = drv->pm->suspend_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_resume(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->resume)
- ret = drv->pm->resume(dev);
- } else {
- ret = of_platform_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_resume_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->resume_noirq)
- ret = drv->pm->resume_noirq(dev);
- }
-
- return ret;
-}
-
-#else /* !CONFIG_SUSPEND */
-
-#define of_platform_pm_suspend NULL
-#define of_platform_pm_resume NULL
-#define of_platform_pm_suspend_noirq NULL
-#define of_platform_pm_resume_noirq NULL
-
-#endif /* !CONFIG_SUSPEND */
-
-#ifdef CONFIG_HIBERNATION
-
-static int of_platform_pm_freeze(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->freeze)
- ret = drv->pm->freeze(dev);
- } else {
- ret = of_platform_legacy_suspend(dev, PMSG_FREEZE);
- }
-
- return ret;
-}
-
-static int of_platform_pm_freeze_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->freeze_noirq)
- ret = drv->pm->freeze_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_thaw(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->thaw)
- ret = drv->pm->thaw(dev);
- } else {
- ret = of_platform_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_thaw_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->thaw_noirq)
- ret = drv->pm->thaw_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_poweroff(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->poweroff)
- ret = drv->pm->poweroff(dev);
- } else {
- ret = of_platform_legacy_suspend(dev, PMSG_HIBERNATE);
- }
-
- return ret;
-}
-
-static int of_platform_pm_poweroff_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->poweroff_noirq)
- ret = drv->pm->poweroff_noirq(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_restore(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->restore)
- ret = drv->pm->restore(dev);
- } else {
- ret = of_platform_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int of_platform_pm_restore_noirq(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->restore_noirq)
- ret = drv->pm->restore_noirq(dev);
- }
-
- return ret;
-}
-
-#else /* !CONFIG_HIBERNATION */
-
-#define of_platform_pm_freeze NULL
-#define of_platform_pm_thaw NULL
-#define of_platform_pm_poweroff NULL
-#define of_platform_pm_restore NULL
-#define of_platform_pm_freeze_noirq NULL
-#define of_platform_pm_thaw_noirq NULL
-#define of_platform_pm_poweroff_noirq NULL
-#define of_platform_pm_restore_noirq NULL
-
-#endif /* !CONFIG_HIBERNATION */
-
-static struct dev_pm_ops of_platform_dev_pm_ops = {
- .prepare = of_platform_pm_prepare,
- .complete = of_platform_pm_complete,
- .suspend = of_platform_pm_suspend,
- .resume = of_platform_pm_resume,
- .freeze = of_platform_pm_freeze,
- .thaw = of_platform_pm_thaw,
- .poweroff = of_platform_pm_poweroff,
- .restore = of_platform_pm_restore,
- .suspend_noirq = of_platform_pm_suspend_noirq,
- .resume_noirq = of_platform_pm_resume_noirq,
- .freeze_noirq = of_platform_pm_freeze_noirq,
- .thaw_noirq = of_platform_pm_thaw_noirq,
- .poweroff_noirq = of_platform_pm_poweroff_noirq,
- .restore_noirq = of_platform_pm_restore_noirq,
-};
-
-#define OF_PLATFORM_PM_OPS_PTR (&of_platform_dev_pm_ops)
-
-#else /* !CONFIG_PM_SLEEP */
-
-#define OF_PLATFORM_PM_OPS_PTR NULL
-
-#endif /* !CONFIG_PM_SLEEP */
-
-int of_bus_type_init(struct bus_type *bus, const char *name)
-{
- bus->name = name;
- bus->match = of_platform_bus_match;
- bus->probe = of_platform_device_probe;
- bus->remove = of_platform_device_remove;
- bus->shutdown = of_platform_device_shutdown;
- bus->dev_attrs = of_platform_device_attrs;
- bus->pm = OF_PLATFORM_PM_OPS_PTR;
- return bus_register(bus);
-}
-
-int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
-{
- /*
- * Temporary: of_platform_bus used to be distinct from the platform
- * bus. It isn't anymore, and so drivers on the platform bus need
- * to be registered in a special way.
- *
- * After all of_platform_bus_type drivers are converted to
- * platform_drivers, this exception can be removed.
- */
- if (bus == &platform_bus_type)
- return of_register_platform_driver(drv);
-
- /* register with core */
- drv->driver.bus = bus;
- return driver_register(&drv->driver);
-}
-EXPORT_SYMBOL(of_register_driver);
-
-void of_unregister_driver(struct of_platform_driver *drv)
-{
- if (drv->driver.bus == &platform_bus_type)
- of_unregister_platform_driver(drv);
- else
- driver_unregister(&drv->driver);
-}
-EXPORT_SYMBOL(of_unregister_driver);
-
#if !defined(CONFIG_SPARC)
/*
* The following routines scan a subtree and registers a device for
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a68716a..048949f 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -47,10 +47,6 @@ struct of_platform_driver
#define to_of_platform_driver(drv) \
container_of(drv,struct of_platform_driver, driver)

-extern int of_register_driver(struct of_platform_driver *drv,
- struct bus_type *bus);
-extern void of_unregister_driver(struct of_platform_driver *drv);
-
/* Platform drivers register/unregister */
extern int of_register_platform_driver(struct of_platform_driver *drv);
extern void of_unregister_platform_driver(struct of_platform_driver *drv);
@@ -60,8 +56,6 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
struct device *parent);
extern struct platform_device *of_find_device_by_node(struct device_node *np);

-extern int of_bus_type_init(struct bus_type *bus, const char *name);
-
#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
/* Platform devices and busses creation */
extern struct platform_device *of_platform_device_create(struct device_node *np,

2011-02-23 04:39:22

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 03/15] dt/powerpc: Eliminate users of of_platform_{, un}register_driver

Get rid of old users of of_platform_driver in arch/powerpc. Most
of_platform_driver users can be converted to use the platform_bus
directly.

Signed-off-by: Grant Likely <[email protected]>
---
arch/powerpc/kernel/of_platform.c | 7 +++---
arch/powerpc/platforms/52xx/mpc52xx_gpio.c | 14 ++++++-------
arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 10 +++------
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 11 ++++------
arch/powerpc/platforms/82xx/ep8248e.c | 7 +++---
arch/powerpc/platforms/83xx/suspend.c | 14 ++++++++-----
arch/powerpc/platforms/cell/axon_msi.c | 11 ++++------
arch/powerpc/platforms/pasemi/gpio_mdio.c | 9 ++++----
arch/powerpc/sysdev/axonram.c | 11 +++++-----
arch/powerpc/sysdev/bestcomm/bestcomm.c | 9 ++++----
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c | 9 ++++----
arch/powerpc/sysdev/fsl_msi.c | 13 +++++++-----
arch/powerpc/sysdev/fsl_pmc.c | 7 +++---
arch/powerpc/sysdev/fsl_rio.c | 7 +++---
arch/powerpc/sysdev/pmi.c | 9 ++++----
arch/powerpc/sysdev/qe_lib/qe.c | 7 +++---
drivers/char/hw_random/pasemi-rng.c | 9 ++++----
drivers/crypto/amcc/crypto4xx_core.c | 9 ++++----
drivers/dma/fsldma.c | 14 +++----------
drivers/dma/mpc512x_dma.c | 9 ++++----
drivers/dma/ppc4xx/adma.c | 11 +++++-----
drivers/edac/mpc85xx_edac.c | 27 +++++++++++--------------
drivers/edac/ppc4xx_edac.c | 23 ++++++---------------
drivers/macintosh/smu.c | 7 +++---
drivers/macintosh/therm_pm72.c | 8 ++++---
drivers/macintosh/therm_windtunnel.c | 9 ++++----
26 files changed, 120 insertions(+), 161 deletions(-)

diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 9bd951c..2458218 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -36,8 +36,7 @@
* lacking some bits needed here.
*/

-static int __devinit of_pci_phb_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit of_pci_phb_probe(struct platform_device *dev)
{
struct pci_controller *phb;

@@ -104,7 +103,7 @@ static struct of_device_id of_pci_phb_ids[] = {
{}
};

-static struct of_platform_driver of_pci_phb_driver = {
+static struct platform_driver of_pci_phb_driver = {
.probe = of_pci_phb_probe,
.driver = {
.name = "of-pci",
@@ -115,7 +114,7 @@ static struct of_platform_driver of_pci_phb_driver = {

static __init int of_pci_phb_init(void)
{
- return of_register_platform_driver(&of_pci_phb_driver);
+ return platform_driver_register(&of_pci_phb_driver);
}

device_initcall(of_pci_phb_init);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 0dad9a9..1757d1d 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -147,8 +147,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
return 0;
}

-static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpiochip *chip;
struct mpc52xx_gpio_wkup __iomem *regs;
@@ -191,7 +190,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
{}
};

-static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = {
+static struct platform_driver mpc52xx_wkup_gpiochip_driver = {
.driver = {
.name = "gpio_wkup",
.owner = THIS_MODULE,
@@ -310,8 +309,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
return 0;
}

-static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpiochip *chip;
struct gpio_chip *gc;
@@ -349,7 +347,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
{}
};

-static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
+static struct platform_driver mpc52xx_simple_gpiochip_driver = {
.driver = {
.name = "gpio",
.owner = THIS_MODULE,
@@ -361,10 +359,10 @@ static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {

static int __init mpc52xx_gpio_init(void)
{
- if (of_register_platform_driver(&mpc52xx_wkup_gpiochip_driver))
+ if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
printk(KERN_ERR "Unable to register wakeup GPIO driver\n");

- if (of_register_platform_driver(&mpc52xx_simple_gpiochip_driver))
+ if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
printk(KERN_ERR "Unable to register simple GPIO driver\n");

return 0;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index e0d703c..859abf1 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -721,8 +721,7 @@ static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
/* ---------------------------------------------------------------------
* of_platform bus binding code
*/
-static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev)
{
struct mpc52xx_gpt_priv *gpt;

@@ -781,7 +780,7 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
{}
};

-static struct of_platform_driver mpc52xx_gpt_driver = {
+static struct platform_driver mpc52xx_gpt_driver = {
.driver = {
.name = "mpc52xx-gpt",
.owner = THIS_MODULE,
@@ -793,10 +792,7 @@ static struct of_platform_driver mpc52xx_gpt_driver = {

static int __init mpc52xx_gpt_init(void)
{
- if (of_register_platform_driver(&mpc52xx_gpt_driver))
- pr_err("error registering MPC52xx GPT driver\n");
-
- return 0;
+ return platform_driver_register(&mpc52xx_gpt_driver);
}

/* Make sure GPIOs and IRQs get set up before anyone tries to use them */
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index f4ac213..6385d88 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -436,8 +436,7 @@ void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
}
EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);

-static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op)
{
struct resource res;
int rc = -ENOMEM;
@@ -536,7 +535,7 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
{},
};

-static struct of_platform_driver mpc52xx_lpbfifo_driver = {
+static struct platform_driver mpc52xx_lpbfifo_driver = {
.driver = {
.name = "mpc52xx-lpbfifo",
.owner = THIS_MODULE,
@@ -551,14 +550,12 @@ static struct of_platform_driver mpc52xx_lpbfifo_driver = {
*/
static int __init mpc52xx_lpbfifo_init(void)
{
- pr_debug("Registering LocalPlus bus FIFO driver\n");
- return of_register_platform_driver(&mpc52xx_lpbfifo_driver);
+ return platform_driver_register(&mpc52xx_lpbfifo_driver);
}
module_init(mpc52xx_lpbfifo_init);

static void __exit mpc52xx_lpbfifo_exit(void)
{
- pr_debug("Unregistering LocalPlus bus FIFO driver\n");
- of_unregister_platform_driver(&mpc52xx_lpbfifo_driver);
+ platform_driver_unregister(&mpc52xx_lpbfifo_driver);
}
module_exit(mpc52xx_lpbfifo_exit);
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 1565e04..10ff526 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -111,8 +111,7 @@ static struct mdiobb_ctrl ep8248e_mdio_ctrl = {
.ops = &ep8248e_mdio_ops,
};

-static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev)
{
struct mii_bus *bus;
struct resource res;
@@ -167,7 +166,7 @@ static const struct of_device_id ep8248e_mdio_match[] = {
{},
};

-static struct of_platform_driver ep8248e_mdio_driver = {
+static struct platform_driver ep8248e_mdio_driver = {
.driver = {
.name = "ep8248e-mdio-bitbang",
.owner = THIS_MODULE,
@@ -308,7 +307,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
static int __init declare_of_platform_devices(void)
{
of_platform_bus_probe(NULL, of_bus_ids, NULL);
- of_register_platform_driver(&ep8248e_mdio_driver);
+ platform_driver_register(&ep8248e_mdio_driver);

return 0;
}
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index fd4f2f2..1882729 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -318,14 +318,18 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
.end = mpc83xx_suspend_end,
};

-static int pmc_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int pmc_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct resource res;
- struct pmc_type *type = match->data;
+ struct pmc_type *type;
int ret = 0;

+ if (!ofdev->dev.of_match)
+ return -EINVAL;
+
+ type = ofdev->dev.of_match->data;
+
if (!of_device_is_available(np))
return -ENODEV;

@@ -422,7 +426,7 @@ static struct of_device_id pmc_match[] = {
{}
};

-static struct of_platform_driver pmc_driver = {
+static struct platform_driver pmc_driver = {
.driver = {
.name = "mpc83xx-pmc",
.owner = THIS_MODULE,
@@ -434,7 +438,7 @@ static struct of_platform_driver pmc_driver = {

static int pmc_init(void)
{
- return of_register_platform_driver(&pmc_driver);
+ return platform_driver_register(&pmc_driver);
}

module_init(pmc_init);
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index e3e379c..c35099a 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -328,7 +328,7 @@ static struct irq_host_ops msic_host_ops = {
.map = msic_host_map,
};

-static int axon_msi_shutdown(struct platform_device *device)
+static void axon_msi_shutdown(struct platform_device *device)
{
struct axon_msic *msic = dev_get_drvdata(&device->dev);
u32 tmp;
@@ -338,12 +338,9 @@ static int axon_msi_shutdown(struct platform_device *device)
tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
-
- return 0;
}

-static int axon_msi_probe(struct platform_device *device,
- const struct of_device_id *device_id)
+static int axon_msi_probe(struct platform_device *device)
{
struct device_node *dn = device->dev.of_node;
struct axon_msic *msic;
@@ -446,7 +443,7 @@ static const struct of_device_id axon_msi_device_id[] = {
{}
};

-static struct of_platform_driver axon_msi_driver = {
+static struct platform_driver axon_msi_driver = {
.probe = axon_msi_probe,
.shutdown = axon_msi_shutdown,
.driver = {
@@ -458,7 +455,7 @@ static struct of_platform_driver axon_msi_driver = {

static int __init axon_msi_init(void)
{
- return of_register_platform_driver(&axon_msi_driver);
+ return platform_driver_register(&axon_msi_driver);
}
subsys_initcall(axon_msi_init);

diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index a5d907b..9886296 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -216,8 +216,7 @@ static int gpio_mdio_reset(struct mii_bus *bus)
}


-static int __devinit gpio_mdio_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit gpio_mdio_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
@@ -299,7 +298,7 @@ static struct of_device_id gpio_mdio_match[] =
};
MODULE_DEVICE_TABLE(of, gpio_mdio_match);

-static struct of_platform_driver gpio_mdio_driver =
+static struct platform_driver gpio_mdio_driver =
{
.probe = gpio_mdio_probe,
.remove = gpio_mdio_remove,
@@ -326,13 +325,13 @@ int gpio_mdio_init(void)
if (!gpio_regs)
return -ENODEV;

- return of_register_platform_driver(&gpio_mdio_driver);
+ return platform_driver_register(&gpio_mdio_driver);
}
module_init(gpio_mdio_init);

void gpio_mdio_exit(void)
{
- of_unregister_platform_driver(&gpio_mdio_driver);
+ platform_driver_unregister(&gpio_mdio_driver);
if (gpio_regs)
iounmap(gpio_regs);
}
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 2659a60..27402c7 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -172,10 +172,9 @@ static const struct block_device_operations axon_ram_devops = {

/**
* axon_ram_probe - probe() method for platform driver
- * @device, @device_id: see of_platform_driver method
+ * @device: see platform_driver method
*/
-static int axon_ram_probe(struct platform_device *device,
- const struct of_device_id *device_id)
+static int axon_ram_probe(struct platform_device *device)
{
static int axon_ram_bank_id = -1;
struct axon_ram_bank *bank;
@@ -326,7 +325,7 @@ static struct of_device_id axon_ram_device_id[] = {
{}
};

-static struct of_platform_driver axon_ram_driver = {
+static struct platform_driver axon_ram_driver = {
.probe = axon_ram_probe,
.remove = axon_ram_remove,
.driver = {
@@ -350,7 +349,7 @@ axon_ram_init(void)
}
azfs_minor = 0;

- return of_register_platform_driver(&axon_ram_driver);
+ return platform_driver_register(&axon_ram_driver);
}

/**
@@ -359,7 +358,7 @@ axon_ram_init(void)
static void __exit
axon_ram_exit(void)
{
- of_unregister_platform_driver(&axon_ram_driver);
+ platform_driver_unregister(&axon_ram_driver);
unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME);
}

diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index 6502561..b3fbb27 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -365,8 +365,7 @@ bcom_engine_cleanup(void)
/* OF platform driver */
/* ======================================================================== */

-static int __devinit mpc52xx_bcom_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc52xx_bcom_probe(struct platform_device *op)
{
struct device_node *ofn_sram;
struct resource res_bcom;
@@ -492,7 +491,7 @@ static struct of_device_id mpc52xx_bcom_of_match[] = {
MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);


-static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
+static struct platform_driver mpc52xx_bcom_of_platform_driver = {
.probe = mpc52xx_bcom_probe,
.remove = mpc52xx_bcom_remove,
.driver = {
@@ -510,13 +509,13 @@ static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
static int __init
mpc52xx_bcom_init(void)
{
- return of_register_platform_driver(&mpc52xx_bcom_of_platform_driver);
+ return platform_driver_register(&mpc52xx_bcom_of_platform_driver);
}

static void __exit
mpc52xx_bcom_exit(void)
{
- of_unregister_platform_driver(&mpc52xx_bcom_of_platform_driver);
+ platform_driver_unregister(&mpc52xx_bcom_of_platform_driver);
}

/* If we're not a module, we must make sure everything is setup before */
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index cc8d655..2b9f0c9 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -71,8 +71,7 @@ static int __init get_offset_from_cmdline(char *str)
__setup("cache-sram-size=", get_size_from_cmdline);
__setup("cache-sram-offset=", get_offset_from_cmdline);

-static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev)
{
long rval;
unsigned int rem;
@@ -204,7 +203,7 @@ static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
{},
};

-static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = {
+static struct platform_driver mpc85xx_l2ctlr_of_platform_driver = {
.driver = {
.name = "fsl-l2ctlr",
.owner = THIS_MODULE,
@@ -216,12 +215,12 @@ static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = {

static __init int mpc85xx_l2ctlr_of_init(void)
{
- return of_register_platform_driver(&mpc85xx_l2ctlr_of_platform_driver);
+ return platform_driver_register(&mpc85xx_l2ctlr_of_platform_driver);
}

static void __exit mpc85xx_l2ctlr_of_exit(void)
{
- of_unregister_platform_driver(&mpc85xx_l2ctlr_of_platform_driver);
+ platform_driver_unregister(&mpc85xx_l2ctlr_of_platform_driver);
}

subsys_initcall(mpc85xx_l2ctlr_of_init);
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 108d76f..ee6a8a5 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -273,8 +273,7 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
return 0;
}

-static int __devinit fsl_of_msi_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit fsl_of_msi_probe(struct platform_device *dev)
{
struct fsl_msi *msi;
struct resource res;
@@ -282,11 +281,15 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev,
int rc;
int virt_msir;
const u32 *p;
- struct fsl_msi_feature *features = match->data;
+ struct fsl_msi_feature *features;
struct fsl_msi_cascade_data *cascade_data = NULL;
int len;
u32 offset;

+ if (!dev->dev.of_match)
+ return -EINVAL;
+ features = dev->dev.of_match->data;
+
printk(KERN_DEBUG "Setting up Freescale MSI support\n");

msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL);
@@ -411,7 +414,7 @@ static const struct of_device_id fsl_of_msi_ids[] = {
{}
};

-static struct of_platform_driver fsl_of_msi_driver = {
+static struct platform_driver fsl_of_msi_driver = {
.driver = {
.name = "fsl-msi",
.owner = THIS_MODULE,
@@ -423,7 +426,7 @@ static struct of_platform_driver fsl_of_msi_driver = {

static __init int fsl_of_msi_init(void)
{
- return of_register_platform_driver(&fsl_of_msi_driver);
+ return platform_driver_register(&fsl_of_msi_driver);
}

subsys_initcall(fsl_of_msi_init);
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index e9381bf..f122e89 100644
--- a/arch/powerpc/sysdev/fsl_pmc.c
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -58,8 +58,7 @@ static const struct platform_suspend_ops pmc_suspend_ops = {
.enter = pmc_suspend_enter,
};

-static int pmc_probe(struct platform_device *ofdev,
- const struct of_device_id *id)
+static int pmc_probe(struct platform_device *ofdev)
{
pmc_regs = of_iomap(ofdev->dev.of_node, 0);
if (!pmc_regs)
@@ -76,7 +75,7 @@ static const struct of_device_id pmc_ids[] = {
{ },
};

-static struct of_platform_driver pmc_driver = {
+static struct platform_driver pmc_driver = {
.driver = {
.name = "fsl-pmc",
.owner = THIS_MODULE,
@@ -87,6 +86,6 @@ static struct of_platform_driver pmc_driver = {

static int __init pmc_init(void)
{
- return of_register_platform_driver(&pmc_driver);
+ return platform_driver_register(&pmc_driver);
}
device_initcall(pmc_init);
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 8c6cab0..3eff2c3 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1570,8 +1570,7 @@ err_ops:

/* The probe function for RapidIO peer-to-peer network.
*/
-static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev)
{
int rc;
printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n",
@@ -1594,7 +1593,7 @@ static const struct of_device_id fsl_of_rio_rpn_ids[] = {
{},
};

-static struct of_platform_driver fsl_of_rio_rpn_driver = {
+static struct platform_driver fsl_of_rio_rpn_driver = {
.driver = {
.name = "fsl-of-rio",
.owner = THIS_MODULE,
@@ -1605,7 +1604,7 @@ static struct of_platform_driver fsl_of_rio_rpn_driver = {

static __init int fsl_of_rio_rpn_init(void)
{
- return of_register_platform_driver(&fsl_of_rio_rpn_driver);
+ return platform_driver_register(&fsl_of_rio_rpn_driver);
}

subsys_initcall(fsl_of_rio_rpn_init);
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 4260f36..8ce4fc3 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -121,8 +121,7 @@ static void pmi_notify_handlers(struct work_struct *work)
spin_unlock(&data->handler_spinlock);
}

-static int pmi_of_probe(struct platform_device *dev,
- const struct of_device_id *match)
+static int pmi_of_probe(struct platform_device *dev)
{
struct device_node *np = dev->dev.of_node;
int rc;
@@ -205,7 +204,7 @@ static int pmi_of_remove(struct platform_device *dev)
return 0;
}

-static struct of_platform_driver pmi_of_platform_driver = {
+static struct platform_driver pmi_of_platform_driver = {
.probe = pmi_of_probe,
.remove = pmi_of_remove,
.driver = {
@@ -217,13 +216,13 @@ static struct of_platform_driver pmi_of_platform_driver = {

static int __init pmi_module_init(void)
{
- return of_register_platform_driver(&pmi_of_platform_driver);
+ return platform_driver_register(&pmi_of_platform_driver);
}
module_init(pmi_module_init);

static void __exit pmi_module_exit(void)
{
- of_unregister_platform_driver(&pmi_of_platform_driver);
+ platform_driver_unregister(&pmi_of_platform_driver);
}
module_exit(pmi_module_exit);

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 90020de..904c6cb 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -659,8 +659,7 @@ static int qe_resume(struct platform_device *ofdev)
return 0;
}

-static int qe_probe(struct platform_device *ofdev,
- const struct of_device_id *id)
+static int qe_probe(struct platform_device *ofdev)
{
return 0;
}
@@ -670,7 +669,7 @@ static const struct of_device_id qe_ids[] = {
{ },
};

-static struct of_platform_driver qe_driver = {
+static struct platform_driver qe_driver = {
.driver = {
.name = "fsl-qe",
.owner = THIS_MODULE,
@@ -682,7 +681,7 @@ static struct of_platform_driver qe_driver = {

static int __init qe_drv_init(void)
{
- return of_register_platform_driver(&qe_driver);
+ return platform_driver_register(&qe_driver);
}
device_initcall(qe_drv_init);
#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index a31c830..1d50481 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -94,8 +94,7 @@ static struct hwrng pasemi_rng = {
.data_read = pasemi_rng_data_read,
};

-static int __devinit rng_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit rng_probe(struct platform_device *ofdev)
{
void __iomem *rng_regs;
struct device_node *rng_np = ofdev->dev.of_node;
@@ -139,7 +138,7 @@ static struct of_device_id rng_match[] = {
{ },
};

-static struct of_platform_driver rng_driver = {
+static struct platform_driver rng_driver = {
.driver = {
.name = "pasemi-rng",
.owner = THIS_MODULE,
@@ -151,13 +150,13 @@ static struct of_platform_driver rng_driver = {

static int __init rng_init(void)
{
- return of_register_platform_driver(&rng_driver);
+ return platform_driver_register(&rng_driver);
}
module_init(rng_init);

static void __exit rng_exit(void)
{
- of_unregister_platform_driver(&rng_driver);
+ platform_driver_unregister(&rng_driver);
}
module_exit(rng_exit);

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 2b1baee..1891252 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1150,8 +1150,7 @@ struct crypto4xx_alg_common crypto4xx_alg[] = {
/**
* Module Initialization Routine
*/
-static int __init crypto4xx_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __init crypto4xx_probe(struct platform_device *ofdev)
{
int rc;
struct resource res;
@@ -1280,7 +1279,7 @@ static const struct of_device_id crypto4xx_match[] = {
{ },
};

-static struct of_platform_driver crypto4xx_driver = {
+static struct platform_driver crypto4xx_driver = {
.driver = {
.name = "crypto4xx",
.owner = THIS_MODULE,
@@ -1292,12 +1291,12 @@ static struct of_platform_driver crypto4xx_driver = {

static int __init crypto4xx_init(void)
{
- return of_register_platform_driver(&crypto4xx_driver);
+ return platform_driver_register(&crypto4xx_driver);
}

static void __exit crypto4xx_exit(void)
{
- of_unregister_platform_driver(&crypto4xx_driver);
+ platform_driver_unregister(&crypto4xx_driver);
}

module_init(crypto4xx_init);
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 4de947a..e3854a8 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -1281,8 +1281,7 @@ static void fsl_dma_chan_remove(struct fsldma_chan *chan)
kfree(chan);
}

-static int __devinit fsldma_of_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit fsldma_of_probe(struct platform_device *op)
{
struct fsldma_device *fdev;
struct device_node *child;
@@ -1414,20 +1413,13 @@ static struct of_platform_driver fsldma_of_driver = {

static __init int fsldma_init(void)
{
- int ret;
-
pr_info("Freescale Elo / Elo Plus DMA driver\n");
-
- ret = of_register_platform_driver(&fsldma_of_driver);
- if (ret)
- pr_err("fsldma: failed to register platform driver\n");
-
- return ret;
+ return platform_driver_register(&fsldma_of_driver);
}

static void __exit fsldma_exit(void)
{
- of_unregister_platform_driver(&fsldma_of_driver);
+ platform_driver_unregister(&fsldma_of_driver);
}

subsys_initcall(fsldma_init);
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 59c2701..4f95d31 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -649,8 +649,7 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, dma_addr_t src,
return &mdesc->desc;
}

-static int __devinit mpc_dma_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc_dma_probe(struct platform_device *op)
{
struct device_node *dn = op->dev.of_node;
struct device *dev = &op->dev;
@@ -827,7 +826,7 @@ static struct of_device_id mpc_dma_match[] = {
{},
};

-static struct of_platform_driver mpc_dma_driver = {
+static struct platform_driver mpc_dma_driver = {
.probe = mpc_dma_probe,
.remove = __devexit_p(mpc_dma_remove),
.driver = {
@@ -839,13 +838,13 @@ static struct of_platform_driver mpc_dma_driver = {

static int __init mpc_dma_init(void)
{
- return of_register_platform_driver(&mpc_dma_driver);
+ return platform_driver_register(&mpc_dma_driver);
}
module_init(mpc_dma_init);

static void __exit mpc_dma_exit(void)
{
- of_unregister_platform_driver(&mpc_dma_driver);
+ platform_driver_unregister(&mpc_dma_driver);
}
module_exit(mpc_dma_exit);

diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index cef5845..3b0247e 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -4393,8 +4393,7 @@ static void ppc440spe_adma_release_irqs(struct ppc440spe_adma_device *adev,
/**
* ppc440spe_adma_probe - probe the asynch device
*/
-static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev,
- const struct of_device_id *match)
+static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev)
{
struct device_node *np = ofdev->dev.of_node;
struct resource res;
@@ -4944,7 +4943,7 @@ static const struct of_device_id ppc440spe_adma_of_match[] __devinitconst = {
};
MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match);

-static struct of_platform_driver ppc440spe_adma_driver = {
+static struct platform_driver ppc440spe_adma_driver = {
.probe = ppc440spe_adma_probe,
.remove = __devexit_p(ppc440spe_adma_remove),
.driver = {
@@ -4962,7 +4961,7 @@ static __init int ppc440spe_adma_init(void)
if (ret)
return ret;

- ret = of_register_platform_driver(&ppc440spe_adma_driver);
+ ret = platform_driver_register(&ppc440spe_adma_driver);
if (ret) {
pr_err("%s: failed to register platform driver\n",
__func__);
@@ -4996,7 +4995,7 @@ out_dev:
/* User will not be able to enable h/w RAID-6 */
pr_err("%s: failed to create RAID-6 driver interface\n",
__func__);
- of_unregister_platform_driver(&ppc440spe_adma_driver);
+ platform_driver_unregister(&ppc440spe_adma_driver);
out_reg:
dcr_unmap(ppc440spe_mq_dcr_host, ppc440spe_mq_dcr_len);
kfree(ppc440spe_dma_fifo_buf);
@@ -5011,7 +5010,7 @@ static void __exit ppc440spe_adma_exit(void)
&driver_attr_enable);
driver_remove_file(&ppc440spe_adma_driver.driver,
&driver_attr_devices);
- of_unregister_platform_driver(&ppc440spe_adma_driver);
+ platform_driver_unregister(&ppc440spe_adma_driver);
dcr_unmap(ppc440spe_mq_dcr_host, ppc440spe_mq_dcr_len);
kfree(ppc440spe_dma_fifo_buf);
}
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index b123bb3..ffb5ad0 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -200,8 +200,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}

-static int __devinit mpc85xx_pci_err_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
{
struct edac_pci_ctl_info *pci;
struct mpc85xx_pci_pdata *pdata;
@@ -338,7 +337,7 @@ static struct of_device_id mpc85xx_pci_err_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);

-static struct of_platform_driver mpc85xx_pci_err_driver = {
+static struct platform_driver mpc85xx_pci_err_driver = {
.probe = mpc85xx_pci_err_probe,
.remove = __devexit_p(mpc85xx_pci_err_remove),
.driver = {
@@ -503,8 +502,7 @@ static irqreturn_t mpc85xx_l2_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}

-static int __devinit mpc85xx_l2_err_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc85xx_l2_err_probe(struct platform_device *op)
{
struct edac_device_ctl_info *edac_dev;
struct mpc85xx_l2_pdata *pdata;
@@ -656,7 +654,7 @@ static struct of_device_id mpc85xx_l2_err_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mpc85xx_l2_err_of_match);

-static struct of_platform_driver mpc85xx_l2_err_driver = {
+static struct platform_driver mpc85xx_l2_err_driver = {
.probe = mpc85xx_l2_err_probe,
.remove = mpc85xx_l2_err_remove,
.driver = {
@@ -956,8 +954,7 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci)
}
}

-static int __devinit mpc85xx_mc_err_probe(struct platform_device *op,
- const struct of_device_id *match)
+static int __devinit mpc85xx_mc_err_probe(struct platform_device *op)
{
struct mem_ctl_info *mci;
struct mpc85xx_mc_pdata *pdata;
@@ -1136,7 +1133,7 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = {
};
MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match);

-static struct of_platform_driver mpc85xx_mc_err_driver = {
+static struct platform_driver mpc85xx_mc_err_driver = {
.probe = mpc85xx_mc_err_probe,
.remove = mpc85xx_mc_err_remove,
.driver = {
@@ -1171,16 +1168,16 @@ static int __init mpc85xx_mc_init(void)
break;
}

- res = of_register_platform_driver(&mpc85xx_mc_err_driver);
+ res = platform_driver_register(&mpc85xx_mc_err_driver);
if (res)
printk(KERN_WARNING EDAC_MOD_STR "MC fails to register\n");

- res = of_register_platform_driver(&mpc85xx_l2_err_driver);
+ res = platform_driver_register(&mpc85xx_l2_err_driver);
if (res)
printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");

#ifdef CONFIG_PCI
- res = of_register_platform_driver(&mpc85xx_pci_err_driver);
+ res = platform_driver_register(&mpc85xx_pci_err_driver);
if (res)
printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
#endif
@@ -1212,10 +1209,10 @@ static void __exit mpc85xx_mc_exit(void)
on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
#endif
#ifdef CONFIG_PCI
- of_unregister_platform_driver(&mpc85xx_pci_err_driver);
+ platform_driver_unregister(&mpc85xx_pci_err_driver);
#endif
- of_unregister_platform_driver(&mpc85xx_l2_err_driver);
- of_unregister_platform_driver(&mpc85xx_mc_err_driver);
+ platform_driver_unregister(&mpc85xx_l2_err_driver);
+ platform_driver_unregister(&mpc85xx_mc_err_driver);
}

module_exit(mpc85xx_mc_exit);
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index b9f0c20..c1f0045 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -184,8 +184,7 @@ struct ppc4xx_ecc_status {

/* Function Prototypes */

-static int ppc4xx_edac_probe(struct platform_device *device,
- const struct of_device_id *device_id);
+static int ppc4xx_edac_probe(struct platform_device *device)
static int ppc4xx_edac_remove(struct platform_device *device);

/* Global Variables */
@@ -201,7 +200,7 @@ static struct of_device_id ppc4xx_edac_match[] = {
{ }
};

-static struct of_platform_driver ppc4xx_edac_driver = {
+static struct platform_driver ppc4xx_edac_driver = {
.probe = ppc4xx_edac_probe,
.remove = ppc4xx_edac_remove,
.driver = {
@@ -997,9 +996,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
* initialized.
* @op: A pointer to the OpenFirmware device tree node associated
* with the controller this EDAC instance is bound to.
- * @match: A pointer to the OpenFirmware device tree match
- * information associated with the controller this EDAC instance
- * is bound to.
* @dcr_host: A pointer to the DCR data containing the DCR mapping
* for this controller instance.
* @mcopt1: The 32-bit Memory Controller Option 1 register value
@@ -1015,7 +1011,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
static int __devinit
ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
struct platform_device *op,
- const struct of_device_id *match,
const dcr_host_t *dcr_host,
u32 mcopt1)
{
@@ -1024,7 +1019,7 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
struct ppc4xx_edac_pdata *pdata = NULL;
const struct device_node *np = op->dev.of_node;

- if (match == NULL)
+ if (op->dev.of_match == NULL)
return -EINVAL;

/* Initial driver pointers and private data */
@@ -1227,9 +1222,6 @@ ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host)
* ppc4xx_edac_probe - check controller and bind driver
* @op: A pointer to the OpenFirmware device tree node associated
* with the controller being probed for driver binding.
- * @match: A pointer to the OpenFirmware device tree match
- * information associated with the controller being probed
- * for driver binding.
*
* This routine probes a specific ibm,sdram-4xx-ddr2 controller
* instance for binding with the driver.
@@ -1237,8 +1229,7 @@ ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host)
* Returns 0 if the controller instance was successfully bound to the
* driver; otherwise, < 0 on error.
*/
-static int __devinit
-ppc4xx_edac_probe(struct platform_device *op, const struct of_device_id *match)
+static int __devinit ppc4xx_edac_probe(struct platform_device *op)
{
int status = 0;
u32 mcopt1, memcheck;
@@ -1304,7 +1295,7 @@ ppc4xx_edac_probe(struct platform_device *op, const struct of_device_id *match)
goto done;
}

- status = ppc4xx_edac_mc_init(mci, op, match, &dcr_host, mcopt1);
+ status = ppc4xx_edac_mc_init(mci, op, &dcr_host, mcopt1);

if (status) {
ppc4xx_edac_mc_printk(KERN_ERR, mci,
@@ -1421,7 +1412,7 @@ ppc4xx_edac_init(void)

ppc4xx_edac_opstate_init();

- return of_register_platform_driver(&ppc4xx_edac_driver);
+ return platform_driver_register(&ppc4xx_edac_driver);
}

/**
@@ -1434,7 +1425,7 @@ ppc4xx_edac_init(void)
static void __exit
ppc4xx_edac_exit(void)
{
- of_unregister_platform_driver(&ppc4xx_edac_driver);
+ platform_driver_unregister(&ppc4xx_edac_driver);
}

module_init(ppc4xx_edac_init);
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 290cb32..116a49c 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -645,8 +645,7 @@ static void smu_expose_childs(struct work_struct *unused)

static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs);

-static int smu_platform_probe(struct platform_device* dev,
- const struct of_device_id *match)
+static int smu_platform_probe(struct platform_device* dev)
{
if (!smu)
return -ENODEV;
@@ -669,7 +668,7 @@ static const struct of_device_id smu_platform_match[] =
{},
};

-static struct of_platform_driver smu_of_platform_driver =
+static struct platform_driver smu_of_platform_driver =
{
.driver = {
.name = "smu",
@@ -689,7 +688,7 @@ static int __init smu_init_sysfs(void)
* I'm a bit too far from figuring out how that works with those
* new chipsets, but that will come back and bite us
*/
- of_register_platform_driver(&smu_of_platform_driver);
+ platform_driver_register(&smu_of_platform_driver);
return 0;
}

diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index f3a29f2..bca2af2 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -2210,7 +2210,7 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
}
}

-static int fcu_of_probe(struct platform_device* dev, const struct of_device_id *match)
+static int fcu_of_probe(struct platform_device* dev)
{
state = state_detached;
of_dev = dev;
@@ -2240,7 +2240,7 @@ static const struct of_device_id fcu_match[] =
};
MODULE_DEVICE_TABLE(of, fcu_match);

-static struct of_platform_driver fcu_of_platform_driver =
+static struct platform_driver fcu_of_platform_driver =
{
.driver = {
.name = "temperature",
@@ -2263,12 +2263,12 @@ static int __init therm_pm72_init(void)
!rackmac)
return -ENODEV;

- return of_register_platform_driver(&fcu_of_platform_driver);
+ return platform_driver_register(&fcu_of_platform_driver);
}

static void __exit therm_pm72_exit(void)
{
- of_unregister_platform_driver(&fcu_of_platform_driver);
+ platform_driver_unregister(&fcu_of_platform_driver);
}

module_init(therm_pm72_init);
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index c89f396..d37819f 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -443,8 +443,7 @@ static struct i2c_driver g4fan_driver = {
/* initialization / cleanup */
/************************************************************************/

-static int
-therm_of_probe( struct platform_device *dev, const struct of_device_id *match )
+static int therm_of_probe(struct platform_device *dev)
{
return i2c_add_driver( &g4fan_driver );
}
@@ -462,7 +461,7 @@ static const struct of_device_id therm_of_match[] = {{
}, {}
};

-static struct of_platform_driver therm_of_driver = {
+static struct platform_driver therm_of_driver = {
.driver = {
.name = "temperature",
.owner = THIS_MODULE,
@@ -509,14 +508,14 @@ g4fan_init( void )
return -ENODEV;
}

- of_register_platform_driver( &therm_of_driver );
+ platform_driver_register( &therm_of_driver );
return 0;
}

static void __exit
g4fan_exit( void )
{
- of_unregister_platform_driver( &therm_of_driver );
+ platform_driver_unregister( &therm_of_driver );

if( x.of_dev )
of_device_unregister( x.of_dev );

2011-02-23 04:40:14

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 07/15] dt: uartlite: merge platform and of_platform driver bindings

of_platform_driver is getting removed, and a single platform_driver
can now support both devicetree and non-devicetree use cases. This
patch merges the two driver registrations.

Signed-off-by: Grant Likely <[email protected]>
---
drivers/tty/serial/uartlite.c | 103 ++++++++++-------------------------------
1 files changed, 24 insertions(+), 79 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index d2fce86..457ac34 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -19,22 +19,11 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <asm/io.h>
-#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>

-/* Match table for of_platform binding */
-static struct of_device_id ulite_of_match[] __devinitdata = {
- { .compatible = "xlnx,opb-uartlite-1.00.b", },
- { .compatible = "xlnx,xps-uartlite-1.00.a", },
- {}
-};
-MODULE_DEVICE_TABLE(of, ulite_of_match);
-
-#endif
-
#define ULITE_NAME "ttyUL"
#define ULITE_MAJOR 204
#define ULITE_MINOR 187
@@ -571,9 +560,23 @@ static int __devexit ulite_release(struct device *dev)
* Platform bus binding
*/

+#if defined(CONFIG_OF)
+/* Match table for of_platform binding */
+static struct of_device_id ulite_of_match[] __devinitdata = {
+ { .compatible = "xlnx,opb-uartlite-1.00.b", },
+ { .compatible = "xlnx,xps-uartlite-1.00.a", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, ulite_of_match);
+#else /* CONFIG_OF */
+#define ulite_of_match NULL
+#endif /* CONFIG_OF */
+
static int __devinit ulite_probe(struct platform_device *pdev)
{
struct resource *res, *res2;
+ const __be32 *prop;
+ int id = pdev->id;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -583,7 +586,13 @@ static int __devinit ulite_probe(struct platform_device *pdev)
if (!res2)
return -ENODEV;

- return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start);
+#ifdef CONFIG_OF
+ prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
+ if (prop)
+ id = be32_to_cpup(prop);
+#endif
+
+ return ulite_assign(&pdev->dev, id, res->start, res2->start);
}

static int __devexit ulite_remove(struct platform_device *pdev)
@@ -595,72 +604,15 @@ static int __devexit ulite_remove(struct platform_device *pdev)
MODULE_ALIAS("platform:uartlite");

static struct platform_driver ulite_platform_driver = {
- .probe = ulite_probe,
- .remove = __devexit_p(ulite_remove),
- .driver = {
- .owner = THIS_MODULE,
- .name = "uartlite",
- },
-};
-
-/* ---------------------------------------------------------------------
- * OF bus bindings
- */
-#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
-static int __devinit
-ulite_of_probe(struct platform_device *op, const struct of_device_id *match)
-{
- struct resource res;
- const unsigned int *id;
- int irq, rc;
-
- dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match);
-
- rc = of_address_to_resource(op->dev.of_node, 0, &res);
- if (rc) {
- dev_err(&op->dev, "invalid address\n");
- return rc;
- }
-
- irq = irq_of_parse_and_map(op->dev.of_node, 0);
-
- id = of_get_property(op->dev.of_node, "port-number", NULL);
-
- return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
-}
-
-static int __devexit ulite_of_remove(struct platform_device *op)
-{
- return ulite_release(&op->dev);
-}
-
-static struct of_platform_driver ulite_of_driver = {
- .probe = ulite_of_probe,
- .remove = __devexit_p(ulite_of_remove),
+ .probe = ulite_probe,
+ .remove = __devexit_p(ulite_remove),
.driver = {
- .name = "uartlite",
.owner = THIS_MODULE,
+ .name = "uartlite",
.of_match_table = ulite_of_match,
},
};

-/* Registration helpers to keep the number of #ifdefs to a minimum */
-static inline int __init ulite_of_register(void)
-{
- pr_debug("uartlite: calling of_register_platform_driver()\n");
- return of_register_platform_driver(&ulite_of_driver);
-}
-
-static inline void __exit ulite_of_unregister(void)
-{
- of_unregister_platform_driver(&ulite_of_driver);
-}
-#else /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
-/* Appropriate config not enabled; do nothing helpers */
-static inline int __init ulite_of_register(void) { return 0; }
-static inline void __exit ulite_of_unregister(void) { }
-#endif /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
-
/* ---------------------------------------------------------------------
* Module setup/teardown
*/
@@ -674,10 +626,6 @@ int __init ulite_init(void)
if (ret)
goto err_uart;

- ret = ulite_of_register();
- if (ret)
- goto err_of;
-
pr_debug("uartlite: calling platform_driver_register()\n");
ret = platform_driver_register(&ulite_platform_driver);
if (ret)
@@ -686,8 +634,6 @@ int __init ulite_init(void)
return 0;

err_plat:
- ulite_of_unregister();
-err_of:
uart_unregister_driver(&ulite_uart_driver);
err_uart:
printk(KERN_ERR "registering uartlite driver failed: err=%i", ret);
@@ -697,7 +643,6 @@ err_uart:
void __exit ulite_exit(void)
{
platform_driver_unregister(&ulite_platform_driver);
- ulite_of_unregister();
uart_unregister_driver(&ulite_uart_driver);
}

2011-02-23 04:42:40

by Grant Likely

[permalink] [raw]
Subject: [RFC PATCH 15/15] dt: eliminate of_platform_driver shim code

Commit eca393016, "of: Merge of_platform_bus_type with
platform_bus_type" added a shim to allow of_platform_drivers to get
registers onto the platform bus so that there was time to migrate the
existing drivers to the platform_bus_type.

This patch removes the shim since there are no more users of the old
interface.

Signed-off-by: Grant Likely <[email protected]>
---
drivers/of/platform.c | 68 -------------------------------------------
include/linux/of_platform.h | 12 +-------
2 files changed, 1 insertions(+), 79 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index b71d0cd..1ce4c45 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -42,74 +42,6 @@ struct platform_device *of_find_device_by_node(struct device_node *np)
}
EXPORT_SYMBOL(of_find_device_by_node);

-static int platform_driver_probe_shim(struct platform_device *pdev)
-{
- struct platform_driver *pdrv;
- struct of_platform_driver *ofpdrv;
- const struct of_device_id *match;
-
- pdrv = container_of(pdev->dev.driver, struct platform_driver, driver);
- ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver);
-
- /* There is an unlikely chance that an of_platform driver might match
- * on a non-OF platform device. If so, then of_match_device() will
- * come up empty. Return -EINVAL in this case so other drivers get
- * the chance to bind. */
- match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
- return match ? ofpdrv->probe(pdev, match) : -EINVAL;
-}
-
-static void platform_driver_shutdown_shim(struct platform_device *pdev)
-{
- struct platform_driver *pdrv;
- struct of_platform_driver *ofpdrv;
-
- pdrv = container_of(pdev->dev.driver, struct platform_driver, driver);
- ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver);
- ofpdrv->shutdown(pdev);
-}
-
-/**
- * of_register_platform_driver
- */
-int of_register_platform_driver(struct of_platform_driver *drv)
-{
- char *of_name;
-
- /* setup of_platform_driver to platform_driver adaptors */
- drv->platform_driver.driver = drv->driver;
-
- /* Prefix the driver name with 'of:' to avoid namespace collisions
- * and bogus matches. There are some drivers in the tree that
- * register both an of_platform_driver and a platform_driver with
- * the same name. This is a temporary measure until they are all
- * cleaned up --gcl July 29, 2010 */
- of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL);
- if (!of_name)
- return -ENOMEM;
- sprintf(of_name, "of:%s", drv->driver.name);
- drv->platform_driver.driver.name = of_name;
-
- if (drv->probe)
- drv->platform_driver.probe = platform_driver_probe_shim;
- drv->platform_driver.remove = drv->remove;
- if (drv->shutdown)
- drv->platform_driver.shutdown = platform_driver_shutdown_shim;
- drv->platform_driver.suspend = drv->suspend;
- drv->platform_driver.resume = drv->resume;
-
- return platform_driver_register(&drv->platform_driver);
-}
-EXPORT_SYMBOL(of_register_platform_driver);
-
-void of_unregister_platform_driver(struct of_platform_driver *drv)
-{
- platform_driver_unregister(&drv->platform_driver);
- kfree(drv->platform_driver.driver.name);
- drv->platform_driver.driver.name = NULL;
-}
-EXPORT_SYMBOL(of_unregister_platform_driver);
-
#if defined(CONFIG_PPC_DCR)
#include <asm/dcr.h>
#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 048949f..17c7e21 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -23,13 +23,7 @@
* of_platform_driver - Legacy of-aware driver for platform devices.
*
* An of_platform_driver driver is attached to a basic platform_device on
- * ether the "platform bus" (platform_bus_type), or the ibm ebus
- * (ibmebus_bus_type).
- *
- * of_platform_driver is being phased out when used with the platform_bus_type,
- * and regular platform_drivers should be used instead. When the transition
- * is complete, only ibmebus will be using this structure, and the
- * platform_driver member of this structure will be removed.
+ * the ibm ebus (ibmebus_bus_type).
*/
struct of_platform_driver
{
@@ -42,15 +36,11 @@ struct of_platform_driver
int (*shutdown)(struct platform_device* dev);

struct device_driver driver;
- struct platform_driver platform_driver;
};
#define to_of_platform_driver(drv) \
container_of(drv,struct of_platform_driver, driver)

/* Platform drivers register/unregister */
-extern int of_register_platform_driver(struct of_platform_driver *drv);
-extern void of_unregister_platform_driver(struct of_platform_driver *drv);
-
extern struct platform_device *of_device_alloc(struct device_node *np,
const char *bus_id,
struct device *parent);

2011-02-23 08:58:11

by Peter Korsgaard

[permalink] [raw]
Subject: Re: [RFC PATCH 07/15] dt: uartlite: merge platform and of_platform driver bindings

>>>>> "Grant" == Grant Likely <[email protected]> writes:

Grant> of_platform_driver is getting removed, and a single platform_driver
Grant> can now support both devicetree and non-devicetree use cases. This
Grant> patch merges the two driver registrations.

Wee!

Grant> static int __devinit ulite_probe(struct platform_device *pdev)
Grant> {
Grant> struct resource *res, *res2;
Grant> + const __be32 *prop;
Grant> + int id = pdev->id;

Grant> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Grant> if (!res)
Grant> @@ -583,7 +586,13 @@ static int __devinit ulite_probe(struct platform_device *pdev)
Grant> if (!res2)
Grant> return -ENODEV;

Grant> - return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start);
Grant> +#ifdef CONFIG_OF
Grant> + prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
Grant> + if (prop)
Grant> + id = be32_to_cpup(prop);
Grant> +#endif
Grant> +
Grant> + return ulite_assign(&pdev->dev, id, res->start, res2->start);
Grant> }

Isn't this going to give a build warning about prop being unused on
!CONFIG_OF builds? Perhaps move it down into the CONFIG_OF conditional?

Other than that,

Acked-by: Peter Korsgaard <[email protected]>

--
Bye, Peter Korsgaard

2011-02-23 16:56:45

by Rob Herring

[permalink] [raw]
Subject: Re: [RFC PATCH 14/15] dt: Eliminate of_platform_{,un}register_driver

Grant,

On 02/22/2011 10:34 PM, Grant Likely wrote:
> Final step to eliminate of_platform_bus_type. They're all just
> platform drivers now.
>
> Signed-off-by: Grant Likely<[email protected]>
> ---

snip

> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
> index b6ae6e9..132951d 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -2556,8 +2556,7 @@ static struct pci_driver ipmi_pci_driver = {
>
>
> #ifdef CONFIG_PPC_OF
> -static int __devinit ipmi_of_probe(struct platform_device *dev,
> - const struct of_device_id *match)
> +static int __devinit ipmi_of_probe(struct platform_device *dev)
> {
> struct smi_info *info;
> struct resource resource;
> @@ -2568,6 +2567,9 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
>
> dev_info(&dev->dev, "probing via device tree\n");
>
> + if (!dev->dev.of_match)
> + return -EINVAL;
> +
> ret = of_address_to_resource(np, 0,&resource);
> if (ret) {
> dev_warn(&dev->dev, PFX "invalid address from OF\n");
> @@ -2600,7 +2602,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
> return -ENOMEM;
> }
>
> - info->si_type = (enum si_type) match->data;
> + info->si_type = (enum si_type) dev->dev.of_match->data;
> info->addr_source = SI_DEVICETREE;
> info->irq_setup = std_irq_setup;
>
> @@ -2652,9 +2654,9 @@ static struct of_device_id ipmi_match[] =
> {},
> };
>
> -static struct of_platform_driver ipmi_of_platform_driver = {
> +static struct platform_driver ipmi_of_platform_driver = {
> .driver = {
> - .name = "ipmi",
> + .name = "of-ipmi",
> .owner = THIS_MODULE,
> .of_match_table = ipmi_match,
> },
> @@ -3396,7 +3398,7 @@ static int __devinit init_ipmi_si(void)
> #endif
>
> #ifdef CONFIG_PPC_OF
> - of_register_platform_driver(&ipmi_of_platform_driver);
> + platform_driver_register(&ipmi_of_platform_driver);
> of_registered = 1;
> #endif
>
> @@ -3457,7 +3459,7 @@ static int __devinit init_ipmi_si(void)
>
> #ifdef CONFIG_PPC_OF
> if (of_registered)
> - of_unregister_platform_driver(&ipmi_of_platform_driver);
> + platform_driver_unregister(&ipmi_of_platform_driver);
> #endif
> driver_unregister(&ipmi_driver.driver);
> printk(KERN_WARNING PFX
> @@ -3558,7 +3560,7 @@ static void __exit cleanup_ipmi_si(void)
>
> #ifdef CONFIG_PPC_OF
> if (of_registered)
> - of_unregister_platform_driver(&ipmi_of_platform_driver);
> + platform_driver_unregister(&ipmi_of_platform_driver);
> #endif
>
> mutex_lock(&smi_infos_lock);

Um, you are doing exactly what you said I should not do. Now the driver
has 2 platform drivers defined. I have an updated patch that addresses
your previous comments. I will send it out later today.

Rob

2011-02-23 17:22:55

by Grant Likely

[permalink] [raw]
Subject: Re: [RFC PATCH 14/15] dt: Eliminate of_platform_{,un}register_driver

On Wed, Feb 23, 2011 at 9:56 AM, Rob Herring <[email protected]> wrote:
> Grant,
>
> On 02/22/2011 10:34 PM, Grant Likely wrote:
>>
>> Final step to eliminate of_platform_bus_type. ?They're all just
>> platform drivers now.
>>
>> Signed-off-by: Grant Likely<[email protected]>
>> ---
>
> snip
>
>> diff --git a/drivers/char/ipmi/ipmi_si_intf.c
>> b/drivers/char/ipmi/ipmi_si_intf.c
>> index b6ae6e9..132951d 100644
>> --- a/drivers/char/ipmi/ipmi_si_intf.c
>> +++ b/drivers/char/ipmi/ipmi_si_intf.c
>> @@ -2556,8 +2556,7 @@ static struct pci_driver ipmi_pci_driver = {
>>
>>
>> ?#ifdef CONFIG_PPC_OF
>> -static int __devinit ipmi_of_probe(struct platform_device *dev,
>> - ? ? ? ? ? ? ? ? ? ? ? ?const struct of_device_id *match)
>> +static int __devinit ipmi_of_probe(struct platform_device *dev)
>> ?{
>> ? ? ? ?struct smi_info *info;
>> ? ? ? ?struct resource resource;
>> @@ -2568,6 +2567,9 @@ static int __devinit ipmi_of_probe(struct
>> platform_device *dev,
>>
>> ? ? ? ?dev_info(&dev->dev, "probing via device tree\n");
>>
>> + ? ? ? if (!dev->dev.of_match)
>> + ? ? ? ? ? ? ? return -EINVAL;
>> +
>> ? ? ? ?ret = of_address_to_resource(np, 0,&resource);
>> ? ? ? ?if (ret) {
>> ? ? ? ? ? ? ? ?dev_warn(&dev->dev, PFX "invalid address from OF\n");
>> @@ -2600,7 +2602,7 @@ static int __devinit ipmi_of_probe(struct
>> platform_device *dev,
>> ? ? ? ? ? ? ? ?return -ENOMEM;
>> ? ? ? ?}
>>
>> - ? ? ? info->si_type ? ? ? ? ? = (enum si_type) match->data;
>> + ? ? ? info->si_type ? ? ? ? ? = (enum si_type) dev->dev.of_match->data;
>> ? ? ? ?info->addr_source ? ? ? = SI_DEVICETREE;
>> ? ? ? ?info->irq_setup ? ? ? ? = std_irq_setup;
>>
>> @@ -2652,9 +2654,9 @@ static struct of_device_id ipmi_match[] =
>> ? ? ? ?{},
>> ?};
>>
>> -static struct of_platform_driver ipmi_of_platform_driver = {
>> +static struct platform_driver ipmi_of_platform_driver = {
>> ? ? ? ?.driver = {
>> - ? ? ? ? ? ? ? .name = "ipmi",
>> + ? ? ? ? ? ? ? .name = "of-ipmi",
>> ? ? ? ? ? ? ? ?.owner = THIS_MODULE,
>> ? ? ? ? ? ? ? ?.of_match_table = ipmi_match,
>> ? ? ? ?},
>> @@ -3396,7 +3398,7 @@ static int __devinit init_ipmi_si(void)
>> ?#endif
>>
>> ?#ifdef CONFIG_PPC_OF
>> - ? ? ? of_register_platform_driver(&ipmi_of_platform_driver);
>> + ? ? ? platform_driver_register(&ipmi_of_platform_driver);
>> ? ? ? ?of_registered = 1;
>> ?#endif
>>
>> @@ -3457,7 +3459,7 @@ static int __devinit init_ipmi_si(void)
>>
>> ?#ifdef CONFIG_PPC_OF
>> ? ? ? ? ? ? ? ?if (of_registered)
>> -
>> of_unregister_platform_driver(&ipmi_of_platform_driver);
>> +
>> platform_driver_unregister(&ipmi_of_platform_driver);
>> ?#endif
>> ? ? ? ? ? ? ? ?driver_unregister(&ipmi_driver.driver);
>> ? ? ? ? ? ? ? ?printk(KERN_WARNING PFX
>> @@ -3558,7 +3560,7 @@ static void __exit cleanup_ipmi_si(void)
>>
>> ?#ifdef CONFIG_PPC_OF
>> ? ? ? ?if (of_registered)
>> - ? ? ? ? ? ? ? of_unregister_platform_driver(&ipmi_of_platform_driver);
>> + ? ? ? ? ? ? ? platform_driver_unregister(&ipmi_of_platform_driver);
>> ?#endif
>>
>> ? ? ? ?mutex_lock(&smi_infos_lock);
>
> Um, you are doing exactly what you said I should not do. Now the driver has
> 2 platform drivers defined. I have an updated patch that addresses your
> previous comments. I will send it out later today.

Thanks. I wacked this whole series out one evening and converted all
the drivers at once, so it's not surprising that I missed some
duplications. Send me your patch and I'll drop my changes here.

g.

2011-02-23 18:10:47

by Grant Likely

[permalink] [raw]
Subject: Re: [RFC PATCH 07/15] dt: uartlite: merge platform and of_platform driver bindings

On Wed, Feb 23, 2011 at 09:58:01AM +0100, Peter Korsgaard wrote:
> >>>>> "Grant" == Grant Likely <[email protected]> writes:
>
> Grant> of_platform_driver is getting removed, and a single platform_driver
> Grant> can now support both devicetree and non-devicetree use cases. This
> Grant> patch merges the two driver registrations.
>
> Wee!
>
> Grant> static int __devinit ulite_probe(struct platform_device *pdev)
> Grant> {
> Grant> struct resource *res, *res2;
> Grant> + const __be32 *prop;
> Grant> + int id = pdev->id;
>
> Grant> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> Grant> if (!res)
> Grant> @@ -583,7 +586,13 @@ static int __devinit ulite_probe(struct platform_device *pdev)
> Grant> if (!res2)
> Grant> return -ENODEV;
>
> Grant> - return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start);
> Grant> +#ifdef CONFIG_OF
> Grant> + prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
> Grant> + if (prop)
> Grant> + id = be32_to_cpup(prop);
> Grant> +#endif
> Grant> +
> Grant> + return ulite_assign(&pdev->dev, id, res->start, res2->start);
> Grant> }
>
> Isn't this going to give a build warning about prop being unused on
> !CONFIG_OF builds? Perhaps move it down into the CONFIG_OF conditional?

I'd actually like to be rid of 'port-number' entirely; but that's
another day's debate. I'll fix this up.

g.

2011-02-23 18:29:08

by Rob Herring

[permalink] [raw]
Subject: Re: [RFC PATCH 02/15] dt: add a match table pointer to struct device

Grant,

On 02/22/2011 10:33 PM, Grant Likely wrote:
> Add a new .of_match field to struct device which points at the
> matching device driver .of_match_table entry when a device is probed
> via the device tree
>
> Signed-off-by: Grant Likely<[email protected]>
> ---
> include/linux/device.h | 1 +
> include/linux/of_device.h | 5 +++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index ca5d252..8d8e267 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -441,6 +441,7 @@ struct device {
> struct dev_archdata archdata;
>
> struct device_node *of_node; /* associated device tree node */
> + const struct of_device_id *of_match; /* matching of_device_id from driver */

Couldn't of_match/of_match_table be merged into the platform dev/drv
id_entry/id_table. Handling MODALIAS for a driver that does both OF
style and normal platform device matching may be a problem though.

Rob

2011-02-23 18:44:10

by Grant Likely

[permalink] [raw]
Subject: Re: [RFC PATCH 02/15] dt: add a match table pointer to struct device

On Wed, Feb 23, 2011 at 12:29:03PM -0600, Rob Herring wrote:
> Grant,
>
> On 02/22/2011 10:33 PM, Grant Likely wrote:
> >Add a new .of_match field to struct device which points at the
> >matching device driver .of_match_table entry when a device is probed
> >via the device tree
> >
> >Signed-off-by: Grant Likely<[email protected]>
> >---
> > include/linux/device.h | 1 +
> > include/linux/of_device.h | 5 +++--
> > 2 files changed, 4 insertions(+), 2 deletions(-)
> >
> >diff --git a/include/linux/device.h b/include/linux/device.h
> >index ca5d252..8d8e267 100644
> >--- a/include/linux/device.h
> >+++ b/include/linux/device.h
> >@@ -441,6 +441,7 @@ struct device {
> > struct dev_archdata archdata;
> >
> > struct device_node *of_node; /* associated device tree node */
> >+ const struct of_device_id *of_match; /* matching of_device_id from driver */
>
> Couldn't of_match/of_match_table be merged into the platform dev/drv
> id_entry/id_table. Handling MODALIAS for a driver that does both OF
> style and normal platform device matching may be a problem though.

.of_match & .of_match_table works on all devices, not just
platform devices. It allows the common library of device tree support
routines to be used with any bus type.

g.

2011-02-25 08:14:42

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC PATCH 13/15] dt/serial: Eliminate users of of_platform_{, un}register_driver

On Wednesday 23 February 2011, Grant Likely wrote:
> Get rid of users of of_platform_driver in drivers/serial. 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 <[email protected]>

of_serial changes look good.

Reviewed-by: Arnd Bergmann <[email protected]>

2011-02-25 08:14:38

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus

On Wednesday 23 February 2011, Grant Likely wrote:
> arch/powerpc/kernel/ibmebus.c is the only remaining user of the
> of_bus_type support code for initializing the bus and registering
> drivers. All others have either been switched to the vanilla platform
> bus or already have their own infrastructure.
>
> This patch moves the functionality that ibmebus is using out of
> drivers/of/{platform,device}.c and into ibmebus.c where it is actually
> used. Also renames the moved symbols from of_platform_* to
> ibmebus_bus_* to reflect the actual usage.
>
> This patch is part of moving all of the of_platform_bus_type users
> over to the platform_bus_type.
>
> Signed-off-by: Grant Likely <[email protected]>

The ibmebus is essentially the platform bus of the IBM Power Systems (a.k.a.
pSeries a.k.a. System p), I think it would make a lot of sense to convert
the two drivers (ehca and ehea) on this bus into platform drivers as well.

The original reason for this bus was to provide a different IOMMU for them
than what is used on the PCI devices. This should now be possible in simpler
ways.

>
> +static void ibmebus_bus_device_shutdown(struct device *dev)
> +{
> + struct platform_device *of_dev = to_platform_device(dev);
> + struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
> +
> + if (dev->driver && drv->shutdown)
> + drv->shutdown(of_dev);
> +}

neither of the drivers provides a shutdown function.

> +#ifdef CONFIG_PM_SLEEP
> +static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
> +{
> + struct platform_device *of_dev = to_platform_device(dev);
> + struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
> + int ret = 0;
> +
> + if (dev->driver && drv->suspend)
> + ret = drv->suspend(of_dev, mesg);
> + return ret;
> +}
> +
> +static int ibmebus_bus_legacy_resume(struct device *dev)
> +{
> + struct platform_device *of_dev = to_platform_device(dev);
> + struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
> + int ret = 0;
> +
> + if (dev->driver && drv->resume)
> + ret = drv->resume(of_dev);
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_prepare(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (drv && drv->pm && drv->pm->prepare)
> + ret = drv->pm->prepare(dev);
> +
> + return ret;
> +}
> +
> +static void ibmebus_bus_pm_complete(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> +
> + if (drv && drv->pm && drv->pm->complete)
> + drv->pm->complete(dev);
> +}
> +
> +#ifdef CONFIG_SUSPEND
> +
> +static int ibmebus_bus_pm_suspend(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->suspend)
> + ret = drv->pm->suspend(dev);
> + } else {
> + ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->suspend_noirq)
> + ret = drv->pm->suspend_noirq(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_resume(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->resume)
> + ret = drv->pm->resume(dev);
> + } else {
> + ret = ibmebus_bus_legacy_resume(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_resume_noirq(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->resume_noirq)
> + ret = drv->pm->resume_noirq(dev);
> + }
> +
> + return ret;
> +}

These are also unused in the drivers.

> +#ifdef CONFIG_HIBERNATION
> +
> +static int ibmebus_bus_pm_freeze(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->freeze)
> + ret = drv->pm->freeze(dev);
> + } else {
> + ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->freeze_noirq)
> + ret = drv->pm->freeze_noirq(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_thaw(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->thaw)
> + ret = drv->pm->thaw(dev);
> + } else {
> + ret = ibmebus_bus_legacy_resume(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->thaw_noirq)
> + ret = drv->pm->thaw_noirq(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_poweroff(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->poweroff)
> + ret = drv->pm->poweroff(dev);
> + } else {
> + ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->poweroff_noirq)
> + ret = drv->pm->poweroff_noirq(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_restore(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->restore)
> + ret = drv->pm->restore(dev);
> + } else {
> + ret = ibmebus_bus_legacy_resume(dev);
> + }
> +
> + return ret;
> +}
> +
> +static int ibmebus_bus_pm_restore_noirq(struct device *dev)
> +{
> + struct device_driver *drv = dev->driver;
> + int ret = 0;
> +
> + if (!drv)
> + return 0;
> +
> + if (drv->pm) {
> + if (drv->pm->restore_noirq)
> + ret = drv->pm->restore_noirq(dev);
> + }
> +
> + return ret;
> +}

And these, too.

Arnd

2011-02-25 08:54:09

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus

On Thu, 2011-02-24 at 15:46 +0100, Arnd Bergmann wrote:
> On Wednesday 23 February 2011, Grant Likely wrote:
> > arch/powerpc/kernel/ibmebus.c is the only remaining user of the
> > of_bus_type support code for initializing the bus and registering
> > drivers. All others have either been switched to the vanilla platform
> > bus or already have their own infrastructure.
> >
> > This patch moves the functionality that ibmebus is using out of
> > drivers/of/{platform,device}.c and into ibmebus.c where it is actually
> > used. Also renames the moved symbols from of_platform_* to
> > ibmebus_bus_* to reflect the actual usage.
> >
> > This patch is part of moving all of the of_platform_bus_type users
> > over to the platform_bus_type.
> >
> > Signed-off-by: Grant Likely <[email protected]>
>
> The ibmebus is essentially the platform bus of the IBM Power Systems (a.k.a.
> pSeries a.k.a. System p), I think it would make a lot of sense to convert
> the two drivers (ehca and ehea) on this bus into platform drivers as well.
>
> The original reason for this bus was to provide a different IOMMU for them
> than what is used on the PCI devices. This should now be possible in simpler
> ways.

Well, it's really the IBM "GX" bus but yeah, it could be converted I
suppose. The "special" iommu functions mostly derive from the fact that
the two adapters we are interested in have their own translation
mechanism built-in. The GX bus sits "above" the TCEs used as an iommu on
these systems.

> > +static void ibmebus_bus_device_shutdown(struct device *dev)
> > +{
> > + struct platform_device *of_dev = to_platform_device(dev);
> > + struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
> > +
> > + if (dev->driver && drv->shutdown)
> > + drv->shutdown(of_dev);
> > +}
>
> neither of the drivers provides a shutdown function.

Right but they might grow one ... and people will wonder why it doesn't
work if you remove the above :-)

.../...

> These are also unused in the drivers.

Same reasoning, however it becomes moot if we convert them to platform.

Cheers,
Ben.

2011-02-25 18:27:19

by Stephen Neuendorffer

[permalink] [raw]
Subject: RE: [RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and of_platformdriver bindings

Minor nit below

Acked-by: Stephen Neuendorffer <[email protected]>

Steve

> -----Original Message-----
> From: [email protected]
[mailto:linuxppc-dev-
> [email protected]] On Behalf Of Grant
Likely
> Sent: Tuesday, February 22, 2011 8:34 PM
> To: Benjamin Herrenschmidt; [email protected];
[email protected]; linux-
> [email protected]; [email protected]
> Cc: [email protected]; [email protected]
> Subject: [RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and
of_platformdriver bindings
>
> of_platform_driver is getting removed, and a single platform_driver
> can now support both devicetree and non-devicetree use cases. This
> patch merges the two driver registrations.
>
> Signed-off-by: Grant Likely <[email protected]>
> ---
> drivers/char/xilinx_hwicap/xilinx_hwicap.c | 129
+++++++++++-----------------
> 1 files changed, 49 insertions(+), 80 deletions(-)
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index 9f2272e..a55e877 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -714,20 +714,29 @@ static int __devexit hwicap_remove(struct device
*dev)
> return 0; /* success */
> }
>
> -static int __devinit hwicap_drv_probe(struct platform_device *pdev)
> +#ifdef CONFIG_OF
> +static int __devinit hwicap_of_probe(struct platform_device *op)
> {
> - struct resource *res;
> - const struct config_registers *regs;
> + struct resource res;
> + const unsigned int *id;
> const char *family;
> + int rc;
> + const struct hwicap_driver_config *config =
op->dev.of_match->data;
> + const struct config_registers *regs;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENODEV;
> +
> + rc = of_address_to_resource(op->dev.of_node, 0, &res);
> + if (rc) {
> + dev_err(&op->dev, "invalid address\n");
> + return rc;
> + }
> +
> + id = of_get_property(op->dev.of_node, "port-number", NULL);
>
> /* It's most likely that we're using V4, if the family is not
> specified */
> regs = &v4_config_registers;
> - family = pdev->dev.platform_data;
> + family = of_get_property(op->dev.of_node, "xlnx,family", NULL);
>
> if (family) {
> if (!strcmp(family, "virtex2p")) {
> @@ -738,54 +747,33 @@ static int __devinit hwicap_drv_probe(struct
platform_device *pdev)
> regs = &v5_config_registers;
> }
> }
> -
> - return hwicap_setup(&pdev->dev, pdev->id, res,
> - &buffer_icap_config, regs);
> + return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
> + regs);
> }
> -
> -static int __devexit hwicap_drv_remove(struct platform_device *pdev)
> +#else
> +static inline int hwicap_of_probe(struct platform_device *op)
> {
> - return hwicap_remove(&pdev->dev);
> + return -EINVAL;
> }
> +#endif /* CONFIG_OF */
>
> -static struct platform_driver hwicap_platform_driver = {
> - .probe = hwicap_drv_probe,
> - .remove = hwicap_drv_remove,
> - .driver = {
> - .owner = THIS_MODULE,
> - .name = DRIVER_NAME,
> - },
> -};
> -
> -/*
---------------------------------------------------------------------
> - * OF bus binding
> - */
> -
> -#if defined(CONFIG_OF)
> -static int __devinit
> -hwicap_of_probe(struct platform_device *op, const struct of_device_id
*match)
> +static int __devinit hwicap_drv_probe(struct platform_device *pdev)
> {
> - struct resource res;
> - const unsigned int *id;
> - const char *family;
> - int rc;
> - const struct hwicap_driver_config *config = match->data;
> + struct resource *res;
> const struct config_registers *regs;
> + const char *family;
>
> - dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match);
> -
> - rc = of_address_to_resource(op->dev.of_node, 0, &res);
> - if (rc) {
> - dev_err(&op->dev, "invalid address\n");
> - return rc;
> - }
> + if (pdev->dev.of_match)
> + return hwicap_of_probe(pdev);
>
> - id = of_get_property(op->dev.of_node, "port-number", NULL);
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + return -ENODEV;
>
> /* It's most likely that we're using V4, if the family is not
> specified */
> regs = &v4_config_registers;
> - family = of_get_property(op->dev.of_node, "xlnx,family", NULL);
> + family = pdev->dev.platform_data;
>
> if (family) {
> if (!strcmp(family, "virtex2p")) {
> @@ -796,15 +784,17 @@ hwicap_of_probe(struct platform_device *op,
const struct of_device_id *match)
> regs = &v5_config_registers;
> }
> }
> - return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
> - regs);
> +
> + return hwicap_setup(&pdev->dev, pdev->id, res,
> + &buffer_icap_config, regs);
> }
>
> -static int __devexit hwicap_of_remove(struct platform_device *op)
> +static int __devexit hwicap_drv_remove(struct platform_device *pdev)
> {
> - return hwicap_remove(&op->dev);
> + return hwicap_remove(&pdev->dev);
> }
>
> +#ifdef CONFIG_OF
> /* Match table for of_platform binding */

Does the comment still make sense?

> static const struct of_device_id __devinitconst hwicap_of_match[] = {
> { .compatible = "xlnx,opb-hwicap-1.00.b", .data =
&buffer_icap_config},
> @@ -812,33 +802,23 @@ static const struct of_device_id __devinitconst
hwicap_of_match[] = {
> {},
> };
> MODULE_DEVICE_TABLE(of, hwicap_of_match);
> +#else
> +#define hwicap_of_match NULL
> +#endif
>
> -static struct of_platform_driver hwicap_of_driver = {
> - .probe = hwicap_of_probe,
> - .remove = __devexit_p(hwicap_of_remove),
> +static struct platform_driver hwicap_platform_driver = {
> + .probe = hwicap_drv_probe,
> + .remove = hwicap_drv_remove,
> .driver = {
> - .name = DRIVER_NAME,
> .owner = THIS_MODULE,
> + .name = DRIVER_NAME,
> .of_match_table = hwicap_of_match,
> },
> };
>
> -/* Registration helpers to keep the number of #ifdefs to a minimum */
> -static inline int __init hwicap_of_register(void)
> -{
> - pr_debug("hwicap: calling of_register_platform_driver()\n");
> - return of_register_platform_driver(&hwicap_of_driver);
> -}
> -
> -static inline void __exit hwicap_of_unregister(void)
> -{
> - of_unregister_platform_driver(&hwicap_of_driver);
> -}
> -#else /* CONFIG_OF */
> -/* CONFIG_OF not enabled; do nothing helpers */
> -static inline int __init hwicap_of_register(void) { return 0; }
> -static inline void __exit hwicap_of_unregister(void) { }
> -#endif /* CONFIG_OF */
> +/*
---------------------------------------------------------------------
> + * OF bus binding
> + */
>
> static int __init hwicap_module_init(void)
> {
> @@ -856,21 +836,12 @@ static int __init hwicap_module_init(void)
> return retval;
>
> retval = platform_driver_register(&hwicap_platform_driver);
> -
> - if (retval)
> - goto failed1;
> -
> - retval = hwicap_of_register();
> -
> if (retval)
> - goto failed2;
> + goto failed;
>
> return retval;
>
> - failed2:
> - platform_driver_unregister(&hwicap_platform_driver);
> -
> - failed1:
> + failed:
> unregister_chrdev_region(devt, HWICAP_DEVICES);
>
> return retval;
> @@ -884,8 +855,6 @@ static void __exit hwicap_module_cleanup(void)
>
> platform_driver_unregister(&hwicap_platform_driver);
>
> - hwicap_of_unregister();
> -
> unregister_chrdev_region(devt, HWICAP_DEVICES);
> }
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> [email protected]
> https://lists.ozlabs.org/listinfo/linuxppc-dev


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

2011-02-28 07:35:35

by Grant Likely

[permalink] [raw]
Subject: Re: [RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus

On Thu, Feb 24, 2011 at 03:46:48PM +0100, Arnd Bergmann wrote:
> On Wednesday 23 February 2011, Grant Likely wrote:
> > arch/powerpc/kernel/ibmebus.c is the only remaining user of the
> > of_bus_type support code for initializing the bus and registering
> > drivers. All others have either been switched to the vanilla platform
> > bus or already have their own infrastructure.
> >
> > This patch moves the functionality that ibmebus is using out of
> > drivers/of/{platform,device}.c and into ibmebus.c where it is actually
> > used. Also renames the moved symbols from of_platform_* to
> > ibmebus_bus_* to reflect the actual usage.
> >
> > This patch is part of moving all of the of_platform_bus_type users
> > over to the platform_bus_type.
> >
> > Signed-off-by: Grant Likely <[email protected]>
>
> The ibmebus is essentially the platform bus of the IBM Power Systems (a.k.a.
> pSeries a.k.a. System p), I think it would make a lot of sense to convert
> the two drivers (ehca and ehea) on this bus into platform drivers as well.
>
> The original reason for this bus was to provide a different IOMMU for them
> than what is used on the PCI devices. This should now be possible in simpler
> ways.

Agreed. Anybody want to volunteer to craft a patch?

In the mean time, do you have any problem with this patch? (assuming
nobody is able to take on the task of converting those drivers
immediately).

g.

2011-02-28 07:41:33

by Grant Likely

[permalink] [raw]
Subject: Re: [RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and of_platformdriver bindings

On Fri, Feb 25, 2011 at 10:25:22AM -0800, Stephen Neuendorffer wrote:
> Minor nit below
>
> Acked-by: Stephen Neuendorffer <[email protected]>
>
> Steve
>
> > +#ifdef CONFIG_OF
> > /* Match table for of_platform binding */
>
> Does the comment still make sense?

Fixed, thanks.