aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-16 20:28:10 -0400
commit4c5811bf463b0ef82fabbd1708f8bb2d753aeb18 (patch)
treeff37d31217c3804ca05de21a55a9b5ca1ca818b2
parentf74b9444192c60603020c61d7915b72893137edc (diff)
parent9f15444fefdb33509132ff5c9be60cb315c44cb2 (diff)
Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6: (21 commits) tty: serial: altera_jtaguart: Add device tree support tty: serial: altera_uart: Add devicetree support dt: eliminate of_platform_driver shim code dt: Eliminate of_platform_{,un}register_driver dt/serial: Eliminate users of of_platform_{,un}register_driver dt/usb: Eliminate users of of_platform_{,un}register_driver dt/video: Eliminate users of of_platform_{,un}register_driver dt/net: Eliminate users of of_platform_{,un}register_driver dt/sound: Eliminate users of of_platform_{,un}register_driver dt/spi: Eliminate users of of_platform_{,un}register_driver dt: uartlite: merge platform and of_platform driver bindings dt: xilinx_hwicap: merge platform and of_platform driver bindings ipmi: convert OF driver to platform driver leds/leds-gpio: merge platform_driver with of_platform_driver dt/sparc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: Eliminate users of of_platform_{,un}register_driver dt/powerpc: move of_bus_type infrastructure to ibmebus drivercore/dt: add a match table pointer to struct device dt: Typo fix. altera_ps2: Add devicetree support ...
-rw-r--r--Documentation/devicetree/bindings/serial/altera_jtaguart.txt4
-rw-r--r--Documentation/devicetree/bindings/serial/altera_uart.txt7
-rw-r--r--Documentation/devicetree/bindings/serio/altera_ps2.txt4
-rw-r--r--arch/microblaze/pci/pci_32.c1
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h27
-rw-r--r--arch/powerpc/include/asm/pci.h2
-rw-r--r--arch/powerpc/kernel/ibmebus.c404
-rw-r--r--arch/powerpc/kernel/of_platform.c9
-rw-r--r--arch/powerpc/kernel/pci-common.c11
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/powerpc/kernel/pci_dn.c9
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c14
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c10
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c11
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c7
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c14
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c11
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c9
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c2
-rw-r--r--arch/powerpc/sysdev/axonram.c11
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c9
-rw-r--r--arch/powerpc/sysdev/fsl_85xx_l2ctlr.c9
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c13
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c7
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c7
-rw-r--r--arch/powerpc/sysdev/pmi.c9
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c7
-rw-r--r--arch/sparc/include/asm/parport.h6
-rw-r--r--arch/sparc/kernel/apc.c7
-rw-r--r--arch/sparc/kernel/auxio_64.c7
-rw-r--r--arch/sparc/kernel/central.c14
-rw-r--r--arch/sparc/kernel/chmc.c19
-rw-r--r--arch/sparc/kernel/pci_fire.c7
-rw-r--r--arch/sparc/kernel/pci_psycho.c7
-rw-r--r--arch/sparc/kernel/pci_sabre.c9
-rw-r--r--arch/sparc/kernel/pci_schizo.c11
-rw-r--r--arch/sparc/kernel/pci_sun4v.c7
-rw-r--r--arch/sparc/kernel/pmc.c7
-rw-r--r--arch/sparc/kernel/power.c6
-rw-r--r--arch/sparc/kernel/time_32.c6
-rw-r--r--arch/sparc/kernel/time_64.c18
-rw-r--r--drivers/ata/pata_mpc52xx.c8
-rw-r--r--drivers/ata/pata_of_platform.c9
-rw-r--r--drivers/ata/sata_dwc_460ex.c9
-rw-r--r--drivers/ata/sata_fsl.c9
-rw-r--r--drivers/atm/fore200e.c17
-rw-r--r--drivers/block/xsysace.c11
-rw-r--r--drivers/char/hw_random/n2-drv.c16
-rw-r--r--drivers/char/hw_random/pasemi-rng.c9
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c70
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c129
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c9
-rw-r--r--drivers/crypto/n2_core.c20
-rw-r--r--drivers/crypto/talitos.c9
-rw-r--r--drivers/dma/fsldma.c14
-rw-r--r--drivers/dma/mpc512x_dma.c9
-rw-r--r--drivers/dma/ppc4xx/adma.c11
-rw-r--r--drivers/edac/mpc85xx_edac.c27
-rw-r--r--drivers/edac/ppc4xx_edac.c23
-rw-r--r--drivers/hwmon/ultra45_env.c9
-rw-r--r--drivers/i2c/busses/i2c-cpm.c9
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c9
-rw-r--r--drivers/i2c/busses/i2c-mpc.c22
-rw-r--r--drivers/input/misc/sparcspkr.c22
-rw-r--r--drivers/input/serio/altera_ps2.c15
-rw-r--r--drivers/input/serio/i8042-sparcio.h8
-rw-r--r--drivers/input/serio/xilinx_ps2.c9
-rw-r--r--drivers/leds/leds-gpio.c214
-rw-r--r--drivers/macintosh/smu.c7
-rw-r--r--drivers/macintosh/therm_pm72.c8
-rw-r--r--drivers/macintosh/therm_windtunnel.c9
-rw-r--r--drivers/media/video/fsl-viu.c9
-rw-r--r--drivers/mmc/host/sdhci-of-core.c15
-rw-r--r--drivers/mtd/maps/physmap_of.c15
-rw-r--r--drivers/mtd/maps/sun_uflash.c8
-rw-r--r--drivers/mtd/nand/fsl_upm.c9
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c9
-rw-r--r--drivers/mtd/nand/ndfc.c9
-rw-r--r--drivers/mtd/nand/pasemi_nand.c9
-rw-r--r--drivers/mtd/nand/socrates_nand.c9
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c15
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c9
-rw-r--r--drivers/net/fec_mpc52xx.c13
-rw-r--r--drivers/net/fec_mpc52xx.h2
-rw-r--r--drivers/net/fec_mpc52xx_phy.c5
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c16
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c9
-rw-r--r--drivers/net/fs_enet/mii-fec.c15
-rw-r--r--drivers/net/fsl_pq_mdio.c9
-rw-r--r--drivers/net/gianfar.c12
-rw-r--r--drivers/net/greth.c8
-rw-r--r--drivers/net/ibm_newemac/core.c9
-rw-r--r--drivers/net/ibm_newemac/mal.c9
-rw-r--r--drivers/net/ibm_newemac/rgmii.c9
-rw-r--r--drivers/net/ibm_newemac/tah.c9
-rw-r--r--drivers/net/ibm_newemac/zmii.c9
-rw-r--r--drivers/net/ll_temac_main.c9
-rw-r--r--drivers/net/myri_sbus.c8
-rw-r--r--drivers/net/niu.c11
-rw-r--r--drivers/net/phy/mdio-gpio.c9
-rw-r--r--drivers/net/sunbmac.c9
-rw-r--r--drivers/net/sunhme.c14
-rw-r--r--drivers/net/sunlance.c8
-rw-r--r--drivers/net/sunqe.c8
-rw-r--r--drivers/net/ucc_geth.c8
-rw-r--r--drivers/net/xilinx_emaclite.c9
-rw-r--r--drivers/of/device.c34
-rw-r--r--drivers/of/platform.c461
-rw-r--r--drivers/parport/parport_sunbpp.c8
-rw-r--r--drivers/pcmcia/electra_cf.c9
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c9
-rw-r--r--drivers/rtc/rtc-mpc5121.c9
-rw-r--r--drivers/sbus/char/bbc_i2c.c9
-rw-r--r--drivers/sbus/char/display7seg.c9
-rw-r--r--drivers/sbus/char/envctrl.c9
-rw-r--r--drivers/sbus/char/flash.c9
-rw-r--r--drivers/sbus/char/uctrl.c9
-rw-r--r--drivers/scsi/qlogicpti.c14
-rw-r--r--drivers/scsi/sun_esp.c8
-rw-r--r--drivers/spi/mpc512x_psc_spi.c9
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c9
-rw-r--r--drivers/spi/mpc52xx_spi.c9
-rw-r--r--drivers/spi/spi_fsl_espi.c11
-rw-r--r--drivers/spi/spi_fsl_lib.c3
-rw-r--r--drivers/spi/spi_fsl_lib.h3
-rw-r--r--drivers/spi/spi_fsl_spi.c11
-rw-r--r--drivers/spi/spi_ppc4xx.c9
-rw-r--r--drivers/tty/serial/altera_jtaguart.c15
-rw-r--r--drivers/tty/serial/altera_uart.c51
-rw-r--r--drivers/tty/serial/apbuart.c11
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_core.c9
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c13
-rw-r--r--drivers/tty/serial/of_serial.c14
-rw-r--r--drivers/tty/serial/sunhv.c8
-rw-r--r--drivers/tty/serial/sunsab.c8
-rw-r--r--drivers/tty/serial/sunsu.c6
-rw-r--r--drivers/tty/serial/sunzilog.c10
-rw-r--r--drivers/tty/serial/uartlite.c103
-rw-r--r--drivers/tty/serial/ucc_uart.c9
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c14
-rw-r--r--drivers/usb/host/ehci-hcd.c12
-rw-r--r--drivers/usb/host/ehci-ppc-of.c9
-rw-r--r--drivers/usb/host/ehci-xilinx-of.c6
-rw-r--r--drivers/usb/host/fhci-hcd.c9
-rw-r--r--drivers/usb/host/isp1760-if.c9
-rw-r--r--drivers/usb/host/ohci-hcd.c6
-rw-r--r--drivers/usb/host/ohci-ppc-of.c9
-rw-r--r--drivers/video/bw2.c8
-rw-r--r--drivers/video/cg14.c8
-rw-r--r--drivers/video/cg3.c9
-rw-r--r--drivers/video/cg6.c9
-rw-r--r--drivers/video/ffb.c9
-rw-r--r--drivers/video/fsl-diu-fb.c9
-rw-r--r--drivers/video/leo.c9
-rw-r--r--drivers/video/mb862xx/mb862xxfb.c9
-rw-r--r--drivers/video/p9100.c8
-rw-r--r--drivers/video/platinumfb.c9
-rw-r--r--drivers/video/sunxvr1000.c9
-rw-r--r--drivers/video/tcx.c9
-rw-r--r--drivers/video/xilinxfb.c11
-rw-r--r--drivers/watchdog/cpwd.c9
-rw-r--r--drivers/watchdog/gef_wdt.c9
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c15
-rw-r--r--drivers/watchdog/riowd.c9
-rw-r--r--include/linux/device.h1
-rw-r--r--include/linux/of.h2
-rw-r--r--include/linux/of_device.h5
-rw-r--r--include/linux/of_platform.h18
-rw-r--r--sound/soc/fsl/fsl_dma.c9
-rw-r--r--sound/soc/fsl/fsl_ssi.c9
-rw-r--r--sound/soc/fsl/mpc5200_dma.c24
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c9
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c9
-rw-r--r--sound/sparc/amd7930.c8
-rw-r--r--sound/sparc/cs4231.c16
-rw-r--r--sound/sparc/dbri.c8
178 files changed, 1407 insertions, 1725 deletions
diff --git a/Documentation/devicetree/bindings/serial/altera_jtaguart.txt b/Documentation/devicetree/bindings/serial/altera_jtaguart.txt
new file mode 100644
index 000000000000..c152f65f9a28
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/altera_jtaguart.txt
@@ -0,0 +1,4 @@
1Altera JTAG UART
2
3Required properties:
4- compatible : should be "ALTR,juart-1.0"
diff --git a/Documentation/devicetree/bindings/serial/altera_uart.txt b/Documentation/devicetree/bindings/serial/altera_uart.txt
new file mode 100644
index 000000000000..71cae3f70100
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/altera_uart.txt
@@ -0,0 +1,7 @@
1Altera UART
2
3Required properties:
4- compatible : should be "ALTR,uart-1.0"
5
6Optional properties:
7- clock-frequency : frequency of the clock input to the UART
diff --git a/Documentation/devicetree/bindings/serio/altera_ps2.txt b/Documentation/devicetree/bindings/serio/altera_ps2.txt
new file mode 100644
index 000000000000..4d9eecc2ef7d
--- /dev/null
+++ b/Documentation/devicetree/bindings/serio/altera_ps2.txt
@@ -0,0 +1,4 @@
1Altera UP PS/2 controller
2
3Required properties:
4- compatible : should be "ALTR,ps2-1.0".
diff --git a/arch/microblaze/pci/pci_32.c b/arch/microblaze/pci/pci_32.c
index 3c3d808d7ce0..92728a6cfd80 100644
--- a/arch/microblaze/pci/pci_32.c
+++ b/arch/microblaze/pci/pci_32.c
@@ -332,6 +332,7 @@ static void __devinit pcibios_scan_phb(struct pci_controller *hose)
332 hose->global_number); 332 hose->global_number);
333 return; 333 return;
334 } 334 }
335 bus.dev->of_node = of_node_get(node);
335 bus->secondary = hose->first_busno; 336 bus->secondary = hose->first_busno;
336 hose->bus = bus; 337 hose->bus = bus;
337 338
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index edeb80fdd2c3..5e156e034fe2 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -164,13 +164,13 @@ extern void setup_indirect_pci(struct pci_controller* hose,
164 resource_size_t cfg_addr, 164 resource_size_t cfg_addr,
165 resource_size_t cfg_data, u32 flags); 165 resource_size_t cfg_data, u32 flags);
166 166
167#ifndef CONFIG_PPC64
168
169static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) 167static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
170{ 168{
171 return bus->sysdata; 169 return bus->sysdata;
172} 170}
173 171
172#ifndef CONFIG_PPC64
173
174static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) 174static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
175{ 175{
176 struct pci_controller *host; 176 struct pci_controller *host;
@@ -228,19 +228,10 @@ extern void * update_dn_pci_info(struct device_node *dn, void *data);
228 228
229/* Get a device_node from a pci_dev. This code must be fast except 229/* Get a device_node from a pci_dev. This code must be fast except
230 * in the case where the sysdata is incorrect and needs to be fixed 230 * in the case where the sysdata is incorrect and needs to be fixed
231 * up (this will only happen once). 231 * up (this will only happen once). */
232 * In this case the sysdata will have been inherited from a PCI host
233 * bridge or a PCI-PCI bridge further up the tree, so it will point
234 * to a valid struct pci_dn, just not the one we want.
235 */
236static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) 232static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
237{ 233{
238 struct device_node *dn = dev->sysdata; 234 return dev->dev.of_node ? dev->dev.of_node : fetch_dev_dn(dev);
239 struct pci_dn *pdn = dn->data;
240
241 if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
242 return dn; /* fast path. sysdata is good */
243 return fetch_dev_dn(dev);
244} 235}
245 236
246static inline int pci_device_from_OF_node(struct device_node *np, 237static inline int pci_device_from_OF_node(struct device_node *np,
@@ -258,7 +249,7 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
258 if (bus->self) 249 if (bus->self)
259 return pci_device_to_OF_node(bus->self); 250 return pci_device_to_OF_node(bus->self);
260 else 251 else
261 return bus->sysdata; /* Must be root bus (PHB) */ 252 return bus->dev.of_node; /* Must be root bus (PHB) */
262} 253}
263 254
264/** Find the bus corresponding to the indicated device node */ 255/** Find the bus corresponding to the indicated device node */
@@ -270,14 +261,6 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus);
270/** Discover new pci devices under this bus, and add them */ 261/** Discover new pci devices under this bus, and add them */
271extern void pcibios_add_pci_devices(struct pci_bus *bus); 262extern void pcibios_add_pci_devices(struct pci_bus *bus);
272 263
273static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
274{
275 struct device_node *busdn = bus->sysdata;
276
277 BUG_ON(busdn == NULL);
278 return PCI_DN(busdn)->phb;
279}
280
281 264
282extern void isa_bridge_find_early(struct pci_controller *hose); 265extern void isa_bridge_find_early(struct pci_controller *hose);
283 266
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index a20a9ad2258b..7d7790954e02 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -201,7 +201,7 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
201extern void pcibios_setup_bus_devices(struct pci_bus *bus); 201extern void pcibios_setup_bus_devices(struct pci_bus *bus);
202extern void pcibios_setup_bus_self(struct pci_bus *bus); 202extern void pcibios_setup_bus_self(struct pci_bus *bus);
203extern void pcibios_setup_phb_io_space(struct pci_controller *hose); 203extern void pcibios_setup_phb_io_space(struct pci_controller *hose);
204extern void pcibios_scan_phb(struct pci_controller *hose, void *sysdata); 204extern void pcibios_scan_phb(struct pci_controller *hose);
205 205
206#endif /* __KERNEL__ */ 206#endif /* __KERNEL__ */
207#endif /* __ASM_POWERPC_PCI_H */ 207#endif /* __ASM_POWERPC_PCI_H */
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index f62efdfd1769..c00d4ca1ee15 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)
201 /* If the driver uses devices that ibmebus doesn't know, add them */ 201 /* If the driver uses devices that ibmebus doesn't know, add them */
202 ibmebus_create_devices(drv->driver.of_match_table); 202 ibmebus_create_devices(drv->driver.of_match_table);
203 203
204 return of_register_driver(drv, &ibmebus_bus_type); 204 drv->driver.bus = &ibmebus_bus_type;
205 return driver_register(&drv->driver);
205} 206}
206EXPORT_SYMBOL(ibmebus_register_driver); 207EXPORT_SYMBOL(ibmebus_register_driver);
207 208
208void ibmebus_unregister_driver(struct of_platform_driver *drv) 209void ibmebus_unregister_driver(struct of_platform_driver *drv)
209{ 210{
210 of_unregister_driver(drv); 211 driver_unregister(&drv->driver);
211} 212}
212EXPORT_SYMBOL(ibmebus_unregister_driver); 213EXPORT_SYMBOL(ibmebus_unregister_driver);
213 214
@@ -308,15 +309,410 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
308 } 309 }
309} 310}
310 311
312
311static struct bus_attribute ibmebus_bus_attrs[] = { 313static struct bus_attribute ibmebus_bus_attrs[] = {
312 __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe), 314 __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
313 __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove), 315 __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
314 __ATTR_NULL 316 __ATTR_NULL
315}; 317};
316 318
319static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
320{
321 const struct of_device_id *matches = drv->of_match_table;
322
323 if (!matches)
324 return 0;
325
326 return of_match_device(matches, dev) != NULL;
327}
328
329static int ibmebus_bus_device_probe(struct device *dev)
330{
331 int error = -ENODEV;
332 struct of_platform_driver *drv;
333 struct platform_device *of_dev;
334 const struct of_device_id *match;
335
336 drv = to_of_platform_driver(dev->driver);
337 of_dev = to_platform_device(dev);
338
339 if (!drv->probe)
340 return error;
341
342 of_dev_get(of_dev);
343
344 match = of_match_device(drv->driver.of_match_table, dev);
345 if (match)
346 error = drv->probe(of_dev, match);
347 if (error)
348 of_dev_put(of_dev);
349
350 return error;
351}
352
353static int ibmebus_bus_device_remove(struct device *dev)
354{
355 struct platform_device *of_dev = to_platform_device(dev);
356 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
357
358 if (dev->driver && drv->remove)
359 drv->remove(of_dev);
360 return 0;
361}
362
363static void ibmebus_bus_device_shutdown(struct device *dev)
364{
365 struct platform_device *of_dev = to_platform_device(dev);
366 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
367
368 if (dev->driver && drv->shutdown)
369 drv->shutdown(of_dev);
370}
371
372/*
373 * ibmebus_bus_device_attrs
374 */
375static ssize_t devspec_show(struct device *dev,
376 struct device_attribute *attr, char *buf)
377{
378 struct platform_device *ofdev;
379
380 ofdev = to_platform_device(dev);
381 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
382}
383
384static ssize_t name_show(struct device *dev,
385 struct device_attribute *attr, char *buf)
386{
387 struct platform_device *ofdev;
388
389 ofdev = to_platform_device(dev);
390 return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
391}
392
393static ssize_t modalias_show(struct device *dev,
394 struct device_attribute *attr, char *buf)
395{
396 ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
397 buf[len] = '\n';
398 buf[len+1] = 0;
399 return len+1;
400}
401
402struct device_attribute ibmebus_bus_device_attrs[] = {
403 __ATTR_RO(devspec),
404 __ATTR_RO(name),
405 __ATTR_RO(modalias),
406 __ATTR_NULL
407};
408
409#ifdef CONFIG_PM_SLEEP
410static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
411{
412 struct platform_device *of_dev = to_platform_device(dev);
413 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
414 int ret = 0;
415
416 if (dev->driver && drv->suspend)
417 ret = drv->suspend(of_dev, mesg);
418 return ret;
419}
420
421static int ibmebus_bus_legacy_resume(struct device *dev)
422{
423 struct platform_device *of_dev = to_platform_device(dev);
424 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
425 int ret = 0;
426
427 if (dev->driver && drv->resume)
428 ret = drv->resume(of_dev);
429 return ret;
430}
431
432static int ibmebus_bus_pm_prepare(struct device *dev)
433{
434 struct device_driver *drv = dev->driver;
435 int ret = 0;
436
437 if (drv && drv->pm && drv->pm->prepare)
438 ret = drv->pm->prepare(dev);
439
440 return ret;
441}
442
443static void ibmebus_bus_pm_complete(struct device *dev)
444{
445 struct device_driver *drv = dev->driver;
446
447 if (drv && drv->pm && drv->pm->complete)
448 drv->pm->complete(dev);
449}
450
451#ifdef CONFIG_SUSPEND
452
453static int ibmebus_bus_pm_suspend(struct device *dev)
454{
455 struct device_driver *drv = dev->driver;
456 int ret = 0;
457
458 if (!drv)
459 return 0;
460
461 if (drv->pm) {
462 if (drv->pm->suspend)
463 ret = drv->pm->suspend(dev);
464 } else {
465 ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
466 }
467
468 return ret;
469}
470
471static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
472{
473 struct device_driver *drv = dev->driver;
474 int ret = 0;
475
476 if (!drv)
477 return 0;
478
479 if (drv->pm) {
480 if (drv->pm->suspend_noirq)
481 ret = drv->pm->suspend_noirq(dev);
482 }
483
484 return ret;
485}
486
487static int ibmebus_bus_pm_resume(struct device *dev)
488{
489 struct device_driver *drv = dev->driver;
490 int ret = 0;
491
492 if (!drv)
493 return 0;
494
495 if (drv->pm) {
496 if (drv->pm->resume)
497 ret = drv->pm->resume(dev);
498 } else {
499 ret = ibmebus_bus_legacy_resume(dev);
500 }
501
502 return ret;
503}
504
505static int ibmebus_bus_pm_resume_noirq(struct device *dev)
506{
507 struct device_driver *drv = dev->driver;
508 int ret = 0;
509
510 if (!drv)
511 return 0;
512
513 if (drv->pm) {
514 if (drv->pm->resume_noirq)
515 ret = drv->pm->resume_noirq(dev);
516 }
517
518 return ret;
519}
520
521#else /* !CONFIG_SUSPEND */
522
523#define ibmebus_bus_pm_suspend NULL
524#define ibmebus_bus_pm_resume NULL
525#define ibmebus_bus_pm_suspend_noirq NULL
526#define ibmebus_bus_pm_resume_noirq NULL
527
528#endif /* !CONFIG_SUSPEND */
529
530#ifdef CONFIG_HIBERNATION
531
532static int ibmebus_bus_pm_freeze(struct device *dev)
533{
534 struct device_driver *drv = dev->driver;
535 int ret = 0;
536
537 if (!drv)
538 return 0;
539
540 if (drv->pm) {
541 if (drv->pm->freeze)
542 ret = drv->pm->freeze(dev);
543 } else {
544 ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
545 }
546
547 return ret;
548}
549
550static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
551{
552 struct device_driver *drv = dev->driver;
553 int ret = 0;
554
555 if (!drv)
556 return 0;
557
558 if (drv->pm) {
559 if (drv->pm->freeze_noirq)
560 ret = drv->pm->freeze_noirq(dev);
561 }
562
563 return ret;
564}
565
566static int ibmebus_bus_pm_thaw(struct device *dev)
567{
568 struct device_driver *drv = dev->driver;
569 int ret = 0;
570
571 if (!drv)
572 return 0;
573
574 if (drv->pm) {
575 if (drv->pm->thaw)
576 ret = drv->pm->thaw(dev);
577 } else {
578 ret = ibmebus_bus_legacy_resume(dev);
579 }
580
581 return ret;
582}
583
584static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
585{
586 struct device_driver *drv = dev->driver;
587 int ret = 0;
588
589 if (!drv)
590 return 0;
591
592 if (drv->pm) {
593 if (drv->pm->thaw_noirq)
594 ret = drv->pm->thaw_noirq(dev);
595 }
596
597 return ret;
598}
599
600static int ibmebus_bus_pm_poweroff(struct device *dev)
601{
602 struct device_driver *drv = dev->driver;
603 int ret = 0;
604
605 if (!drv)
606 return 0;
607
608 if (drv->pm) {
609 if (drv->pm->poweroff)
610 ret = drv->pm->poweroff(dev);
611 } else {
612 ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
613 }
614
615 return ret;
616}
617
618static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
619{
620 struct device_driver *drv = dev->driver;
621 int ret = 0;
622
623 if (!drv)
624 return 0;
625
626 if (drv->pm) {
627 if (drv->pm->poweroff_noirq)
628 ret = drv->pm->poweroff_noirq(dev);
629 }
630
631 return ret;
632}
633
634static int ibmebus_bus_pm_restore(struct device *dev)
635{
636 struct device_driver *drv = dev->driver;
637 int ret = 0;
638
639 if (!drv)
640 return 0;
641
642 if (drv->pm) {
643 if (drv->pm->restore)
644 ret = drv->pm->restore(dev);
645 } else {
646 ret = ibmebus_bus_legacy_resume(dev);
647 }
648
649 return ret;
650}
651
652static int ibmebus_bus_pm_restore_noirq(struct device *dev)
653{
654 struct device_driver *drv = dev->driver;
655 int ret = 0;
656
657 if (!drv)
658 return 0;
659
660 if (drv->pm) {
661 if (drv->pm->restore_noirq)
662 ret = drv->pm->restore_noirq(dev);
663 }
664
665 return ret;
666}
667
668#else /* !CONFIG_HIBERNATION */
669
670#define ibmebus_bus_pm_freeze NULL
671#define ibmebus_bus_pm_thaw NULL
672#define ibmebus_bus_pm_poweroff NULL
673#define ibmebus_bus_pm_restore NULL
674#define ibmebus_bus_pm_freeze_noirq NULL
675#define ibmebus_bus_pm_thaw_noirq NULL
676#define ibmebus_bus_pm_poweroff_noirq NULL
677#define ibmebus_bus_pm_restore_noirq NULL
678
679#endif /* !CONFIG_HIBERNATION */
680
681static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
682 .prepare = ibmebus_bus_pm_prepare,
683 .complete = ibmebus_bus_pm_complete,
684 .suspend = ibmebus_bus_pm_suspend,
685 .resume = ibmebus_bus_pm_resume,
686 .freeze = ibmebus_bus_pm_freeze,
687 .thaw = ibmebus_bus_pm_thaw,
688 .poweroff = ibmebus_bus_pm_poweroff,
689 .restore = ibmebus_bus_pm_restore,
690 .suspend_noirq = ibmebus_bus_pm_suspend_noirq,
691 .resume_noirq = ibmebus_bus_pm_resume_noirq,
692 .freeze_noirq = ibmebus_bus_pm_freeze_noirq,
693 .thaw_noirq = ibmebus_bus_pm_thaw_noirq,
694 .poweroff_noirq = ibmebus_bus_pm_poweroff_noirq,
695 .restore_noirq = ibmebus_bus_pm_restore_noirq,
696};
697
698#define IBMEBUS_BUS_PM_OPS_PTR (&ibmebus_bus_dev_pm_ops)
699
700#else /* !CONFIG_PM_SLEEP */
701
702#define IBMEBUS_BUS_PM_OPS_PTR NULL
703
704#endif /* !CONFIG_PM_SLEEP */
705
317struct bus_type ibmebus_bus_type = { 706struct bus_type ibmebus_bus_type = {
707 .name = "ibmebus",
318 .uevent = of_device_uevent, 708 .uevent = of_device_uevent,
319 .bus_attrs = ibmebus_bus_attrs 709 .bus_attrs = ibmebus_bus_attrs,
710 .match = ibmebus_bus_bus_match,
711 .probe = ibmebus_bus_device_probe,
712 .remove = ibmebus_bus_device_remove,
713 .shutdown = ibmebus_bus_device_shutdown,
714 .dev_attrs = ibmebus_bus_device_attrs,
715 .pm = IBMEBUS_BUS_PM_OPS_PTR,
320}; 716};
321EXPORT_SYMBOL(ibmebus_bus_type); 717EXPORT_SYMBOL(ibmebus_bus_type);
322 718
@@ -326,7 +722,7 @@ static int __init ibmebus_bus_init(void)
326 722
327 printk(KERN_INFO "IBM eBus Device Driver\n"); 723 printk(KERN_INFO "IBM eBus Device Driver\n");
328 724
329 err = of_bus_type_init(&ibmebus_bus_type, "ibmebus"); 725 err = bus_register(&ibmebus_bus_type);
330 if (err) { 726 if (err) {
331 printk(KERN_ERR "%s: failed to register IBM eBus.\n", 727 printk(KERN_ERR "%s: failed to register IBM eBus.\n",
332 __func__); 728 __func__);
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index b2c363ef38ad..24582181b6ec 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -36,8 +36,7 @@
36 * lacking some bits needed here. 36 * lacking some bits needed here.
37 */ 37 */
38 38
39static int __devinit of_pci_phb_probe(struct platform_device *dev, 39static int __devinit of_pci_phb_probe(struct platform_device *dev)
40 const struct of_device_id *match)
41{ 40{
42 struct pci_controller *phb; 41 struct pci_controller *phb;
43 42
@@ -74,7 +73,7 @@ static int __devinit of_pci_phb_probe(struct platform_device *dev,
74#endif /* CONFIG_EEH */ 73#endif /* CONFIG_EEH */
75 74
76 /* Scan the bus */ 75 /* Scan the bus */
77 pcibios_scan_phb(phb, dev->dev.of_node); 76 pcibios_scan_phb(phb);
78 if (phb->bus == NULL) 77 if (phb->bus == NULL)
79 return -ENXIO; 78 return -ENXIO;
80 79
@@ -104,7 +103,7 @@ static struct of_device_id of_pci_phb_ids[] = {
104 {} 103 {}
105}; 104};
106 105
107static struct of_platform_driver of_pci_phb_driver = { 106static struct platform_driver of_pci_phb_driver = {
108 .probe = of_pci_phb_probe, 107 .probe = of_pci_phb_probe,
109 .driver = { 108 .driver = {
110 .name = "of-pci", 109 .name = "of-pci",
@@ -115,7 +114,7 @@ static struct of_platform_driver of_pci_phb_driver = {
115 114
116static __init int of_pci_phb_init(void) 115static __init int of_pci_phb_init(void)
117{ 116{
118 return of_register_platform_driver(&of_pci_phb_driver); 117 return platform_driver_register(&of_pci_phb_driver);
119} 118}
120 119
121device_initcall(of_pci_phb_init); 120device_initcall(of_pci_phb_init);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index eb341be9a4d9..3cd85faa8ac6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1688,13 +1688,8 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
1688/** 1688/**
1689 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus 1689 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
1690 * @hose: Pointer to the PCI host controller instance structure 1690 * @hose: Pointer to the PCI host controller instance structure
1691 * @sysdata: value to use for sysdata pointer. ppc32 and ppc64 differ here
1692 *
1693 * Note: the 'data' pointer is a temporary measure. As 32 and 64 bit
1694 * pci code gets merged, this parameter should become unnecessary because
1695 * both will use the same value.
1696 */ 1691 */
1697void __devinit pcibios_scan_phb(struct pci_controller *hose, void *sysdata) 1692void __devinit pcibios_scan_phb(struct pci_controller *hose)
1698{ 1693{
1699 struct pci_bus *bus; 1694 struct pci_bus *bus;
1700 struct device_node *node = hose->dn; 1695 struct device_node *node = hose->dn;
@@ -1704,13 +1699,13 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose, void *sysdata)
1704 node ? node->full_name : "<NO NAME>"); 1699 node ? node->full_name : "<NO NAME>");
1705 1700
1706 /* Create an empty bus for the toplevel */ 1701 /* Create an empty bus for the toplevel */
1707 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, 1702 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose);
1708 sysdata);
1709 if (bus == NULL) { 1703 if (bus == NULL) {
1710 pr_err("Failed to create bus for PCI domain %04x\n", 1704 pr_err("Failed to create bus for PCI domain %04x\n",
1711 hose->global_number); 1705 hose->global_number);
1712 return; 1706 return;
1713 } 1707 }
1708 bus->dev.of_node = of_node_get(node);
1714 bus->secondary = hose->first_busno; 1709 bus->secondary = hose->first_busno;
1715 hose->bus = bus; 1710 hose->bus = bus;
1716 1711
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e7db5b48004a..bedb370459f2 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -381,7 +381,7 @@ static int __init pcibios_init(void)
381 if (pci_assign_all_buses) 381 if (pci_assign_all_buses)
382 hose->first_busno = next_busno; 382 hose->first_busno = next_busno;
383 hose->last_busno = 0xff; 383 hose->last_busno = 0xff;
384 pcibios_scan_phb(hose, hose); 384 pcibios_scan_phb(hose);
385 pci_bus_add_devices(hose->bus); 385 pci_bus_add_devices(hose->bus);
386 if (pci_assign_all_buses || next_busno <= hose->last_busno) 386 if (pci_assign_all_buses || next_busno <= hose->last_busno)
387 next_busno = hose->last_busno + pcibios_assign_bus_offset; 387 next_busno = hose->last_busno + pcibios_assign_bus_offset;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 851577608a78..fc6452b6be9f 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -64,7 +64,7 @@ static int __init pcibios_init(void)
64 64
65 /* Scan all of the recorded PCI controllers. */ 65 /* Scan all of the recorded PCI controllers. */
66 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 66 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
67 pcibios_scan_phb(hose, hose->dn); 67 pcibios_scan_phb(hose);
68 pci_bus_add_devices(hose->bus); 68 pci_bus_add_devices(hose->bus);
69 } 69 }
70 70
@@ -242,10 +242,10 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
242 break; 242 break;
243 bus = NULL; 243 bus = NULL;
244 } 244 }
245 if (bus == NULL || bus->sysdata == NULL) 245 if (bus == NULL || bus->dev.of_node == NULL)
246 return -ENODEV; 246 return -ENODEV;
247 247
248 hose_node = (struct device_node *)bus->sysdata; 248 hose_node = bus->dev.of_node;
249 hose = PCI_DN(hose_node)->phb; 249 hose = PCI_DN(hose_node)->phb;
250 250
251 switch (which) { 251 switch (which) {
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index d56b35ee7f74..29852688ceaa 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -161,7 +161,7 @@ static void *is_devfn_node(struct device_node *dn, void *data)
161/* 161/*
162 * This is the "slow" path for looking up a device_node from a 162 * This is the "slow" path for looking up a device_node from a
163 * pci_dev. It will hunt for the device under its parent's 163 * pci_dev. It will hunt for the device under its parent's
164 * phb and then update sysdata for a future fastpath. 164 * phb and then update of_node pointer.
165 * 165 *
166 * It may also do fixups on the actual device since this happens 166 * It may also do fixups on the actual device since this happens
167 * on the first read/write. 167 * on the first read/write.
@@ -170,16 +170,19 @@ static void *is_devfn_node(struct device_node *dn, void *data)
170 * In this case it may probe for real hardware ("just in case") 170 * In this case it may probe for real hardware ("just in case")
171 * and add a device_node to the device tree if necessary. 171 * and add a device_node to the device tree if necessary.
172 * 172 *
173 * Is this function necessary anymore now that dev->dev.of_node is
174 * used to store the node pointer?
175 *
173 */ 176 */
174struct device_node *fetch_dev_dn(struct pci_dev *dev) 177struct device_node *fetch_dev_dn(struct pci_dev *dev)
175{ 178{
176 struct device_node *orig_dn = dev->sysdata; 179 struct device_node *orig_dn = dev->dev.of_node;
177 struct device_node *dn; 180 struct device_node *dn;
178 unsigned long searchval = (dev->bus->number << 8) | dev->devfn; 181 unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
179 182
180 dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval); 183 dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
181 if (dn) 184 if (dn)
182 dev->sysdata = dn; 185 dev->dev.of_node = dn;
183 return dn; 186 return dn;
184} 187}
185EXPORT_SYMBOL(fetch_dev_dn); 188EXPORT_SYMBOL(fetch_dev_dn);
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index e751506323b4..1e89a72fd030 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -135,7 +135,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
135 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type); 135 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
136 136
137 dev->bus = bus; 137 dev->bus = bus;
138 dev->sysdata = node; 138 dev->dev.of_node = of_node_get(node);
139 dev->dev.parent = bus->bridge; 139 dev->dev.parent = bus->bridge;
140 dev->dev.bus = &pci_bus_type; 140 dev->dev.bus = &pci_bus_type;
141 dev->devfn = devfn; 141 dev->devfn = devfn;
@@ -238,7 +238,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
238 bus->primary = dev->bus->number; 238 bus->primary = dev->bus->number;
239 bus->subordinate = busrange[1]; 239 bus->subordinate = busrange[1];
240 bus->bridge_ctl = 0; 240 bus->bridge_ctl = 0;
241 bus->sysdata = node; 241 bus->dev.of_node = of_node_get(node);
242 242
243 /* parse ranges property */ 243 /* parse ranges property */
244 /* PCI #address-cells == 3 and #size-cells == 2 always */ 244 /* PCI #address-cells == 3 and #size-cells == 2 always */
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index 0dad9a935eb5..1757d1db4b51 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)
147 return 0; 147 return 0;
148} 148}
149 149
150static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev, 150static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
151 const struct of_device_id *match)
152{ 151{
153 struct mpc52xx_gpiochip *chip; 152 struct mpc52xx_gpiochip *chip;
154 struct mpc52xx_gpio_wkup __iomem *regs; 153 struct mpc52xx_gpio_wkup __iomem *regs;
@@ -191,7 +190,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
191 {} 190 {}
192}; 191};
193 192
194static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = { 193static struct platform_driver mpc52xx_wkup_gpiochip_driver = {
195 .driver = { 194 .driver = {
196 .name = "gpio_wkup", 195 .name = "gpio_wkup",
197 .owner = THIS_MODULE, 196 .owner = THIS_MODULE,
@@ -310,8 +309,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
310 return 0; 309 return 0;
311} 310}
312 311
313static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev, 312static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
314 const struct of_device_id *match)
315{ 313{
316 struct mpc52xx_gpiochip *chip; 314 struct mpc52xx_gpiochip *chip;
317 struct gpio_chip *gc; 315 struct gpio_chip *gc;
@@ -349,7 +347,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
349 {} 347 {}
350}; 348};
351 349
352static struct of_platform_driver mpc52xx_simple_gpiochip_driver = { 350static struct platform_driver mpc52xx_simple_gpiochip_driver = {
353 .driver = { 351 .driver = {
354 .name = "gpio", 352 .name = "gpio",
355 .owner = THIS_MODULE, 353 .owner = THIS_MODULE,
@@ -361,10 +359,10 @@ static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
361 359
362static int __init mpc52xx_gpio_init(void) 360static int __init mpc52xx_gpio_init(void)
363{ 361{
364 if (of_register_platform_driver(&mpc52xx_wkup_gpiochip_driver)) 362 if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
365 printk(KERN_ERR "Unable to register wakeup GPIO driver\n"); 363 printk(KERN_ERR "Unable to register wakeup GPIO driver\n");
366 364
367 if (of_register_platform_driver(&mpc52xx_simple_gpiochip_driver)) 365 if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
368 printk(KERN_ERR "Unable to register simple GPIO driver\n"); 366 printk(KERN_ERR "Unable to register simple GPIO driver\n");
369 367
370 return 0; 368 return 0;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index e0d703c7fdf7..859abf1c6d4b 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,
721/* --------------------------------------------------------------------- 721/* ---------------------------------------------------------------------
722 * of_platform bus binding code 722 * of_platform bus binding code
723 */ 723 */
724static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev, 724static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev)
725 const struct of_device_id *match)
726{ 725{
727 struct mpc52xx_gpt_priv *gpt; 726 struct mpc52xx_gpt_priv *gpt;
728 727
@@ -781,7 +780,7 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
781 {} 780 {}
782}; 781};
783 782
784static struct of_platform_driver mpc52xx_gpt_driver = { 783static struct platform_driver mpc52xx_gpt_driver = {
785 .driver = { 784 .driver = {
786 .name = "mpc52xx-gpt", 785 .name = "mpc52xx-gpt",
787 .owner = THIS_MODULE, 786 .owner = THIS_MODULE,
@@ -793,10 +792,7 @@ static struct of_platform_driver mpc52xx_gpt_driver = {
793 792
794static int __init mpc52xx_gpt_init(void) 793static int __init mpc52xx_gpt_init(void)
795{ 794{
796 if (of_register_platform_driver(&mpc52xx_gpt_driver)) 795 return platform_driver_register(&mpc52xx_gpt_driver);
797 pr_err("error registering MPC52xx GPT driver\n");
798
799 return 0;
800} 796}
801 797
802/* Make sure GPIOs and IRQs get set up before anyone tries to use them */ 798/* 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 f4ac213c89c0..6385d883cb8d 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)
436} 436}
437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort); 437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);
438 438
439static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op, 439static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op)
440 const struct of_device_id *match)
441{ 440{
442 struct resource res; 441 struct resource res;
443 int rc = -ENOMEM; 442 int rc = -ENOMEM;
@@ -536,7 +535,7 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
536 {}, 535 {},
537}; 536};
538 537
539static struct of_platform_driver mpc52xx_lpbfifo_driver = { 538static struct platform_driver mpc52xx_lpbfifo_driver = {
540 .driver = { 539 .driver = {
541 .name = "mpc52xx-lpbfifo", 540 .name = "mpc52xx-lpbfifo",
542 .owner = THIS_MODULE, 541 .owner = THIS_MODULE,
@@ -551,14 +550,12 @@ static struct of_platform_driver mpc52xx_lpbfifo_driver = {
551 */ 550 */
552static int __init mpc52xx_lpbfifo_init(void) 551static int __init mpc52xx_lpbfifo_init(void)
553{ 552{
554 pr_debug("Registering LocalPlus bus FIFO driver\n"); 553 return platform_driver_register(&mpc52xx_lpbfifo_driver);
555 return of_register_platform_driver(&mpc52xx_lpbfifo_driver);
556} 554}
557module_init(mpc52xx_lpbfifo_init); 555module_init(mpc52xx_lpbfifo_init);
558 556
559static void __exit mpc52xx_lpbfifo_exit(void) 557static void __exit mpc52xx_lpbfifo_exit(void)
560{ 558{
561 pr_debug("Unregistering LocalPlus bus FIFO driver\n"); 559 platform_driver_unregister(&mpc52xx_lpbfifo_driver);
562 of_unregister_platform_driver(&mpc52xx_lpbfifo_driver);
563} 560}
564module_exit(mpc52xx_lpbfifo_exit); 561module_exit(mpc52xx_lpbfifo_exit);
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 1565e0446dc8..10ff526cd046 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 = {
111 .ops = &ep8248e_mdio_ops, 111 .ops = &ep8248e_mdio_ops,
112}; 112};
113 113
114static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev, 114static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev)
115 const struct of_device_id *match)
116{ 115{
117 struct mii_bus *bus; 116 struct mii_bus *bus;
118 struct resource res; 117 struct resource res;
@@ -167,7 +166,7 @@ static const struct of_device_id ep8248e_mdio_match[] = {
167 {}, 166 {},
168}; 167};
169 168
170static struct of_platform_driver ep8248e_mdio_driver = { 169static struct platform_driver ep8248e_mdio_driver = {
171 .driver = { 170 .driver = {
172 .name = "ep8248e-mdio-bitbang", 171 .name = "ep8248e-mdio-bitbang",
173 .owner = THIS_MODULE, 172 .owner = THIS_MODULE,
@@ -308,7 +307,7 @@ static __initdata struct of_device_id of_bus_ids[] = {
308static int __init declare_of_platform_devices(void) 307static int __init declare_of_platform_devices(void)
309{ 308{
310 of_platform_bus_probe(NULL, of_bus_ids, NULL); 309 of_platform_bus_probe(NULL, of_bus_ids, NULL);
311 of_register_platform_driver(&ep8248e_mdio_driver); 310 platform_driver_register(&ep8248e_mdio_driver);
312 311
313 return 0; 312 return 0;
314} 313}
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index fd4f2f2f19e6..188272934cfb 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 = {
318 .end = mpc83xx_suspend_end, 318 .end = mpc83xx_suspend_end,
319}; 319};
320 320
321static int pmc_probe(struct platform_device *ofdev, 321static int pmc_probe(struct platform_device *ofdev)
322 const struct of_device_id *match)
323{ 322{
324 struct device_node *np = ofdev->dev.of_node; 323 struct device_node *np = ofdev->dev.of_node;
325 struct resource res; 324 struct resource res;
326 struct pmc_type *type = match->data; 325 struct pmc_type *type;
327 int ret = 0; 326 int ret = 0;
328 327
328 if (!ofdev->dev.of_match)
329 return -EINVAL;
330
331 type = ofdev->dev.of_match->data;
332
329 if (!of_device_is_available(np)) 333 if (!of_device_is_available(np))
330 return -ENODEV; 334 return -ENODEV;
331 335
@@ -422,7 +426,7 @@ static struct of_device_id pmc_match[] = {
422 {} 426 {}
423}; 427};
424 428
425static struct of_platform_driver pmc_driver = { 429static struct platform_driver pmc_driver = {
426 .driver = { 430 .driver = {
427 .name = "mpc83xx-pmc", 431 .name = "mpc83xx-pmc",
428 .owner = THIS_MODULE, 432 .owner = THIS_MODULE,
@@ -434,7 +438,7 @@ static struct of_platform_driver pmc_driver = {
434 438
435static int pmc_init(void) 439static int pmc_init(void)
436{ 440{
437 return of_register_platform_driver(&pmc_driver); 441 return platform_driver_register(&pmc_driver);
438} 442}
439 443
440module_init(pmc_init); 444module_init(pmc_init);
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index e3e379c6caa7..c35099af340e 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 = {
328 .map = msic_host_map, 328 .map = msic_host_map,
329}; 329};
330 330
331static int axon_msi_shutdown(struct platform_device *device) 331static void axon_msi_shutdown(struct platform_device *device)
332{ 332{
333 struct axon_msic *msic = dev_get_drvdata(&device->dev); 333 struct axon_msic *msic = dev_get_drvdata(&device->dev);
334 u32 tmp; 334 u32 tmp;
@@ -338,12 +338,9 @@ static int axon_msi_shutdown(struct platform_device *device)
338 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); 338 tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG);
339 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; 339 tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE;
340 msic_dcr_write(msic, MSIC_CTRL_REG, tmp); 340 msic_dcr_write(msic, MSIC_CTRL_REG, tmp);
341
342 return 0;
343} 341}
344 342
345static int axon_msi_probe(struct platform_device *device, 343static int axon_msi_probe(struct platform_device *device)
346 const struct of_device_id *device_id)
347{ 344{
348 struct device_node *dn = device->dev.of_node; 345 struct device_node *dn = device->dev.of_node;
349 struct axon_msic *msic; 346 struct axon_msic *msic;
@@ -446,7 +443,7 @@ static const struct of_device_id axon_msi_device_id[] = {
446 {} 443 {}
447}; 444};
448 445
449static struct of_platform_driver axon_msi_driver = { 446static struct platform_driver axon_msi_driver = {
450 .probe = axon_msi_probe, 447 .probe = axon_msi_probe,
451 .shutdown = axon_msi_shutdown, 448 .shutdown = axon_msi_shutdown,
452 .driver = { 449 .driver = {
@@ -458,7 +455,7 @@ static struct of_platform_driver axon_msi_driver = {
458 455
459static int __init axon_msi_init(void) 456static int __init axon_msi_init(void)
460{ 457{
461 return of_register_platform_driver(&axon_msi_driver); 458 return platform_driver_register(&axon_msi_driver);
462} 459}
463subsys_initcall(axon_msi_init); 460subsys_initcall(axon_msi_init);
464 461
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index a5d907b5a4c2..9886296e08da 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)
216} 216}
217 217
218 218
219static int __devinit gpio_mdio_probe(struct platform_device *ofdev, 219static int __devinit gpio_mdio_probe(struct platform_device *ofdev)
220 const struct of_device_id *match)
221{ 220{
222 struct device *dev = &ofdev->dev; 221 struct device *dev = &ofdev->dev;
223 struct device_node *np = ofdev->dev.of_node; 222 struct device_node *np = ofdev->dev.of_node;
@@ -299,7 +298,7 @@ static struct of_device_id gpio_mdio_match[] =
299}; 298};
300MODULE_DEVICE_TABLE(of, gpio_mdio_match); 299MODULE_DEVICE_TABLE(of, gpio_mdio_match);
301 300
302static struct of_platform_driver gpio_mdio_driver = 301static struct platform_driver gpio_mdio_driver =
303{ 302{
304 .probe = gpio_mdio_probe, 303 .probe = gpio_mdio_probe,
305 .remove = gpio_mdio_remove, 304 .remove = gpio_mdio_remove,
@@ -326,13 +325,13 @@ int gpio_mdio_init(void)
326 if (!gpio_regs) 325 if (!gpio_regs)
327 return -ENODEV; 326 return -ENODEV;
328 327
329 return of_register_platform_driver(&gpio_mdio_driver); 328 return platform_driver_register(&gpio_mdio_driver);
330} 329}
331module_init(gpio_mdio_init); 330module_init(gpio_mdio_init);
332 331
333void gpio_mdio_exit(void) 332void gpio_mdio_exit(void)
334{ 333{
335 of_unregister_platform_driver(&gpio_mdio_driver); 334 platform_driver_unregister(&gpio_mdio_driver);
336 if (gpio_regs) 335 if (gpio_regs)
337 iounmap(gpio_regs); 336 iounmap(gpio_regs);
338} 337}
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 5fcc92a12d3e..3bf4488aaec6 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -149,7 +149,7 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
149 if (dn->child) 149 if (dn->child)
150 eeh_add_device_tree_early(dn); 150 eeh_add_device_tree_early(dn);
151 151
152 pcibios_scan_phb(phb, dn); 152 pcibios_scan_phb(phb);
153 pcibios_finish_adding_to_bus(phb->bus); 153 pcibios_finish_adding_to_bus(phb->bus);
154 154
155 return phb; 155 return phb;
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 2659a60bd7b8..27402c7d309d 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 = {
172 172
173/** 173/**
174 * axon_ram_probe - probe() method for platform driver 174 * axon_ram_probe - probe() method for platform driver
175 * @device, @device_id: see of_platform_driver method 175 * @device: see platform_driver method
176 */ 176 */
177static int axon_ram_probe(struct platform_device *device, 177static int axon_ram_probe(struct platform_device *device)
178 const struct of_device_id *device_id)
179{ 178{
180 static int axon_ram_bank_id = -1; 179 static int axon_ram_bank_id = -1;
181 struct axon_ram_bank *bank; 180 struct axon_ram_bank *bank;
@@ -326,7 +325,7 @@ static struct of_device_id axon_ram_device_id[] = {
326 {} 325 {}
327}; 326};
328 327
329static struct of_platform_driver axon_ram_driver = { 328static struct platform_driver axon_ram_driver = {
330 .probe = axon_ram_probe, 329 .probe = axon_ram_probe,
331 .remove = axon_ram_remove, 330 .remove = axon_ram_remove,
332 .driver = { 331 .driver = {
@@ -350,7 +349,7 @@ axon_ram_init(void)
350 } 349 }
351 azfs_minor = 0; 350 azfs_minor = 0;
352 351
353 return of_register_platform_driver(&axon_ram_driver); 352 return platform_driver_register(&axon_ram_driver);
354} 353}
355 354
356/** 355/**
@@ -359,7 +358,7 @@ axon_ram_init(void)
359static void __exit 358static void __exit
360axon_ram_exit(void) 359axon_ram_exit(void)
361{ 360{
362 of_unregister_platform_driver(&axon_ram_driver); 361 platform_driver_unregister(&axon_ram_driver);
363 unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME); 362 unregister_blkdev(azfs_major, AXON_RAM_DEVICE_NAME);
364} 363}
365 364
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index 650256115064..b3fbb271be87 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -365,8 +365,7 @@ bcom_engine_cleanup(void)
365/* OF platform driver */ 365/* OF platform driver */
366/* ======================================================================== */ 366/* ======================================================================== */
367 367
368static int __devinit mpc52xx_bcom_probe(struct platform_device *op, 368static int __devinit mpc52xx_bcom_probe(struct platform_device *op)
369 const struct of_device_id *match)
370{ 369{
371 struct device_node *ofn_sram; 370 struct device_node *ofn_sram;
372 struct resource res_bcom; 371 struct resource res_bcom;
@@ -492,7 +491,7 @@ static struct of_device_id mpc52xx_bcom_of_match[] = {
492MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match); 491MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);
493 492
494 493
495static struct of_platform_driver mpc52xx_bcom_of_platform_driver = { 494static struct platform_driver mpc52xx_bcom_of_platform_driver = {
496 .probe = mpc52xx_bcom_probe, 495 .probe = mpc52xx_bcom_probe,
497 .remove = mpc52xx_bcom_remove, 496 .remove = mpc52xx_bcom_remove,
498 .driver = { 497 .driver = {
@@ -510,13 +509,13 @@ static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
510static int __init 509static int __init
511mpc52xx_bcom_init(void) 510mpc52xx_bcom_init(void)
512{ 511{
513 return of_register_platform_driver(&mpc52xx_bcom_of_platform_driver); 512 return platform_driver_register(&mpc52xx_bcom_of_platform_driver);
514} 513}
515 514
516static void __exit 515static void __exit
517mpc52xx_bcom_exit(void) 516mpc52xx_bcom_exit(void)
518{ 517{
519 of_unregister_platform_driver(&mpc52xx_bcom_of_platform_driver); 518 platform_driver_unregister(&mpc52xx_bcom_of_platform_driver);
520} 519}
521 520
522/* If we're not a module, we must make sure everything is setup before */ 521/* 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 cc8d6556d799..2b9f0c925326 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)
71__setup("cache-sram-size=", get_size_from_cmdline); 71__setup("cache-sram-size=", get_size_from_cmdline);
72__setup("cache-sram-offset=", get_offset_from_cmdline); 72__setup("cache-sram-offset=", get_offset_from_cmdline);
73 73
74static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev, 74static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev)
75 const struct of_device_id *match)
76{ 75{
77 long rval; 76 long rval;
78 unsigned int rem; 77 unsigned int rem;
@@ -204,7 +203,7 @@ static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
204 {}, 203 {},
205}; 204};
206 205
207static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = { 206static struct platform_driver mpc85xx_l2ctlr_of_platform_driver = {
208 .driver = { 207 .driver = {
209 .name = "fsl-l2ctlr", 208 .name = "fsl-l2ctlr",
210 .owner = THIS_MODULE, 209 .owner = THIS_MODULE,
@@ -216,12 +215,12 @@ static struct of_platform_driver mpc85xx_l2ctlr_of_platform_driver = {
216 215
217static __init int mpc85xx_l2ctlr_of_init(void) 216static __init int mpc85xx_l2ctlr_of_init(void)
218{ 217{
219 return of_register_platform_driver(&mpc85xx_l2ctlr_of_platform_driver); 218 return platform_driver_register(&mpc85xx_l2ctlr_of_platform_driver);
220} 219}
221 220
222static void __exit mpc85xx_l2ctlr_of_exit(void) 221static void __exit mpc85xx_l2ctlr_of_exit(void)
223{ 222{
224 of_unregister_platform_driver(&mpc85xx_l2ctlr_of_platform_driver); 223 platform_driver_unregister(&mpc85xx_l2ctlr_of_platform_driver);
225} 224}
226 225
227subsys_initcall(mpc85xx_l2ctlr_of_init); 226subsys_initcall(mpc85xx_l2ctlr_of_init);
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 108d76fa8f1c..ee6a8a52ac71 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)
273 return 0; 273 return 0;
274} 274}
275 275
276static int __devinit fsl_of_msi_probe(struct platform_device *dev, 276static int __devinit fsl_of_msi_probe(struct platform_device *dev)
277 const struct of_device_id *match)
278{ 277{
279 struct fsl_msi *msi; 278 struct fsl_msi *msi;
280 struct resource res; 279 struct resource res;
@@ -282,11 +281,15 @@ static int __devinit fsl_of_msi_probe(struct platform_device *dev,
282 int rc; 281 int rc;
283 int virt_msir; 282 int virt_msir;
284 const u32 *p; 283 const u32 *p;
285 struct fsl_msi_feature *features = match->data; 284 struct fsl_msi_feature *features;
286 struct fsl_msi_cascade_data *cascade_data = NULL; 285 struct fsl_msi_cascade_data *cascade_data = NULL;
287 int len; 286 int len;
288 u32 offset; 287 u32 offset;
289 288
289 if (!dev->dev.of_match)
290 return -EINVAL;
291 features = dev->dev.of_match->data;
292
290 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); 293 printk(KERN_DEBUG "Setting up Freescale MSI support\n");
291 294
292 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL); 295 msi = kzalloc(sizeof(struct fsl_msi), GFP_KERNEL);
@@ -411,7 +414,7 @@ static const struct of_device_id fsl_of_msi_ids[] = {
411 {} 414 {}
412}; 415};
413 416
414static struct of_platform_driver fsl_of_msi_driver = { 417static struct platform_driver fsl_of_msi_driver = {
415 .driver = { 418 .driver = {
416 .name = "fsl-msi", 419 .name = "fsl-msi",
417 .owner = THIS_MODULE, 420 .owner = THIS_MODULE,
@@ -423,7 +426,7 @@ static struct of_platform_driver fsl_of_msi_driver = {
423 426
424static __init int fsl_of_msi_init(void) 427static __init int fsl_of_msi_init(void)
425{ 428{
426 return of_register_platform_driver(&fsl_of_msi_driver); 429 return platform_driver_register(&fsl_of_msi_driver);
427} 430}
428 431
429subsys_initcall(fsl_of_msi_init); 432subsys_initcall(fsl_of_msi_init);
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index e9381bfefb21..f122e8961d32 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 = {
58 .enter = pmc_suspend_enter, 58 .enter = pmc_suspend_enter,
59}; 59};
60 60
61static int pmc_probe(struct platform_device *ofdev, 61static int pmc_probe(struct platform_device *ofdev)
62 const struct of_device_id *id)
63{ 62{
64 pmc_regs = of_iomap(ofdev->dev.of_node, 0); 63 pmc_regs = of_iomap(ofdev->dev.of_node, 0);
65 if (!pmc_regs) 64 if (!pmc_regs)
@@ -76,7 +75,7 @@ static const struct of_device_id pmc_ids[] = {
76 { }, 75 { },
77}; 76};
78 77
79static struct of_platform_driver pmc_driver = { 78static struct platform_driver pmc_driver = {
80 .driver = { 79 .driver = {
81 .name = "fsl-pmc", 80 .name = "fsl-pmc",
82 .owner = THIS_MODULE, 81 .owner = THIS_MODULE,
@@ -87,6 +86,6 @@ static struct of_platform_driver pmc_driver = {
87 86
88static int __init pmc_init(void) 87static int __init pmc_init(void)
89{ 88{
90 return of_register_platform_driver(&pmc_driver); 89 return platform_driver_register(&pmc_driver);
91} 90}
92device_initcall(pmc_init); 91device_initcall(pmc_init);
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 8c6cab013278..3eff2c3a9ad5 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1570,8 +1570,7 @@ err_ops:
1570 1570
1571/* The probe function for RapidIO peer-to-peer network. 1571/* The probe function for RapidIO peer-to-peer network.
1572 */ 1572 */
1573static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev, 1573static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev)
1574 const struct of_device_id *match)
1575{ 1574{
1576 int rc; 1575 int rc;
1577 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n", 1576 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[] = {
1594 {}, 1593 {},
1595}; 1594};
1596 1595
1597static struct of_platform_driver fsl_of_rio_rpn_driver = { 1596static struct platform_driver fsl_of_rio_rpn_driver = {
1598 .driver = { 1597 .driver = {
1599 .name = "fsl-of-rio", 1598 .name = "fsl-of-rio",
1600 .owner = THIS_MODULE, 1599 .owner = THIS_MODULE,
@@ -1605,7 +1604,7 @@ static struct of_platform_driver fsl_of_rio_rpn_driver = {
1605 1604
1606static __init int fsl_of_rio_rpn_init(void) 1605static __init int fsl_of_rio_rpn_init(void)
1607{ 1606{
1608 return of_register_platform_driver(&fsl_of_rio_rpn_driver); 1607 return platform_driver_register(&fsl_of_rio_rpn_driver);
1609} 1608}
1610 1609
1611subsys_initcall(fsl_of_rio_rpn_init); 1610subsys_initcall(fsl_of_rio_rpn_init);
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 4260f368db52..8ce4fc3d9828 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)
121 spin_unlock(&data->handler_spinlock); 121 spin_unlock(&data->handler_spinlock);
122} 122}
123 123
124static int pmi_of_probe(struct platform_device *dev, 124static int pmi_of_probe(struct platform_device *dev)
125 const struct of_device_id *match)
126{ 125{
127 struct device_node *np = dev->dev.of_node; 126 struct device_node *np = dev->dev.of_node;
128 int rc; 127 int rc;
@@ -205,7 +204,7 @@ static int pmi_of_remove(struct platform_device *dev)
205 return 0; 204 return 0;
206} 205}
207 206
208static struct of_platform_driver pmi_of_platform_driver = { 207static struct platform_driver pmi_of_platform_driver = {
209 .probe = pmi_of_probe, 208 .probe = pmi_of_probe,
210 .remove = pmi_of_remove, 209 .remove = pmi_of_remove,
211 .driver = { 210 .driver = {
@@ -217,13 +216,13 @@ static struct of_platform_driver pmi_of_platform_driver = {
217 216
218static int __init pmi_module_init(void) 217static int __init pmi_module_init(void)
219{ 218{
220 return of_register_platform_driver(&pmi_of_platform_driver); 219 return platform_driver_register(&pmi_of_platform_driver);
221} 220}
222module_init(pmi_module_init); 221module_init(pmi_module_init);
223 222
224static void __exit pmi_module_exit(void) 223static void __exit pmi_module_exit(void)
225{ 224{
226 of_unregister_platform_driver(&pmi_of_platform_driver); 225 platform_driver_unregister(&pmi_of_platform_driver);
227} 226}
228module_exit(pmi_module_exit); 227module_exit(pmi_module_exit);
229 228
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 90020de4dcf2..904c6cbaf45b 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)
659 return 0; 659 return 0;
660} 660}
661 661
662static int qe_probe(struct platform_device *ofdev, 662static int qe_probe(struct platform_device *ofdev)
663 const struct of_device_id *id)
664{ 663{
665 return 0; 664 return 0;
666} 665}
@@ -670,7 +669,7 @@ static const struct of_device_id qe_ids[] = {
670 { }, 669 { },
671}; 670};
672 671
673static struct of_platform_driver qe_driver = { 672static struct platform_driver qe_driver = {
674 .driver = { 673 .driver = {
675 .name = "fsl-qe", 674 .name = "fsl-qe",
676 .owner = THIS_MODULE, 675 .owner = THIS_MODULE,
@@ -682,7 +681,7 @@ static struct of_platform_driver qe_driver = {
682 681
683static int __init qe_drv_init(void) 682static int __init qe_drv_init(void)
684{ 683{
685 return of_register_platform_driver(&qe_driver); 684 return platform_driver_register(&qe_driver);
686} 685}
687device_initcall(qe_drv_init); 686device_initcall(qe_drv_init);
688#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */ 687#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index aa4c82648d88..cb33608cc68f 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)
103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
104} 104}
105 105
106static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match) 106static int __devinit ecpp_probe(struct platform_device *op)
107{ 107{
108 unsigned long base = op->resource[0].start; 108 unsigned long base = op->resource[0].start;
109 unsigned long config = op->resource[1].start; 109 unsigned long config = op->resource[1].start;
@@ -235,7 +235,7 @@ static const struct of_device_id ecpp_match[] = {
235 {}, 235 {},
236}; 236};
237 237
238static struct of_platform_driver ecpp_driver = { 238static struct platform_driver ecpp_driver = {
239 .driver = { 239 .driver = {
240 .name = "ecpp", 240 .name = "ecpp",
241 .owner = THIS_MODULE, 241 .owner = THIS_MODULE,
@@ -247,7 +247,7 @@ static struct of_platform_driver ecpp_driver = {
247 247
248static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 248static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
249{ 249{
250 return of_register_platform_driver(&ecpp_driver); 250 return platform_driver_register(&ecpp_driver);
251} 251}
252 252
253#endif /* !(_ASM_SPARC64_PARPORT_H */ 253#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 52de4a9424e8..f679c57644d5 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -137,8 +137,7 @@ static const struct file_operations apc_fops = {
137 137
138static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 138static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
139 139
140static int __devinit apc_probe(struct platform_device *op, 140static int __devinit apc_probe(struct platform_device *op)
141 const struct of_device_id *match)
142{ 141{
143 int err; 142 int err;
144 143
@@ -174,7 +173,7 @@ static struct of_device_id __initdata apc_match[] = {
174}; 173};
175MODULE_DEVICE_TABLE(of, apc_match); 174MODULE_DEVICE_TABLE(of, apc_match);
176 175
177static struct of_platform_driver apc_driver = { 176static struct platform_driver apc_driver = {
178 .driver = { 177 .driver = {
179 .name = "apc", 178 .name = "apc",
180 .owner = THIS_MODULE, 179 .owner = THIS_MODULE,
@@ -185,7 +184,7 @@ static struct of_platform_driver apc_driver = {
185 184
186static int __init apc_init(void) 185static int __init apc_init(void)
187{ 186{
188 return of_register_platform_driver(&apc_driver); 187 return platform_driver_register(&apc_driver);
189} 188}
190 189
191/* This driver is not critical to the boot process 190/* 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 3efd3c5af6a9..2abace076c7d 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[] = {
102 102
103MODULE_DEVICE_TABLE(of, auxio_match); 103MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct platform_device *dev, 105static int __devinit auxio_probe(struct platform_device *dev)
106 const struct of_device_id *match)
107{ 106{
108 struct device_node *dp = dev->dev.of_node; 107 struct device_node *dp = dev->dev.of_node;
109 unsigned long size; 108 unsigned long size;
@@ -132,7 +131,7 @@ static int __devinit auxio_probe(struct platform_device *dev,
132 return 0; 131 return 0;
133} 132}
134 133
135static struct of_platform_driver auxio_driver = { 134static struct platform_driver auxio_driver = {
136 .probe = auxio_probe, 135 .probe = auxio_probe,
137 .driver = { 136 .driver = {
138 .name = "auxio", 137 .name = "auxio",
@@ -143,7 +142,7 @@ static struct of_platform_driver auxio_driver = {
143 142
144static int __init auxio_init(void) 143static int __init auxio_init(void)
145{ 144{
146 return of_register_platform_driver(&auxio_driver); 145 return platform_driver_register(&auxio_driver);
147} 146}
148 147
149/* Must be after subsys_initcall() so that busses are probed. Must 148/* 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 cfa2624c5332..136d3718a74a 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)
59 } 59 }
60} 60}
61 61
62static int __devinit clock_board_probe(struct platform_device *op, 62static int __devinit clock_board_probe(struct platform_device *op)
63 const struct of_device_id *match)
64{ 63{
65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); 64 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
66 int err = -ENOMEM; 65 int err = -ENOMEM;
@@ -148,7 +147,7 @@ static struct of_device_id __initdata clock_board_match[] = {
148 {}, 147 {},
149}; 148};
150 149
151static struct of_platform_driver clock_board_driver = { 150static struct platform_driver clock_board_driver = {
152 .probe = clock_board_probe, 151 .probe = clock_board_probe,
153 .driver = { 152 .driver = {
154 .name = "clock_board", 153 .name = "clock_board",
@@ -157,8 +156,7 @@ static struct of_platform_driver clock_board_driver = {
157 }, 156 },
158}; 157};
159 158
160static int __devinit fhc_probe(struct platform_device *op, 159static int __devinit fhc_probe(struct platform_device *op)
161 const struct of_device_id *match)
162{ 160{
163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); 161 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
164 int err = -ENOMEM; 162 int err = -ENOMEM;
@@ -254,7 +252,7 @@ static struct of_device_id __initdata fhc_match[] = {
254 {}, 252 {},
255}; 253};
256 254
257static struct of_platform_driver fhc_driver = { 255static struct platform_driver fhc_driver = {
258 .probe = fhc_probe, 256 .probe = fhc_probe,
259 .driver = { 257 .driver = {
260 .name = "fhc", 258 .name = "fhc",
@@ -265,8 +263,8 @@ static struct of_platform_driver fhc_driver = {
265 263
266static int __init sunfire_init(void) 264static int __init sunfire_init(void)
267{ 265{
268 (void) of_register_platform_driver(&fhc_driver); 266 (void) platform_driver_register(&fhc_driver);
269 (void) of_register_platform_driver(&clock_board_driver); 267 (void) platform_driver_register(&clock_board_driver);
270 return 0; 268 return 0;
271} 269}
272 270
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 08c466ebb32b..668c7be5d365 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,
392 } 392 }
393} 393}
394 394
395static int __devinit jbusmc_probe(struct platform_device *op, 395static int __devinit jbusmc_probe(struct platform_device *op)
396 const struct of_device_id *match)
397{ 396{
398 const struct linux_prom64_registers *mem_regs; 397 const struct linux_prom64_registers *mem_regs;
399 struct device_node *mem_node; 398 struct device_node *mem_node;
@@ -690,8 +689,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
690 chmc_read_mcreg(p, CHMCTRL_DECODE4)); 689 chmc_read_mcreg(p, CHMCTRL_DECODE4));
691} 690}
692 691
693static int __devinit chmc_probe(struct platform_device *op, 692static int __devinit chmc_probe(struct platform_device *op)
694 const struct of_device_id *match)
695{ 693{
696 struct device_node *dp = op->dev.of_node; 694 struct device_node *dp = op->dev.of_node;
697 unsigned long ver; 695 unsigned long ver;
@@ -765,13 +763,12 @@ out_free:
765 goto out; 763 goto out;
766} 764}
767 765
768static int __devinit us3mc_probe(struct platform_device *op, 766static int __devinit us3mc_probe(struct platform_device *op)
769 const struct of_device_id *match)
770{ 767{
771 if (mc_type == MC_TYPE_SAFARI) 768 if (mc_type == MC_TYPE_SAFARI)
772 return chmc_probe(op, match); 769 return chmc_probe(op);
773 else if (mc_type == MC_TYPE_JBUS) 770 else if (mc_type == MC_TYPE_JBUS)
774 return jbusmc_probe(op, match); 771 return jbusmc_probe(op);
775 return -ENODEV; 772 return -ENODEV;
776} 773}
777 774
@@ -810,7 +807,7 @@ static const struct of_device_id us3mc_match[] = {
810}; 807};
811MODULE_DEVICE_TABLE(of, us3mc_match); 808MODULE_DEVICE_TABLE(of, us3mc_match);
812 809
813static struct of_platform_driver us3mc_driver = { 810static struct platform_driver us3mc_driver = {
814 .driver = { 811 .driver = {
815 .name = "us3mc", 812 .name = "us3mc",
816 .owner = THIS_MODULE, 813 .owner = THIS_MODULE,
@@ -848,7 +845,7 @@ static int __init us3mc_init(void)
848 ret = register_dimm_printer(us3mc_dimm_printer); 845 ret = register_dimm_printer(us3mc_dimm_printer);
849 846
850 if (!ret) { 847 if (!ret) {
851 ret = of_register_platform_driver(&us3mc_driver); 848 ret = platform_driver_register(&us3mc_driver);
852 if (ret) 849 if (ret)
853 unregister_dimm_printer(us3mc_dimm_printer); 850 unregister_dimm_printer(us3mc_dimm_printer);
854 } 851 }
@@ -859,7 +856,7 @@ static void __exit us3mc_cleanup(void)
859{ 856{
860 if (us3mc_platform()) { 857 if (us3mc_platform()) {
861 unregister_dimm_printer(us3mc_dimm_printer); 858 unregister_dimm_printer(us3mc_dimm_printer);
862 of_unregister_platform_driver(&us3mc_driver); 859 platform_driver_unregister(&us3mc_driver);
863 } 860 }
864} 861}
865 862
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index efb896d68754..be5e2441c6d7 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,
455 return 0; 455 return 0;
456} 456}
457 457
458static int __devinit fire_probe(struct platform_device *op, 458static int __devinit fire_probe(struct platform_device *op)
459 const struct of_device_id *match)
460{ 459{
461 struct device_node *dp = op->dev.of_node; 460 struct device_node *dp = op->dev.of_node;
462 struct pci_pbm_info *pbm; 461 struct pci_pbm_info *pbm;
@@ -507,7 +506,7 @@ static struct of_device_id __initdata fire_match[] = {
507 {}, 506 {},
508}; 507};
509 508
510static struct of_platform_driver fire_driver = { 509static struct platform_driver fire_driver = {
511 .driver = { 510 .driver = {
512 .name = DRIVER_NAME, 511 .name = DRIVER_NAME,
513 .owner = THIS_MODULE, 512 .owner = THIS_MODULE,
@@ -518,7 +517,7 @@ static struct of_platform_driver fire_driver = {
518 517
519static int __init fire_init(void) 518static int __init fire_init(void)
520{ 519{
521 return of_register_platform_driver(&fire_driver); 520 return platform_driver_register(&fire_driver);
522} 521}
523 522
524subsys_initcall(fire_init); 523subsys_initcall(fire_init);
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 22eab7cf3b11..56ee745064de 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)
503 503
504#define PSYCHO_CONFIGSPACE 0x001000000UL 504#define PSYCHO_CONFIGSPACE 0x001000000UL
505 505
506static int __devinit psycho_probe(struct platform_device *op, 506static int __devinit psycho_probe(struct platform_device *op)
507 const struct of_device_id *match)
508{ 507{
509 const struct linux_prom64_registers *pr_regs; 508 const struct linux_prom64_registers *pr_regs;
510 struct device_node *dp = op->dev.of_node; 509 struct device_node *dp = op->dev.of_node;
@@ -601,7 +600,7 @@ static struct of_device_id __initdata psycho_match[] = {
601 {}, 600 {},
602}; 601};
603 602
604static struct of_platform_driver psycho_driver = { 603static struct platform_driver psycho_driver = {
605 .driver = { 604 .driver = {
606 .name = DRIVER_NAME, 605 .name = DRIVER_NAME,
607 .owner = THIS_MODULE, 606 .owner = THIS_MODULE,
@@ -612,7 +611,7 @@ static struct of_platform_driver psycho_driver = {
612 611
613static int __init psycho_init(void) 612static int __init psycho_init(void)
614{ 613{
615 return of_register_platform_driver(&psycho_driver); 614 return platform_driver_register(&psycho_driver);
616} 615}
617 616
618subsys_initcall(psycho_init); 617subsys_initcall(psycho_init);
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 5c3f5ec4cabc..2857073342d2 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,
452 sabre_scan_bus(pbm, &op->dev); 452 sabre_scan_bus(pbm, &op->dev);
453} 453}
454 454
455static int __devinit sabre_probe(struct platform_device *op, 455static int __devinit sabre_probe(struct platform_device *op)
456 const struct of_device_id *match)
457{ 456{
458 const struct linux_prom64_registers *pr_regs; 457 const struct linux_prom64_registers *pr_regs;
459 struct device_node *dp = op->dev.of_node; 458 struct device_node *dp = op->dev.of_node;
@@ -464,7 +463,7 @@ static int __devinit sabre_probe(struct platform_device *op,
464 const u32 *vdma; 463 const u32 *vdma;
465 u64 clear_irq; 464 u64 clear_irq;
466 465
467 hummingbird_p = (match->data != NULL); 466 hummingbird_p = op->dev.of_match && (op->dev.of_match->data != NULL);
468 if (!hummingbird_p) { 467 if (!hummingbird_p) {
469 struct device_node *cpu_dp; 468 struct device_node *cpu_dp;
470 469
@@ -595,7 +594,7 @@ static struct of_device_id __initdata sabre_match[] = {
595 {}, 594 {},
596}; 595};
597 596
598static struct of_platform_driver sabre_driver = { 597static struct platform_driver sabre_driver = {
599 .driver = { 598 .driver = {
600 .name = DRIVER_NAME, 599 .name = DRIVER_NAME,
601 .owner = THIS_MODULE, 600 .owner = THIS_MODULE,
@@ -606,7 +605,7 @@ static struct of_platform_driver sabre_driver = {
606 605
607static int __init sabre_init(void) 606static int __init sabre_init(void)
608{ 607{
609 return of_register_platform_driver(&sabre_driver); 608 return platform_driver_register(&sabre_driver);
610} 609}
611 610
612subsys_initcall(sabre_init); 611subsys_initcall(sabre_init);
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 445a47a2fb3d..6783410ceb02 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1460,10 +1460,11 @@ out_err:
1460 return err; 1460 return err;
1461} 1461}
1462 1462
1463static int __devinit schizo_probe(struct platform_device *op, 1463static int __devinit schizo_probe(struct platform_device *op)
1464 const struct of_device_id *match)
1465{ 1464{
1466 return __schizo_init(op, (unsigned long) match->data); 1465 if (!op->dev.of_match)
1466 return -EINVAL;
1467 return __schizo_init(op, (unsigned long) op->dev.of_match->data);
1467} 1468}
1468 1469
1469/* The ordering of this table is very important. Some Tomatillo 1470/* The ordering of this table is very important. Some Tomatillo
@@ -1490,7 +1491,7 @@ static struct of_device_id __initdata schizo_match[] = {
1490 {}, 1491 {},
1491}; 1492};
1492 1493
1493static struct of_platform_driver schizo_driver = { 1494static struct platform_driver schizo_driver = {
1494 .driver = { 1495 .driver = {
1495 .name = DRIVER_NAME, 1496 .name = DRIVER_NAME,
1496 .owner = THIS_MODULE, 1497 .owner = THIS_MODULE,
@@ -1501,7 +1502,7 @@ static struct of_platform_driver schizo_driver = {
1501 1502
1502static int __init schizo_init(void) 1503static int __init schizo_init(void)
1503{ 1504{
1504 return of_register_platform_driver(&schizo_driver); 1505 return platform_driver_register(&schizo_driver);
1505} 1506}
1506 1507
1507subsys_initcall(schizo_init); 1508subsys_initcall(schizo_init);
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 743344aa6d8a..158cd739b263 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,
918 return 0; 918 return 0;
919} 919}
920 920
921static int __devinit pci_sun4v_probe(struct platform_device *op, 921static int __devinit pci_sun4v_probe(struct platform_device *op)
922 const struct of_device_id *match)
923{ 922{
924 const struct linux_prom64_registers *regs; 923 const struct linux_prom64_registers *regs;
925 static int hvapi_negotiated = 0; 924 static int hvapi_negotiated = 0;
@@ -1008,7 +1007,7 @@ static struct of_device_id __initdata pci_sun4v_match[] = {
1008 {}, 1007 {},
1009}; 1008};
1010 1009
1011static struct of_platform_driver pci_sun4v_driver = { 1010static struct platform_driver pci_sun4v_driver = {
1012 .driver = { 1011 .driver = {
1013 .name = DRIVER_NAME, 1012 .name = DRIVER_NAME,
1014 .owner = THIS_MODULE, 1013 .owner = THIS_MODULE,
@@ -1019,7 +1018,7 @@ static struct of_platform_driver pci_sun4v_driver = {
1019 1018
1020static int __init pci_sun4v_init(void) 1019static int __init pci_sun4v_init(void)
1021{ 1020{
1022 return of_register_platform_driver(&pci_sun4v_driver); 1021 return platform_driver_register(&pci_sun4v_driver);
1023} 1022}
1024 1023
1025subsys_initcall(pci_sun4v_init); 1024subsys_initcall(pci_sun4v_init);
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 94536a85f161..93d7b4465f8d 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -51,8 +51,7 @@ static void pmc_swift_idle(void)
51#endif 51#endif
52} 52}
53 53
54static int __devinit pmc_probe(struct platform_device *op, 54static int __devinit pmc_probe(struct platform_device *op)
55 const struct of_device_id *match)
56{ 55{
57 regs = of_ioremap(&op->resource[0], 0, 56 regs = of_ioremap(&op->resource[0], 0,
58 resource_size(&op->resource[0]), PMC_OBPNAME); 57 resource_size(&op->resource[0]), PMC_OBPNAME);
@@ -78,7 +77,7 @@ static struct of_device_id __initdata pmc_match[] = {
78}; 77};
79MODULE_DEVICE_TABLE(of, pmc_match); 78MODULE_DEVICE_TABLE(of, pmc_match);
80 79
81static struct of_platform_driver pmc_driver = { 80static struct platform_driver pmc_driver = {
82 .driver = { 81 .driver = {
83 .name = "pmc", 82 .name = "pmc",
84 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
@@ -89,7 +88,7 @@ static struct of_platform_driver pmc_driver = {
89 88
90static int __init pmc_init(void) 89static int __init pmc_init(void)
91{ 90{
92 return of_register_platform_driver(&pmc_driver); 91 return platform_driver_register(&pmc_driver);
93} 92}
94 93
95/* This driver is not critical to the boot process 94/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 2c59f4d387dd..cd725fe238b2 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 *
33 return 1; 33 return 1;
34} 34}
35 35
36static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match) 36static int __devinit power_probe(struct platform_device *op)
37{ 37{
38 struct resource *res = &op->resource[0]; 38 struct resource *res = &op->resource[0];
39 unsigned int irq = op->archdata.irqs[0]; 39 unsigned int irq = op->archdata.irqs[0];
@@ -59,7 +59,7 @@ static struct of_device_id __initdata power_match[] = {
59 {}, 59 {},
60}; 60};
61 61
62static struct of_platform_driver power_driver = { 62static struct platform_driver power_driver = {
63 .probe = power_probe, 63 .probe = power_probe,
64 .driver = { 64 .driver = {
65 .name = "power", 65 .name = "power",
@@ -70,7 +70,7 @@ static struct of_platform_driver power_driver = {
70 70
71static int __init power_init(void) 71static int __init power_init(void)
72{ 72{
73 return of_register_platform_driver(&power_driver); 73 return platform_driver_register(&power_driver);
74} 74}
75 75
76device_initcall(power_init); 76device_initcall(power_init);
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 4211bfc9bcad..19ab42a932db 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -137,7 +137,7 @@ static struct platform_device m48t59_rtc = {
137 }, 137 },
138}; 138};
139 139
140static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match) 140static int __devinit clock_probe(struct platform_device *op)
141{ 141{
142 struct device_node *dp = op->dev.of_node; 142 struct device_node *dp = op->dev.of_node;
143 const char *model = of_get_property(dp, "model", NULL); 143 const char *model = of_get_property(dp, "model", NULL);
@@ -171,7 +171,7 @@ static struct of_device_id __initdata clock_match[] = {
171 {}, 171 {},
172}; 172};
173 173
174static struct of_platform_driver clock_driver = { 174static struct platform_driver clock_driver = {
175 .probe = clock_probe, 175 .probe = clock_probe,
176 .driver = { 176 .driver = {
177 .name = "rtc", 177 .name = "rtc",
@@ -184,7 +184,7 @@ static struct of_platform_driver clock_driver = {
184/* Probe for the mostek real time clock chip. */ 184/* Probe for the mostek real time clock chip. */
185static int __init clock_init(void) 185static int __init clock_init(void)
186{ 186{
187 return of_register_platform_driver(&clock_driver); 187 return platform_driver_register(&clock_driver);
188} 188}
189/* Must be after subsys_initcall() so that busses are probed. Must 189/* Must be after subsys_initcall() so that busses are probed. Must
190 * be before device_initcall() because things like the RTC driver 190 * 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 3bc9c9979b92..e1862793a61d 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 = {
419 .num_resources = 1, 419 .num_resources = 1,
420}; 420};
421 421
422static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match) 422static int __devinit rtc_probe(struct platform_device *op)
423{ 423{
424 struct resource *r; 424 struct resource *r;
425 425
@@ -462,7 +462,7 @@ static struct of_device_id __initdata rtc_match[] = {
462 {}, 462 {},
463}; 463};
464 464
465static struct of_platform_driver rtc_driver = { 465static struct platform_driver rtc_driver = {
466 .probe = rtc_probe, 466 .probe = rtc_probe,
467 .driver = { 467 .driver = {
468 .name = "rtc", 468 .name = "rtc",
@@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = {
477 .num_resources = 1, 477 .num_resources = 1,
478}; 478};
479 479
480static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match) 480static int __devinit bq4802_probe(struct platform_device *op)
481{ 481{
482 482
483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
@@ -495,7 +495,7 @@ static struct of_device_id __initdata bq4802_match[] = {
495 {}, 495 {},
496}; 496};
497 497
498static struct of_platform_driver bq4802_driver = { 498static struct platform_driver bq4802_driver = {
499 .probe = bq4802_probe, 499 .probe = bq4802_probe,
500 .driver = { 500 .driver = {
501 .name = "bq4802", 501 .name = "bq4802",
@@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = {
534 }, 534 },
535}; 535};
536 536
537static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match) 537static int __devinit mostek_probe(struct platform_device *op)
538{ 538{
539 struct device_node *dp = op->dev.of_node; 539 struct device_node *dp = op->dev.of_node;
540 540
@@ -559,7 +559,7 @@ static struct of_device_id __initdata mostek_match[] = {
559 {}, 559 {},
560}; 560};
561 561
562static struct of_platform_driver mostek_driver = { 562static struct platform_driver mostek_driver = {
563 .probe = mostek_probe, 563 .probe = mostek_probe,
564 .driver = { 564 .driver = {
565 .name = "mostek", 565 .name = "mostek",
@@ -586,9 +586,9 @@ static int __init clock_init(void)
586 if (tlb_type == hypervisor) 586 if (tlb_type == hypervisor)
587 return platform_device_register(&rtc_sun4v_device); 587 return platform_device_register(&rtc_sun4v_device);
588 588
589 (void) of_register_platform_driver(&rtc_driver); 589 (void) platform_driver_register(&rtc_driver);
590 (void) of_register_platform_driver(&mostek_driver); 590 (void) platform_driver_register(&mostek_driver);
591 (void) of_register_platform_driver(&bq4802_driver); 591 (void) platform_driver_register(&bq4802_driver);
592 592
593 return 0; 593 return 0;
594} 594}
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index d7d8026cde99..2fcac511d39c 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -680,7 +680,7 @@ mpc52xx_ata_remove_one(struct device *dev)
680/* ======================================================================== */ 680/* ======================================================================== */
681 681
682static int __devinit 682static int __devinit
683mpc52xx_ata_probe(struct platform_device *op, const struct of_device_id *match) 683mpc52xx_ata_probe(struct platform_device *op)
684{ 684{
685 unsigned int ipb_freq; 685 unsigned int ipb_freq;
686 struct resource res_mem; 686 struct resource res_mem;
@@ -883,7 +883,7 @@ static struct of_device_id mpc52xx_ata_of_match[] = {
883}; 883};
884 884
885 885
886static struct of_platform_driver mpc52xx_ata_of_platform_driver = { 886static struct platform_driver mpc52xx_ata_of_platform_driver = {
887 .probe = mpc52xx_ata_probe, 887 .probe = mpc52xx_ata_probe,
888 .remove = mpc52xx_ata_remove, 888 .remove = mpc52xx_ata_remove,
889#ifdef CONFIG_PM 889#ifdef CONFIG_PM
@@ -906,13 +906,13 @@ static int __init
906mpc52xx_ata_init(void) 906mpc52xx_ata_init(void)
907{ 907{
908 printk(KERN_INFO "ata: MPC52xx IDE/ATA libata driver\n"); 908 printk(KERN_INFO "ata: MPC52xx IDE/ATA libata driver\n");
909 return of_register_platform_driver(&mpc52xx_ata_of_platform_driver); 909 return platform_driver_register(&mpc52xx_ata_of_platform_driver);
910} 910}
911 911
912static void __exit 912static void __exit
913mpc52xx_ata_exit(void) 913mpc52xx_ata_exit(void)
914{ 914{
915 of_unregister_platform_driver(&mpc52xx_ata_of_platform_driver); 915 platform_driver_unregister(&mpc52xx_ata_of_platform_driver);
916} 916}
917 917
918module_init(mpc52xx_ata_init); 918module_init(mpc52xx_ata_init);
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 480e043ce6b8..f3054009bd25 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -14,8 +14,7 @@
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <linux/ata_platform.h> 15#include <linux/ata_platform.h>
16 16
17static int __devinit pata_of_platform_probe(struct platform_device *ofdev, 17static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
18 const struct of_device_id *match)
19{ 18{
20 int ret; 19 int ret;
21 struct device_node *dn = ofdev->dev.of_node; 20 struct device_node *dn = ofdev->dev.of_node;
@@ -90,7 +89,7 @@ static struct of_device_id pata_of_platform_match[] = {
90}; 89};
91MODULE_DEVICE_TABLE(of, pata_of_platform_match); 90MODULE_DEVICE_TABLE(of, pata_of_platform_match);
92 91
93static struct of_platform_driver pata_of_platform_driver = { 92static struct platform_driver pata_of_platform_driver = {
94 .driver = { 93 .driver = {
95 .name = "pata_of_platform", 94 .name = "pata_of_platform",
96 .owner = THIS_MODULE, 95 .owner = THIS_MODULE,
@@ -102,13 +101,13 @@ static struct of_platform_driver pata_of_platform_driver = {
102 101
103static int __init pata_of_platform_init(void) 102static int __init pata_of_platform_init(void)
104{ 103{
105 return of_register_platform_driver(&pata_of_platform_driver); 104 return platform_driver_register(&pata_of_platform_driver);
106} 105}
107module_init(pata_of_platform_init); 106module_init(pata_of_platform_init);
108 107
109static void __exit pata_of_platform_exit(void) 108static void __exit pata_of_platform_exit(void)
110{ 109{
111 of_unregister_platform_driver(&pata_of_platform_driver); 110 platform_driver_unregister(&pata_of_platform_driver);
112} 111}
113module_exit(pata_of_platform_exit); 112module_exit(pata_of_platform_exit);
114 113
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 712ab5a4922e..1c4b3aa4c7c4 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1625,8 +1625,7 @@ static const struct ata_port_info sata_dwc_port_info[] = {
1625 }, 1625 },
1626}; 1626};
1627 1627
1628static int sata_dwc_probe(struct platform_device *ofdev, 1628static int sata_dwc_probe(struct platform_device *ofdev)
1629 const struct of_device_id *match)
1630{ 1629{
1631 struct sata_dwc_device *hsdev; 1630 struct sata_dwc_device *hsdev;
1632 u32 idr, versionr; 1631 u32 idr, versionr;
@@ -1764,7 +1763,7 @@ static const struct of_device_id sata_dwc_match[] = {
1764}; 1763};
1765MODULE_DEVICE_TABLE(of, sata_dwc_match); 1764MODULE_DEVICE_TABLE(of, sata_dwc_match);
1766 1765
1767static struct of_platform_driver sata_dwc_driver = { 1766static struct platform_driver sata_dwc_driver = {
1768 .driver = { 1767 .driver = {
1769 .name = DRV_NAME, 1768 .name = DRV_NAME,
1770 .owner = THIS_MODULE, 1769 .owner = THIS_MODULE,
@@ -1776,12 +1775,12 @@ static struct of_platform_driver sata_dwc_driver = {
1776 1775
1777static int __init sata_dwc_init(void) 1776static int __init sata_dwc_init(void)
1778{ 1777{
1779 return of_register_platform_driver(&sata_dwc_driver); 1778 return platform_driver_register(&sata_dwc_driver);
1780} 1779}
1781 1780
1782static void __exit sata_dwc_exit(void) 1781static void __exit sata_dwc_exit(void)
1783{ 1782{
1784 of_unregister_platform_driver(&sata_dwc_driver); 1783 platform_driver_unregister(&sata_dwc_driver);
1785} 1784}
1786 1785
1787module_init(sata_dwc_init); 1786module_init(sata_dwc_init);
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 7f9eab34a386..ef3ce26bb1f0 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1300,8 +1300,7 @@ static const struct ata_port_info sata_fsl_port_info[] = {
1300 }, 1300 },
1301}; 1301};
1302 1302
1303static int sata_fsl_probe(struct platform_device *ofdev, 1303static int sata_fsl_probe(struct platform_device *ofdev)
1304 const struct of_device_id *match)
1305{ 1304{
1306 int retval = -ENXIO; 1305 int retval = -ENXIO;
1307 void __iomem *hcr_base = NULL; 1306 void __iomem *hcr_base = NULL;
@@ -1437,7 +1436,7 @@ static struct of_device_id fsl_sata_match[] = {
1437 1436
1438MODULE_DEVICE_TABLE(of, fsl_sata_match); 1437MODULE_DEVICE_TABLE(of, fsl_sata_match);
1439 1438
1440static struct of_platform_driver fsl_sata_driver = { 1439static struct platform_driver fsl_sata_driver = {
1441 .driver = { 1440 .driver = {
1442 .name = "fsl-sata", 1441 .name = "fsl-sata",
1443 .owner = THIS_MODULE, 1442 .owner = THIS_MODULE,
@@ -1453,13 +1452,13 @@ static struct of_platform_driver fsl_sata_driver = {
1453 1452
1454static int __init sata_fsl_init(void) 1453static int __init sata_fsl_init(void)
1455{ 1454{
1456 of_register_platform_driver(&fsl_sata_driver); 1455 platform_driver_register(&fsl_sata_driver);
1457 return 0; 1456 return 0;
1458} 1457}
1459 1458
1460static void __exit sata_fsl_exit(void) 1459static void __exit sata_fsl_exit(void)
1461{ 1460{
1462 of_unregister_platform_driver(&fsl_sata_driver); 1461 platform_driver_unregister(&fsl_sata_driver);
1463} 1462}
1464 1463
1465MODULE_LICENSE("GPL"); 1464MODULE_LICENSE("GPL");
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 44f778507770..bdd2719f3f68 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2643,14 +2643,17 @@ fore200e_init(struct fore200e* fore200e, struct device *parent)
2643} 2643}
2644 2644
2645#ifdef CONFIG_SBUS 2645#ifdef CONFIG_SBUS
2646static int __devinit fore200e_sba_probe(struct platform_device *op, 2646static int __devinit fore200e_sba_probe(struct platform_device *op)
2647 const struct of_device_id *match)
2648{ 2647{
2649 const struct fore200e_bus *bus = match->data; 2648 const struct fore200e_bus *bus;
2650 struct fore200e *fore200e; 2649 struct fore200e *fore200e;
2651 static int index = 0; 2650 static int index = 0;
2652 int err; 2651 int err;
2653 2652
2653 if (!op->dev.of_match)
2654 return -EINVAL;
2655 bus = op->dev.of_match->data;
2656
2654 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL); 2657 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL);
2655 if (!fore200e) 2658 if (!fore200e)
2656 return -ENOMEM; 2659 return -ENOMEM;
@@ -2694,7 +2697,7 @@ static const struct of_device_id fore200e_sba_match[] = {
2694}; 2697};
2695MODULE_DEVICE_TABLE(of, fore200e_sba_match); 2698MODULE_DEVICE_TABLE(of, fore200e_sba_match);
2696 2699
2697static struct of_platform_driver fore200e_sba_driver = { 2700static struct platform_driver fore200e_sba_driver = {
2698 .driver = { 2701 .driver = {
2699 .name = "fore_200e", 2702 .name = "fore_200e",
2700 .owner = THIS_MODULE, 2703 .owner = THIS_MODULE,
@@ -2795,7 +2798,7 @@ static int __init fore200e_module_init(void)
2795 printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n"); 2798 printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n");
2796 2799
2797#ifdef CONFIG_SBUS 2800#ifdef CONFIG_SBUS
2798 err = of_register_platform_driver(&fore200e_sba_driver); 2801 err = platform_driver_register(&fore200e_sba_driver);
2799 if (err) 2802 if (err)
2800 return err; 2803 return err;
2801#endif 2804#endif
@@ -2806,7 +2809,7 @@ static int __init fore200e_module_init(void)
2806 2809
2807#ifdef CONFIG_SBUS 2810#ifdef CONFIG_SBUS
2808 if (err) 2811 if (err)
2809 of_unregister_platform_driver(&fore200e_sba_driver); 2812 platform_driver_unregister(&fore200e_sba_driver);
2810#endif 2813#endif
2811 2814
2812 return err; 2815 return err;
@@ -2818,7 +2821,7 @@ static void __exit fore200e_module_cleanup(void)
2818 pci_unregister_driver(&fore200e_pca_driver); 2821 pci_unregister_driver(&fore200e_pca_driver);
2819#endif 2822#endif
2820#ifdef CONFIG_SBUS 2823#ifdef CONFIG_SBUS
2821 of_unregister_platform_driver(&fore200e_sba_driver); 2824 platform_driver_unregister(&fore200e_sba_driver);
2822#endif 2825#endif
2823} 2826}
2824 2827
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 829161edae53..2c590a796aa1 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1195,16 +1195,13 @@ static struct platform_driver ace_platform_driver = {
1195 */ 1195 */
1196 1196
1197#if defined(CONFIG_OF) 1197#if defined(CONFIG_OF)
1198static int __devinit 1198static int __devinit ace_of_probe(struct platform_device *op)
1199ace_of_probe(struct platform_device *op, const struct of_device_id *match)
1200{ 1199{
1201 struct resource res; 1200 struct resource res;
1202 resource_size_t physaddr; 1201 resource_size_t physaddr;
1203 const u32 *id; 1202 const u32 *id;
1204 int irq, bus_width, rc; 1203 int irq, bus_width, rc;
1205 1204
1206 dev_dbg(&op->dev, "ace_of_probe(%p, %p)\n", op, match);
1207
1208 /* device id */ 1205 /* device id */
1209 id = of_get_property(op->dev.of_node, "port-number", NULL); 1206 id = of_get_property(op->dev.of_node, "port-number", NULL);
1210 1207
@@ -1245,7 +1242,7 @@ static const struct of_device_id ace_of_match[] __devinitconst = {
1245}; 1242};
1246MODULE_DEVICE_TABLE(of, ace_of_match); 1243MODULE_DEVICE_TABLE(of, ace_of_match);
1247 1244
1248static struct of_platform_driver ace_of_driver = { 1245static struct platform_driver ace_of_driver = {
1249 .probe = ace_of_probe, 1246 .probe = ace_of_probe,
1250 .remove = __devexit_p(ace_of_remove), 1247 .remove = __devexit_p(ace_of_remove),
1251 .driver = { 1248 .driver = {
@@ -1259,12 +1256,12 @@ static struct of_platform_driver ace_of_driver = {
1259static inline int __init ace_of_register(void) 1256static inline int __init ace_of_register(void)
1260{ 1257{
1261 pr_debug("xsysace: registering OF binding\n"); 1258 pr_debug("xsysace: registering OF binding\n");
1262 return of_register_platform_driver(&ace_of_driver); 1259 return platform_driver_register(&ace_of_driver);
1263} 1260}
1264 1261
1265static inline void __exit ace_of_unregister(void) 1262static inline void __exit ace_of_unregister(void)
1266{ 1263{
1267 of_unregister_platform_driver(&ace_of_driver); 1264 platform_driver_unregister(&ace_of_driver);
1268} 1265}
1269#else /* CONFIG_OF */ 1266#else /* CONFIG_OF */
1270/* CONFIG_OF not enabled; do nothing helpers */ 1267/* CONFIG_OF not enabled; do nothing helpers */
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index a3f5e381e746..43ac61978d8b 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)
619 pr_info("%s", version); 619 pr_info("%s", version);
620} 620}
621 621
622static int __devinit n2rng_probe(struct platform_device *op, 622static int __devinit n2rng_probe(struct platform_device *op)
623 const struct of_device_id *match)
624{ 623{
625 int victoria_falls = (match->data != NULL); 624 int victoria_falls;
626 int err = -ENOMEM; 625 int err = -ENOMEM;
627 struct n2rng *np; 626 struct n2rng *np;
628 627
629 n2rng_driver_version(); 628 if (!op->dev.of_match)
629 return -EINVAL;
630 victoria_falls = (op->dev.of_match->data != NULL);
630 631
632 n2rng_driver_version();
631 np = kzalloc(sizeof(*np), GFP_KERNEL); 633 np = kzalloc(sizeof(*np), GFP_KERNEL);
632 if (!np) 634 if (!np)
633 goto out; 635 goto out;
@@ -750,7 +752,7 @@ static const struct of_device_id n2rng_match[] = {
750}; 752};
751MODULE_DEVICE_TABLE(of, n2rng_match); 753MODULE_DEVICE_TABLE(of, n2rng_match);
752 754
753static struct of_platform_driver n2rng_driver = { 755static struct platform_driver n2rng_driver = {
754 .driver = { 756 .driver = {
755 .name = "n2rng", 757 .name = "n2rng",
756 .owner = THIS_MODULE, 758 .owner = THIS_MODULE,
@@ -762,12 +764,12 @@ static struct of_platform_driver n2rng_driver = {
762 764
763static int __init n2rng_init(void) 765static int __init n2rng_init(void)
764{ 766{
765 return of_register_platform_driver(&n2rng_driver); 767 return platform_driver_register(&n2rng_driver);
766} 768}
767 769
768static void __exit n2rng_exit(void) 770static void __exit n2rng_exit(void)
769{ 771{
770 of_unregister_platform_driver(&n2rng_driver); 772 platform_driver_unregister(&n2rng_driver);
771} 773}
772 774
773module_init(n2rng_init); 775module_init(n2rng_init);
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index a31c830ca8cd..1d504815e6db 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 = {
94 .data_read = pasemi_rng_data_read, 94 .data_read = pasemi_rng_data_read,
95}; 95};
96 96
97static int __devinit rng_probe(struct platform_device *ofdev, 97static int __devinit rng_probe(struct platform_device *ofdev)
98 const struct of_device_id *match)
99{ 98{
100 void __iomem *rng_regs; 99 void __iomem *rng_regs;
101 struct device_node *rng_np = ofdev->dev.of_node; 100 struct device_node *rng_np = ofdev->dev.of_node;
@@ -139,7 +138,7 @@ static struct of_device_id rng_match[] = {
139 { }, 138 { },
140}; 139};
141 140
142static struct of_platform_driver rng_driver = { 141static struct platform_driver rng_driver = {
143 .driver = { 142 .driver = {
144 .name = "pasemi-rng", 143 .name = "pasemi-rng",
145 .owner = THIS_MODULE, 144 .owner = THIS_MODULE,
@@ -151,13 +150,13 @@ static struct of_platform_driver rng_driver = {
151 150
152static int __init rng_init(void) 151static int __init rng_init(void)
153{ 152{
154 return of_register_platform_driver(&rng_driver); 153 return platform_driver_register(&rng_driver);
155} 154}
156module_init(rng_init); 155module_init(rng_init);
157 156
158static void __exit rng_exit(void) 157static void __exit rng_exit(void)
159{ 158{
160 of_unregister_platform_driver(&rng_driver); 159 platform_driver_unregister(&rng_driver);
161} 160}
162module_exit(rng_exit); 161module_exit(rng_exit);
163 162
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 62787e30d508..c86d43b88e1e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -66,13 +66,10 @@
66#include <linux/string.h> 66#include <linux/string.h>
67#include <linux/ctype.h> 67#include <linux/ctype.h>
68#include <linux/pnp.h> 68#include <linux/pnp.h>
69
70#ifdef CONFIG_PPC_OF
71#include <linux/of_device.h> 69#include <linux/of_device.h>
72#include <linux/of_platform.h> 70#include <linux/of_platform.h>
73#include <linux/of_address.h> 71#include <linux/of_address.h>
74#include <linux/of_irq.h> 72#include <linux/of_irq.h>
75#endif
76 73
77#define PFX "ipmi_si: " 74#define PFX "ipmi_si: "
78 75
@@ -116,13 +113,7 @@ static char *ipmi_addr_src_to_str[] = { NULL, "hotmod", "hardcoded", "SPMI",
116 113
117#define DEVICE_NAME "ipmi_si" 114#define DEVICE_NAME "ipmi_si"
118 115
119static struct platform_driver ipmi_driver = { 116static struct platform_driver ipmi_driver;
120 .driver = {
121 .name = DEVICE_NAME,
122 .bus = &platform_bus_type
123 }
124};
125
126 117
127/* 118/*
128 * Indexes into stats[] in smi_info below. 119 * Indexes into stats[] in smi_info below.
@@ -308,9 +299,6 @@ static int pci_registered;
308#ifdef CONFIG_ACPI 299#ifdef CONFIG_ACPI
309static int pnp_registered; 300static int pnp_registered;
310#endif 301#endif
311#ifdef CONFIG_PPC_OF
312static int of_registered;
313#endif
314 302
315static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; 303static unsigned int kipmid_max_busy_us[SI_MAX_PARMS];
316static int num_max_busy_us; 304static int num_max_busy_us;
@@ -1868,8 +1856,9 @@ static int hotmod_handler(const char *val, struct kernel_param *kp)
1868 return rv; 1856 return rv;
1869} 1857}
1870 1858
1871static void __devinit hardcode_find_bmc(void) 1859static int __devinit hardcode_find_bmc(void)
1872{ 1860{
1861 int ret = -ENODEV;
1873 int i; 1862 int i;
1874 struct smi_info *info; 1863 struct smi_info *info;
1875 1864
@@ -1879,7 +1868,7 @@ static void __devinit hardcode_find_bmc(void)
1879 1868
1880 info = smi_info_alloc(); 1869 info = smi_info_alloc();
1881 if (!info) 1870 if (!info)
1882 return; 1871 return -ENOMEM;
1883 1872
1884 info->addr_source = SI_HARDCODED; 1873 info->addr_source = SI_HARDCODED;
1885 printk(KERN_INFO PFX "probing via hardcoded address\n"); 1874 printk(KERN_INFO PFX "probing via hardcoded address\n");
@@ -1932,10 +1921,12 @@ static void __devinit hardcode_find_bmc(void)
1932 if (!add_smi(info)) { 1921 if (!add_smi(info)) {
1933 if (try_smi_init(info)) 1922 if (try_smi_init(info))
1934 cleanup_one_si(info); 1923 cleanup_one_si(info);
1924 ret = 0;
1935 } else { 1925 } else {
1936 kfree(info); 1926 kfree(info);
1937 } 1927 }
1938 } 1928 }
1929 return ret;
1939} 1930}
1940 1931
1941#ifdef CONFIG_ACPI 1932#ifdef CONFIG_ACPI
@@ -2563,11 +2554,9 @@ static struct pci_driver ipmi_pci_driver = {
2563}; 2554};
2564#endif /* CONFIG_PCI */ 2555#endif /* CONFIG_PCI */
2565 2556
2566 2557static int __devinit ipmi_probe(struct platform_device *dev)
2567#ifdef CONFIG_PPC_OF
2568static int __devinit ipmi_of_probe(struct platform_device *dev,
2569 const struct of_device_id *match)
2570{ 2558{
2559#ifdef CONFIG_OF
2571 struct smi_info *info; 2560 struct smi_info *info;
2572 struct resource resource; 2561 struct resource resource;
2573 const __be32 *regsize, *regspacing, *regshift; 2562 const __be32 *regsize, *regspacing, *regshift;
@@ -2577,6 +2566,9 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2577 2566
2578 dev_info(&dev->dev, "probing via device tree\n"); 2567 dev_info(&dev->dev, "probing via device tree\n");
2579 2568
2569 if (!dev->dev.of_match)
2570 return -EINVAL;
2571
2580 ret = of_address_to_resource(np, 0, &resource); 2572 ret = of_address_to_resource(np, 0, &resource);
2581 if (ret) { 2573 if (ret) {
2582 dev_warn(&dev->dev, PFX "invalid address from OF\n"); 2574 dev_warn(&dev->dev, PFX "invalid address from OF\n");
@@ -2609,7 +2601,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2609 return -ENOMEM; 2601 return -ENOMEM;
2610 } 2602 }
2611 2603
2612 info->si_type = (enum si_type) match->data; 2604 info->si_type = (enum si_type) dev->dev.of_match->data;
2613 info->addr_source = SI_DEVICETREE; 2605 info->addr_source = SI_DEVICETREE;
2614 info->irq_setup = std_irq_setup; 2606 info->irq_setup = std_irq_setup;
2615 2607
@@ -2640,13 +2632,15 @@ static int __devinit ipmi_of_probe(struct platform_device *dev,
2640 kfree(info); 2632 kfree(info);
2641 return -EBUSY; 2633 return -EBUSY;
2642 } 2634 }
2643 2635#endif
2644 return 0; 2636 return 0;
2645} 2637}
2646 2638
2647static int __devexit ipmi_of_remove(struct platform_device *dev) 2639static int __devexit ipmi_remove(struct platform_device *dev)
2648{ 2640{
2641#ifdef CONFIG_OF
2649 cleanup_one_si(dev_get_drvdata(&dev->dev)); 2642 cleanup_one_si(dev_get_drvdata(&dev->dev));
2643#endif
2650 return 0; 2644 return 0;
2651} 2645}
2652 2646
@@ -2661,16 +2655,15 @@ static struct of_device_id ipmi_match[] =
2661 {}, 2655 {},
2662}; 2656};
2663 2657
2664static struct of_platform_driver ipmi_of_platform_driver = { 2658static struct platform_driver ipmi_driver = {
2665 .driver = { 2659 .driver = {
2666 .name = "ipmi", 2660 .name = DEVICE_NAME,
2667 .owner = THIS_MODULE, 2661 .owner = THIS_MODULE,
2668 .of_match_table = ipmi_match, 2662 .of_match_table = ipmi_match,
2669 }, 2663 },
2670 .probe = ipmi_of_probe, 2664 .probe = ipmi_probe,
2671 .remove = __devexit_p(ipmi_of_remove), 2665 .remove = __devexit_p(ipmi_remove),
2672}; 2666};
2673#endif /* CONFIG_PPC_OF */
2674 2667
2675static int wait_for_msg_done(struct smi_info *smi_info) 2668static int wait_for_msg_done(struct smi_info *smi_info)
2676{ 2669{
@@ -3348,8 +3341,7 @@ static int __devinit init_ipmi_si(void)
3348 return 0; 3341 return 0;
3349 initialized = 1; 3342 initialized = 1;
3350 3343
3351 /* Register the device drivers. */ 3344 rv = platform_driver_register(&ipmi_driver);
3352 rv = driver_register(&ipmi_driver.driver);
3353 if (rv) { 3345 if (rv) {
3354 printk(KERN_ERR PFX "Unable to register driver: %d\n", rv); 3346 printk(KERN_ERR PFX "Unable to register driver: %d\n", rv);
3355 return rv; 3347 return rv;
@@ -3373,15 +3365,9 @@ static int __devinit init_ipmi_si(void)
3373 3365
3374 printk(KERN_INFO "IPMI System Interface driver.\n"); 3366 printk(KERN_INFO "IPMI System Interface driver.\n");
3375 3367
3376 hardcode_find_bmc();
3377
3378 /* If the user gave us a device, they presumably want us to use it */ 3368 /* If the user gave us a device, they presumably want us to use it */
3379 mutex_lock(&smi_infos_lock); 3369 if (!hardcode_find_bmc())
3380 if (!list_empty(&smi_infos)) {
3381 mutex_unlock(&smi_infos_lock);
3382 return 0; 3370 return 0;
3383 }
3384 mutex_unlock(&smi_infos_lock);
3385 3371
3386#ifdef CONFIG_PCI 3372#ifdef CONFIG_PCI
3387 rv = pci_register_driver(&ipmi_pci_driver); 3373 rv = pci_register_driver(&ipmi_pci_driver);
@@ -3404,11 +3390,6 @@ static int __devinit init_ipmi_si(void)
3404 spmi_find_bmc(); 3390 spmi_find_bmc();
3405#endif 3391#endif
3406 3392
3407#ifdef CONFIG_PPC_OF
3408 of_register_platform_driver(&ipmi_of_platform_driver);
3409 of_registered = 1;
3410#endif
3411
3412 /* We prefer devices with interrupts, but in the case of a machine 3393 /* We prefer devices with interrupts, but in the case of a machine
3413 with multiple BMCs we assume that there will be several instances 3394 with multiple BMCs we assume that there will be several instances
3414 of a given type so if we succeed in registering a type then also 3395 of a given type so if we succeed in registering a type then also
@@ -3556,17 +3537,12 @@ static void __exit cleanup_ipmi_si(void)
3556 pnp_unregister_driver(&ipmi_pnp_driver); 3537 pnp_unregister_driver(&ipmi_pnp_driver);
3557#endif 3538#endif
3558 3539
3559#ifdef CONFIG_PPC_OF 3540 platform_driver_unregister(&ipmi_driver);
3560 if (of_registered)
3561 of_unregister_platform_driver(&ipmi_of_platform_driver);
3562#endif
3563 3541
3564 mutex_lock(&smi_infos_lock); 3542 mutex_lock(&smi_infos_lock);
3565 list_for_each_entry_safe(e, tmp_e, &smi_infos, link) 3543 list_for_each_entry_safe(e, tmp_e, &smi_infos, link)
3566 cleanup_one_si(e); 3544 cleanup_one_si(e);
3567 mutex_unlock(&smi_infos_lock); 3545 mutex_unlock(&smi_infos_lock);
3568
3569 driver_unregister(&ipmi_driver.driver);
3570} 3546}
3571module_exit(cleanup_ipmi_si); 3547module_exit(cleanup_ipmi_si);
3572 3548
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 9f2272e6de1c..d3c9d755ed98 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)
714 return 0; /* success */ 714 return 0; /* success */
715} 715}
716 716
717static int __devinit hwicap_drv_probe(struct platform_device *pdev) 717#ifdef CONFIG_OF
718static int __devinit hwicap_of_probe(struct platform_device *op)
718{ 719{
719 struct resource *res; 720 struct resource res;
720 const struct config_registers *regs; 721 const unsigned int *id;
721 const char *family; 722 const char *family;
723 int rc;
724 const struct hwicap_driver_config *config = op->dev.of_match->data;
725 const struct config_registers *regs;
722 726
723 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 727
724 if (!res) 728 rc = of_address_to_resource(op->dev.of_node, 0, &res);
725 return -ENODEV; 729 if (rc) {
730 dev_err(&op->dev, "invalid address\n");
731 return rc;
732 }
733
734 id = of_get_property(op->dev.of_node, "port-number", NULL);
726 735
727 /* It's most likely that we're using V4, if the family is not 736 /* It's most likely that we're using V4, if the family is not
728 specified */ 737 specified */
729 regs = &v4_config_registers; 738 regs = &v4_config_registers;
730 family = pdev->dev.platform_data; 739 family = of_get_property(op->dev.of_node, "xlnx,family", NULL);
731 740
732 if (family) { 741 if (family) {
733 if (!strcmp(family, "virtex2p")) { 742 if (!strcmp(family, "virtex2p")) {
@@ -738,54 +747,33 @@ static int __devinit hwicap_drv_probe(struct platform_device *pdev)
738 regs = &v5_config_registers; 747 regs = &v5_config_registers;
739 } 748 }
740 } 749 }
741 750 return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
742 return hwicap_setup(&pdev->dev, pdev->id, res, 751 regs);
743 &buffer_icap_config, regs);
744} 752}
745 753#else
746static int __devexit hwicap_drv_remove(struct platform_device *pdev) 754static inline int hwicap_of_probe(struct platform_device *op)
747{ 755{
748 return hwicap_remove(&pdev->dev); 756 return -EINVAL;
749} 757}
758#endif /* CONFIG_OF */
750 759
751static struct platform_driver hwicap_platform_driver = { 760static int __devinit hwicap_drv_probe(struct platform_device *pdev)
752 .probe = hwicap_drv_probe,
753 .remove = hwicap_drv_remove,
754 .driver = {
755 .owner = THIS_MODULE,
756 .name = DRIVER_NAME,
757 },
758};
759
760/* ---------------------------------------------------------------------
761 * OF bus binding
762 */
763
764#if defined(CONFIG_OF)
765static int __devinit
766hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
767{ 761{
768 struct resource res; 762 struct resource *res;
769 const unsigned int *id;
770 const char *family;
771 int rc;
772 const struct hwicap_driver_config *config = match->data;
773 const struct config_registers *regs; 763 const struct config_registers *regs;
764 const char *family;
774 765
775 dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match); 766 if (pdev->dev.of_match)
776 767 return hwicap_of_probe(pdev);
777 rc = of_address_to_resource(op->dev.of_node, 0, &res);
778 if (rc) {
779 dev_err(&op->dev, "invalid address\n");
780 return rc;
781 }
782 768
783 id = of_get_property(op->dev.of_node, "port-number", NULL); 769 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
770 if (!res)
771 return -ENODEV;
784 772
785 /* It's most likely that we're using V4, if the family is not 773 /* It's most likely that we're using V4, if the family is not
786 specified */ 774 specified */
787 regs = &v4_config_registers; 775 regs = &v4_config_registers;
788 family = of_get_property(op->dev.of_node, "xlnx,family", NULL); 776 family = pdev->dev.platform_data;
789 777
790 if (family) { 778 if (family) {
791 if (!strcmp(family, "virtex2p")) { 779 if (!strcmp(family, "virtex2p")) {
@@ -796,50 +784,38 @@ hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
796 regs = &v5_config_registers; 784 regs = &v5_config_registers;
797 } 785 }
798 } 786 }
799 return hwicap_setup(&op->dev, id ? *id : -1, &res, config, 787
800 regs); 788 return hwicap_setup(&pdev->dev, pdev->id, res,
789 &buffer_icap_config, regs);
801} 790}
802 791
803static int __devexit hwicap_of_remove(struct platform_device *op) 792static int __devexit hwicap_drv_remove(struct platform_device *pdev)
804{ 793{
805 return hwicap_remove(&op->dev); 794 return hwicap_remove(&pdev->dev);
806} 795}
807 796
808/* Match table for of_platform binding */ 797#ifdef CONFIG_OF
798/* Match table for device tree binding */
809static const struct of_device_id __devinitconst hwicap_of_match[] = { 799static const struct of_device_id __devinitconst hwicap_of_match[] = {
810 { .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config}, 800 { .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config},
811 { .compatible = "xlnx,xps-hwicap-1.00.a", .data = &fifo_icap_config}, 801 { .compatible = "xlnx,xps-hwicap-1.00.a", .data = &fifo_icap_config},
812 {}, 802 {},
813}; 803};
814MODULE_DEVICE_TABLE(of, hwicap_of_match); 804MODULE_DEVICE_TABLE(of, hwicap_of_match);
805#else
806#define hwicap_of_match NULL
807#endif
815 808
816static struct of_platform_driver hwicap_of_driver = { 809static struct platform_driver hwicap_platform_driver = {
817 .probe = hwicap_of_probe, 810 .probe = hwicap_drv_probe,
818 .remove = __devexit_p(hwicap_of_remove), 811 .remove = hwicap_drv_remove,
819 .driver = { 812 .driver = {
820 .name = DRIVER_NAME,
821 .owner = THIS_MODULE, 813 .owner = THIS_MODULE,
814 .name = DRIVER_NAME,
822 .of_match_table = hwicap_of_match, 815 .of_match_table = hwicap_of_match,
823 }, 816 },
824}; 817};
825 818
826/* Registration helpers to keep the number of #ifdefs to a minimum */
827static inline int __init hwicap_of_register(void)
828{
829 pr_debug("hwicap: calling of_register_platform_driver()\n");
830 return of_register_platform_driver(&hwicap_of_driver);
831}
832
833static inline void __exit hwicap_of_unregister(void)
834{
835 of_unregister_platform_driver(&hwicap_of_driver);
836}
837#else /* CONFIG_OF */
838/* CONFIG_OF not enabled; do nothing helpers */
839static inline int __init hwicap_of_register(void) { return 0; }
840static inline void __exit hwicap_of_unregister(void) { }
841#endif /* CONFIG_OF */
842
843static int __init hwicap_module_init(void) 819static int __init hwicap_module_init(void)
844{ 820{
845 dev_t devt; 821 dev_t devt;
@@ -856,21 +832,12 @@ static int __init hwicap_module_init(void)
856 return retval; 832 return retval;
857 833
858 retval = platform_driver_register(&hwicap_platform_driver); 834 retval = platform_driver_register(&hwicap_platform_driver);
859
860 if (retval)
861 goto failed1;
862
863 retval = hwicap_of_register();
864
865 if (retval) 835 if (retval)
866 goto failed2; 836 goto failed;
867 837
868 return retval; 838 return retval;
869 839
870 failed2: 840 failed:
871 platform_driver_unregister(&hwicap_platform_driver);
872
873 failed1:
874 unregister_chrdev_region(devt, HWICAP_DEVICES); 841 unregister_chrdev_region(devt, HWICAP_DEVICES);
875 842
876 return retval; 843 return retval;
@@ -884,8 +851,6 @@ static void __exit hwicap_module_cleanup(void)
884 851
885 platform_driver_unregister(&hwicap_platform_driver); 852 platform_driver_unregister(&hwicap_platform_driver);
886 853
887 hwicap_of_unregister();
888
889 unregister_chrdev_region(devt, HWICAP_DEVICES); 854 unregister_chrdev_region(devt, HWICAP_DEVICES);
890} 855}
891 856
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 2b1baee525bc..18912521a7a5 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[] = {
1150/** 1150/**
1151 * Module Initialization Routine 1151 * Module Initialization Routine
1152 */ 1152 */
1153static int __init crypto4xx_probe(struct platform_device *ofdev, 1153static int __init crypto4xx_probe(struct platform_device *ofdev)
1154 const struct of_device_id *match)
1155{ 1154{
1156 int rc; 1155 int rc;
1157 struct resource res; 1156 struct resource res;
@@ -1280,7 +1279,7 @@ static const struct of_device_id crypto4xx_match[] = {
1280 { }, 1279 { },
1281}; 1280};
1282 1281
1283static struct of_platform_driver crypto4xx_driver = { 1282static struct platform_driver crypto4xx_driver = {
1284 .driver = { 1283 .driver = {
1285 .name = "crypto4xx", 1284 .name = "crypto4xx",
1286 .owner = THIS_MODULE, 1285 .owner = THIS_MODULE,
@@ -1292,12 +1291,12 @@ static struct of_platform_driver crypto4xx_driver = {
1292 1291
1293static int __init crypto4xx_init(void) 1292static int __init crypto4xx_init(void)
1294{ 1293{
1295 return of_register_platform_driver(&crypto4xx_driver); 1294 return platform_driver_register(&crypto4xx_driver);
1296} 1295}
1297 1296
1298static void __exit crypto4xx_exit(void) 1297static void __exit crypto4xx_exit(void)
1299{ 1298{
1300 of_unregister_platform_driver(&crypto4xx_driver); 1299 platform_driver_unregister(&crypto4xx_driver);
1301} 1300}
1302 1301
1303module_init(crypto4xx_init); 1302module_init(crypto4xx_init);
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 80dc094e78c6..2e5b2044c96f 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)
2004 pr_info("%s", version); 2004 pr_info("%s", version);
2005} 2005}
2006 2006
2007static int __devinit n2_crypto_probe(struct platform_device *dev, 2007static int __devinit n2_crypto_probe(struct platform_device *dev)
2008 const struct of_device_id *match)
2009{ 2008{
2010 struct mdesc_handle *mdesc; 2009 struct mdesc_handle *mdesc;
2011 const char *full_name; 2010 const char *full_name;
@@ -2116,8 +2115,7 @@ static void free_ncp(struct n2_mau *mp)
2116 kfree(mp); 2115 kfree(mp);
2117} 2116}
2118 2117
2119static int __devinit n2_mau_probe(struct platform_device *dev, 2118static int __devinit n2_mau_probe(struct platform_device *dev)
2120 const struct of_device_id *match)
2121{ 2119{
2122 struct mdesc_handle *mdesc; 2120 struct mdesc_handle *mdesc;
2123 const char *full_name; 2121 const char *full_name;
@@ -2211,7 +2209,7 @@ static struct of_device_id n2_crypto_match[] = {
2211 2209
2212MODULE_DEVICE_TABLE(of, n2_crypto_match); 2210MODULE_DEVICE_TABLE(of, n2_crypto_match);
2213 2211
2214static struct of_platform_driver n2_crypto_driver = { 2212static struct platform_driver n2_crypto_driver = {
2215 .driver = { 2213 .driver = {
2216 .name = "n2cp", 2214 .name = "n2cp",
2217 .owner = THIS_MODULE, 2215 .owner = THIS_MODULE,
@@ -2235,7 +2233,7 @@ static struct of_device_id n2_mau_match[] = {
2235 2233
2236MODULE_DEVICE_TABLE(of, n2_mau_match); 2234MODULE_DEVICE_TABLE(of, n2_mau_match);
2237 2235
2238static struct of_platform_driver n2_mau_driver = { 2236static struct platform_driver n2_mau_driver = {
2239 .driver = { 2237 .driver = {
2240 .name = "ncp", 2238 .name = "ncp",
2241 .owner = THIS_MODULE, 2239 .owner = THIS_MODULE,
@@ -2247,20 +2245,20 @@ static struct of_platform_driver n2_mau_driver = {
2247 2245
2248static int __init n2_init(void) 2246static int __init n2_init(void)
2249{ 2247{
2250 int err = of_register_platform_driver(&n2_crypto_driver); 2248 int err = platform_driver_register(&n2_crypto_driver);
2251 2249
2252 if (!err) { 2250 if (!err) {
2253 err = of_register_platform_driver(&n2_mau_driver); 2251 err = platform_driver_register(&n2_mau_driver);
2254 if (err) 2252 if (err)
2255 of_unregister_platform_driver(&n2_crypto_driver); 2253 platform_driver_unregister(&n2_crypto_driver);
2256 } 2254 }
2257 return err; 2255 return err;
2258} 2256}
2259 2257
2260static void __exit n2_exit(void) 2258static void __exit n2_exit(void)
2261{ 2259{
2262 of_unregister_platform_driver(&n2_mau_driver); 2260 platform_driver_unregister(&n2_mau_driver);
2263 of_unregister_platform_driver(&n2_crypto_driver); 2261 platform_driver_unregister(&n2_crypto_driver);
2264} 2262}
2265 2263
2266module_init(n2_init); 2264module_init(n2_init);
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index b879c3f5d7c0..854e2632f9a6 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,
2402 return t_alg; 2402 return t_alg;
2403} 2403}
2404 2404
2405static int talitos_probe(struct platform_device *ofdev, 2405static int talitos_probe(struct platform_device *ofdev)
2406 const struct of_device_id *match)
2407{ 2406{
2408 struct device *dev = &ofdev->dev; 2407 struct device *dev = &ofdev->dev;
2409 struct device_node *np = ofdev->dev.of_node; 2408 struct device_node *np = ofdev->dev.of_node;
@@ -2580,7 +2579,7 @@ static const struct of_device_id talitos_match[] = {
2580}; 2579};
2581MODULE_DEVICE_TABLE(of, talitos_match); 2580MODULE_DEVICE_TABLE(of, talitos_match);
2582 2581
2583static struct of_platform_driver talitos_driver = { 2582static struct platform_driver talitos_driver = {
2584 .driver = { 2583 .driver = {
2585 .name = "talitos", 2584 .name = "talitos",
2586 .owner = THIS_MODULE, 2585 .owner = THIS_MODULE,
@@ -2592,13 +2591,13 @@ static struct of_platform_driver talitos_driver = {
2592 2591
2593static int __init talitos_init(void) 2592static int __init talitos_init(void)
2594{ 2593{
2595 return of_register_platform_driver(&talitos_driver); 2594 return platform_driver_register(&talitos_driver);
2596} 2595}
2597module_init(talitos_init); 2596module_init(talitos_init);
2598 2597
2599static void __exit talitos_exit(void) 2598static void __exit talitos_exit(void)
2600{ 2599{
2601 of_unregister_platform_driver(&talitos_driver); 2600 platform_driver_unregister(&talitos_driver);
2602} 2601}
2603module_exit(talitos_exit); 2602module_exit(talitos_exit);
2604 2603
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 4de947a450fc..e3854a8f0de0 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)
1281 kfree(chan); 1281 kfree(chan);
1282} 1282}
1283 1283
1284static int __devinit fsldma_of_probe(struct platform_device *op, 1284static int __devinit fsldma_of_probe(struct platform_device *op)
1285 const struct of_device_id *match)
1286{ 1285{
1287 struct fsldma_device *fdev; 1286 struct fsldma_device *fdev;
1288 struct device_node *child; 1287 struct device_node *child;
@@ -1414,20 +1413,13 @@ static struct of_platform_driver fsldma_of_driver = {
1414 1413
1415static __init int fsldma_init(void) 1414static __init int fsldma_init(void)
1416{ 1415{
1417 int ret;
1418
1419 pr_info("Freescale Elo / Elo Plus DMA driver\n"); 1416 pr_info("Freescale Elo / Elo Plus DMA driver\n");
1420 1417 return platform_driver_register(&fsldma_of_driver);
1421 ret = of_register_platform_driver(&fsldma_of_driver);
1422 if (ret)
1423 pr_err("fsldma: failed to register platform driver\n");
1424
1425 return ret;
1426} 1418}
1427 1419
1428static void __exit fsldma_exit(void) 1420static void __exit fsldma_exit(void)
1429{ 1421{
1430 of_unregister_platform_driver(&fsldma_of_driver); 1422 platform_driver_unregister(&fsldma_of_driver);
1431} 1423}
1432 1424
1433subsys_initcall(fsldma_init); 1425subsys_initcall(fsldma_init);
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 59c270192ccc..4f95d31f5a20 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,
649 return &mdesc->desc; 649 return &mdesc->desc;
650} 650}
651 651
652static int __devinit mpc_dma_probe(struct platform_device *op, 652static int __devinit mpc_dma_probe(struct platform_device *op)
653 const struct of_device_id *match)
654{ 653{
655 struct device_node *dn = op->dev.of_node; 654 struct device_node *dn = op->dev.of_node;
656 struct device *dev = &op->dev; 655 struct device *dev = &op->dev;
@@ -827,7 +826,7 @@ static struct of_device_id mpc_dma_match[] = {
827 {}, 826 {},
828}; 827};
829 828
830static struct of_platform_driver mpc_dma_driver = { 829static struct platform_driver mpc_dma_driver = {
831 .probe = mpc_dma_probe, 830 .probe = mpc_dma_probe,
832 .remove = __devexit_p(mpc_dma_remove), 831 .remove = __devexit_p(mpc_dma_remove),
833 .driver = { 832 .driver = {
@@ -839,13 +838,13 @@ static struct of_platform_driver mpc_dma_driver = {
839 838
840static int __init mpc_dma_init(void) 839static int __init mpc_dma_init(void)
841{ 840{
842 return of_register_platform_driver(&mpc_dma_driver); 841 return platform_driver_register(&mpc_dma_driver);
843} 842}
844module_init(mpc_dma_init); 843module_init(mpc_dma_init);
845 844
846static void __exit mpc_dma_exit(void) 845static void __exit mpc_dma_exit(void)
847{ 846{
848 of_unregister_platform_driver(&mpc_dma_driver); 847 platform_driver_unregister(&mpc_dma_driver);
849} 848}
850module_exit(mpc_dma_exit); 849module_exit(mpc_dma_exit);
851 850
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index cef584533ee8..3b0247e74cc4 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,
4393/** 4393/**
4394 * ppc440spe_adma_probe - probe the asynch device 4394 * ppc440spe_adma_probe - probe the asynch device
4395 */ 4395 */
4396static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev, 4396static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev)
4397 const struct of_device_id *match)
4398{ 4397{
4399 struct device_node *np = ofdev->dev.of_node; 4398 struct device_node *np = ofdev->dev.of_node;
4400 struct resource res; 4399 struct resource res;
@@ -4944,7 +4943,7 @@ static const struct of_device_id ppc440spe_adma_of_match[] __devinitconst = {
4944}; 4943};
4945MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match); 4944MODULE_DEVICE_TABLE(of, ppc440spe_adma_of_match);
4946 4945
4947static struct of_platform_driver ppc440spe_adma_driver = { 4946static struct platform_driver ppc440spe_adma_driver = {
4948 .probe = ppc440spe_adma_probe, 4947 .probe = ppc440spe_adma_probe,
4949 .remove = __devexit_p(ppc440spe_adma_remove), 4948 .remove = __devexit_p(ppc440spe_adma_remove),
4950 .driver = { 4949 .driver = {
@@ -4962,7 +4961,7 @@ static __init int ppc440spe_adma_init(void)
4962 if (ret) 4961 if (ret)
4963 return ret; 4962 return ret;
4964 4963
4965 ret = of_register_platform_driver(&ppc440spe_adma_driver); 4964 ret = platform_driver_register(&ppc440spe_adma_driver);
4966 if (ret) { 4965 if (ret) {
4967 pr_err("%s: failed to register platform driver\n", 4966 pr_err("%s: failed to register platform driver\n",
4968 __func__); 4967 __func__);
@@ -4996,7 +4995,7 @@ out_dev:
4996 /* User will not be able to enable h/w RAID-6 */ 4995 /* User will not be able to enable h/w RAID-6 */
4997 pr_err("%s: failed to create RAID-6 driver interface\n", 4996 pr_err("%s: failed to create RAID-6 driver interface\n",
4998 __func__); 4997 __func__);
4999 of_unregister_platform_driver(&ppc440spe_adma_driver); 4998 platform_driver_unregister(&ppc440spe_adma_driver);
5000out_reg: 4999out_reg:
5001 dcr_unmap(ppc440spe_mq_dcr_host, ppc440spe_mq_dcr_len); 5000 dcr_unmap(ppc440spe_mq_dcr_host, ppc440spe_mq_dcr_len);
5002 kfree(ppc440spe_dma_fifo_buf); 5001 kfree(ppc440spe_dma_fifo_buf);
@@ -5011,7 +5010,7 @@ static void __exit ppc440spe_adma_exit(void)
5011 &driver_attr_enable); 5010 &driver_attr_enable);
5012 driver_remove_file(&ppc440spe_adma_driver.driver, 5011 driver_remove_file(&ppc440spe_adma_driver.driver,
5013 &driver_attr_devices); 5012 &driver_attr_devices);
5014 of_unregister_platform_driver(&ppc440spe_adma_driver); 5013 platform_driver_unregister(&ppc440spe_adma_driver);
5015 dcr_unmap(ppc440spe_mq_dcr_host, ppc440spe_mq_dcr_len); 5014 dcr_unmap(ppc440spe_mq_dcr_host, ppc440spe_mq_dcr_len);
5016 kfree(ppc440spe_dma_fifo_buf); 5015 kfree(ppc440spe_dma_fifo_buf);
5017} 5016}
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index b123bb308a4a..ffb5ad080bee 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)
200 return IRQ_HANDLED; 200 return IRQ_HANDLED;
201} 201}
202 202
203static int __devinit mpc85xx_pci_err_probe(struct platform_device *op, 203static int __devinit mpc85xx_pci_err_probe(struct platform_device *op)
204 const struct of_device_id *match)
205{ 204{
206 struct edac_pci_ctl_info *pci; 205 struct edac_pci_ctl_info *pci;
207 struct mpc85xx_pci_pdata *pdata; 206 struct mpc85xx_pci_pdata *pdata;
@@ -338,7 +337,7 @@ static struct of_device_id mpc85xx_pci_err_of_match[] = {
338}; 337};
339MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match); 338MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
340 339
341static struct of_platform_driver mpc85xx_pci_err_driver = { 340static struct platform_driver mpc85xx_pci_err_driver = {
342 .probe = mpc85xx_pci_err_probe, 341 .probe = mpc85xx_pci_err_probe,
343 .remove = __devexit_p(mpc85xx_pci_err_remove), 342 .remove = __devexit_p(mpc85xx_pci_err_remove),
344 .driver = { 343 .driver = {
@@ -503,8 +502,7 @@ static irqreturn_t mpc85xx_l2_isr(int irq, void *dev_id)
503 return IRQ_HANDLED; 502 return IRQ_HANDLED;
504} 503}
505 504
506static int __devinit mpc85xx_l2_err_probe(struct platform_device *op, 505static int __devinit mpc85xx_l2_err_probe(struct platform_device *op)
507 const struct of_device_id *match)
508{ 506{
509 struct edac_device_ctl_info *edac_dev; 507 struct edac_device_ctl_info *edac_dev;
510 struct mpc85xx_l2_pdata *pdata; 508 struct mpc85xx_l2_pdata *pdata;
@@ -656,7 +654,7 @@ static struct of_device_id mpc85xx_l2_err_of_match[] = {
656}; 654};
657MODULE_DEVICE_TABLE(of, mpc85xx_l2_err_of_match); 655MODULE_DEVICE_TABLE(of, mpc85xx_l2_err_of_match);
658 656
659static struct of_platform_driver mpc85xx_l2_err_driver = { 657static struct platform_driver mpc85xx_l2_err_driver = {
660 .probe = mpc85xx_l2_err_probe, 658 .probe = mpc85xx_l2_err_probe,
661 .remove = mpc85xx_l2_err_remove, 659 .remove = mpc85xx_l2_err_remove,
662 .driver = { 660 .driver = {
@@ -956,8 +954,7 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci)
956 } 954 }
957} 955}
958 956
959static int __devinit mpc85xx_mc_err_probe(struct platform_device *op, 957static int __devinit mpc85xx_mc_err_probe(struct platform_device *op)
960 const struct of_device_id *match)
961{ 958{
962 struct mem_ctl_info *mci; 959 struct mem_ctl_info *mci;
963 struct mpc85xx_mc_pdata *pdata; 960 struct mpc85xx_mc_pdata *pdata;
@@ -1136,7 +1133,7 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = {
1136}; 1133};
1137MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match); 1134MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match);
1138 1135
1139static struct of_platform_driver mpc85xx_mc_err_driver = { 1136static struct platform_driver mpc85xx_mc_err_driver = {
1140 .probe = mpc85xx_mc_err_probe, 1137 .probe = mpc85xx_mc_err_probe,
1141 .remove = mpc85xx_mc_err_remove, 1138 .remove = mpc85xx_mc_err_remove,
1142 .driver = { 1139 .driver = {
@@ -1171,16 +1168,16 @@ static int __init mpc85xx_mc_init(void)
1171 break; 1168 break;
1172 } 1169 }
1173 1170
1174 res = of_register_platform_driver(&mpc85xx_mc_err_driver); 1171 res = platform_driver_register(&mpc85xx_mc_err_driver);
1175 if (res) 1172 if (res)
1176 printk(KERN_WARNING EDAC_MOD_STR "MC fails to register\n"); 1173 printk(KERN_WARNING EDAC_MOD_STR "MC fails to register\n");
1177 1174
1178 res = of_register_platform_driver(&mpc85xx_l2_err_driver); 1175 res = platform_driver_register(&mpc85xx_l2_err_driver);
1179 if (res) 1176 if (res)
1180 printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n"); 1177 printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n");
1181 1178
1182#ifdef CONFIG_PCI 1179#ifdef CONFIG_PCI
1183 res = of_register_platform_driver(&mpc85xx_pci_err_driver); 1180 res = platform_driver_register(&mpc85xx_pci_err_driver);
1184 if (res) 1181 if (res)
1185 printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n"); 1182 printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n");
1186#endif 1183#endif
@@ -1212,10 +1209,10 @@ static void __exit mpc85xx_mc_exit(void)
1212 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); 1209 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
1213#endif 1210#endif
1214#ifdef CONFIG_PCI 1211#ifdef CONFIG_PCI
1215 of_unregister_platform_driver(&mpc85xx_pci_err_driver); 1212 platform_driver_unregister(&mpc85xx_pci_err_driver);
1216#endif 1213#endif
1217 of_unregister_platform_driver(&mpc85xx_l2_err_driver); 1214 platform_driver_unregister(&mpc85xx_l2_err_driver);
1218 of_unregister_platform_driver(&mpc85xx_mc_err_driver); 1215 platform_driver_unregister(&mpc85xx_mc_err_driver);
1219} 1216}
1220 1217
1221module_exit(mpc85xx_mc_exit); 1218module_exit(mpc85xx_mc_exit);
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index b9f0c20df1aa..c1f0045ceb8e 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -184,8 +184,7 @@ struct ppc4xx_ecc_status {
184 184
185/* Function Prototypes */ 185/* Function Prototypes */
186 186
187static int ppc4xx_edac_probe(struct platform_device *device, 187static int ppc4xx_edac_probe(struct platform_device *device)
188 const struct of_device_id *device_id);
189static int ppc4xx_edac_remove(struct platform_device *device); 188static int ppc4xx_edac_remove(struct platform_device *device);
190 189
191/* Global Variables */ 190/* Global Variables */
@@ -201,7 +200,7 @@ static struct of_device_id ppc4xx_edac_match[] = {
201 { } 200 { }
202}; 201};
203 202
204static struct of_platform_driver ppc4xx_edac_driver = { 203static struct platform_driver ppc4xx_edac_driver = {
205 .probe = ppc4xx_edac_probe, 204 .probe = ppc4xx_edac_probe,
206 .remove = ppc4xx_edac_remove, 205 .remove = ppc4xx_edac_remove,
207 .driver = { 206 .driver = {
@@ -997,9 +996,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
997 * initialized. 996 * initialized.
998 * @op: A pointer to the OpenFirmware device tree node associated 997 * @op: A pointer to the OpenFirmware device tree node associated
999 * with the controller this EDAC instance is bound to. 998 * with the controller this EDAC instance is bound to.
1000 * @match: A pointer to the OpenFirmware device tree match
1001 * information associated with the controller this EDAC instance
1002 * is bound to.
1003 * @dcr_host: A pointer to the DCR data containing the DCR mapping 999 * @dcr_host: A pointer to the DCR data containing the DCR mapping
1004 * for this controller instance. 1000 * for this controller instance.
1005 * @mcopt1: The 32-bit Memory Controller Option 1 register value 1001 * @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)
1015static int __devinit 1011static int __devinit
1016ppc4xx_edac_mc_init(struct mem_ctl_info *mci, 1012ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
1017 struct platform_device *op, 1013 struct platform_device *op,
1018 const struct of_device_id *match,
1019 const dcr_host_t *dcr_host, 1014 const dcr_host_t *dcr_host,
1020 u32 mcopt1) 1015 u32 mcopt1)
1021{ 1016{
@@ -1024,7 +1019,7 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
1024 struct ppc4xx_edac_pdata *pdata = NULL; 1019 struct ppc4xx_edac_pdata *pdata = NULL;
1025 const struct device_node *np = op->dev.of_node; 1020 const struct device_node *np = op->dev.of_node;
1026 1021
1027 if (match == NULL) 1022 if (op->dev.of_match == NULL)
1028 return -EINVAL; 1023 return -EINVAL;
1029 1024
1030 /* Initial driver pointers and private data */ 1025 /* Initial driver pointers and private data */
@@ -1227,9 +1222,6 @@ ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host)
1227 * ppc4xx_edac_probe - check controller and bind driver 1222 * ppc4xx_edac_probe - check controller and bind driver
1228 * @op: A pointer to the OpenFirmware device tree node associated 1223 * @op: A pointer to the OpenFirmware device tree node associated
1229 * with the controller being probed for driver binding. 1224 * with the controller being probed for driver binding.
1230 * @match: A pointer to the OpenFirmware device tree match
1231 * information associated with the controller being probed
1232 * for driver binding.
1233 * 1225 *
1234 * This routine probes a specific ibm,sdram-4xx-ddr2 controller 1226 * This routine probes a specific ibm,sdram-4xx-ddr2 controller
1235 * instance for binding with the driver. 1227 * instance for binding with the driver.
@@ -1237,8 +1229,7 @@ ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host)
1237 * Returns 0 if the controller instance was successfully bound to the 1229 * Returns 0 if the controller instance was successfully bound to the
1238 * driver; otherwise, < 0 on error. 1230 * driver; otherwise, < 0 on error.
1239 */ 1231 */
1240static int __devinit 1232static int __devinit ppc4xx_edac_probe(struct platform_device *op)
1241ppc4xx_edac_probe(struct platform_device *op, const struct of_device_id *match)
1242{ 1233{
1243 int status = 0; 1234 int status = 0;
1244 u32 mcopt1, memcheck; 1235 u32 mcopt1, memcheck;
@@ -1304,7 +1295,7 @@ ppc4xx_edac_probe(struct platform_device *op, const struct of_device_id *match)
1304 goto done; 1295 goto done;
1305 } 1296 }
1306 1297
1307 status = ppc4xx_edac_mc_init(mci, op, match, &dcr_host, mcopt1); 1298 status = ppc4xx_edac_mc_init(mci, op, &dcr_host, mcopt1);
1308 1299
1309 if (status) { 1300 if (status) {
1310 ppc4xx_edac_mc_printk(KERN_ERR, mci, 1301 ppc4xx_edac_mc_printk(KERN_ERR, mci,
@@ -1421,7 +1412,7 @@ ppc4xx_edac_init(void)
1421 1412
1422 ppc4xx_edac_opstate_init(); 1413 ppc4xx_edac_opstate_init();
1423 1414
1424 return of_register_platform_driver(&ppc4xx_edac_driver); 1415 return platform_driver_register(&ppc4xx_edac_driver);
1425} 1416}
1426 1417
1427/** 1418/**
@@ -1434,7 +1425,7 @@ ppc4xx_edac_init(void)
1434static void __exit 1425static void __exit
1435ppc4xx_edac_exit(void) 1426ppc4xx_edac_exit(void)
1436{ 1427{
1437 of_unregister_platform_driver(&ppc4xx_edac_driver); 1428 platform_driver_unregister(&ppc4xx_edac_driver);
1438} 1429}
1439 1430
1440module_init(ppc4xx_edac_init); 1431module_init(ppc4xx_edac_init);
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c
index d863e13a50b8..1f36c635d933 100644
--- a/drivers/hwmon/ultra45_env.c
+++ b/drivers/hwmon/ultra45_env.c
@@ -234,8 +234,7 @@ static const struct attribute_group env_group = {
234 .attrs = env_attributes, 234 .attrs = env_attributes,
235}; 235};
236 236
237static int __devinit env_probe(struct platform_device *op, 237static int __devinit env_probe(struct platform_device *op)
238 const struct of_device_id *match)
239{ 238{
240 struct env *p = kzalloc(sizeof(*p), GFP_KERNEL); 239 struct env *p = kzalloc(sizeof(*p), GFP_KERNEL);
241 int err = -ENOMEM; 240 int err = -ENOMEM;
@@ -299,7 +298,7 @@ static const struct of_device_id env_match[] = {
299}; 298};
300MODULE_DEVICE_TABLE(of, env_match); 299MODULE_DEVICE_TABLE(of, env_match);
301 300
302static struct of_platform_driver env_driver = { 301static struct platform_driver env_driver = {
303 .driver = { 302 .driver = {
304 .name = "ultra45_env", 303 .name = "ultra45_env",
305 .owner = THIS_MODULE, 304 .owner = THIS_MODULE,
@@ -311,12 +310,12 @@ static struct of_platform_driver env_driver = {
311 310
312static int __init env_init(void) 311static int __init env_init(void)
313{ 312{
314 return of_register_platform_driver(&env_driver); 313 return platform_driver_register(&env_driver);
315} 314}
316 315
317static void __exit env_exit(void) 316static void __exit env_exit(void)
318{ 317{
319 of_unregister_platform_driver(&env_driver); 318 platform_driver_unregister(&env_driver);
320} 319}
321 320
322module_init(env_init); 321module_init(env_init);
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index f2de3be35df3..3a20961bef1e 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)
634 cpm_muram_free(cpm->i2c_addr); 634 cpm_muram_free(cpm->i2c_addr);
635} 635}
636 636
637static int __devinit cpm_i2c_probe(struct platform_device *ofdev, 637static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
638 const struct of_device_id *match)
639{ 638{
640 int result, len; 639 int result, len;
641 struct cpm_i2c *cpm; 640 struct cpm_i2c *cpm;
@@ -718,7 +717,7 @@ static const struct of_device_id cpm_i2c_match[] = {
718 717
719MODULE_DEVICE_TABLE(of, cpm_i2c_match); 718MODULE_DEVICE_TABLE(of, cpm_i2c_match);
720 719
721static struct of_platform_driver cpm_i2c_driver = { 720static struct platform_driver cpm_i2c_driver = {
722 .probe = cpm_i2c_probe, 721 .probe = cpm_i2c_probe,
723 .remove = __devexit_p(cpm_i2c_remove), 722 .remove = __devexit_p(cpm_i2c_remove),
724 .driver = { 723 .driver = {
@@ -730,12 +729,12 @@ static struct of_platform_driver cpm_i2c_driver = {
730 729
731static int __init cpm_i2c_init(void) 730static int __init cpm_i2c_init(void)
732{ 731{
733 return of_register_platform_driver(&cpm_i2c_driver); 732 return platform_driver_register(&cpm_i2c_driver);
734} 733}
735 734
736static void __exit cpm_i2c_exit(void) 735static void __exit cpm_i2c_exit(void)
737{ 736{
738 of_unregister_platform_driver(&cpm_i2c_driver); 737 platform_driver_unregister(&cpm_i2c_driver);
739} 738}
740 739
741module_init(cpm_i2c_init); 740module_init(cpm_i2c_init);
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 6e3c38240336..e4f88dca99b5 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,
691/* 691/*
692 * Register single IIC interface 692 * Register single IIC interface
693 */ 693 */
694static int __devinit iic_probe(struct platform_device *ofdev, 694static int __devinit iic_probe(struct platform_device *ofdev)
695 const struct of_device_id *match)
696{ 695{
697 struct device_node *np = ofdev->dev.of_node; 696 struct device_node *np = ofdev->dev.of_node;
698 struct ibm_iic_private *dev; 697 struct ibm_iic_private *dev;
@@ -806,7 +805,7 @@ static const struct of_device_id ibm_iic_match[] = {
806 {} 805 {}
807}; 806};
808 807
809static struct of_platform_driver ibm_iic_driver = { 808static struct platform_driver ibm_iic_driver = {
810 .driver = { 809 .driver = {
811 .name = "ibm-iic", 810 .name = "ibm-iic",
812 .owner = THIS_MODULE, 811 .owner = THIS_MODULE,
@@ -818,12 +817,12 @@ static struct of_platform_driver ibm_iic_driver = {
818 817
819static int __init iic_init(void) 818static int __init iic_init(void)
820{ 819{
821 return of_register_platform_driver(&ibm_iic_driver); 820 return platform_driver_register(&ibm_iic_driver);
822} 821}
823 822
824static void __exit iic_exit(void) 823static void __exit iic_exit(void)
825{ 824{
826 of_unregister_platform_driver(&ibm_iic_driver); 825 platform_driver_unregister(&ibm_iic_driver);
827} 826}
828 827
829module_init(iic_init); 828module_init(iic_init);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b74e6dc6886c..75b984c519ac 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 = {
560 .timeout = HZ, 560 .timeout = HZ,
561}; 561};
562 562
563static int __devinit fsl_i2c_probe(struct platform_device *op, 563static int __devinit fsl_i2c_probe(struct platform_device *op)
564 const struct of_device_id *match)
565{ 564{
566 struct mpc_i2c *i2c; 565 struct mpc_i2c *i2c;
567 const u32 *prop; 566 const u32 *prop;
@@ -569,6 +568,9 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
569 int result = 0; 568 int result = 0;
570 int plen; 569 int plen;
571 570
571 if (!op->dev.of_match)
572 return -EINVAL;
573
572 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); 574 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
573 if (!i2c) 575 if (!i2c)
574 return -ENOMEM; 576 return -ENOMEM;
@@ -603,8 +605,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
603 clock = *prop; 605 clock = *prop;
604 } 606 }
605 607
606 if (match->data) { 608 if (op->dev.of_match->data) {
607 struct mpc_i2c_data *data = match->data; 609 struct mpc_i2c_data *data = op->dev.of_match->data;
608 data->setup(op->dev.of_node, i2c, clock, data->prescaler); 610 data->setup(op->dev.of_node, i2c, clock, data->prescaler);
609 } else { 611 } else {
610 /* Backwards compatibility */ 612 /* Backwards compatibility */
@@ -700,7 +702,7 @@ static const struct of_device_id mpc_i2c_of_match[] = {
700MODULE_DEVICE_TABLE(of, mpc_i2c_of_match); 702MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
701 703
702/* Structure for a device driver */ 704/* Structure for a device driver */
703static struct of_platform_driver mpc_i2c_driver = { 705static struct platform_driver mpc_i2c_driver = {
704 .probe = fsl_i2c_probe, 706 .probe = fsl_i2c_probe,
705 .remove = __devexit_p(fsl_i2c_remove), 707 .remove = __devexit_p(fsl_i2c_remove),
706 .driver = { 708 .driver = {
@@ -712,18 +714,12 @@ static struct of_platform_driver mpc_i2c_driver = {
712 714
713static int __init fsl_i2c_init(void) 715static int __init fsl_i2c_init(void)
714{ 716{
715 int rv; 717 return platform_driver_register(&mpc_i2c_driver);
716
717 rv = of_register_platform_driver(&mpc_i2c_driver);
718 if (rv)
719 printk(KERN_ERR DRV_NAME
720 " of_register_platform_driver failed (%i)\n", rv);
721 return rv;
722} 718}
723 719
724static void __exit fsl_i2c_exit(void) 720static void __exit fsl_i2c_exit(void)
725{ 721{
726 of_unregister_platform_driver(&mpc_i2c_driver); 722 platform_driver_unregister(&mpc_i2c_driver);
727} 723}
728 724
729module_init(fsl_i2c_init); 725module_init(fsl_i2c_init);
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index 8e130bf7d32b..0122f5351577 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)
173 return 0; 173 return 0;
174} 174}
175 175
176static int sparcspkr_shutdown(struct platform_device *dev) 176static void sparcspkr_shutdown(struct platform_device *dev)
177{ 177{
178 struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); 178 struct sparcspkr_state *state = dev_get_drvdata(&dev->dev);
179 struct input_dev *input_dev = state->input_dev; 179 struct input_dev *input_dev = state->input_dev;
180 180
181 /* turn off the speaker */ 181 /* turn off the speaker */
182 state->event(input_dev, EV_SND, SND_BELL, 0); 182 state->event(input_dev, EV_SND, SND_BELL, 0);
183
184 return 0;
185} 183}
186 184
187static int __devinit bbc_beep_probe(struct platform_device *op, const struct of_device_id *match) 185static int __devinit bbc_beep_probe(struct platform_device *op)
188{ 186{
189 struct sparcspkr_state *state; 187 struct sparcspkr_state *state;
190 struct bbc_beep_info *info; 188 struct bbc_beep_info *info;
@@ -258,7 +256,7 @@ static const struct of_device_id bbc_beep_match[] = {
258 {}, 256 {},
259}; 257};
260 258
261static struct of_platform_driver bbc_beep_driver = { 259static struct platform_driver bbc_beep_driver = {
262 .driver = { 260 .driver = {
263 .name = "bbcbeep", 261 .name = "bbcbeep",
264 .owner = THIS_MODULE, 262 .owner = THIS_MODULE,
@@ -269,7 +267,7 @@ static struct of_platform_driver bbc_beep_driver = {
269 .shutdown = sparcspkr_shutdown, 267 .shutdown = sparcspkr_shutdown,
270}; 268};
271 269
272static int __devinit grover_beep_probe(struct platform_device *op, const struct of_device_id *match) 270static int __devinit grover_beep_probe(struct platform_device *op)
273{ 271{
274 struct sparcspkr_state *state; 272 struct sparcspkr_state *state;
275 struct grover_beep_info *info; 273 struct grover_beep_info *info;
@@ -340,7 +338,7 @@ static const struct of_device_id grover_beep_match[] = {
340 {}, 338 {},
341}; 339};
342 340
343static struct of_platform_driver grover_beep_driver = { 341static struct platform_driver grover_beep_driver = {
344 .driver = { 342 .driver = {
345 .name = "groverbeep", 343 .name = "groverbeep",
346 .owner = THIS_MODULE, 344 .owner = THIS_MODULE,
@@ -353,12 +351,12 @@ static struct of_platform_driver grover_beep_driver = {
353 351
354static int __init sparcspkr_init(void) 352static int __init sparcspkr_init(void)
355{ 353{
356 int err = of_register_platform_driver(&bbc_beep_driver); 354 int err = platform_driver_register(&bbc_beep_driver);
357 355
358 if (!err) { 356 if (!err) {
359 err = of_register_platform_driver(&grover_beep_driver); 357 err = platform_driver_register(&grover_beep_driver);
360 if (err) 358 if (err)
361 of_unregister_platform_driver(&bbc_beep_driver); 359 platform_driver_unregister(&bbc_beep_driver);
362 } 360 }
363 361
364 return err; 362 return err;
@@ -366,8 +364,8 @@ static int __init sparcspkr_init(void)
366 364
367static void __exit sparcspkr_exit(void) 365static void __exit sparcspkr_exit(void)
368{ 366{
369 of_unregister_platform_driver(&bbc_beep_driver); 367 platform_driver_unregister(&bbc_beep_driver);
370 of_unregister_platform_driver(&grover_beep_driver); 368 platform_driver_unregister(&grover_beep_driver);
371} 369}
372 370
373module_init(sparcspkr_init); 371module_init(sparcspkr_init);
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c
index 7998560a1904..d363dc4571a3 100644
--- a/drivers/input/serio/altera_ps2.c
+++ b/drivers/input/serio/altera_ps2.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/of.h>
22 23
23#define DRV_NAME "altera_ps2" 24#define DRV_NAME "altera_ps2"
24 25
@@ -173,6 +174,16 @@ static int __devexit altera_ps2_remove(struct platform_device *pdev)
173 return 0; 174 return 0;
174} 175}
175 176
177#ifdef CONFIG_OF
178static const struct of_device_id altera_ps2_match[] = {
179 { .compatible = "ALTR,ps2-1.0", },
180 {},
181};
182MODULE_DEVICE_TABLE(of, altera_ps2_match);
183#else /* CONFIG_OF */
184#define altera_ps2_match NULL
185#endif /* CONFIG_OF */
186
176/* 187/*
177 * Our device driver structure 188 * Our device driver structure
178 */ 189 */
@@ -182,6 +193,7 @@ static struct platform_driver altera_ps2_driver = {
182 .driver = { 193 .driver = {
183 .name = DRV_NAME, 194 .name = DRV_NAME,
184 .owner = THIS_MODULE, 195 .owner = THIS_MODULE,
196 .of_match_table = altera_ps2_match,
185 }, 197 },
186}; 198};
187 199
@@ -189,13 +201,12 @@ static int __init altera_ps2_init(void)
189{ 201{
190 return platform_driver_register(&altera_ps2_driver); 202 return platform_driver_register(&altera_ps2_driver);
191} 203}
204module_init(altera_ps2_init);
192 205
193static void __exit altera_ps2_exit(void) 206static void __exit altera_ps2_exit(void)
194{ 207{
195 platform_driver_unregister(&altera_ps2_driver); 208 platform_driver_unregister(&altera_ps2_driver);
196} 209}
197
198module_init(altera_ps2_init);
199module_exit(altera_ps2_exit); 210module_exit(altera_ps2_exit);
200 211
201MODULE_DESCRIPTION("Altera University Program PS2 controller driver"); 212MODULE_DESCRIPTION("Altera University Program PS2 controller driver");
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index c5cc4508d6df..395a9af3adcd 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)
49#define OBP_PS2MS_NAME1 "kdmouse" 49#define OBP_PS2MS_NAME1 "kdmouse"
50#define OBP_PS2MS_NAME2 "mouse" 50#define OBP_PS2MS_NAME2 "mouse"
51 51
52static int __devinit sparc_i8042_probe(struct platform_device *op, const struct of_device_id *match) 52static int __devinit sparc_i8042_probe(struct platform_device *op)
53{ 53{
54 struct device_node *dp = op->dev.of_node; 54 struct device_node *dp = op->dev.of_node;
55 55
@@ -95,7 +95,7 @@ static const struct of_device_id sparc_i8042_match[] = {
95}; 95};
96MODULE_DEVICE_TABLE(of, sparc_i8042_match); 96MODULE_DEVICE_TABLE(of, sparc_i8042_match);
97 97
98static struct of_platform_driver sparc_i8042_driver = { 98static struct platform_driver sparc_i8042_driver = {
99 .driver = { 99 .driver = {
100 .name = "i8042", 100 .name = "i8042",
101 .owner = THIS_MODULE, 101 .owner = THIS_MODULE,
@@ -116,7 +116,7 @@ static int __init i8042_platform_init(void)
116 if (!kbd_iobase) 116 if (!kbd_iobase)
117 return -ENODEV; 117 return -ENODEV;
118 } else { 118 } else {
119 int err = of_register_platform_driver(&sparc_i8042_driver); 119 int err = platform_driver_register(&sparc_i8042_driver);
120 if (err) 120 if (err)
121 return err; 121 return err;
122 122
@@ -140,7 +140,7 @@ static inline void i8042_platform_exit(void)
140 struct device_node *root = of_find_node_by_path("/"); 140 struct device_node *root = of_find_node_by_path("/");
141 141
142 if (strcmp(root->name, "SUNW,JavaStation-1")) 142 if (strcmp(root->name, "SUNW,JavaStation-1"))
143 of_unregister_platform_driver(&sparc_i8042_driver); 143 platform_driver_unregister(&sparc_i8042_driver);
144} 144}
145 145
146#else /* !CONFIG_PCI */ 146#else /* !CONFIG_PCI */
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index bb14449fb022..7540bafc95cf 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)
232 * It returns 0, if the driver is bound to the PS/2 device, or a negative 232 * It returns 0, if the driver is bound to the PS/2 device, or a negative
233 * value if there is an error. 233 * value if there is an error.
234 */ 234 */
235static int __devinit xps2_of_probe(struct platform_device *ofdev, 235static int __devinit xps2_of_probe(struct platform_device *ofdev)
236 const struct of_device_id *match)
237{ 236{
238 struct resource r_irq; /* Interrupt resources */ 237 struct resource r_irq; /* Interrupt resources */
239 struct resource r_mem; /* IO mem resources */ 238 struct resource r_mem; /* IO mem resources */
@@ -361,7 +360,7 @@ static const struct of_device_id xps2_of_match[] __devinitconst = {
361}; 360};
362MODULE_DEVICE_TABLE(of, xps2_of_match); 361MODULE_DEVICE_TABLE(of, xps2_of_match);
363 362
364static struct of_platform_driver xps2_of_driver = { 363static struct platform_driver xps2_of_driver = {
365 .driver = { 364 .driver = {
366 .name = DRIVER_NAME, 365 .name = DRIVER_NAME,
367 .owner = THIS_MODULE, 366 .owner = THIS_MODULE,
@@ -373,12 +372,12 @@ static struct of_platform_driver xps2_of_driver = {
373 372
374static int __init xps2_init(void) 373static int __init xps2_init(void)
375{ 374{
376 return of_register_platform_driver(&xps2_of_driver); 375 return platform_driver_register(&xps2_of_driver);
377} 376}
378 377
379static void __exit xps2_cleanup(void) 378static void __exit xps2_cleanup(void)
380{ 379{
381 of_unregister_platform_driver(&xps2_of_driver); 380 platform_driver_unregister(&xps2_of_driver);
382} 381}
383 382
384module_init(xps2_init); 383module_init(xps2_init);
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 4d9fa38d9ff6..b0480c8fbcbf 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -14,6 +14,8 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/leds.h> 16#include <linux/leds.h>
17#include <linux/of_platform.h>
18#include <linux/of_gpio.h>
17#include <linux/slab.h> 19#include <linux/slab.h>
18#include <linux/workqueue.h> 20#include <linux/workqueue.h>
19 21
@@ -151,96 +153,34 @@ static void delete_gpio_led(struct gpio_led_data *led)
151 gpio_free(led->gpio); 153 gpio_free(led->gpio);
152} 154}
153 155
154#ifdef CONFIG_LEDS_GPIO_PLATFORM 156struct gpio_leds_priv {
155static int __devinit gpio_led_probe(struct platform_device *pdev) 157 int num_leds;
156{ 158 struct gpio_led_data leds[];
157 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 159};
158 struct gpio_led_data *leds_data;
159 int i, ret = 0;
160
161 if (!pdata)
162 return -EBUSY;
163
164 leds_data = kzalloc(sizeof(struct gpio_led_data) * pdata->num_leds,
165 GFP_KERNEL);
166 if (!leds_data)
167 return -ENOMEM;
168
169 for (i = 0; i < pdata->num_leds; i++) {
170 ret = create_gpio_led(&pdata->leds[i], &leds_data[i],
171 &pdev->dev, pdata->gpio_blink_set);
172 if (ret < 0)
173 goto err;
174 }
175
176 platform_set_drvdata(pdev, leds_data);
177
178 return 0;
179
180err:
181 for (i = i - 1; i >= 0; i--)
182 delete_gpio_led(&leds_data[i]);
183
184 kfree(leds_data);
185
186 return ret;
187}
188 160
189static int __devexit gpio_led_remove(struct platform_device *pdev) 161static inline int sizeof_gpio_leds_priv(int num_leds)
190{ 162{
191 int i; 163 return sizeof(struct gpio_leds_priv) +
192 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 164 (sizeof(struct gpio_led_data) * num_leds);
193 struct gpio_led_data *leds_data;
194
195 leds_data = platform_get_drvdata(pdev);
196
197 for (i = 0; i < pdata->num_leds; i++)
198 delete_gpio_led(&leds_data[i]);
199
200 kfree(leds_data);
201
202 return 0;
203} 165}
204 166
205static struct platform_driver gpio_led_driver = {
206 .probe = gpio_led_probe,
207 .remove = __devexit_p(gpio_led_remove),
208 .driver = {
209 .name = "leds-gpio",
210 .owner = THIS_MODULE,
211 },
212};
213
214MODULE_ALIAS("platform:leds-gpio");
215#endif /* CONFIG_LEDS_GPIO_PLATFORM */
216
217/* Code to create from OpenFirmware platform devices */ 167/* Code to create from OpenFirmware platform devices */
218#ifdef CONFIG_LEDS_GPIO_OF 168#ifdef CONFIG_LEDS_GPIO_OF
219#include <linux/of_platform.h> 169static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_device *pdev)
220#include <linux/of_gpio.h>
221
222struct gpio_led_of_platform_data {
223 int num_leds;
224 struct gpio_led_data led_data[];
225};
226
227static int __devinit of_gpio_leds_probe(struct platform_device *ofdev,
228 const struct of_device_id *match)
229{ 170{
230 struct device_node *np = ofdev->dev.of_node, *child; 171 struct device_node *np = pdev->dev.of_node, *child;
231 struct gpio_led_of_platform_data *pdata; 172 struct gpio_leds_priv *priv;
232 int count = 0, ret; 173 int count = 0, ret;
233 174
234 /* count LEDs defined by this device, so we know how much to allocate */ 175 /* count LEDs in this device, so we know how much to allocate */
235 for_each_child_of_node(np, child) 176 for_each_child_of_node(np, child)
236 count++; 177 count++;
237 if (!count) 178 if (!count)
238 return 0; /* or ENODEV? */ 179 return NULL;
239 180
240 pdata = kzalloc(sizeof(*pdata) + sizeof(struct gpio_led_data) * count, 181 priv = kzalloc(sizeof_gpio_leds_priv(count), GFP_KERNEL);
241 GFP_KERNEL); 182 if (!priv)
242 if (!pdata) 183 return NULL;
243 return -ENOMEM;
244 184
245 for_each_child_of_node(np, child) { 185 for_each_child_of_node(np, child) {
246 struct gpio_led led = {}; 186 struct gpio_led led = {};
@@ -256,92 +196,112 @@ static int __devinit of_gpio_leds_probe(struct platform_device *ofdev,
256 if (state) { 196 if (state) {
257 if (!strcmp(state, "keep")) 197 if (!strcmp(state, "keep"))
258 led.default_state = LEDS_GPIO_DEFSTATE_KEEP; 198 led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
259 else if(!strcmp(state, "on")) 199 else if (!strcmp(state, "on"))
260 led.default_state = LEDS_GPIO_DEFSTATE_ON; 200 led.default_state = LEDS_GPIO_DEFSTATE_ON;
261 else 201 else
262 led.default_state = LEDS_GPIO_DEFSTATE_OFF; 202 led.default_state = LEDS_GPIO_DEFSTATE_OFF;
263 } 203 }
264 204
265 ret = create_gpio_led(&led, &pdata->led_data[pdata->num_leds++], 205 ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
266 &ofdev->dev, NULL); 206 &pdev->dev, NULL);
267 if (ret < 0) { 207 if (ret < 0) {
268 of_node_put(child); 208 of_node_put(child);
269 goto err; 209 goto err;
270 } 210 }
271 } 211 }
272 212
273 dev_set_drvdata(&ofdev->dev, pdata); 213 return priv;
274
275 return 0;
276 214
277err: 215err:
278 for (count = pdata->num_leds - 2; count >= 0; count--) 216 for (count = priv->num_leds - 2; count >= 0; count--)
279 delete_gpio_led(&pdata->led_data[count]); 217 delete_gpio_led(&priv->leds[count]);
218 kfree(priv);
219 return NULL;
220}
280 221
281 kfree(pdata); 222static const struct of_device_id of_gpio_leds_match[] = {
223 { .compatible = "gpio-leds", },
224 {},
225};
226#else
227static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_device *pdev)
228{
229 return NULL;
230}
231#define of_gpio_leds_match NULL
232#endif
282 233
283 return ret; 234
235static int __devinit gpio_led_probe(struct platform_device *pdev)
236{
237 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
238 struct gpio_leds_priv *priv;
239 int i, ret = 0;
240
241 if (pdata && pdata->num_leds) {
242 priv = kzalloc(sizeof_gpio_leds_priv(pdata->num_leds),
243 GFP_KERNEL);
244 if (!priv)
245 return -ENOMEM;
246
247 priv->num_leds = pdata->num_leds;
248 for (i = 0; i < priv->num_leds; i++) {
249 ret = create_gpio_led(&pdata->leds[i],
250 &priv->leds[i],
251 &pdev->dev, pdata->gpio_blink_set);
252 if (ret < 0) {
253 /* On failure: unwind the led creations */
254 for (i = i - 1; i >= 0; i--)
255 delete_gpio_led(&priv->leds[i]);
256 kfree(priv);
257 return ret;
258 }
259 }
260 } else {
261 priv = gpio_leds_create_of(pdev);
262 if (!priv)
263 return -ENODEV;
264 }
265
266 platform_set_drvdata(pdev, priv);
267
268 return 0;
284} 269}
285 270
286static int __devexit of_gpio_leds_remove(struct platform_device *ofdev) 271static int __devexit gpio_led_remove(struct platform_device *pdev)
287{ 272{
288 struct gpio_led_of_platform_data *pdata = dev_get_drvdata(&ofdev->dev); 273 struct gpio_leds_priv *priv = dev_get_drvdata(&pdev->dev);
289 int i; 274 int i;
290 275
291 for (i = 0; i < pdata->num_leds; i++) 276 for (i = 0; i < priv->num_leds; i++)
292 delete_gpio_led(&pdata->led_data[i]); 277 delete_gpio_led(&priv->leds[i]);
293
294 kfree(pdata);
295 278
296 dev_set_drvdata(&ofdev->dev, NULL); 279 dev_set_drvdata(&pdev->dev, NULL);
280 kfree(priv);
297 281
298 return 0; 282 return 0;
299} 283}
300 284
301static const struct of_device_id of_gpio_leds_match[] = { 285static struct platform_driver gpio_led_driver = {
302 { .compatible = "gpio-leds", }, 286 .probe = gpio_led_probe,
303 {}, 287 .remove = __devexit_p(gpio_led_remove),
304}; 288 .driver = {
305 289 .name = "leds-gpio",
306static struct of_platform_driver of_gpio_leds_driver = { 290 .owner = THIS_MODULE,
307 .driver = {
308 .name = "of_gpio_leds",
309 .owner = THIS_MODULE,
310 .of_match_table = of_gpio_leds_match, 291 .of_match_table = of_gpio_leds_match,
311 }, 292 },
312 .probe = of_gpio_leds_probe,
313 .remove = __devexit_p(of_gpio_leds_remove),
314}; 293};
315#endif 294
295MODULE_ALIAS("platform:leds-gpio");
316 296
317static int __init gpio_led_init(void) 297static int __init gpio_led_init(void)
318{ 298{
319 int ret = 0; 299 return platform_driver_register(&gpio_led_driver);
320
321#ifdef CONFIG_LEDS_GPIO_PLATFORM
322 ret = platform_driver_register(&gpio_led_driver);
323 if (ret)
324 return ret;
325#endif
326#ifdef CONFIG_LEDS_GPIO_OF
327 ret = of_register_platform_driver(&of_gpio_leds_driver);
328#endif
329#ifdef CONFIG_LEDS_GPIO_PLATFORM
330 if (ret)
331 platform_driver_unregister(&gpio_led_driver);
332#endif
333
334 return ret;
335} 300}
336 301
337static void __exit gpio_led_exit(void) 302static void __exit gpio_led_exit(void)
338{ 303{
339#ifdef CONFIG_LEDS_GPIO_PLATFORM
340 platform_driver_unregister(&gpio_led_driver); 304 platform_driver_unregister(&gpio_led_driver);
341#endif
342#ifdef CONFIG_LEDS_GPIO_OF
343 of_unregister_platform_driver(&of_gpio_leds_driver);
344#endif
345} 305}
346 306
347module_init(gpio_led_init); 307module_init(gpio_led_init);
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 290cb325a94c..116a49ce74b2 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -645,8 +645,7 @@ static void smu_expose_childs(struct work_struct *unused)
645 645
646static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs); 646static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs);
647 647
648static int smu_platform_probe(struct platform_device* dev, 648static int smu_platform_probe(struct platform_device* dev)
649 const struct of_device_id *match)
650{ 649{
651 if (!smu) 650 if (!smu)
652 return -ENODEV; 651 return -ENODEV;
@@ -669,7 +668,7 @@ static const struct of_device_id smu_platform_match[] =
669 {}, 668 {},
670}; 669};
671 670
672static struct of_platform_driver smu_of_platform_driver = 671static struct platform_driver smu_of_platform_driver =
673{ 672{
674 .driver = { 673 .driver = {
675 .name = "smu", 674 .name = "smu",
@@ -689,7 +688,7 @@ static int __init smu_init_sysfs(void)
689 * I'm a bit too far from figuring out how that works with those 688 * I'm a bit too far from figuring out how that works with those
690 * new chipsets, but that will come back and bite us 689 * new chipsets, but that will come back and bite us
691 */ 690 */
692 of_register_platform_driver(&smu_of_platform_driver); 691 platform_driver_register(&smu_of_platform_driver);
693 return 0; 692 return 0;
694} 693}
695 694
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index f3a29f264db9..bca2af2e3760 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)
2210 } 2210 }
2211} 2211}
2212 2212
2213static int fcu_of_probe(struct platform_device* dev, const struct of_device_id *match) 2213static int fcu_of_probe(struct platform_device* dev)
2214{ 2214{
2215 state = state_detached; 2215 state = state_detached;
2216 of_dev = dev; 2216 of_dev = dev;
@@ -2240,7 +2240,7 @@ static const struct of_device_id fcu_match[] =
2240}; 2240};
2241MODULE_DEVICE_TABLE(of, fcu_match); 2241MODULE_DEVICE_TABLE(of, fcu_match);
2242 2242
2243static struct of_platform_driver fcu_of_platform_driver = 2243static struct platform_driver fcu_of_platform_driver =
2244{ 2244{
2245 .driver = { 2245 .driver = {
2246 .name = "temperature", 2246 .name = "temperature",
@@ -2263,12 +2263,12 @@ static int __init therm_pm72_init(void)
2263 !rackmac) 2263 !rackmac)
2264 return -ENODEV; 2264 return -ENODEV;
2265 2265
2266 return of_register_platform_driver(&fcu_of_platform_driver); 2266 return platform_driver_register(&fcu_of_platform_driver);
2267} 2267}
2268 2268
2269static void __exit therm_pm72_exit(void) 2269static void __exit therm_pm72_exit(void)
2270{ 2270{
2271 of_unregister_platform_driver(&fcu_of_platform_driver); 2271 platform_driver_unregister(&fcu_of_platform_driver);
2272} 2272}
2273 2273
2274module_init(therm_pm72_init); 2274module_init(therm_pm72_init);
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index c89f396e4c53..d37819fd5ad3 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -443,8 +443,7 @@ static struct i2c_driver g4fan_driver = {
443/* initialization / cleanup */ 443/* initialization / cleanup */
444/************************************************************************/ 444/************************************************************************/
445 445
446static int 446static int therm_of_probe(struct platform_device *dev)
447therm_of_probe( struct platform_device *dev, const struct of_device_id *match )
448{ 447{
449 return i2c_add_driver( &g4fan_driver ); 448 return i2c_add_driver( &g4fan_driver );
450} 449}
@@ -462,7 +461,7 @@ static const struct of_device_id therm_of_match[] = {{
462 }, {} 461 }, {}
463}; 462};
464 463
465static struct of_platform_driver therm_of_driver = { 464static struct platform_driver therm_of_driver = {
466 .driver = { 465 .driver = {
467 .name = "temperature", 466 .name = "temperature",
468 .owner = THIS_MODULE, 467 .owner = THIS_MODULE,
@@ -509,14 +508,14 @@ g4fan_init( void )
509 return -ENODEV; 508 return -ENODEV;
510 } 509 }
511 510
512 of_register_platform_driver( &therm_of_driver ); 511 platform_driver_register( &therm_of_driver );
513 return 0; 512 return 0;
514} 513}
515 514
516static void __exit 515static void __exit
517g4fan_exit( void ) 516g4fan_exit( void )
518{ 517{
519 of_unregister_platform_driver( &therm_of_driver ); 518 platform_driver_unregister( &therm_of_driver );
520 519
521 if( x.of_dev ) 520 if( x.of_dev )
522 of_device_unregister( x.of_dev ); 521 of_device_unregister( x.of_dev );
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c
index e4bba88254c7..031af1610154 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 = {
1445 .current_norm = V4L2_STD_NTSC_M, 1445 .current_norm = V4L2_STD_NTSC_M,
1446}; 1446};
1447 1447
1448static int __devinit viu_of_probe(struct platform_device *op, 1448static int __devinit viu_of_probe(struct platform_device *op)
1449 const struct of_device_id *match)
1450{ 1449{
1451 struct viu_dev *viu_dev; 1450 struct viu_dev *viu_dev;
1452 struct video_device *vdev; 1451 struct video_device *vdev;
@@ -1627,7 +1626,7 @@ static struct of_device_id mpc512x_viu_of_match[] = {
1627}; 1626};
1628MODULE_DEVICE_TABLE(of, mpc512x_viu_of_match); 1627MODULE_DEVICE_TABLE(of, mpc512x_viu_of_match);
1629 1628
1630static struct of_platform_driver viu_of_platform_driver = { 1629static struct platform_driver viu_of_platform_driver = {
1631 .probe = viu_of_probe, 1630 .probe = viu_of_probe,
1632 .remove = __devexit_p(viu_of_remove), 1631 .remove = __devexit_p(viu_of_remove),
1633#ifdef CONFIG_PM 1632#ifdef CONFIG_PM
@@ -1643,12 +1642,12 @@ static struct of_platform_driver viu_of_platform_driver = {
1643 1642
1644static int __init viu_init(void) 1643static int __init viu_init(void)
1645{ 1644{
1646 return of_register_platform_driver(&viu_of_platform_driver); 1645 return platform_driver_register(&viu_of_platform_driver);
1647} 1646}
1648 1647
1649static void __exit viu_exit(void) 1648static void __exit viu_exit(void)
1650{ 1649{
1651 of_unregister_platform_driver(&viu_of_platform_driver); 1650 platform_driver_unregister(&viu_of_platform_driver);
1652} 1651}
1653 1652
1654module_init(viu_init); 1653module_init(viu_init);
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index dd84124f4209..f9b611fc773e 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -124,17 +124,20 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np)
124#endif 124#endif
125} 125}
126 126
127static int __devinit sdhci_of_probe(struct platform_device *ofdev, 127static int __devinit sdhci_of_probe(struct platform_device *ofdev)
128 const struct of_device_id *match)
129{ 128{
130 struct device_node *np = ofdev->dev.of_node; 129 struct device_node *np = ofdev->dev.of_node;
131 struct sdhci_of_data *sdhci_of_data = match->data; 130 struct sdhci_of_data *sdhci_of_data;
132 struct sdhci_host *host; 131 struct sdhci_host *host;
133 struct sdhci_of_host *of_host; 132 struct sdhci_of_host *of_host;
134 const __be32 *clk; 133 const __be32 *clk;
135 int size; 134 int size;
136 int ret; 135 int ret;
137 136
137 if (!ofdev->dev.of_match)
138 return -EINVAL;
139 sdhci_of_data = ofdev->dev.of_match->data;
140
138 if (!of_device_is_available(np)) 141 if (!of_device_is_available(np))
139 return -ENODEV; 142 return -ENODEV;
140 143
@@ -217,7 +220,7 @@ static const struct of_device_id sdhci_of_match[] = {
217}; 220};
218MODULE_DEVICE_TABLE(of, sdhci_of_match); 221MODULE_DEVICE_TABLE(of, sdhci_of_match);
219 222
220static struct of_platform_driver sdhci_of_driver = { 223static struct platform_driver sdhci_of_driver = {
221 .driver = { 224 .driver = {
222 .name = "sdhci-of", 225 .name = "sdhci-of",
223 .owner = THIS_MODULE, 226 .owner = THIS_MODULE,
@@ -231,13 +234,13 @@ static struct of_platform_driver sdhci_of_driver = {
231 234
232static int __init sdhci_of_init(void) 235static int __init sdhci_of_init(void)
233{ 236{
234 return of_register_platform_driver(&sdhci_of_driver); 237 return platform_driver_register(&sdhci_of_driver);
235} 238}
236module_init(sdhci_of_init); 239module_init(sdhci_of_init);
237 240
238static void __exit sdhci_of_exit(void) 241static void __exit sdhci_of_exit(void)
239{ 242{
240 of_unregister_platform_driver(&sdhci_of_driver); 243 platform_driver_unregister(&sdhci_of_driver);
241} 244}
242module_exit(sdhci_of_exit); 245module_exit(sdhci_of_exit);
243 246
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 8506578e6a35..3db0cb083d31 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)
216} 216}
217#endif 217#endif
218 218
219static int __devinit of_flash_probe(struct platform_device *dev, 219static int __devinit of_flash_probe(struct platform_device *dev)
220 const struct of_device_id *match)
221{ 220{
222#ifdef CONFIG_MTD_PARTITIONS 221#ifdef CONFIG_MTD_PARTITIONS
223 const char **part_probe_types; 222 const char **part_probe_types;
@@ -225,7 +224,7 @@ static int __devinit of_flash_probe(struct platform_device *dev,
225 struct device_node *dp = dev->dev.of_node; 224 struct device_node *dp = dev->dev.of_node;
226 struct resource res; 225 struct resource res;
227 struct of_flash *info; 226 struct of_flash *info;
228 const char *probe_type = match->data; 227 const char *probe_type;
229 const __be32 *width; 228 const __be32 *width;
230 int err; 229 int err;
231 int i; 230 int i;
@@ -235,6 +234,10 @@ static int __devinit of_flash_probe(struct platform_device *dev,
235 struct mtd_info **mtd_list = NULL; 234 struct mtd_info **mtd_list = NULL;
236 resource_size_t res_size; 235 resource_size_t res_size;
237 236
237 if (!dev->dev.of_match)
238 return -EINVAL;
239 probe_type = dev->dev.of_match->data;
240
238 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32); 241 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32);
239 242
240 /* 243 /*
@@ -418,7 +421,7 @@ static struct of_device_id of_flash_match[] = {
418}; 421};
419MODULE_DEVICE_TABLE(of, of_flash_match); 422MODULE_DEVICE_TABLE(of, of_flash_match);
420 423
421static struct of_platform_driver of_flash_driver = { 424static struct platform_driver of_flash_driver = {
422 .driver = { 425 .driver = {
423 .name = "of-flash", 426 .name = "of-flash",
424 .owner = THIS_MODULE, 427 .owner = THIS_MODULE,
@@ -430,12 +433,12 @@ static struct of_platform_driver of_flash_driver = {
430 433
431static int __init of_flash_init(void) 434static int __init of_flash_init(void)
432{ 435{
433 return of_register_platform_driver(&of_flash_driver); 436 return platform_driver_register(&of_flash_driver);
434} 437}
435 438
436static void __exit of_flash_exit(void) 439static void __exit of_flash_exit(void)
437{ 440{
438 of_unregister_platform_driver(&of_flash_driver); 441 platform_driver_unregister(&of_flash_driver);
439} 442}
440 443
441module_init(of_flash_init); 444module_init(of_flash_init);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 3582ba1f9b09..3f1cb328a574 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)
108 return 0; 108 return 0;
109} 109}
110 110
111static int __devinit uflash_probe(struct platform_device *op, const struct of_device_id *match) 111static int __devinit uflash_probe(struct platform_device *op)
112{ 112{
113 struct device_node *dp = op->dev.of_node; 113 struct device_node *dp = op->dev.of_node;
114 114
@@ -148,7 +148,7 @@ static const struct of_device_id uflash_match[] = {
148 148
149MODULE_DEVICE_TABLE(of, uflash_match); 149MODULE_DEVICE_TABLE(of, uflash_match);
150 150
151static struct of_platform_driver uflash_driver = { 151static struct platform_driver uflash_driver = {
152 .driver = { 152 .driver = {
153 .name = DRIVER_NAME, 153 .name = DRIVER_NAME,
154 .owner = THIS_MODULE, 154 .owner = THIS_MODULE,
@@ -160,12 +160,12 @@ static struct of_platform_driver uflash_driver = {
160 160
161static int __init uflash_init(void) 161static int __init uflash_init(void)
162{ 162{
163 return of_register_platform_driver(&uflash_driver); 163 return platform_driver_register(&uflash_driver);
164} 164}
165 165
166static void __exit uflash_exit(void) 166static void __exit uflash_exit(void)
167{ 167{
168 of_unregister_platform_driver(&uflash_driver); 168 platform_driver_unregister(&uflash_driver);
169} 169}
170 170
171module_init(uflash_init); 171module_init(uflash_init);
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index efdcca94ce55..073ee026a17c 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -217,8 +217,7 @@ err:
217 return ret; 217 return ret;
218} 218}
219 219
220static int __devinit fun_probe(struct platform_device *ofdev, 220static int __devinit fun_probe(struct platform_device *ofdev)
221 const struct of_device_id *ofid)
222{ 221{
223 struct fsl_upm_nand *fun; 222 struct fsl_upm_nand *fun;
224 struct resource io_res; 223 struct resource io_res;
@@ -360,7 +359,7 @@ static const struct of_device_id of_fun_match[] = {
360}; 359};
361MODULE_DEVICE_TABLE(of, of_fun_match); 360MODULE_DEVICE_TABLE(of, of_fun_match);
362 361
363static struct of_platform_driver of_fun_driver = { 362static struct platform_driver of_fun_driver = {
364 .driver = { 363 .driver = {
365 .name = "fsl,upm-nand", 364 .name = "fsl,upm-nand",
366 .owner = THIS_MODULE, 365 .owner = THIS_MODULE,
@@ -372,13 +371,13 @@ static struct of_platform_driver of_fun_driver = {
372 371
373static int __init fun_module_init(void) 372static int __init fun_module_init(void)
374{ 373{
375 return of_register_platform_driver(&of_fun_driver); 374 return platform_driver_register(&of_fun_driver);
376} 375}
377module_init(fun_module_init); 376module_init(fun_module_init);
378 377
379static void __exit fun_module_exit(void) 378static void __exit fun_module_exit(void)
380{ 379{
381 of_unregister_platform_driver(&of_fun_driver); 380 platform_driver_unregister(&of_fun_driver);
382} 381}
383module_exit(fun_module_exit); 382module_exit(fun_module_exit);
384 383
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 469e649c911c..c2f95437e5e9 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)
650 iounmap(prv->csreg); 650 iounmap(prv->csreg);
651} 651}
652 652
653static int __devinit mpc5121_nfc_probe(struct platform_device *op, 653static int __devinit mpc5121_nfc_probe(struct platform_device *op)
654 const struct of_device_id *match)
655{ 654{
656 struct device_node *rootnode, *dn = op->dev.of_node; 655 struct device_node *rootnode, *dn = op->dev.of_node;
657 struct device *dev = &op->dev; 656 struct device *dev = &op->dev;
@@ -891,7 +890,7 @@ static struct of_device_id mpc5121_nfc_match[] __devinitdata = {
891 {}, 890 {},
892}; 891};
893 892
894static struct of_platform_driver mpc5121_nfc_driver = { 893static struct platform_driver mpc5121_nfc_driver = {
895 .probe = mpc5121_nfc_probe, 894 .probe = mpc5121_nfc_probe,
896 .remove = __devexit_p(mpc5121_nfc_remove), 895 .remove = __devexit_p(mpc5121_nfc_remove),
897 .driver = { 896 .driver = {
@@ -903,14 +902,14 @@ static struct of_platform_driver mpc5121_nfc_driver = {
903 902
904static int __init mpc5121_nfc_init(void) 903static int __init mpc5121_nfc_init(void)
905{ 904{
906 return of_register_platform_driver(&mpc5121_nfc_driver); 905 return platform_driver_register(&mpc5121_nfc_driver);
907} 906}
908 907
909module_init(mpc5121_nfc_init); 908module_init(mpc5121_nfc_init);
910 909
911static void __exit mpc5121_nfc_cleanup(void) 910static void __exit mpc5121_nfc_cleanup(void)
912{ 911{
913 of_unregister_platform_driver(&mpc5121_nfc_driver); 912 platform_driver_unregister(&mpc5121_nfc_driver);
914} 913}
915 914
916module_exit(mpc5121_nfc_cleanup); 915module_exit(mpc5121_nfc_cleanup);
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index c9ae0a5023b6..bbe6d451290d 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -225,8 +225,7 @@ err:
225 return ret; 225 return ret;
226} 226}
227 227
228static int __devinit ndfc_probe(struct platform_device *ofdev, 228static int __devinit ndfc_probe(struct platform_device *ofdev)
229 const struct of_device_id *match)
230{ 229{
231 struct ndfc_controller *ndfc = &ndfc_ctrl; 230 struct ndfc_controller *ndfc = &ndfc_ctrl;
232 const __be32 *reg; 231 const __be32 *reg;
@@ -292,7 +291,7 @@ static const struct of_device_id ndfc_match[] = {
292}; 291};
293MODULE_DEVICE_TABLE(of, ndfc_match); 292MODULE_DEVICE_TABLE(of, ndfc_match);
294 293
295static struct of_platform_driver ndfc_driver = { 294static struct platform_driver ndfc_driver = {
296 .driver = { 295 .driver = {
297 .name = "ndfc", 296 .name = "ndfc",
298 .owner = THIS_MODULE, 297 .owner = THIS_MODULE,
@@ -304,12 +303,12 @@ static struct of_platform_driver ndfc_driver = {
304 303
305static int __init ndfc_nand_init(void) 304static int __init ndfc_nand_init(void)
306{ 305{
307 return of_register_platform_driver(&ndfc_driver); 306 return platform_driver_register(&ndfc_driver);
308} 307}
309 308
310static void __exit ndfc_nand_exit(void) 309static void __exit ndfc_nand_exit(void)
311{ 310{
312 of_unregister_platform_driver(&ndfc_driver); 311 platform_driver_unregister(&ndfc_driver);
313} 312}
314 313
315module_init(ndfc_nand_init); 314module_init(ndfc_nand_init);
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index bb277a54986f..59efa829ef24 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)
89 return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR); 89 return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR);
90} 90}
91 91
92static int __devinit pasemi_nand_probe(struct platform_device *ofdev, 92static int __devinit pasemi_nand_probe(struct platform_device *ofdev)
93 const struct of_device_id *match)
94{ 93{
95 struct pci_dev *pdev; 94 struct pci_dev *pdev;
96 struct device_node *np = ofdev->dev.of_node; 95 struct device_node *np = ofdev->dev.of_node;
@@ -219,7 +218,7 @@ static const struct of_device_id pasemi_nand_match[] =
219 218
220MODULE_DEVICE_TABLE(of, pasemi_nand_match); 219MODULE_DEVICE_TABLE(of, pasemi_nand_match);
221 220
222static struct of_platform_driver pasemi_nand_driver = 221static struct platform_driver pasemi_nand_driver =
223{ 222{
224 .driver = { 223 .driver = {
225 .name = (char*)driver_name, 224 .name = (char*)driver_name,
@@ -232,13 +231,13 @@ static struct of_platform_driver pasemi_nand_driver =
232 231
233static int __init pasemi_nand_init(void) 232static int __init pasemi_nand_init(void)
234{ 233{
235 return of_register_platform_driver(&pasemi_nand_driver); 234 return platform_driver_register(&pasemi_nand_driver);
236} 235}
237module_init(pasemi_nand_init); 236module_init(pasemi_nand_init);
238 237
239static void __exit pasemi_nand_exit(void) 238static void __exit pasemi_nand_exit(void)
240{ 239{
241 of_unregister_platform_driver(&pasemi_nand_driver); 240 platform_driver_unregister(&pasemi_nand_driver);
242} 241}
243module_exit(pasemi_nand_exit); 242module_exit(pasemi_nand_exit);
244 243
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index a8e403eebedb..a853548986f0 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 };
162/* 162/*
163 * Probe for the NAND device. 163 * Probe for the NAND device.
164 */ 164 */
165static int __devinit socrates_nand_probe(struct platform_device *ofdev, 165static int __devinit socrates_nand_probe(struct platform_device *ofdev)
166 const struct of_device_id *ofid)
167{ 166{
168 struct socrates_nand_host *host; 167 struct socrates_nand_host *host;
169 struct mtd_info *mtd; 168 struct mtd_info *mtd;
@@ -300,7 +299,7 @@ static const struct of_device_id socrates_nand_match[] =
300 299
301MODULE_DEVICE_TABLE(of, socrates_nand_match); 300MODULE_DEVICE_TABLE(of, socrates_nand_match);
302 301
303static struct of_platform_driver socrates_nand_driver = { 302static struct platform_driver socrates_nand_driver = {
304 .driver = { 303 .driver = {
305 .name = "socrates_nand", 304 .name = "socrates_nand",
306 .owner = THIS_MODULE, 305 .owner = THIS_MODULE,
@@ -312,12 +311,12 @@ static struct of_platform_driver socrates_nand_driver = {
312 311
313static int __init socrates_nand_init(void) 312static int __init socrates_nand_init(void)
314{ 313{
315 return of_register_platform_driver(&socrates_nand_driver); 314 return platform_driver_register(&socrates_nand_driver);
316} 315}
317 316
318static void __exit socrates_nand_exit(void) 317static void __exit socrates_nand_exit(void)
319{ 318{
320 of_unregister_platform_driver(&socrates_nand_driver); 319 platform_driver_unregister(&socrates_nand_driver);
321} 320}
322 321
323module_init(socrates_nand_init); 322module_init(socrates_nand_init);
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 312b9c8f4f3b..c0a1bc5b1435 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,
247} 247}
248#endif /* CONFIG_PPC_MPC512x */ 248#endif /* CONFIG_PPC_MPC512x */
249 249
250static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev, 250static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev)
251 const struct of_device_id *id)
252{ 251{
253 struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data; 252 struct mpc5xxx_can_data *data;
254 struct device_node *np = ofdev->dev.of_node; 253 struct device_node *np = ofdev->dev.of_node;
255 struct net_device *dev; 254 struct net_device *dev;
256 struct mscan_priv *priv; 255 struct mscan_priv *priv;
@@ -259,6 +258,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev,
259 int irq, mscan_clksrc = 0; 258 int irq, mscan_clksrc = 0;
260 int err = -ENOMEM; 259 int err = -ENOMEM;
261 260
261 if (!ofdev->dev.of_match)
262 return -EINVAL;
263 data = (struct mpc5xxx_can_data *)of_dev->dev.of_match->data;
264
262 base = of_iomap(np, 0); 265 base = of_iomap(np, 0);
263 if (!base) { 266 if (!base) {
264 dev_err(&ofdev->dev, "couldn't ioremap\n"); 267 dev_err(&ofdev->dev, "couldn't ioremap\n");
@@ -391,7 +394,7 @@ static struct of_device_id __devinitdata mpc5xxx_can_table[] = {
391 {}, 394 {},
392}; 395};
393 396
394static struct of_platform_driver mpc5xxx_can_driver = { 397static struct platform_driver mpc5xxx_can_driver = {
395 .driver = { 398 .driver = {
396 .name = "mpc5xxx_can", 399 .name = "mpc5xxx_can",
397 .owner = THIS_MODULE, 400 .owner = THIS_MODULE,
@@ -407,13 +410,13 @@ static struct of_platform_driver mpc5xxx_can_driver = {
407 410
408static int __init mpc5xxx_can_init(void) 411static int __init mpc5xxx_can_init(void)
409{ 412{
410 return of_register_platform_driver(&mpc5xxx_can_driver); 413 return platform_driver_register(&mpc5xxx_can_driver);
411} 414}
412module_init(mpc5xxx_can_init); 415module_init(mpc5xxx_can_init);
413 416
414static void __exit mpc5xxx_can_exit(void) 417static void __exit mpc5xxx_can_exit(void)
415{ 418{
416 return of_unregister_platform_driver(&mpc5xxx_can_driver); 419 platform_driver_unregister(&mpc5xxx_can_driver);
417}; 420};
418module_exit(mpc5xxx_can_exit); 421module_exit(mpc5xxx_can_exit);
419 422
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 09c3e9db9316..9793df6e3455 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)
87 return 0; 87 return 0;
88} 88}
89 89
90static int __devinit sja1000_ofp_probe(struct platform_device *ofdev, 90static int __devinit sja1000_ofp_probe(struct platform_device *ofdev)
91 const struct of_device_id *id)
92{ 91{
93 struct device_node *np = ofdev->dev.of_node; 92 struct device_node *np = ofdev->dev.of_node;
94 struct net_device *dev; 93 struct net_device *dev;
@@ -210,7 +209,7 @@ static struct of_device_id __devinitdata sja1000_ofp_table[] = {
210}; 209};
211MODULE_DEVICE_TABLE(of, sja1000_ofp_table); 210MODULE_DEVICE_TABLE(of, sja1000_ofp_table);
212 211
213static struct of_platform_driver sja1000_ofp_driver = { 212static struct platform_driver sja1000_ofp_driver = {
214 .driver = { 213 .driver = {
215 .owner = THIS_MODULE, 214 .owner = THIS_MODULE,
216 .name = DRV_NAME, 215 .name = DRV_NAME,
@@ -222,12 +221,12 @@ static struct of_platform_driver sja1000_ofp_driver = {
222 221
223static int __init sja1000_ofp_init(void) 222static int __init sja1000_ofp_init(void)
224{ 223{
225 return of_register_platform_driver(&sja1000_ofp_driver); 224 return platform_driver_register(&sja1000_ofp_driver);
226} 225}
227module_init(sja1000_ofp_init); 226module_init(sja1000_ofp_init);
228 227
229static void __exit sja1000_ofp_exit(void) 228static void __exit sja1000_ofp_exit(void)
230{ 229{
231 return of_unregister_platform_driver(&sja1000_ofp_driver); 230 return platform_driver_unregister(&sja1000_ofp_driver);
232}; 231};
233module_exit(sja1000_ofp_exit); 232module_exit(sja1000_ofp_exit);
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 50c1213f61fe..9f81b1ac130e 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 = {
840/* OF Driver */ 840/* OF Driver */
841/* ======================================================================== */ 841/* ======================================================================== */
842 842
843static int __devinit 843static int __devinit mpc52xx_fec_probe(struct platform_device *op)
844mpc52xx_fec_probe(struct platform_device *op, const struct of_device_id *match)
845{ 844{
846 int rv; 845 int rv;
847 struct net_device *ndev; 846 struct net_device *ndev;
@@ -1049,7 +1048,7 @@ static struct of_device_id mpc52xx_fec_match[] = {
1049 1048
1050MODULE_DEVICE_TABLE(of, mpc52xx_fec_match); 1049MODULE_DEVICE_TABLE(of, mpc52xx_fec_match);
1051 1050
1052static struct of_platform_driver mpc52xx_fec_driver = { 1051static struct platform_driver mpc52xx_fec_driver = {
1053 .driver = { 1052 .driver = {
1054 .name = DRIVER_NAME, 1053 .name = DRIVER_NAME,
1055 .owner = THIS_MODULE, 1054 .owner = THIS_MODULE,
@@ -1073,21 +1072,21 @@ mpc52xx_fec_init(void)
1073{ 1072{
1074#ifdef CONFIG_FEC_MPC52xx_MDIO 1073#ifdef CONFIG_FEC_MPC52xx_MDIO
1075 int ret; 1074 int ret;
1076 ret = of_register_platform_driver(&mpc52xx_fec_mdio_driver); 1075 ret = platform_driver_register(&mpc52xx_fec_mdio_driver);
1077 if (ret) { 1076 if (ret) {
1078 printk(KERN_ERR DRIVER_NAME ": failed to register mdio driver\n"); 1077 printk(KERN_ERR DRIVER_NAME ": failed to register mdio driver\n");
1079 return ret; 1078 return ret;
1080 } 1079 }
1081#endif 1080#endif
1082 return of_register_platform_driver(&mpc52xx_fec_driver); 1081 return platform_driver_register(&mpc52xx_fec_driver);
1083} 1082}
1084 1083
1085static void __exit 1084static void __exit
1086mpc52xx_fec_exit(void) 1085mpc52xx_fec_exit(void)
1087{ 1086{
1088 of_unregister_platform_driver(&mpc52xx_fec_driver); 1087 platform_driver_unregister(&mpc52xx_fec_driver);
1089#ifdef CONFIG_FEC_MPC52xx_MDIO 1088#ifdef CONFIG_FEC_MPC52xx_MDIO
1090 of_unregister_platform_driver(&mpc52xx_fec_mdio_driver); 1089 platform_driver_unregister(&mpc52xx_fec_mdio_driver);
1091#endif 1090#endif
1092} 1091}
1093 1092
diff --git a/drivers/net/fec_mpc52xx.h b/drivers/net/fec_mpc52xx.h
index a227a525bdbb..41d2dffde55b 100644
--- a/drivers/net/fec_mpc52xx.h
+++ b/drivers/net/fec_mpc52xx.h
@@ -289,6 +289,6 @@ struct mpc52xx_fec {
289#define FEC_XMIT_FSM_ENABLE_CRC 0x01000000 289#define FEC_XMIT_FSM_ENABLE_CRC 0x01000000
290 290
291 291
292extern struct of_platform_driver mpc52xx_fec_mdio_driver; 292extern struct platform_driver mpc52xx_fec_mdio_driver;
293 293
294#endif /* __DRIVERS_NET_MPC52XX_FEC_H__ */ 294#endif /* __DRIVERS_NET_MPC52XX_FEC_H__ */
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
index 0b4cb6f15984..360a578c2bb7 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,
61 data | FEC_MII_WRITE_FRAME); 61 data | FEC_MII_WRITE_FRAME);
62} 62}
63 63
64static int mpc52xx_fec_mdio_probe(struct platform_device *of, 64static int mpc52xx_fec_mdio_probe(struct platform_device *of)
65 const struct of_device_id *match)
66{ 65{
67 struct device *dev = &of->dev; 66 struct device *dev = &of->dev;
68 struct device_node *np = of->dev.of_node; 67 struct device_node *np = of->dev.of_node;
@@ -145,7 +144,7 @@ static struct of_device_id mpc52xx_fec_mdio_match[] = {
145}; 144};
146MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match); 145MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match);
147 146
148struct of_platform_driver mpc52xx_fec_mdio_driver = { 147struct platform_driver mpc52xx_fec_mdio_driver = {
149 .driver = { 148 .driver = {
150 .name = "mpc5200b-fec-phy", 149 .name = "mpc5200b-fec-phy",
151 .owner = THIS_MODULE, 150 .owner = THIS_MODULE,
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 7a1f3d0ffa78..24cb953900dd 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 = {
998#endif 998#endif
999}; 999};
1000 1000
1001static int __devinit fs_enet_probe(struct platform_device *ofdev, 1001static int __devinit fs_enet_probe(struct platform_device *ofdev)
1002 const struct of_device_id *match)
1003{ 1002{
1004 struct net_device *ndev; 1003 struct net_device *ndev;
1005 struct fs_enet_private *fep; 1004 struct fs_enet_private *fep;
@@ -1008,11 +1007,14 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev,
1008 const u8 *mac_addr; 1007 const u8 *mac_addr;
1009 int privsize, len, ret = -ENODEV; 1008 int privsize, len, ret = -ENODEV;
1010 1009
1010 if (!ofdev->dev.of_match)
1011 return -EINVAL;
1012
1011 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL); 1013 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL);
1012 if (!fpi) 1014 if (!fpi)
1013 return -ENOMEM; 1015 return -ENOMEM;
1014 1016
1015 if (!IS_FEC(match)) { 1017 if (!IS_FEC(ofdev->dev.of_match)) {
1016 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); 1018 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len);
1017 if (!data || len != 4) 1019 if (!data || len != 4)
1018 goto out_free_fpi; 1020 goto out_free_fpi;
@@ -1047,7 +1049,7 @@ static int __devinit fs_enet_probe(struct platform_device *ofdev,
1047 fep->dev = &ofdev->dev; 1049 fep->dev = &ofdev->dev;
1048 fep->ndev = ndev; 1050 fep->ndev = ndev;
1049 fep->fpi = fpi; 1051 fep->fpi = fpi;
1050 fep->ops = match->data; 1052 fep->ops = ofdev->dev.of_match->data;
1051 1053
1052 ret = fep->ops->setup_data(ndev); 1054 ret = fep->ops->setup_data(ndev);
1053 if (ret) 1055 if (ret)
@@ -1156,7 +1158,7 @@ static struct of_device_id fs_enet_match[] = {
1156}; 1158};
1157MODULE_DEVICE_TABLE(of, fs_enet_match); 1159MODULE_DEVICE_TABLE(of, fs_enet_match);
1158 1160
1159static struct of_platform_driver fs_enet_driver = { 1161static struct platform_driver fs_enet_driver = {
1160 .driver = { 1162 .driver = {
1161 .owner = THIS_MODULE, 1163 .owner = THIS_MODULE,
1162 .name = "fs_enet", 1164 .name = "fs_enet",
@@ -1168,12 +1170,12 @@ static struct of_platform_driver fs_enet_driver = {
1168 1170
1169static int __init fs_init(void) 1171static int __init fs_init(void)
1170{ 1172{
1171 return of_register_platform_driver(&fs_enet_driver); 1173 return platform_driver_register(&fs_enet_driver);
1172} 1174}
1173 1175
1174static void __exit fs_cleanup(void) 1176static void __exit fs_cleanup(void)
1175{ 1177{
1176 of_unregister_platform_driver(&fs_enet_driver); 1178 platform_driver_unregister(&fs_enet_driver);
1177} 1179}
1178 1180
1179#ifdef CONFIG_NET_POLL_CONTROLLER 1181#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 3cda2b515471..ad2975440719 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,
150 return 0; 150 return 0;
151} 151}
152 152
153static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev, 153static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
154 const struct of_device_id *match)
155{ 154{
156 struct mii_bus *new_bus; 155 struct mii_bus *new_bus;
157 struct bb_info *bitbang; 156 struct bb_info *bitbang;
@@ -223,7 +222,7 @@ static struct of_device_id fs_enet_mdio_bb_match[] = {
223}; 222};
224MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match); 223MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match);
225 224
226static struct of_platform_driver fs_enet_bb_mdio_driver = { 225static struct platform_driver fs_enet_bb_mdio_driver = {
227 .driver = { 226 .driver = {
228 .name = "fsl-bb-mdio", 227 .name = "fsl-bb-mdio",
229 .owner = THIS_MODULE, 228 .owner = THIS_MODULE,
@@ -235,12 +234,12 @@ static struct of_platform_driver fs_enet_bb_mdio_driver = {
235 234
236static int fs_enet_mdio_bb_init(void) 235static int fs_enet_mdio_bb_init(void)
237{ 236{
238 return of_register_platform_driver(&fs_enet_bb_mdio_driver); 237 return platform_driver_register(&fs_enet_bb_mdio_driver);
239} 238}
240 239
241static void fs_enet_mdio_bb_exit(void) 240static void fs_enet_mdio_bb_exit(void)
242{ 241{
243 of_unregister_platform_driver(&fs_enet_bb_mdio_driver); 242 platform_driver_unregister(&fs_enet_bb_mdio_driver);
244} 243}
245 244
246module_init(fs_enet_mdio_bb_init); 245module_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 dbb9c48623df..7e840d373ab3 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)
101 return 0; 101 return 0;
102} 102}
103 103
104static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev, 104static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
105 const struct of_device_id *match)
106{ 105{
107 struct resource res; 106 struct resource res;
108 struct mii_bus *new_bus; 107 struct mii_bus *new_bus;
109 struct fec_info *fec; 108 struct fec_info *fec;
110 int (*get_bus_freq)(struct device_node *) = match->data; 109 int (*get_bus_freq)(struct device_node *);
111 int ret = -ENOMEM, clock, speed; 110 int ret = -ENOMEM, clock, speed;
112 111
112 if (!ofdev->dev.of_match)
113 return -EINVAL;
114 get_bus_freq = ofdev->dev.of_match->data;
115
113 new_bus = mdiobus_alloc(); 116 new_bus = mdiobus_alloc();
114 if (!new_bus) 117 if (!new_bus)
115 goto out; 118 goto out;
@@ -221,7 +224,7 @@ static struct of_device_id fs_enet_mdio_fec_match[] = {
221}; 224};
222MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match); 225MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match);
223 226
224static struct of_platform_driver fs_enet_fec_mdio_driver = { 227static struct platform_driver fs_enet_fec_mdio_driver = {
225 .driver = { 228 .driver = {
226 .name = "fsl-fec-mdio", 229 .name = "fsl-fec-mdio",
227 .owner = THIS_MODULE, 230 .owner = THIS_MODULE,
@@ -233,12 +236,12 @@ static struct of_platform_driver fs_enet_fec_mdio_driver = {
233 236
234static int fs_enet_mdio_fec_init(void) 237static int fs_enet_mdio_fec_init(void)
235{ 238{
236 return of_register_platform_driver(&fs_enet_fec_mdio_driver); 239 return platform_driver_register(&fs_enet_fec_mdio_driver);
237} 240}
238 241
239static void fs_enet_mdio_fec_exit(void) 242static void fs_enet_mdio_fec_exit(void)
240{ 243{
241 of_unregister_platform_driver(&fs_enet_fec_mdio_driver); 244 platform_driver_unregister(&fs_enet_fec_mdio_driver);
242} 245}
243 246
244module_init(fs_enet_mdio_fec_init); 247module_init(fs_enet_mdio_fec_init);
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index 8d3a2ccbc953..52f4e8ad48e7 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)
265#endif 265#endif
266 266
267 267
268static int fsl_pq_mdio_probe(struct platform_device *ofdev, 268static int fsl_pq_mdio_probe(struct platform_device *ofdev)
269 const struct of_device_id *match)
270{ 269{
271 struct device_node *np = ofdev->dev.of_node; 270 struct device_node *np = ofdev->dev.of_node;
272 struct device_node *tbi; 271 struct device_node *tbi;
@@ -471,7 +470,7 @@ static struct of_device_id fsl_pq_mdio_match[] = {
471}; 470};
472MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match); 471MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
473 472
474static struct of_platform_driver fsl_pq_mdio_driver = { 473static struct platform_driver fsl_pq_mdio_driver = {
475 .driver = { 474 .driver = {
476 .name = "fsl-pq_mdio", 475 .name = "fsl-pq_mdio",
477 .owner = THIS_MODULE, 476 .owner = THIS_MODULE,
@@ -483,13 +482,13 @@ static struct of_platform_driver fsl_pq_mdio_driver = {
483 482
484int __init fsl_pq_mdio_init(void) 483int __init fsl_pq_mdio_init(void)
485{ 484{
486 return of_register_platform_driver(&fsl_pq_mdio_driver); 485 return platform_driver_register(&fsl_pq_mdio_driver);
487} 486}
488module_init(fsl_pq_mdio_init); 487module_init(fsl_pq_mdio_init);
489 488
490void fsl_pq_mdio_exit(void) 489void fsl_pq_mdio_exit(void)
491{ 490{
492 of_unregister_platform_driver(&fsl_pq_mdio_driver); 491 platform_driver_unregister(&fsl_pq_mdio_driver);
493} 492}
494module_exit(fsl_pq_mdio_exit); 493module_exit(fsl_pq_mdio_exit);
495MODULE_LICENSE("GPL"); 494MODULE_LICENSE("GPL");
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 5ed8f9f9419f..ccb231c4d933 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);
123static void adjust_link(struct net_device *dev); 123static void adjust_link(struct net_device *dev);
124static void init_registers(struct net_device *dev); 124static void init_registers(struct net_device *dev);
125static int init_phy(struct net_device *dev); 125static int init_phy(struct net_device *dev);
126static int gfar_probe(struct platform_device *ofdev, 126static int gfar_probe(struct platform_device *ofdev);
127 const struct of_device_id *match);
128static int gfar_remove(struct platform_device *ofdev); 127static int gfar_remove(struct platform_device *ofdev);
129static void free_skb_resources(struct gfar_private *priv); 128static void free_skb_resources(struct gfar_private *priv);
130static void gfar_set_multi(struct net_device *dev); 129static void gfar_set_multi(struct net_device *dev);
@@ -957,8 +956,7 @@ static void gfar_detect_errata(struct gfar_private *priv)
957 956
958/* Set up the ethernet device structure, private data, 957/* Set up the ethernet device structure, private data,
959 * and anything else we need before we start */ 958 * and anything else we need before we start */
960static int gfar_probe(struct platform_device *ofdev, 959static int gfar_probe(struct platform_device *ofdev)
961 const struct of_device_id *match)
962{ 960{
963 u32 tempval; 961 u32 tempval;
964 struct net_device *dev = NULL; 962 struct net_device *dev = NULL;
@@ -3256,7 +3254,7 @@ static struct of_device_id gfar_match[] =
3256MODULE_DEVICE_TABLE(of, gfar_match); 3254MODULE_DEVICE_TABLE(of, gfar_match);
3257 3255
3258/* Structure for a device driver */ 3256/* Structure for a device driver */
3259static struct of_platform_driver gfar_driver = { 3257static struct platform_driver gfar_driver = {
3260 .driver = { 3258 .driver = {
3261 .name = "fsl-gianfar", 3259 .name = "fsl-gianfar",
3262 .owner = THIS_MODULE, 3260 .owner = THIS_MODULE,
@@ -3269,12 +3267,12 @@ static struct of_platform_driver gfar_driver = {
3269 3267
3270static int __init gfar_init(void) 3268static int __init gfar_init(void)
3271{ 3269{
3272 return of_register_platform_driver(&gfar_driver); 3270 return platform_driver_register(&gfar_driver);
3273} 3271}
3274 3272
3275static void __exit gfar_exit(void) 3273static void __exit gfar_exit(void)
3276{ 3274{
3277 of_unregister_platform_driver(&gfar_driver); 3275 platform_driver_unregister(&gfar_driver);
3278} 3276}
3279 3277
3280module_init(gfar_init); 3278module_init(gfar_init);
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index fdb0333f5cb6..396ff7d785d1 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -1411,7 +1411,7 @@ error:
1411} 1411}
1412 1412
1413/* Initialize the GRETH MAC */ 1413/* Initialize the GRETH MAC */
1414static int __devinit greth_of_probe(struct platform_device *ofdev, const struct of_device_id *match) 1414static int __devinit greth_of_probe(struct platform_device *ofdev)
1415{ 1415{
1416 struct net_device *dev; 1416 struct net_device *dev;
1417 struct greth_private *greth; 1417 struct greth_private *greth;
@@ -1646,7 +1646,7 @@ static struct of_device_id greth_of_match[] = {
1646 1646
1647MODULE_DEVICE_TABLE(of, greth_of_match); 1647MODULE_DEVICE_TABLE(of, greth_of_match);
1648 1648
1649static struct of_platform_driver greth_of_driver = { 1649static struct platform_driver greth_of_driver = {
1650 .driver = { 1650 .driver = {
1651 .name = "grlib-greth", 1651 .name = "grlib-greth",
1652 .owner = THIS_MODULE, 1652 .owner = THIS_MODULE,
@@ -1658,12 +1658,12 @@ static struct of_platform_driver greth_of_driver = {
1658 1658
1659static int __init greth_init(void) 1659static int __init greth_init(void)
1660{ 1660{
1661 return of_register_platform_driver(&greth_of_driver); 1661 return platform_driver_register(&greth_of_driver);
1662} 1662}
1663 1663
1664static void __exit greth_cleanup(void) 1664static void __exit greth_cleanup(void)
1665{ 1665{
1666 of_unregister_platform_driver(&greth_of_driver); 1666 platform_driver_unregister(&greth_of_driver);
1667} 1667}
1668 1668
1669module_init(greth_init); 1669module_init(greth_init);
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 6d9275c52e05..3bb990b6651a 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 = {
2719 .ndo_change_mtu = emac_change_mtu, 2719 .ndo_change_mtu = emac_change_mtu,
2720}; 2720};
2721 2721
2722static int __devinit emac_probe(struct platform_device *ofdev, 2722static int __devinit emac_probe(struct platform_device *ofdev)
2723 const struct of_device_id *match)
2724{ 2723{
2725 struct net_device *ndev; 2724 struct net_device *ndev;
2726 struct emac_instance *dev; 2725 struct emac_instance *dev;
@@ -2994,7 +2993,7 @@ static struct of_device_id emac_match[] =
2994}; 2993};
2995MODULE_DEVICE_TABLE(of, emac_match); 2994MODULE_DEVICE_TABLE(of, emac_match);
2996 2995
2997static struct of_platform_driver emac_driver = { 2996static struct platform_driver emac_driver = {
2998 .driver = { 2997 .driver = {
2999 .name = "emac", 2998 .name = "emac",
3000 .owner = THIS_MODULE, 2999 .owner = THIS_MODULE,
@@ -3069,7 +3068,7 @@ static int __init emac_init(void)
3069 rc = tah_init(); 3068 rc = tah_init();
3070 if (rc) 3069 if (rc)
3071 goto err_rgmii; 3070 goto err_rgmii;
3072 rc = of_register_platform_driver(&emac_driver); 3071 rc = platform_driver_register(&emac_driver);
3073 if (rc) 3072 if (rc)
3074 goto err_tah; 3073 goto err_tah;
3075 3074
@@ -3091,7 +3090,7 @@ static void __exit emac_exit(void)
3091{ 3090{
3092 int i; 3091 int i;
3093 3092
3094 of_unregister_platform_driver(&emac_driver); 3093 platform_driver_unregister(&emac_driver);
3095 3094
3096 tah_exit(); 3095 tah_exit();
3097 rgmii_exit(); 3096 rgmii_exit();
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index d5717e2123e1..d268f404b7b0 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)
517 return regs + 1; 517 return regs + 1;
518} 518}
519 519
520static int __devinit mal_probe(struct platform_device *ofdev, 520static int __devinit mal_probe(struct platform_device *ofdev)
521 const struct of_device_id *match)
522{ 521{
523 struct mal_instance *mal; 522 struct mal_instance *mal;
524 int err = 0, i, bd_size; 523 int err = 0, i, bd_size;
@@ -789,7 +788,7 @@ static struct of_device_id mal_platform_match[] =
789 {}, 788 {},
790}; 789};
791 790
792static struct of_platform_driver mal_of_driver = { 791static struct platform_driver mal_of_driver = {
793 .driver = { 792 .driver = {
794 .name = "mcmal", 793 .name = "mcmal",
795 .owner = THIS_MODULE, 794 .owner = THIS_MODULE,
@@ -801,10 +800,10 @@ static struct of_platform_driver mal_of_driver = {
801 800
802int __init mal_init(void) 801int __init mal_init(void)
803{ 802{
804 return of_register_platform_driver(&mal_of_driver); 803 return platform_driver_register(&mal_of_driver);
805} 804}
806 805
807void mal_exit(void) 806void mal_exit(void)
808{ 807{
809 of_unregister_platform_driver(&mal_of_driver); 808 platform_driver_unregister(&mal_of_driver);
810} 809}
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
index dd61798897ac..4fa53f3def64 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)
228} 228}
229 229
230 230
231static int __devinit rgmii_probe(struct platform_device *ofdev, 231static int __devinit rgmii_probe(struct platform_device *ofdev)
232 const struct of_device_id *match)
233{ 232{
234 struct device_node *np = ofdev->dev.of_node; 233 struct device_node *np = ofdev->dev.of_node;
235 struct rgmii_instance *dev; 234 struct rgmii_instance *dev;
@@ -318,7 +317,7 @@ static struct of_device_id rgmii_match[] =
318 {}, 317 {},
319}; 318};
320 319
321static struct of_platform_driver rgmii_driver = { 320static struct platform_driver rgmii_driver = {
322 .driver = { 321 .driver = {
323 .name = "emac-rgmii", 322 .name = "emac-rgmii",
324 .owner = THIS_MODULE, 323 .owner = THIS_MODULE,
@@ -330,10 +329,10 @@ static struct of_platform_driver rgmii_driver = {
330 329
331int __init rgmii_init(void) 330int __init rgmii_init(void)
332{ 331{
333 return of_register_platform_driver(&rgmii_driver); 332 return platform_driver_register(&rgmii_driver);
334} 333}
335 334
336void rgmii_exit(void) 335void rgmii_exit(void)
337{ 336{
338 of_unregister_platform_driver(&rgmii_driver); 337 platform_driver_unregister(&rgmii_driver);
339} 338}
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c
index 299aa49490c0..8ead6a96abaa 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)
87 return regs + 1; 87 return regs + 1;
88} 88}
89 89
90static int __devinit tah_probe(struct platform_device *ofdev, 90static int __devinit tah_probe(struct platform_device *ofdev)
91 const struct of_device_id *match)
92{ 91{
93 struct device_node *np = ofdev->dev.of_node; 92 struct device_node *np = ofdev->dev.of_node;
94 struct tah_instance *dev; 93 struct tah_instance *dev;
@@ -165,7 +164,7 @@ static struct of_device_id tah_match[] =
165 {}, 164 {},
166}; 165};
167 166
168static struct of_platform_driver tah_driver = { 167static struct platform_driver tah_driver = {
169 .driver = { 168 .driver = {
170 .name = "emac-tah", 169 .name = "emac-tah",
171 .owner = THIS_MODULE, 170 .owner = THIS_MODULE,
@@ -177,10 +176,10 @@ static struct of_platform_driver tah_driver = {
177 176
178int __init tah_init(void) 177int __init tah_init(void)
179{ 178{
180 return of_register_platform_driver(&tah_driver); 179 return platform_driver_register(&tah_driver);
181} 180}
182 181
183void tah_exit(void) 182void tah_exit(void)
184{ 183{
185 of_unregister_platform_driver(&tah_driver); 184 platform_driver_unregister(&tah_driver);
186} 185}
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c
index 34ed6ee8ca8a..97449e786d61 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)
231 return regs + 1; 231 return regs + 1;
232} 232}
233 233
234static int __devinit zmii_probe(struct platform_device *ofdev, 234static int __devinit zmii_probe(struct platform_device *ofdev)
235 const struct of_device_id *match)
236{ 235{
237 struct device_node *np = ofdev->dev.of_node; 236 struct device_node *np = ofdev->dev.of_node;
238 struct zmii_instance *dev; 237 struct zmii_instance *dev;
@@ -312,7 +311,7 @@ static struct of_device_id zmii_match[] =
312 {}, 311 {},
313}; 312};
314 313
315static struct of_platform_driver zmii_driver = { 314static struct platform_driver zmii_driver = {
316 .driver = { 315 .driver = {
317 .name = "emac-zmii", 316 .name = "emac-zmii",
318 .owner = THIS_MODULE, 317 .owner = THIS_MODULE,
@@ -324,10 +323,10 @@ static struct of_platform_driver zmii_driver = {
324 323
325int __init zmii_init(void) 324int __init zmii_init(void)
326{ 325{
327 return of_register_platform_driver(&zmii_driver); 326 return platform_driver_register(&zmii_driver);
328} 327}
329 328
330void zmii_exit(void) 329void zmii_exit(void)
331{ 330{
332 of_unregister_platform_driver(&zmii_driver); 331 platform_driver_unregister(&zmii_driver);
333} 332}
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index f35554d11441..b7948ccfcf7d 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 = {
952 .attrs = temac_device_attrs, 952 .attrs = temac_device_attrs,
953}; 953};
954 954
955static int __devinit 955static int __devinit temac_of_probe(struct platform_device *op)
956temac_of_probe(struct platform_device *op, const struct of_device_id *match)
957{ 956{
958 struct device_node *np; 957 struct device_node *np;
959 struct temac_local *lp; 958 struct temac_local *lp;
@@ -1123,7 +1122,7 @@ static struct of_device_id temac_of_match[] __devinitdata = {
1123}; 1122};
1124MODULE_DEVICE_TABLE(of, temac_of_match); 1123MODULE_DEVICE_TABLE(of, temac_of_match);
1125 1124
1126static struct of_platform_driver temac_of_driver = { 1125static struct platform_driver temac_of_driver = {
1127 .probe = temac_of_probe, 1126 .probe = temac_of_probe,
1128 .remove = __devexit_p(temac_of_remove), 1127 .remove = __devexit_p(temac_of_remove),
1129 .driver = { 1128 .driver = {
@@ -1135,13 +1134,13 @@ static struct of_platform_driver temac_of_driver = {
1135 1134
1136static int __init temac_init(void) 1135static int __init temac_init(void)
1137{ 1136{
1138 return of_register_platform_driver(&temac_of_driver); 1137 return platform_driver_register(&temac_of_driver);
1139} 1138}
1140module_init(temac_init); 1139module_init(temac_init);
1141 1140
1142static void __exit temac_exit(void) 1141static void __exit temac_exit(void)
1143{ 1142{
1144 of_unregister_platform_driver(&temac_of_driver); 1143 platform_driver_unregister(&temac_of_driver);
1145} 1144}
1146module_exit(temac_exit); 1145module_exit(temac_exit);
1147 1146
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 4846e131a04e..a761076b69c3 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 = {
926 .ndo_validate_addr = eth_validate_addr, 926 .ndo_validate_addr = eth_validate_addr,
927}; 927};
928 928
929static int __devinit myri_sbus_probe(struct platform_device *op, const struct of_device_id *match) 929static int __devinit myri_sbus_probe(struct platform_device *op)
930{ 930{
931 struct device_node *dp = op->dev.of_node; 931 struct device_node *dp = op->dev.of_node;
932 static unsigned version_printed; 932 static unsigned version_printed;
@@ -1160,7 +1160,7 @@ static const struct of_device_id myri_sbus_match[] = {
1160 1160
1161MODULE_DEVICE_TABLE(of, myri_sbus_match); 1161MODULE_DEVICE_TABLE(of, myri_sbus_match);
1162 1162
1163static struct of_platform_driver myri_sbus_driver = { 1163static struct platform_driver myri_sbus_driver = {
1164 .driver = { 1164 .driver = {
1165 .name = "myri", 1165 .name = "myri",
1166 .owner = THIS_MODULE, 1166 .owner = THIS_MODULE,
@@ -1172,12 +1172,12 @@ static struct of_platform_driver myri_sbus_driver = {
1172 1172
1173static int __init myri_sbus_init(void) 1173static int __init myri_sbus_init(void)
1174{ 1174{
1175 return of_register_platform_driver(&myri_sbus_driver); 1175 return platform_driver_register(&myri_sbus_driver);
1176} 1176}
1177 1177
1178static void __exit myri_sbus_exit(void) 1178static void __exit myri_sbus_exit(void)
1179{ 1179{
1180 of_unregister_platform_driver(&myri_sbus_driver); 1180 platform_driver_unregister(&myri_sbus_driver);
1181} 1181}
1182 1182
1183module_init(myri_sbus_init); 1183module_init(myri_sbus_init);
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 9fb59d3f9c92..40fa59e2fd5c 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -10062,8 +10062,7 @@ static const struct niu_ops niu_phys_ops = {
10062 .unmap_single = niu_phys_unmap_single, 10062 .unmap_single = niu_phys_unmap_single,
10063}; 10063};
10064 10064
10065static int __devinit niu_of_probe(struct platform_device *op, 10065static int __devinit niu_of_probe(struct platform_device *op)
10066 const struct of_device_id *match)
10067{ 10066{
10068 union niu_parent_id parent_id; 10067 union niu_parent_id parent_id;
10069 struct net_device *dev; 10068 struct net_device *dev;
@@ -10223,7 +10222,7 @@ static const struct of_device_id niu_match[] = {
10223}; 10222};
10224MODULE_DEVICE_TABLE(of, niu_match); 10223MODULE_DEVICE_TABLE(of, niu_match);
10225 10224
10226static struct of_platform_driver niu_of_driver = { 10225static struct platform_driver niu_of_driver = {
10227 .driver = { 10226 .driver = {
10228 .name = "niu", 10227 .name = "niu",
10229 .owner = THIS_MODULE, 10228 .owner = THIS_MODULE,
@@ -10244,14 +10243,14 @@ static int __init niu_init(void)
10244 niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT); 10243 niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT);
10245 10244
10246#ifdef CONFIG_SPARC64 10245#ifdef CONFIG_SPARC64
10247 err = of_register_platform_driver(&niu_of_driver); 10246 err = platform_driver_register(&niu_of_driver);
10248#endif 10247#endif
10249 10248
10250 if (!err) { 10249 if (!err) {
10251 err = pci_register_driver(&niu_pci_driver); 10250 err = pci_register_driver(&niu_pci_driver);
10252#ifdef CONFIG_SPARC64 10251#ifdef CONFIG_SPARC64
10253 if (err) 10252 if (err)
10254 of_unregister_platform_driver(&niu_of_driver); 10253 platform_driver_unregister(&niu_of_driver);
10255#endif 10254#endif
10256 } 10255 }
10257 10256
@@ -10262,7 +10261,7 @@ static void __exit niu_exit(void)
10262{ 10261{
10263 pci_unregister_driver(&niu_pci_driver); 10262 pci_unregister_driver(&niu_pci_driver);
10264#ifdef CONFIG_SPARC64 10263#ifdef CONFIG_SPARC64
10265 of_unregister_platform_driver(&niu_of_driver); 10264 platform_driver_unregister(&niu_of_driver);
10266#endif 10265#endif
10267} 10266}
10268 10267
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index f62c7b717bc8..47c8339a0359 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)
188 188
189#ifdef CONFIG_OF_GPIO 189#ifdef CONFIG_OF_GPIO
190 190
191static int __devinit mdio_ofgpio_probe(struct platform_device *ofdev, 191static int __devinit mdio_ofgpio_probe(struct platform_device *ofdev)
192 const struct of_device_id *match)
193{ 192{
194 struct mdio_gpio_platform_data *pdata; 193 struct mdio_gpio_platform_data *pdata;
195 struct mii_bus *new_bus; 194 struct mii_bus *new_bus;
@@ -240,7 +239,7 @@ static struct of_device_id mdio_ofgpio_match[] = {
240}; 239};
241MODULE_DEVICE_TABLE(of, mdio_ofgpio_match); 240MODULE_DEVICE_TABLE(of, mdio_ofgpio_match);
242 241
243static struct of_platform_driver mdio_ofgpio_driver = { 242static struct platform_driver mdio_ofgpio_driver = {
244 .driver = { 243 .driver = {
245 .name = "mdio-gpio", 244 .name = "mdio-gpio",
246 .owner = THIS_MODULE, 245 .owner = THIS_MODULE,
@@ -252,12 +251,12 @@ static struct of_platform_driver mdio_ofgpio_driver = {
252 251
253static inline int __init mdio_ofgpio_init(void) 252static inline int __init mdio_ofgpio_init(void)
254{ 253{
255 return of_register_platform_driver(&mdio_ofgpio_driver); 254 return platform_driver_register(&mdio_ofgpio_driver);
256} 255}
257 256
258static inline void __exit mdio_ofgpio_exit(void) 257static inline void __exit mdio_ofgpio_exit(void)
259{ 258{
260 of_unregister_platform_driver(&mdio_ofgpio_driver); 259 platform_driver_unregister(&mdio_ofgpio_driver);
261} 260}
262#else 261#else
263static inline int __init mdio_ofgpio_init(void) { return 0; } 262static inline int __init mdio_ofgpio_init(void) { return 0; }
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 0a6a5ced3c1c..aa4765803a4c 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -1242,8 +1242,7 @@ fail_and_cleanup:
1242/* QEC can be the parent of either QuadEthernet or a BigMAC. We want 1242/* QEC can be the parent of either QuadEthernet or a BigMAC. We want
1243 * the latter. 1243 * the latter.
1244 */ 1244 */
1245static int __devinit bigmac_sbus_probe(struct platform_device *op, 1245static int __devinit bigmac_sbus_probe(struct platform_device *op)
1246 const struct of_device_id *match)
1247{ 1246{
1248 struct device *parent = op->dev.parent; 1247 struct device *parent = op->dev.parent;
1249 struct platform_device *qec_op; 1248 struct platform_device *qec_op;
@@ -1289,7 +1288,7 @@ static const struct of_device_id bigmac_sbus_match[] = {
1289 1288
1290MODULE_DEVICE_TABLE(of, bigmac_sbus_match); 1289MODULE_DEVICE_TABLE(of, bigmac_sbus_match);
1291 1290
1292static struct of_platform_driver bigmac_sbus_driver = { 1291static struct platform_driver bigmac_sbus_driver = {
1293 .driver = { 1292 .driver = {
1294 .name = "sunbmac", 1293 .name = "sunbmac",
1295 .owner = THIS_MODULE, 1294 .owner = THIS_MODULE,
@@ -1301,12 +1300,12 @@ static struct of_platform_driver bigmac_sbus_driver = {
1301 1300
1302static int __init bigmac_init(void) 1301static int __init bigmac_init(void)
1303{ 1302{
1304 return of_register_platform_driver(&bigmac_sbus_driver); 1303 return platform_driver_register(&bigmac_sbus_driver);
1305} 1304}
1306 1305
1307static void __exit bigmac_exit(void) 1306static void __exit bigmac_exit(void)
1308{ 1307{
1309 of_unregister_platform_driver(&bigmac_sbus_driver); 1308 platform_driver_unregister(&bigmac_sbus_driver);
1310} 1309}
1311 1310
1312module_init(bigmac_init); 1311module_init(bigmac_init);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 55bbb9c15d96..eb4f59fb01e9 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3237,11 +3237,15 @@ static void happy_meal_pci_exit(void)
3237#endif 3237#endif
3238 3238
3239#ifdef CONFIG_SBUS 3239#ifdef CONFIG_SBUS
3240static int __devinit hme_sbus_probe(struct platform_device *op, const struct of_device_id *match) 3240static int __devinit hme_sbus_probe(struct platform_device *op)
3241{ 3241{
3242 struct device_node *dp = op->dev.of_node; 3242 struct device_node *dp = op->dev.of_node;
3243 const char *model = of_get_property(dp, "model", NULL); 3243 const char *model = of_get_property(dp, "model", NULL);
3244 int is_qfe = (match->data != NULL); 3244 int is_qfe;
3245
3246 if (!op->dev.of_match)
3247 return -EINVAL;
3248 is_qfe = (op->dev.of_match->data != NULL);
3245 3249
3246 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) 3250 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe"))
3247 is_qfe = 1; 3251 is_qfe = 1;
@@ -3292,7 +3296,7 @@ static const struct of_device_id hme_sbus_match[] = {
3292 3296
3293MODULE_DEVICE_TABLE(of, hme_sbus_match); 3297MODULE_DEVICE_TABLE(of, hme_sbus_match);
3294 3298
3295static struct of_platform_driver hme_sbus_driver = { 3299static struct platform_driver hme_sbus_driver = {
3296 .driver = { 3300 .driver = {
3297 .name = "hme", 3301 .name = "hme",
3298 .owner = THIS_MODULE, 3302 .owner = THIS_MODULE,
@@ -3306,7 +3310,7 @@ static int __init happy_meal_sbus_init(void)
3306{ 3310{
3307 int err; 3311 int err;
3308 3312
3309 err = of_register_platform_driver(&hme_sbus_driver); 3313 err = platform_driver_register(&hme_sbus_driver);
3310 if (!err) 3314 if (!err)
3311 err = quattro_sbus_register_irqs(); 3315 err = quattro_sbus_register_irqs();
3312 3316
@@ -3315,7 +3319,7 @@ static int __init happy_meal_sbus_init(void)
3315 3319
3316static void happy_meal_sbus_exit(void) 3320static void happy_meal_sbus_exit(void)
3317{ 3321{
3318 of_unregister_platform_driver(&hme_sbus_driver); 3322 platform_driver_unregister(&hme_sbus_driver);
3319 quattro_sbus_free_irqs(); 3323 quattro_sbus_free_irqs();
3320 3324
3321 while (qfe_sbus_list) { 3325 while (qfe_sbus_list) {
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 767e1e2b210d..32a5c7f63c43 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1495,7 +1495,7 @@ fail:
1495 return -ENODEV; 1495 return -ENODEV;
1496} 1496}
1497 1497
1498static int __devinit sunlance_sbus_probe(struct platform_device *op, const struct of_device_id *match) 1498static int __devinit sunlance_sbus_probe(struct platform_device *op)
1499{ 1499{
1500 struct platform_device *parent = to_platform_device(op->dev.parent); 1500 struct platform_device *parent = to_platform_device(op->dev.parent);
1501 struct device_node *parent_dp = parent->dev.of_node; 1501 struct device_node *parent_dp = parent->dev.of_node;
@@ -1536,7 +1536,7 @@ static const struct of_device_id sunlance_sbus_match[] = {
1536 1536
1537MODULE_DEVICE_TABLE(of, sunlance_sbus_match); 1537MODULE_DEVICE_TABLE(of, sunlance_sbus_match);
1538 1538
1539static struct of_platform_driver sunlance_sbus_driver = { 1539static struct platform_driver sunlance_sbus_driver = {
1540 .driver = { 1540 .driver = {
1541 .name = "sunlance", 1541 .name = "sunlance",
1542 .owner = THIS_MODULE, 1542 .owner = THIS_MODULE,
@@ -1550,12 +1550,12 @@ static struct of_platform_driver sunlance_sbus_driver = {
1550/* Find all the lance cards on the system and initialize them */ 1550/* Find all the lance cards on the system and initialize them */
1551static int __init sparc_lance_init(void) 1551static int __init sparc_lance_init(void)
1552{ 1552{
1553 return of_register_platform_driver(&sunlance_sbus_driver); 1553 return platform_driver_register(&sunlance_sbus_driver);
1554} 1554}
1555 1555
1556static void __exit sparc_lance_exit(void) 1556static void __exit sparc_lance_exit(void)
1557{ 1557{
1558 of_unregister_platform_driver(&sunlance_sbus_driver); 1558 platform_driver_unregister(&sunlance_sbus_driver);
1559} 1559}
1560 1560
1561module_init(sparc_lance_init); 1561module_init(sparc_lance_init);
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 9536b2f010be..18ecdc303751 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -941,7 +941,7 @@ fail:
941 return res; 941 return res;
942} 942}
943 943
944static int __devinit qec_sbus_probe(struct platform_device *op, const struct of_device_id *match) 944static int __devinit qec_sbus_probe(struct platform_device *op)
945{ 945{
946 return qec_ether_init(op); 946 return qec_ether_init(op);
947} 947}
@@ -976,7 +976,7 @@ static const struct of_device_id qec_sbus_match[] = {
976 976
977MODULE_DEVICE_TABLE(of, qec_sbus_match); 977MODULE_DEVICE_TABLE(of, qec_sbus_match);
978 978
979static struct of_platform_driver qec_sbus_driver = { 979static struct platform_driver qec_sbus_driver = {
980 .driver = { 980 .driver = {
981 .name = "qec", 981 .name = "qec",
982 .owner = THIS_MODULE, 982 .owner = THIS_MODULE,
@@ -988,12 +988,12 @@ static struct of_platform_driver qec_sbus_driver = {
988 988
989static int __init qec_init(void) 989static int __init qec_init(void)
990{ 990{
991 return of_register_platform_driver(&qec_sbus_driver); 991 return platform_driver_register(&qec_sbus_driver);
992} 992}
993 993
994static void __exit qec_exit(void) 994static void __exit qec_exit(void)
995{ 995{
996 of_unregister_platform_driver(&qec_sbus_driver); 996 platform_driver_unregister(&qec_sbus_driver);
997 997
998 while (root_qec_dev) { 998 while (root_qec_dev) {
999 struct sunqec *next = root_qec_dev->next_module; 999 struct sunqec *next = root_qec_dev->next_module;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 715e7b47e7e9..ef041057d9d3 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 = {
3740#endif 3740#endif
3741}; 3741};
3742 3742
3743static int ucc_geth_probe(struct platform_device* ofdev, const struct of_device_id *match) 3743static int ucc_geth_probe(struct platform_device* ofdev)
3744{ 3744{
3745 struct device *device = &ofdev->dev; 3745 struct device *device = &ofdev->dev;
3746 struct device_node *np = ofdev->dev.of_node; 3746 struct device_node *np = ofdev->dev.of_node;
@@ -3986,7 +3986,7 @@ static struct of_device_id ucc_geth_match[] = {
3986 3986
3987MODULE_DEVICE_TABLE(of, ucc_geth_match); 3987MODULE_DEVICE_TABLE(of, ucc_geth_match);
3988 3988
3989static struct of_platform_driver ucc_geth_driver = { 3989static struct platform_driver ucc_geth_driver = {
3990 .driver = { 3990 .driver = {
3991 .name = DRV_NAME, 3991 .name = DRV_NAME,
3992 .owner = THIS_MODULE, 3992 .owner = THIS_MODULE,
@@ -4008,14 +4008,14 @@ static int __init ucc_geth_init(void)
4008 memcpy(&(ugeth_info[i]), &ugeth_primary_info, 4008 memcpy(&(ugeth_info[i]), &ugeth_primary_info,
4009 sizeof(ugeth_primary_info)); 4009 sizeof(ugeth_primary_info));
4010 4010
4011 ret = of_register_platform_driver(&ucc_geth_driver); 4011 ret = platform_driver_register(&ucc_geth_driver);
4012 4012
4013 return ret; 4013 return ret;
4014} 4014}
4015 4015
4016static void __exit ucc_geth_exit(void) 4016static void __exit ucc_geth_exit(void)
4017{ 4017{
4018 of_unregister_platform_driver(&ucc_geth_driver); 4018 platform_driver_unregister(&ucc_geth_driver);
4019} 4019}
4020 4020
4021module_init(ucc_geth_init); 4021module_init(ucc_geth_init);
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index cad66ce1640b..2642af4ee491 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;
1101 * Return: 0, if the driver is bound to the Emaclite device, or 1101 * Return: 0, if the driver is bound to the Emaclite device, or
1102 * a negative error if there is failure. 1102 * a negative error if there is failure.
1103 */ 1103 */
1104static int __devinit xemaclite_of_probe(struct platform_device *ofdev, 1104static int __devinit xemaclite_of_probe(struct platform_device *ofdev)
1105 const struct of_device_id *match)
1106{ 1105{
1107 struct resource r_irq; /* Interrupt resources */ 1106 struct resource r_irq; /* Interrupt resources */
1108 struct resource r_mem; /* IO mem resources */ 1107 struct resource r_mem; /* IO mem resources */
@@ -1288,7 +1287,7 @@ static struct of_device_id xemaclite_of_match[] __devinitdata = {
1288}; 1287};
1289MODULE_DEVICE_TABLE(of, xemaclite_of_match); 1288MODULE_DEVICE_TABLE(of, xemaclite_of_match);
1290 1289
1291static struct of_platform_driver xemaclite_of_driver = { 1290static struct platform_driver xemaclite_of_driver = {
1292 .driver = { 1291 .driver = {
1293 .name = DRIVER_NAME, 1292 .name = DRIVER_NAME,
1294 .owner = THIS_MODULE, 1293 .owner = THIS_MODULE,
@@ -1306,7 +1305,7 @@ static struct of_platform_driver xemaclite_of_driver = {
1306static int __init xemaclite_init(void) 1305static int __init xemaclite_init(void)
1307{ 1306{
1308 /* No kernel boot options used, we just need to register the driver */ 1307 /* No kernel boot options used, we just need to register the driver */
1309 return of_register_platform_driver(&xemaclite_of_driver); 1308 return platform_driver_register(&xemaclite_of_driver);
1310} 1309}
1311 1310
1312/** 1311/**
@@ -1314,7 +1313,7 @@ static int __init xemaclite_init(void)
1314 */ 1313 */
1315static void __exit xemaclite_cleanup(void) 1314static void __exit xemaclite_cleanup(void)
1316{ 1315{
1317 of_unregister_platform_driver(&xemaclite_of_driver); 1316 platform_driver_unregister(&xemaclite_of_driver);
1318} 1317}
1319 1318
1320module_init(xemaclite_init); 1319module_init(xemaclite_init);
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 45d86530799f..62b4b32ac887 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -47,40 +47,6 @@ void of_dev_put(struct platform_device *dev)
47} 47}
48EXPORT_SYMBOL(of_dev_put); 48EXPORT_SYMBOL(of_dev_put);
49 49
50static ssize_t devspec_show(struct device *dev,
51 struct device_attribute *attr, char *buf)
52{
53 struct platform_device *ofdev;
54
55 ofdev = to_platform_device(dev);
56 return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
57}
58
59static ssize_t name_show(struct device *dev,
60 struct device_attribute *attr, char *buf)
61{
62 struct platform_device *ofdev;
63
64 ofdev = to_platform_device(dev);
65 return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
66}
67
68static ssize_t modalias_show(struct device *dev,
69 struct device_attribute *attr, char *buf)
70{
71 ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
72 buf[len] = '\n';
73 buf[len+1] = 0;
74 return len+1;
75}
76
77struct device_attribute of_platform_device_attrs[] = {
78 __ATTR_RO(devspec),
79 __ATTR_RO(name),
80 __ATTR_RO(modalias),
81 __ATTR_NULL
82};
83
84int of_device_add(struct platform_device *ofdev) 50int of_device_add(struct platform_device *ofdev)
85{ 51{
86 BUG_ON(ofdev->dev.of_node == NULL); 52 BUG_ON(ofdev->dev.of_node == NULL);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c01cd1ac7617..1ce4c45c4ab2 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -42,471 +42,10 @@ struct platform_device *of_find_device_by_node(struct device_node *np)
42} 42}
43EXPORT_SYMBOL(of_find_device_by_node); 43EXPORT_SYMBOL(of_find_device_by_node);
44 44
45static int platform_driver_probe_shim(struct platform_device *pdev)
46{
47 struct platform_driver *pdrv;
48 struct of_platform_driver *ofpdrv;
49 const struct of_device_id *match;
50
51 pdrv = container_of(pdev->dev.driver, struct platform_driver, driver);
52 ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver);
53
54 /* There is an unlikely chance that an of_platform driver might match
55 * on a non-OF platform device. If so, then of_match_device() will
56 * come up empty. Return -EINVAL in this case so other drivers get
57 * the chance to bind. */
58 match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
59 return match ? ofpdrv->probe(pdev, match) : -EINVAL;
60}
61
62static void platform_driver_shutdown_shim(struct platform_device *pdev)
63{
64 struct platform_driver *pdrv;
65 struct of_platform_driver *ofpdrv;
66
67 pdrv = container_of(pdev->dev.driver, struct platform_driver, driver);
68 ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver);
69 ofpdrv->shutdown(pdev);
70}
71
72/**
73 * of_register_platform_driver
74 */
75int of_register_platform_driver(struct of_platform_driver *drv)
76{
77 char *of_name;
78
79 /* setup of_platform_driver to platform_driver adaptors */
80 drv->platform_driver.driver = drv->driver;
81
82 /* Prefix the driver name with 'of:' to avoid namespace collisions
83 * and bogus matches. There are some drivers in the tree that
84 * register both an of_platform_driver and a platform_driver with
85 * the same name. This is a temporary measure until they are all
86 * cleaned up --gcl July 29, 2010 */
87 of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL);
88 if (!of_name)
89 return -ENOMEM;
90 sprintf(of_name, "of:%s", drv->driver.name);
91 drv->platform_driver.driver.name = of_name;
92
93 if (drv->probe)
94 drv->platform_driver.probe = platform_driver_probe_shim;
95 drv->platform_driver.remove = drv->remove;
96 if (drv->shutdown)
97 drv->platform_driver.shutdown = platform_driver_shutdown_shim;
98 drv->platform_driver.suspend = drv->suspend;
99 drv->platform_driver.resume = drv->resume;
100
101 return platform_driver_register(&drv->platform_driver);
102}
103EXPORT_SYMBOL(of_register_platform_driver);
104
105void of_unregister_platform_driver(struct of_platform_driver *drv)
106{
107 platform_driver_unregister(&drv->platform_driver);
108 kfree(drv->platform_driver.driver.name);
109 drv->platform_driver.driver.name = NULL;
110}
111EXPORT_SYMBOL(of_unregister_platform_driver);
112
113#if defined(CONFIG_PPC_DCR) 45#if defined(CONFIG_PPC_DCR)
114#include <asm/dcr.h> 46#include <asm/dcr.h>
115#endif 47#endif
116 48
117extern struct device_attribute of_platform_device_attrs[];
118
119static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
120{
121 const struct of_device_id *matches = drv->of_match_table;
122
123 if (!matches)
124 return 0;
125
126 return of_match_device(matches, dev) != NULL;
127}
128
129static int of_platform_device_probe(struct device *dev)
130{
131 int error = -ENODEV;
132 struct of_platform_driver *drv;
133 struct platform_device *of_dev;
134 const struct of_device_id *match;
135
136 drv = to_of_platform_driver(dev->driver);
137 of_dev = to_platform_device(dev);
138
139 if (!drv->probe)
140 return error;
141
142 of_dev_get(of_dev);
143
144 match = of_match_device(drv->driver.of_match_table, dev);
145 if (match)
146 error = drv->probe(of_dev, match);
147 if (error)
148 of_dev_put(of_dev);
149
150 return error;
151}
152
153static int of_platform_device_remove(struct device *dev)
154{
155 struct platform_device *of_dev = to_platform_device(dev);
156 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
157
158 if (dev->driver && drv->remove)
159 drv->remove(of_dev);
160 return 0;
161}
162
163static void of_platform_device_shutdown(struct device *dev)
164{
165 struct platform_device *of_dev = to_platform_device(dev);
166 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
167
168 if (dev->driver && drv->shutdown)
169 drv->shutdown(of_dev);
170}
171
172#ifdef CONFIG_PM_SLEEP
173
174static int of_platform_legacy_suspend(struct device *dev, pm_message_t mesg)
175{
176 struct platform_device *of_dev = to_platform_device(dev);
177 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
178 int ret = 0;
179
180 if (dev->driver && drv->suspend)
181 ret = drv->suspend(of_dev, mesg);
182 return ret;
183}
184
185static int of_platform_legacy_resume(struct device *dev)
186{
187 struct platform_device *of_dev = to_platform_device(dev);
188 struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
189 int ret = 0;
190
191 if (dev->driver && drv->resume)
192 ret = drv->resume(of_dev);
193 return ret;
194}
195
196static int of_platform_pm_prepare(struct device *dev)
197{
198 struct device_driver *drv = dev->driver;
199 int ret = 0;
200
201 if (drv && drv->pm && drv->pm->prepare)
202 ret = drv->pm->prepare(dev);
203
204 return ret;
205}
206
207static void of_platform_pm_complete(struct device *dev)
208{
209 struct device_driver *drv = dev->driver;
210
211 if (drv && drv->pm && drv->pm->complete)
212 drv->pm->complete(dev);
213}
214
215#ifdef CONFIG_SUSPEND
216
217static int of_platform_pm_suspend(struct device *dev)
218{
219 struct device_driver *drv = dev->driver;
220 int ret = 0;
221
222 if (!drv)
223 return 0;
224
225 if (drv->pm) {
226 if (drv->pm->suspend)
227 ret = drv->pm->suspend(dev);
228 } else {
229 ret = of_platform_legacy_suspend(dev, PMSG_SUSPEND);
230 }
231
232 return ret;
233}
234
235static int of_platform_pm_suspend_noirq(struct device *dev)
236{
237 struct device_driver *drv = dev->driver;
238 int ret = 0;
239
240 if (!drv)
241 return 0;
242
243 if (drv->pm) {
244 if (drv->pm->suspend_noirq)
245 ret = drv->pm->suspend_noirq(dev);
246 }
247
248 return ret;
249}
250
251static int of_platform_pm_resume(struct device *dev)
252{
253 struct device_driver *drv = dev->driver;
254 int ret = 0;
255
256 if (!drv)
257 return 0;
258
259 if (drv->pm) {
260 if (drv->pm->resume)
261 ret = drv->pm->resume(dev);
262 } else {
263 ret = of_platform_legacy_resume(dev);
264 }
265
266 return ret;
267}
268
269static int of_platform_pm_resume_noirq(struct device *dev)
270{
271 struct device_driver *drv = dev->driver;
272 int ret = 0;
273
274 if (!drv)
275 return 0;
276
277 if (drv->pm) {
278 if (drv->pm->resume_noirq)
279 ret = drv->pm->resume_noirq(dev);
280 }
281
282 return ret;
283}
284
285#else /* !CONFIG_SUSPEND */
286
287#define of_platform_pm_suspend NULL
288#define of_platform_pm_resume NULL
289#define of_platform_pm_suspend_noirq NULL
290#define of_platform_pm_resume_noirq NULL
291
292#endif /* !CONFIG_SUSPEND */
293
294#ifdef CONFIG_HIBERNATION
295
296static int of_platform_pm_freeze(struct device *dev)
297{
298 struct device_driver *drv = dev->driver;
299 int ret = 0;
300
301 if (!drv)
302 return 0;
303
304 if (drv->pm) {
305 if (drv->pm->freeze)
306 ret = drv->pm->freeze(dev);
307 } else {
308 ret = of_platform_legacy_suspend(dev, PMSG_FREEZE);
309 }
310
311 return ret;
312}
313
314static int of_platform_pm_freeze_noirq(struct device *dev)
315{
316 struct device_driver *drv = dev->driver;
317 int ret = 0;
318
319 if (!drv)
320 return 0;
321
322 if (drv->pm) {
323 if (drv->pm->freeze_noirq)
324 ret = drv->pm->freeze_noirq(dev);
325 }
326
327 return ret;
328}
329
330static int of_platform_pm_thaw(struct device *dev)
331{
332 struct device_driver *drv = dev->driver;
333 int ret = 0;
334
335 if (!drv)
336 return 0;
337
338 if (drv->pm) {
339 if (drv->pm->thaw)
340 ret = drv->pm->thaw(dev);
341 } else {
342 ret = of_platform_legacy_resume(dev);
343 }
344
345 return ret;
346}
347
348static int of_platform_pm_thaw_noirq(struct device *dev)
349{
350 struct device_driver *drv = dev->driver;
351 int ret = 0;
352
353 if (!drv)
354 return 0;
355
356 if (drv->pm) {
357 if (drv->pm->thaw_noirq)
358 ret = drv->pm->thaw_noirq(dev);
359 }
360
361 return ret;
362}
363
364static int of_platform_pm_poweroff(struct device *dev)
365{
366 struct device_driver *drv = dev->driver;
367 int ret = 0;
368
369 if (!drv)
370 return 0;
371
372 if (drv->pm) {
373 if (drv->pm->poweroff)
374 ret = drv->pm->poweroff(dev);
375 } else {
376 ret = of_platform_legacy_suspend(dev, PMSG_HIBERNATE);
377 }
378
379 return ret;
380}
381
382static int of_platform_pm_poweroff_noirq(struct device *dev)
383{
384 struct device_driver *drv = dev->driver;
385 int ret = 0;
386
387 if (!drv)
388 return 0;
389
390 if (drv->pm) {
391 if (drv->pm->poweroff_noirq)
392 ret = drv->pm->poweroff_noirq(dev);
393 }
394
395 return ret;
396}
397
398static int of_platform_pm_restore(struct device *dev)
399{
400 struct device_driver *drv = dev->driver;
401 int ret = 0;
402
403 if (!drv)
404 return 0;
405
406 if (drv->pm) {
407 if (drv->pm->restore)
408 ret = drv->pm->restore(dev);
409 } else {
410 ret = of_platform_legacy_resume(dev);
411 }
412
413 return ret;
414}
415
416static int of_platform_pm_restore_noirq(struct device *dev)
417{
418 struct device_driver *drv = dev->driver;
419 int ret = 0;
420
421 if (!drv)
422 return 0;
423
424 if (drv->pm) {
425 if (drv->pm->restore_noirq)
426 ret = drv->pm->restore_noirq(dev);
427 }
428
429 return ret;
430}
431
432#else /* !CONFIG_HIBERNATION */
433
434#define of_platform_pm_freeze NULL
435#define of_platform_pm_thaw NULL
436#define of_platform_pm_poweroff NULL
437#define of_platform_pm_restore NULL
438#define of_platform_pm_freeze_noirq NULL
439#define of_platform_pm_thaw_noirq NULL
440#define of_platform_pm_poweroff_noirq NULL
441#define of_platform_pm_restore_noirq NULL
442
443#endif /* !CONFIG_HIBERNATION */
444
445static struct dev_pm_ops of_platform_dev_pm_ops = {
446 .prepare = of_platform_pm_prepare,
447 .complete = of_platform_pm_complete,
448 .suspend = of_platform_pm_suspend,
449 .resume = of_platform_pm_resume,
450 .freeze = of_platform_pm_freeze,
451 .thaw = of_platform_pm_thaw,
452 .poweroff = of_platform_pm_poweroff,
453 .restore = of_platform_pm_restore,
454 .suspend_noirq = of_platform_pm_suspend_noirq,
455 .resume_noirq = of_platform_pm_resume_noirq,
456 .freeze_noirq = of_platform_pm_freeze_noirq,
457 .thaw_noirq = of_platform_pm_thaw_noirq,
458 .poweroff_noirq = of_platform_pm_poweroff_noirq,
459 .restore_noirq = of_platform_pm_restore_noirq,
460};
461
462#define OF_PLATFORM_PM_OPS_PTR (&of_platform_dev_pm_ops)
463
464#else /* !CONFIG_PM_SLEEP */
465
466#define OF_PLATFORM_PM_OPS_PTR NULL
467
468#endif /* !CONFIG_PM_SLEEP */
469
470int of_bus_type_init(struct bus_type *bus, const char *name)
471{
472 bus->name = name;
473 bus->match = of_platform_bus_match;
474 bus->probe = of_platform_device_probe;
475 bus->remove = of_platform_device_remove;
476 bus->shutdown = of_platform_device_shutdown;
477 bus->dev_attrs = of_platform_device_attrs;
478 bus->pm = OF_PLATFORM_PM_OPS_PTR;
479 return bus_register(bus);
480}
481
482int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
483{
484 /*
485 * Temporary: of_platform_bus used to be distinct from the platform
486 * bus. It isn't anymore, and so drivers on the platform bus need
487 * to be registered in a special way.
488 *
489 * After all of_platform_bus_type drivers are converted to
490 * platform_drivers, this exception can be removed.
491 */
492 if (bus == &platform_bus_type)
493 return of_register_platform_driver(drv);
494
495 /* register with core */
496 drv->driver.bus = bus;
497 return driver_register(&drv->driver);
498}
499EXPORT_SYMBOL(of_register_driver);
500
501void of_unregister_driver(struct of_platform_driver *drv)
502{
503 if (drv->driver.bus == &platform_bus_type)
504 of_unregister_platform_driver(drv);
505 else
506 driver_unregister(&drv->driver);
507}
508EXPORT_SYMBOL(of_unregister_driver);
509
510#if !defined(CONFIG_SPARC) 49#if !defined(CONFIG_SPARC)
511/* 50/*
512 * The following routines scan a subtree and registers a device for 51 * The following routines scan a subtree and registers a device for
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 55ba118f1cf1..910c5a26e347 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -286,7 +286,7 @@ static struct parport_operations parport_sunbpp_ops =
286 .owner = THIS_MODULE, 286 .owner = THIS_MODULE,
287}; 287};
288 288
289static int __devinit bpp_probe(struct platform_device *op, const struct of_device_id *match) 289static int __devinit bpp_probe(struct platform_device *op)
290{ 290{
291 struct parport_operations *ops; 291 struct parport_operations *ops;
292 struct bpp_regs __iomem *regs; 292 struct bpp_regs __iomem *regs;
@@ -381,7 +381,7 @@ static const struct of_device_id bpp_match[] = {
381 381
382MODULE_DEVICE_TABLE(of, bpp_match); 382MODULE_DEVICE_TABLE(of, bpp_match);
383 383
384static struct of_platform_driver bpp_sbus_driver = { 384static struct platform_driver bpp_sbus_driver = {
385 .driver = { 385 .driver = {
386 .name = "bpp", 386 .name = "bpp",
387 .owner = THIS_MODULE, 387 .owner = THIS_MODULE,
@@ -393,12 +393,12 @@ static struct of_platform_driver bpp_sbus_driver = {
393 393
394static int __init parport_sunbpp_init(void) 394static int __init parport_sunbpp_init(void)
395{ 395{
396 return of_register_platform_driver(&bpp_sbus_driver); 396 return platform_driver_register(&bpp_sbus_driver);
397} 397}
398 398
399static void __exit parport_sunbpp_exit(void) 399static void __exit parport_sunbpp_exit(void)
400{ 400{
401 of_unregister_platform_driver(&bpp_sbus_driver); 401 platform_driver_unregister(&bpp_sbus_driver);
402} 402}
403 403
404MODULE_AUTHOR("Derrick J Brashear"); 404MODULE_AUTHOR("Derrick J Brashear");
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 546d3024b6f0..6defd4a8168e 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -181,8 +181,7 @@ static struct pccard_operations electra_cf_ops = {
181 .set_mem_map = electra_cf_set_mem_map, 181 .set_mem_map = electra_cf_set_mem_map,
182}; 182};
183 183
184static int __devinit electra_cf_probe(struct platform_device *ofdev, 184static int __devinit electra_cf_probe(struct platform_device *ofdev)
185 const struct of_device_id *match)
186{ 185{
187 struct device *device = &ofdev->dev; 186 struct device *device = &ofdev->dev;
188 struct device_node *np = ofdev->dev.of_node; 187 struct device_node *np = ofdev->dev.of_node;
@@ -356,7 +355,7 @@ static const struct of_device_id electra_cf_match[] = {
356}; 355};
357MODULE_DEVICE_TABLE(of, electra_cf_match); 356MODULE_DEVICE_TABLE(of, electra_cf_match);
358 357
359static struct of_platform_driver electra_cf_driver = { 358static struct platform_driver electra_cf_driver = {
360 .driver = { 359 .driver = {
361 .name = (char *)driver_name, 360 .name = (char *)driver_name,
362 .owner = THIS_MODULE, 361 .owner = THIS_MODULE,
@@ -368,13 +367,13 @@ static struct of_platform_driver electra_cf_driver = {
368 367
369static int __init electra_cf_init(void) 368static int __init electra_cf_init(void)
370{ 369{
371 return of_register_platform_driver(&electra_cf_driver); 370 return platform_driver_register(&electra_cf_driver);
372} 371}
373module_init(electra_cf_init); 372module_init(electra_cf_init);
374 373
375static void __exit electra_cf_exit(void) 374static void __exit electra_cf_exit(void)
376{ 375{
377 of_unregister_platform_driver(&electra_cf_driver); 376 platform_driver_unregister(&electra_cf_driver);
378} 377}
379module_exit(electra_cf_exit); 378module_exit(electra_cf_exit);
380 379
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 0db482771fb5..271a590a5f3c 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -1148,8 +1148,7 @@ static struct pccard_operations m8xx_services = {
1148 .set_mem_map = m8xx_set_mem_map, 1148 .set_mem_map = m8xx_set_mem_map,
1149}; 1149};
1150 1150
1151static int __init m8xx_probe(struct platform_device *ofdev, 1151static int __init m8xx_probe(struct platform_device *ofdev)
1152 const struct of_device_id *match)
1153{ 1152{
1154 struct pcmcia_win *w; 1153 struct pcmcia_win *w;
1155 unsigned int i, m, hwirq; 1154 unsigned int i, m, hwirq;
@@ -1295,7 +1294,7 @@ static const struct of_device_id m8xx_pcmcia_match[] = {
1295 1294
1296MODULE_DEVICE_TABLE(of, m8xx_pcmcia_match); 1295MODULE_DEVICE_TABLE(of, m8xx_pcmcia_match);
1297 1296
1298static struct of_platform_driver m8xx_pcmcia_driver = { 1297static struct platform_driver m8xx_pcmcia_driver = {
1299 .driver = { 1298 .driver = {
1300 .name = driver_name, 1299 .name = driver_name,
1301 .owner = THIS_MODULE, 1300 .owner = THIS_MODULE,
@@ -1307,12 +1306,12 @@ static struct of_platform_driver m8xx_pcmcia_driver = {
1307 1306
1308static int __init m8xx_init(void) 1307static int __init m8xx_init(void)
1309{ 1308{
1310 return of_register_platform_driver(&m8xx_pcmcia_driver); 1309 return platform_driver_register(&m8xx_pcmcia_driver);
1311} 1310}
1312 1311
1313static void __exit m8xx_exit(void) 1312static void __exit m8xx_exit(void)
1314{ 1313{
1315 of_unregister_platform_driver(&m8xx_pcmcia_driver); 1314 platform_driver_unregister(&m8xx_pcmcia_driver);
1316} 1315}
1317 1316
1318module_init(m8xx_init); 1317module_init(m8xx_init);
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index b40c1ff1ebc8..09ccd8d3ba2a 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -248,8 +248,7 @@ static const struct rtc_class_ops mpc5121_rtc_ops = {
248 .alarm_irq_enable = mpc5121_rtc_alarm_irq_enable, 248 .alarm_irq_enable = mpc5121_rtc_alarm_irq_enable,
249}; 249};
250 250
251static int __devinit mpc5121_rtc_probe(struct platform_device *op, 251static int __devinit mpc5121_rtc_probe(struct platform_device *op)
252 const struct of_device_id *match)
253{ 252{
254 struct mpc5121_rtc_data *rtc; 253 struct mpc5121_rtc_data *rtc;
255 int err = 0; 254 int err = 0;
@@ -344,7 +343,7 @@ static struct of_device_id mpc5121_rtc_match[] __devinitdata = {
344 {}, 343 {},
345}; 344};
346 345
347static struct of_platform_driver mpc5121_rtc_driver = { 346static struct platform_driver mpc5121_rtc_driver = {
348 .driver = { 347 .driver = {
349 .name = "mpc5121-rtc", 348 .name = "mpc5121-rtc",
350 .owner = THIS_MODULE, 349 .owner = THIS_MODULE,
@@ -356,13 +355,13 @@ static struct of_platform_driver mpc5121_rtc_driver = {
356 355
357static int __init mpc5121_rtc_init(void) 356static int __init mpc5121_rtc_init(void)
358{ 357{
359 return of_register_platform_driver(&mpc5121_rtc_driver); 358 return platform_driver_register(&mpc5121_rtc_driver);
360} 359}
361module_init(mpc5121_rtc_init); 360module_init(mpc5121_rtc_init);
362 361
363static void __exit mpc5121_rtc_exit(void) 362static void __exit mpc5121_rtc_exit(void)
364{ 363{
365 of_unregister_platform_driver(&mpc5121_rtc_driver); 364 platform_driver_unregister(&mpc5121_rtc_driver);
366} 365}
367module_exit(mpc5121_rtc_exit); 366module_exit(mpc5121_rtc_exit);
368 367
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 614a5e114a19..5f94d22c491e 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -361,8 +361,7 @@ fail:
361extern int bbc_envctrl_init(struct bbc_i2c_bus *bp); 361extern int bbc_envctrl_init(struct bbc_i2c_bus *bp);
362extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp); 362extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp);
363 363
364static int __devinit bbc_i2c_probe(struct platform_device *op, 364static int __devinit bbc_i2c_probe(struct platform_device *op)
365 const struct of_device_id *match)
366{ 365{
367 struct bbc_i2c_bus *bp; 366 struct bbc_i2c_bus *bp;
368 int err, index = 0; 367 int err, index = 0;
@@ -413,7 +412,7 @@ static const struct of_device_id bbc_i2c_match[] = {
413}; 412};
414MODULE_DEVICE_TABLE(of, bbc_i2c_match); 413MODULE_DEVICE_TABLE(of, bbc_i2c_match);
415 414
416static struct of_platform_driver bbc_i2c_driver = { 415static struct platform_driver bbc_i2c_driver = {
417 .driver = { 416 .driver = {
418 .name = "bbc_i2c", 417 .name = "bbc_i2c",
419 .owner = THIS_MODULE, 418 .owner = THIS_MODULE,
@@ -425,12 +424,12 @@ static struct of_platform_driver bbc_i2c_driver = {
425 424
426static int __init bbc_i2c_init(void) 425static int __init bbc_i2c_init(void)
427{ 426{
428 return of_register_platform_driver(&bbc_i2c_driver); 427 return platform_driver_register(&bbc_i2c_driver);
429} 428}
430 429
431static void __exit bbc_i2c_exit(void) 430static void __exit bbc_i2c_exit(void)
432{ 431{
433 of_unregister_platform_driver(&bbc_i2c_driver); 432 platform_driver_unregister(&bbc_i2c_driver);
434} 433}
435 434
436module_init(bbc_i2c_init); 435module_init(bbc_i2c_init);
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 55f71ea9c418..740da4465447 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -171,8 +171,7 @@ static struct miscdevice d7s_miscdev = {
171 .fops = &d7s_fops 171 .fops = &d7s_fops
172}; 172};
173 173
174static int __devinit d7s_probe(struct platform_device *op, 174static int __devinit d7s_probe(struct platform_device *op)
175 const struct of_device_id *match)
176{ 175{
177 struct device_node *opts; 176 struct device_node *opts;
178 int err = -EINVAL; 177 int err = -EINVAL;
@@ -266,7 +265,7 @@ static const struct of_device_id d7s_match[] = {
266}; 265};
267MODULE_DEVICE_TABLE(of, d7s_match); 266MODULE_DEVICE_TABLE(of, d7s_match);
268 267
269static struct of_platform_driver d7s_driver = { 268static struct platform_driver d7s_driver = {
270 .driver = { 269 .driver = {
271 .name = DRIVER_NAME, 270 .name = DRIVER_NAME,
272 .owner = THIS_MODULE, 271 .owner = THIS_MODULE,
@@ -278,12 +277,12 @@ static struct of_platform_driver d7s_driver = {
278 277
279static int __init d7s_init(void) 278static int __init d7s_init(void)
280{ 279{
281 return of_register_platform_driver(&d7s_driver); 280 return platform_driver_register(&d7s_driver);
282} 281}
283 282
284static void __exit d7s_exit(void) 283static void __exit d7s_exit(void)
285{ 284{
286 of_unregister_platform_driver(&d7s_driver); 285 platform_driver_unregister(&d7s_driver);
287} 286}
288 287
289module_init(d7s_init); 288module_init(d7s_init);
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 8ce414e39489..be7b4e56154f 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -1028,8 +1028,7 @@ static int kenvctrld(void *__unused)
1028 return 0; 1028 return 0;
1029} 1029}
1030 1030
1031static int __devinit envctrl_probe(struct platform_device *op, 1031static int __devinit envctrl_probe(struct platform_device *op)
1032 const struct of_device_id *match)
1033{ 1032{
1034 struct device_node *dp; 1033 struct device_node *dp;
1035 int index, err; 1034 int index, err;
@@ -1129,7 +1128,7 @@ static const struct of_device_id envctrl_match[] = {
1129}; 1128};
1130MODULE_DEVICE_TABLE(of, envctrl_match); 1129MODULE_DEVICE_TABLE(of, envctrl_match);
1131 1130
1132static struct of_platform_driver envctrl_driver = { 1131static struct platform_driver envctrl_driver = {
1133 .driver = { 1132 .driver = {
1134 .name = DRIVER_NAME, 1133 .name = DRIVER_NAME,
1135 .owner = THIS_MODULE, 1134 .owner = THIS_MODULE,
@@ -1141,12 +1140,12 @@ static struct of_platform_driver envctrl_driver = {
1141 1140
1142static int __init envctrl_init(void) 1141static int __init envctrl_init(void)
1143{ 1142{
1144 return of_register_platform_driver(&envctrl_driver); 1143 return platform_driver_register(&envctrl_driver);
1145} 1144}
1146 1145
1147static void __exit envctrl_exit(void) 1146static void __exit envctrl_exit(void)
1148{ 1147{
1149 of_unregister_platform_driver(&envctrl_driver); 1148 platform_driver_unregister(&envctrl_driver);
1150} 1149}
1151 1150
1152module_init(envctrl_init); 1151module_init(envctrl_init);
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 2b4b4b613c48..73dd4e7afaaa 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -160,8 +160,7 @@ static const struct file_operations flash_fops = {
160 160
161static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops }; 161static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops };
162 162
163static int __devinit flash_probe(struct platform_device *op, 163static int __devinit flash_probe(struct platform_device *op)
164 const struct of_device_id *match)
165{ 164{
166 struct device_node *dp = op->dev.of_node; 165 struct device_node *dp = op->dev.of_node;
167 struct device_node *parent; 166 struct device_node *parent;
@@ -207,7 +206,7 @@ static const struct of_device_id flash_match[] = {
207}; 206};
208MODULE_DEVICE_TABLE(of, flash_match); 207MODULE_DEVICE_TABLE(of, flash_match);
209 208
210static struct of_platform_driver flash_driver = { 209static struct platform_driver flash_driver = {
211 .driver = { 210 .driver = {
212 .name = "flash", 211 .name = "flash",
213 .owner = THIS_MODULE, 212 .owner = THIS_MODULE,
@@ -219,12 +218,12 @@ static struct of_platform_driver flash_driver = {
219 218
220static int __init flash_init(void) 219static int __init flash_init(void)
221{ 220{
222 return of_register_platform_driver(&flash_driver); 221 return platform_driver_register(&flash_driver);
223} 222}
224 223
225static void __exit flash_cleanup(void) 224static void __exit flash_cleanup(void)
226{ 225{
227 of_unregister_platform_driver(&flash_driver); 226 platform_driver_unregister(&flash_driver);
228} 227}
229 228
230module_init(flash_init); 229module_init(flash_init);
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 1b345be5cc02..ebce9639a26a 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)
348 348
349} 349}
350 350
351static int __devinit uctrl_probe(struct platform_device *op, 351static int __devinit uctrl_probe(struct platform_device *op)
352 const struct of_device_id *match)
353{ 352{
354 struct uctrl_driver *p; 353 struct uctrl_driver *p;
355 int err = -ENOMEM; 354 int err = -ENOMEM;
@@ -425,7 +424,7 @@ static const struct of_device_id uctrl_match[] = {
425}; 424};
426MODULE_DEVICE_TABLE(of, uctrl_match); 425MODULE_DEVICE_TABLE(of, uctrl_match);
427 426
428static struct of_platform_driver uctrl_driver = { 427static struct platform_driver uctrl_driver = {
429 .driver = { 428 .driver = {
430 .name = "uctrl", 429 .name = "uctrl",
431 .owner = THIS_MODULE, 430 .owner = THIS_MODULE,
@@ -438,12 +437,12 @@ static struct of_platform_driver uctrl_driver = {
438 437
439static int __init uctrl_init(void) 438static int __init uctrl_init(void)
440{ 439{
441 return of_register_platform_driver(&uctrl_driver); 440 return platform_driver_register(&uctrl_driver);
442} 441}
443 442
444static void __exit uctrl_exit(void) 443static void __exit uctrl_exit(void)
445{ 444{
446 of_unregister_platform_driver(&uctrl_driver); 445 platform_driver_unregister(&uctrl_driver);
447} 446}
448 447
449module_init(uctrl_init); 448module_init(uctrl_init);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 664c9572d0c9..e2d45c91b8e8 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1292,15 +1292,19 @@ static struct scsi_host_template qpti_template = {
1292 .use_clustering = ENABLE_CLUSTERING, 1292 .use_clustering = ENABLE_CLUSTERING,
1293}; 1293};
1294 1294
1295static int __devinit qpti_sbus_probe(struct platform_device *op, const struct of_device_id *match) 1295static int __devinit qpti_sbus_probe(struct platform_device *op)
1296{ 1296{
1297 struct scsi_host_template *tpnt = match->data; 1297 struct scsi_host_template *tpnt;
1298 struct device_node *dp = op->dev.of_node; 1298 struct device_node *dp = op->dev.of_node;
1299 struct Scsi_Host *host; 1299 struct Scsi_Host *host;
1300 struct qlogicpti *qpti; 1300 struct qlogicpti *qpti;
1301 static int nqptis; 1301 static int nqptis;
1302 const char *fcode; 1302 const char *fcode;
1303 1303
1304 if (!op->dev.of_match)
1305 return -EINVAL;
1306 tpnt = op->dev.of_match->data;
1307
1304 /* Sometimes Antares cards come up not completely 1308 /* Sometimes Antares cards come up not completely
1305 * setup, and we get a report of a zero IRQ. 1309 * setup, and we get a report of a zero IRQ.
1306 */ 1310 */
@@ -1457,7 +1461,7 @@ static const struct of_device_id qpti_match[] = {
1457}; 1461};
1458MODULE_DEVICE_TABLE(of, qpti_match); 1462MODULE_DEVICE_TABLE(of, qpti_match);
1459 1463
1460static struct of_platform_driver qpti_sbus_driver = { 1464static struct platform_driver qpti_sbus_driver = {
1461 .driver = { 1465 .driver = {
1462 .name = "qpti", 1466 .name = "qpti",
1463 .owner = THIS_MODULE, 1467 .owner = THIS_MODULE,
@@ -1469,12 +1473,12 @@ static struct of_platform_driver qpti_sbus_driver = {
1469 1473
1470static int __init qpti_init(void) 1474static int __init qpti_init(void)
1471{ 1475{
1472 return of_register_platform_driver(&qpti_sbus_driver); 1476 return platform_driver_register(&qpti_sbus_driver);
1473} 1477}
1474 1478
1475static void __exit qpti_exit(void) 1479static void __exit qpti_exit(void)
1476{ 1480{
1477 of_unregister_platform_driver(&qpti_sbus_driver); 1481 platform_driver_unregister(&qpti_sbus_driver);
1478} 1482}
1479 1483
1480MODULE_DESCRIPTION("QlogicISP SBUS driver"); 1484MODULE_DESCRIPTION("QlogicISP SBUS driver");
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index 193b37ba1834..676fe9ac7f61 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -562,7 +562,7 @@ fail:
562 return err; 562 return err;
563} 563}
564 564
565static int __devinit esp_sbus_probe(struct platform_device *op, const struct of_device_id *match) 565static int __devinit esp_sbus_probe(struct platform_device *op)
566{ 566{
567 struct device_node *dma_node = NULL; 567 struct device_node *dma_node = NULL;
568 struct device_node *dp = op->dev.of_node; 568 struct device_node *dp = op->dev.of_node;
@@ -632,7 +632,7 @@ static const struct of_device_id esp_match[] = {
632}; 632};
633MODULE_DEVICE_TABLE(of, esp_match); 633MODULE_DEVICE_TABLE(of, esp_match);
634 634
635static struct of_platform_driver esp_sbus_driver = { 635static struct platform_driver esp_sbus_driver = {
636 .driver = { 636 .driver = {
637 .name = "esp", 637 .name = "esp",
638 .owner = THIS_MODULE, 638 .owner = THIS_MODULE,
@@ -644,12 +644,12 @@ static struct of_platform_driver esp_sbus_driver = {
644 644
645static int __init sunesp_init(void) 645static int __init sunesp_init(void)
646{ 646{
647 return of_register_platform_driver(&esp_sbus_driver); 647 return platform_driver_register(&esp_sbus_driver);
648} 648}
649 649
650static void __exit sunesp_exit(void) 650static void __exit sunesp_exit(void)
651{ 651{
652 of_unregister_platform_driver(&esp_sbus_driver); 652 platform_driver_unregister(&esp_sbus_driver);
653} 653}
654 654
655MODULE_DESCRIPTION("Sun ESP SCSI driver"); 655MODULE_DESCRIPTION("Sun ESP SCSI driver");
diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/mpc512x_psc_spi.c
index 77d9e7ee8b27..6a5b4238fb6b 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)
507 return 0; 507 return 0;
508} 508}
509 509
510static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op, 510static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op)
511 const struct of_device_id *match)
512{ 511{
513 const u32 *regaddr_p; 512 const u32 *regaddr_p;
514 u64 regaddr64, size64; 513 u64 regaddr64, size64;
@@ -551,7 +550,7 @@ static struct of_device_id mpc512x_psc_spi_of_match[] = {
551 550
552MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match); 551MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match);
553 552
554static struct of_platform_driver mpc512x_psc_spi_of_driver = { 553static struct platform_driver mpc512x_psc_spi_of_driver = {
555 .probe = mpc512x_psc_spi_of_probe, 554 .probe = mpc512x_psc_spi_of_probe,
556 .remove = __devexit_p(mpc512x_psc_spi_of_remove), 555 .remove = __devexit_p(mpc512x_psc_spi_of_remove),
557 .driver = { 556 .driver = {
@@ -563,13 +562,13 @@ static struct of_platform_driver mpc512x_psc_spi_of_driver = {
563 562
564static int __init mpc512x_psc_spi_init(void) 563static int __init mpc512x_psc_spi_init(void)
565{ 564{
566 return of_register_platform_driver(&mpc512x_psc_spi_of_driver); 565 return platform_driver_register(&mpc512x_psc_spi_of_driver);
567} 566}
568module_init(mpc512x_psc_spi_init); 567module_init(mpc512x_psc_spi_init);
569 568
570static void __exit mpc512x_psc_spi_exit(void) 569static void __exit mpc512x_psc_spi_exit(void)
571{ 570{
572 of_unregister_platform_driver(&mpc512x_psc_spi_of_driver); 571 platform_driver_unregister(&mpc512x_psc_spi_of_driver);
573} 572}
574module_exit(mpc512x_psc_spi_exit); 573module_exit(mpc512x_psc_spi_exit);
575 574
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 8a904c1c8485..e30baf0852ac 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -450,8 +450,7 @@ free_master:
450 return ret; 450 return ret;
451} 451}
452 452
453static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op, 453static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op)
454 const struct of_device_id *match)
455{ 454{
456 const u32 *regaddr_p; 455 const u32 *regaddr_p;
457 u64 regaddr64, size64; 456 u64 regaddr64, size64;
@@ -503,7 +502,7 @@ static const struct of_device_id mpc52xx_psc_spi_of_match[] = {
503 502
504MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); 503MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match);
505 504
506static struct of_platform_driver mpc52xx_psc_spi_of_driver = { 505static struct platform_driver mpc52xx_psc_spi_of_driver = {
507 .probe = mpc52xx_psc_spi_of_probe, 506 .probe = mpc52xx_psc_spi_of_probe,
508 .remove = __devexit_p(mpc52xx_psc_spi_of_remove), 507 .remove = __devexit_p(mpc52xx_psc_spi_of_remove),
509 .driver = { 508 .driver = {
@@ -515,13 +514,13 @@ static struct of_platform_driver mpc52xx_psc_spi_of_driver = {
515 514
516static int __init mpc52xx_psc_spi_init(void) 515static int __init mpc52xx_psc_spi_init(void)
517{ 516{
518 return of_register_platform_driver(&mpc52xx_psc_spi_of_driver); 517 return platform_driver_register(&mpc52xx_psc_spi_of_driver);
519} 518}
520module_init(mpc52xx_psc_spi_init); 519module_init(mpc52xx_psc_spi_init);
521 520
522static void __exit mpc52xx_psc_spi_exit(void) 521static void __exit mpc52xx_psc_spi_exit(void)
523{ 522{
524 of_unregister_platform_driver(&mpc52xx_psc_spi_of_driver); 523 platform_driver_unregister(&mpc52xx_psc_spi_of_driver);
525} 524}
526module_exit(mpc52xx_psc_spi_exit); 525module_exit(mpc52xx_psc_spi_exit);
527 526
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
index 84439f655601..015a974bed72 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)
390/* 390/*
391 * OF Platform Bus Binding 391 * OF Platform Bus Binding
392 */ 392 */
393static int __devinit mpc52xx_spi_probe(struct platform_device *op, 393static int __devinit mpc52xx_spi_probe(struct platform_device *op)
394 const struct of_device_id *match)
395{ 394{
396 struct spi_master *master; 395 struct spi_master *master;
397 struct mpc52xx_spi *ms; 396 struct mpc52xx_spi *ms;
@@ -556,7 +555,7 @@ static const struct of_device_id mpc52xx_spi_match[] __devinitconst = {
556}; 555};
557MODULE_DEVICE_TABLE(of, mpc52xx_spi_match); 556MODULE_DEVICE_TABLE(of, mpc52xx_spi_match);
558 557
559static struct of_platform_driver mpc52xx_spi_of_driver = { 558static struct platform_driver mpc52xx_spi_of_driver = {
560 .driver = { 559 .driver = {
561 .name = "mpc52xx-spi", 560 .name = "mpc52xx-spi",
562 .owner = THIS_MODULE, 561 .owner = THIS_MODULE,
@@ -568,13 +567,13 @@ static struct of_platform_driver mpc52xx_spi_of_driver = {
568 567
569static int __init mpc52xx_spi_init(void) 568static int __init mpc52xx_spi_init(void)
570{ 569{
571 return of_register_platform_driver(&mpc52xx_spi_of_driver); 570 return platform_driver_register(&mpc52xx_spi_of_driver);
572} 571}
573module_init(mpc52xx_spi_init); 572module_init(mpc52xx_spi_init);
574 573
575static void __exit mpc52xx_spi_exit(void) 574static void __exit mpc52xx_spi_exit(void)
576{ 575{
577 of_unregister_platform_driver(&mpc52xx_spi_of_driver); 576 platform_driver_unregister(&mpc52xx_spi_of_driver);
578} 577}
579module_exit(mpc52xx_spi_exit); 578module_exit(mpc52xx_spi_exit);
580 579
diff --git a/drivers/spi/spi_fsl_espi.c b/drivers/spi/spi_fsl_espi.c
index a99e2333b949..900e921ab80e 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)
685 return 0; 685 return 0;
686} 686}
687 687
688static int __devinit of_fsl_espi_probe(struct platform_device *ofdev, 688static int __devinit of_fsl_espi_probe(struct platform_device *ofdev)
689 const struct of_device_id *ofid)
690{ 689{
691 struct device *dev = &ofdev->dev; 690 struct device *dev = &ofdev->dev;
692 struct device_node *np = ofdev->dev.of_node; 691 struct device_node *np = ofdev->dev.of_node;
@@ -695,7 +694,7 @@ static int __devinit of_fsl_espi_probe(struct platform_device *ofdev,
695 struct resource irq; 694 struct resource irq;
696 int ret = -ENOMEM; 695 int ret = -ENOMEM;
697 696
698 ret = of_mpc8xxx_spi_probe(ofdev, ofid); 697 ret = of_mpc8xxx_spi_probe(ofdev);
699 if (ret) 698 if (ret)
700 return ret; 699 return ret;
701 700
@@ -736,7 +735,7 @@ static const struct of_device_id of_fsl_espi_match[] = {
736}; 735};
737MODULE_DEVICE_TABLE(of, of_fsl_espi_match); 736MODULE_DEVICE_TABLE(of, of_fsl_espi_match);
738 737
739static struct of_platform_driver fsl_espi_driver = { 738static struct platform_driver fsl_espi_driver = {
740 .driver = { 739 .driver = {
741 .name = "fsl_espi", 740 .name = "fsl_espi",
742 .owner = THIS_MODULE, 741 .owner = THIS_MODULE,
@@ -748,13 +747,13 @@ static struct of_platform_driver fsl_espi_driver = {
748 747
749static int __init fsl_espi_init(void) 748static int __init fsl_espi_init(void)
750{ 749{
751 return of_register_platform_driver(&fsl_espi_driver); 750 return platform_driver_register(&fsl_espi_driver);
752} 751}
753module_init(fsl_espi_init); 752module_init(fsl_espi_init);
754 753
755static void __exit fsl_espi_exit(void) 754static void __exit fsl_espi_exit(void)
756{ 755{
757 of_unregister_platform_driver(&fsl_espi_driver); 756 platform_driver_unregister(&fsl_espi_driver);
758} 757}
759module_exit(fsl_espi_exit); 758module_exit(fsl_espi_exit);
760 759
diff --git a/drivers/spi/spi_fsl_lib.c b/drivers/spi/spi_fsl_lib.c
index 5cd741fdb5c3..ff59f42ae990 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)
189 return 0; 189 return 0;
190} 190}
191 191
192int __devinit of_mpc8xxx_spi_probe(struct platform_device *ofdev, 192int __devinit of_mpc8xxx_spi_probe(struct platform_device *ofdev)
193 const struct of_device_id *ofid)
194{ 193{
195 struct device *dev = &ofdev->dev; 194 struct device *dev = &ofdev->dev;
196 struct device_node *np = ofdev->dev.of_node; 195 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 281e060977cd..cbe881b9ea76 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);
118extern int mpc8xxx_spi_probe(struct device *dev, struct resource *mem, 118extern int mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
119 unsigned int irq); 119 unsigned int irq);
120extern int mpc8xxx_spi_remove(struct device *dev); 120extern int mpc8xxx_spi_remove(struct device *dev);
121extern int of_mpc8xxx_spi_probe(struct platform_device *ofdev, 121extern int of_mpc8xxx_spi_probe(struct platform_device *ofdev);
122 const struct of_device_id *ofid);
123 122
124#endif /* __SPI_FSL_LIB_H__ */ 123#endif /* __SPI_FSL_LIB_H__ */
diff --git a/drivers/spi/spi_fsl_spi.c b/drivers/spi/spi_fsl_spi.c
index 7ca52d3ae8f8..7963c9b49566 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)
1042 return 0; 1042 return 0;
1043} 1043}
1044 1044
1045static int __devinit of_fsl_spi_probe(struct platform_device *ofdev, 1045static int __devinit of_fsl_spi_probe(struct platform_device *ofdev)
1046 const struct of_device_id *ofid)
1047{ 1046{
1048 struct device *dev = &ofdev->dev; 1047 struct device *dev = &ofdev->dev;
1049 struct device_node *np = ofdev->dev.of_node; 1048 struct device_node *np = ofdev->dev.of_node;
@@ -1052,7 +1051,7 @@ static int __devinit of_fsl_spi_probe(struct platform_device *ofdev,
1052 struct resource irq; 1051 struct resource irq;
1053 int ret = -ENOMEM; 1052 int ret = -ENOMEM;
1054 1053
1055 ret = of_mpc8xxx_spi_probe(ofdev, ofid); 1054 ret = of_mpc8xxx_spi_probe(ofdev);
1056 if (ret) 1055 if (ret)
1057 return ret; 1056 return ret;
1058 1057
@@ -1100,7 +1099,7 @@ static const struct of_device_id of_fsl_spi_match[] = {
1100}; 1099};
1101MODULE_DEVICE_TABLE(of, of_fsl_spi_match); 1100MODULE_DEVICE_TABLE(of, of_fsl_spi_match);
1102 1101
1103static struct of_platform_driver of_fsl_spi_driver = { 1102static struct platform_driver of_fsl_spi_driver = {
1104 .driver = { 1103 .driver = {
1105 .name = "fsl_spi", 1104 .name = "fsl_spi",
1106 .owner = THIS_MODULE, 1105 .owner = THIS_MODULE,
@@ -1177,13 +1176,13 @@ static void __exit legacy_driver_unregister(void) {}
1177static int __init fsl_spi_init(void) 1176static int __init fsl_spi_init(void)
1178{ 1177{
1179 legacy_driver_register(); 1178 legacy_driver_register();
1180 return of_register_platform_driver(&of_fsl_spi_driver); 1179 return platform_driver_register(&of_fsl_spi_driver);
1181} 1180}
1182module_init(fsl_spi_init); 1181module_init(fsl_spi_init);
1183 1182
1184static void __exit fsl_spi_exit(void) 1183static void __exit fsl_spi_exit(void)
1185{ 1184{
1186 of_unregister_platform_driver(&of_fsl_spi_driver); 1185 platform_driver_unregister(&of_fsl_spi_driver);
1187 legacy_driver_unregister(); 1186 legacy_driver_unregister();
1188} 1187}
1189module_exit(fsl_spi_exit); 1188module_exit(fsl_spi_exit);
diff --git a/drivers/spi/spi_ppc4xx.c b/drivers/spi/spi_ppc4xx.c
index 80e172d3e72a..2a298c029194 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)
390/* 390/*
391 * platform_device layer stuff... 391 * platform_device layer stuff...
392 */ 392 */
393static int __init spi_ppc4xx_of_probe(struct platform_device *op, 393static int __init spi_ppc4xx_of_probe(struct platform_device *op)
394 const struct of_device_id *match)
395{ 394{
396 struct ppc4xx_spi *hw; 395 struct ppc4xx_spi *hw;
397 struct spi_master *master; 396 struct spi_master *master;
@@ -586,7 +585,7 @@ static const struct of_device_id spi_ppc4xx_of_match[] = {
586 585
587MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match); 586MODULE_DEVICE_TABLE(of, spi_ppc4xx_of_match);
588 587
589static struct of_platform_driver spi_ppc4xx_of_driver = { 588static struct platform_driver spi_ppc4xx_of_driver = {
590 .probe = spi_ppc4xx_of_probe, 589 .probe = spi_ppc4xx_of_probe,
591 .remove = __exit_p(spi_ppc4xx_of_remove), 590 .remove = __exit_p(spi_ppc4xx_of_remove),
592 .driver = { 591 .driver = {
@@ -598,13 +597,13 @@ static struct of_platform_driver spi_ppc4xx_of_driver = {
598 597
599static int __init spi_ppc4xx_init(void) 598static int __init spi_ppc4xx_init(void)
600{ 599{
601 return of_register_platform_driver(&spi_ppc4xx_of_driver); 600 return platform_driver_register(&spi_ppc4xx_of_driver);
602} 601}
603module_init(spi_ppc4xx_init); 602module_init(spi_ppc4xx_init);
604 603
605static void __exit spi_ppc4xx_exit(void) 604static void __exit spi_ppc4xx_exit(void)
606{ 605{
607 of_unregister_platform_driver(&spi_ppc4xx_of_driver); 606 platform_driver_unregister(&spi_ppc4xx_of_driver);
608} 607}
609module_exit(spi_ppc4xx_exit); 608module_exit(spi_ppc4xx_exit);
610 609
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 8f014bb916b7..60e049b041a7 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -466,12 +466,23 @@ static int __devexit altera_jtaguart_remove(struct platform_device *pdev)
466 return 0; 466 return 0;
467} 467}
468 468
469#ifdef CONFIG_OF
470static struct of_device_id altera_jtaguart_match[] = {
471 { .compatible = "ALTR,juart-1.0", },
472 {},
473};
474MODULE_DEVICE_TABLE(of, altera_jtaguart_match);
475#else
476#define altera_jtaguart_match NULL
477#endif /* CONFIG_OF */
478
469static struct platform_driver altera_jtaguart_platform_driver = { 479static struct platform_driver altera_jtaguart_platform_driver = {
470 .probe = altera_jtaguart_probe, 480 .probe = altera_jtaguart_probe,
471 .remove = __devexit_p(altera_jtaguart_remove), 481 .remove = __devexit_p(altera_jtaguart_remove),
472 .driver = { 482 .driver = {
473 .name = DRV_NAME, 483 .name = DRV_NAME,
474 .owner = THIS_MODULE, 484 .owner = THIS_MODULE,
485 .of_match_table = altera_jtaguart_match,
475 }, 486 },
476}; 487};
477 488
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 3a573528555e..6d5b036ac783 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -24,6 +24,7 @@
24#include <linux/serial.h> 24#include <linux/serial.h>
25#include <linux/serial_core.h> 25#include <linux/serial_core.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/of.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/altera_uart.h> 29#include <linux/altera_uart.h>
29 30
@@ -507,6 +508,29 @@ static struct uart_driver altera_uart_driver = {
507 .cons = ALTERA_UART_CONSOLE, 508 .cons = ALTERA_UART_CONSOLE,
508}; 509};
509 510
511#ifdef CONFIG_OF
512static int altera_uart_get_of_uartclk(struct platform_device *pdev,
513 struct uart_port *port)
514{
515 int len;
516 const __be32 *clk;
517
518 clk = of_get_property(pdev->dev.of_node, "clock-frequency", &len);
519 if (!clk || len < sizeof(__be32))
520 return -ENODEV;
521
522 port->uartclk = be32_to_cpup(clk);
523
524 return 0;
525}
526#else
527static int altera_uart_get_of_uartclk(struct platform_device *pdev,
528 struct uart_port *port)
529{
530 return -ENODEV;
531}
532#endif /* CONFIG_OF */
533
510static int __devinit altera_uart_probe(struct platform_device *pdev) 534static int __devinit altera_uart_probe(struct platform_device *pdev)
511{ 535{
512 struct altera_uart_platform_uart *platp = pdev->dev.platform_data; 536 struct altera_uart_platform_uart *platp = pdev->dev.platform_data;
@@ -514,6 +538,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
514 struct resource *res_mem; 538 struct resource *res_mem;
515 struct resource *res_irq; 539 struct resource *res_irq;
516 int i = pdev->id; 540 int i = pdev->id;
541 int ret;
517 542
518 /* -1 emphasizes that the platform must have one port, no .N suffix */ 543 /* -1 emphasizes that the platform must have one port, no .N suffix */
519 if (i == -1) 544 if (i == -1)
@@ -538,6 +563,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
538 else if (platp->irq) 563 else if (platp->irq)
539 port->irq = platp->irq; 564 port->irq = platp->irq;
540 565
566 /* Check platform data first so we can override device node data */
567 if (platp)
568 port->uartclk = platp->uartclk;
569 else {
570 ret = altera_uart_get_of_uartclk(pdev, port);
571 if (ret)
572 return ret;
573 }
574
541 port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE); 575 port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
542 if (!port->membase) 576 if (!port->membase)
543 return -ENOMEM; 577 return -ENOMEM;
@@ -550,7 +584,6 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
550 port->line = i; 584 port->line = i;
551 port->type = PORT_ALTERA_UART; 585 port->type = PORT_ALTERA_UART;
552 port->iotype = SERIAL_IO_MEM; 586 port->iotype = SERIAL_IO_MEM;
553 port->uartclk = platp->uartclk;
554 port->ops = &altera_uart_ops; 587 port->ops = &altera_uart_ops;
555 port->flags = UPF_BOOT_AUTOCONF; 588 port->flags = UPF_BOOT_AUTOCONF;
556 589
@@ -573,13 +606,23 @@ static int __devexit altera_uart_remove(struct platform_device *pdev)
573 return 0; 606 return 0;
574} 607}
575 608
609#ifdef CONFIG_OF
610static struct of_device_id altera_uart_match[] = {
611 { .compatible = "ALTR,uart-1.0", },
612 {},
613};
614MODULE_DEVICE_TABLE(of, altera_uart_match);
615#else
616#define altera_uart_match NULL
617#endif /* CONFIG_OF */
618
576static struct platform_driver altera_uart_platform_driver = { 619static struct platform_driver altera_uart_platform_driver = {
577 .probe = altera_uart_probe, 620 .probe = altera_uart_probe,
578 .remove = __devexit_p(altera_uart_remove), 621 .remove = __devexit_p(altera_uart_remove),
579 .driver = { 622 .driver = {
580 .name = DRV_NAME, 623 .name = DRV_NAME,
581 .owner = THIS_MODULE, 624 .owner = THIS_MODULE,
582 .pm = NULL, 625 .of_match_table = altera_uart_match,
583 }, 626 },
584}; 627};
585 628
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 095a5d562618..1ab999b04ef3 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -553,8 +553,7 @@ static struct uart_driver grlib_apbuart_driver = {
553/* OF Platform Driver */ 553/* OF Platform Driver */
554/* ======================================================================== */ 554/* ======================================================================== */
555 555
556static int __devinit apbuart_probe(struct platform_device *op, 556static int __devinit apbuart_probe(struct platform_device *op)
557 const struct of_device_id *match)
558{ 557{
559 int i = -1; 558 int i = -1;
560 struct uart_port *port = NULL; 559 struct uart_port *port = NULL;
@@ -587,7 +586,7 @@ static struct of_device_id __initdata apbuart_match[] = {
587 {}, 586 {},
588}; 587};
589 588
590static struct of_platform_driver grlib_apbuart_of_driver = { 589static struct platform_driver grlib_apbuart_of_driver = {
591 .probe = apbuart_probe, 590 .probe = apbuart_probe,
592 .driver = { 591 .driver = {
593 .owner = THIS_MODULE, 592 .owner = THIS_MODULE,
@@ -676,10 +675,10 @@ static int __init grlib_apbuart_init(void)
676 return ret; 675 return ret;
677 } 676 }
678 677
679 ret = of_register_platform_driver(&grlib_apbuart_of_driver); 678 ret = platform_driver_register(&grlib_apbuart_of_driver);
680 if (ret) { 679 if (ret) {
681 printk(KERN_ERR 680 printk(KERN_ERR
682 "%s: of_register_platform_driver failed (%i)\n", 681 "%s: platform_driver_register failed (%i)\n",
683 __FILE__, ret); 682 __FILE__, ret);
684 uart_unregister_driver(&grlib_apbuart_driver); 683 uart_unregister_driver(&grlib_apbuart_driver);
685 return ret; 684 return ret;
@@ -697,7 +696,7 @@ static void __exit grlib_apbuart_exit(void)
697 &grlib_apbuart_ports[i]); 696 &grlib_apbuart_ports[i]);
698 697
699 uart_unregister_driver(&grlib_apbuart_driver); 698 uart_unregister_driver(&grlib_apbuart_driver);
700 of_unregister_platform_driver(&grlib_apbuart_of_driver); 699 platform_driver_unregister(&grlib_apbuart_of_driver);
701} 700}
702 701
703module_init(grlib_apbuart_init); 702module_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 8692ff98fc07..a9a6a5fd169e 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 = {
1359 1359
1360static int probe_index; 1360static int probe_index;
1361 1361
1362static int __devinit cpm_uart_probe(struct platform_device *ofdev, 1362static int __devinit cpm_uart_probe(struct platform_device *ofdev)
1363 const struct of_device_id *match)
1364{ 1363{
1365 int index = probe_index++; 1364 int index = probe_index++;
1366 struct uart_cpm_port *pinfo = &cpm_uart_ports[index]; 1365 struct uart_cpm_port *pinfo = &cpm_uart_ports[index];
@@ -1405,7 +1404,7 @@ static struct of_device_id cpm_uart_match[] = {
1405 {} 1404 {}
1406}; 1405};
1407 1406
1408static struct of_platform_driver cpm_uart_driver = { 1407static struct platform_driver cpm_uart_driver = {
1409 .driver = { 1408 .driver = {
1410 .name = "cpm_uart", 1409 .name = "cpm_uart",
1411 .owner = THIS_MODULE, 1410 .owner = THIS_MODULE,
@@ -1421,7 +1420,7 @@ static int __init cpm_uart_init(void)
1421 if (ret) 1420 if (ret)
1422 return ret; 1421 return ret;
1423 1422
1424 ret = of_register_platform_driver(&cpm_uart_driver); 1423 ret = platform_driver_register(&cpm_uart_driver);
1425 if (ret) 1424 if (ret)
1426 uart_unregister_driver(&cpm_reg); 1425 uart_unregister_driver(&cpm_reg);
1427 1426
@@ -1430,7 +1429,7 @@ static int __init cpm_uart_init(void)
1430 1429
1431static void __exit cpm_uart_exit(void) 1430static void __exit cpm_uart_exit(void)
1432{ 1431{
1433 of_unregister_platform_driver(&cpm_uart_driver); 1432 platform_driver_unregister(&cpm_uart_driver);
1434 uart_unregister_driver(&cpm_reg); 1433 uart_unregister_driver(&cpm_reg);
1435} 1434}
1436 1435
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 126ec7f568ec..a0bcd8a3758d 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[] = {
1302 {}, 1302 {},
1303}; 1303};
1304 1304
1305static int __devinit 1305static int __devinit mpc52xx_uart_of_probe(struct platform_device *op)
1306mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *match)
1307{ 1306{
1308 int idx = -1; 1307 int idx = -1;
1309 unsigned int uartclk; 1308 unsigned int uartclk;
@@ -1311,8 +1310,6 @@ mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *mat
1311 struct resource res; 1310 struct resource res;
1312 int ret; 1311 int ret;
1313 1312
1314 dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match);
1315
1316 /* Check validity & presence */ 1313 /* Check validity & presence */
1317 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++) 1314 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
1318 if (mpc52xx_uart_nodes[idx] == op->dev.of_node) 1315 if (mpc52xx_uart_nodes[idx] == op->dev.of_node)
@@ -1453,7 +1450,7 @@ mpc52xx_uart_of_enumerate(void)
1453 1450
1454MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match); 1451MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
1455 1452
1456static struct of_platform_driver mpc52xx_uart_of_driver = { 1453static struct platform_driver mpc52xx_uart_of_driver = {
1457 .probe = mpc52xx_uart_of_probe, 1454 .probe = mpc52xx_uart_of_probe,
1458 .remove = mpc52xx_uart_of_remove, 1455 .remove = mpc52xx_uart_of_remove,
1459#ifdef CONFIG_PM 1456#ifdef CONFIG_PM
@@ -1497,9 +1494,9 @@ mpc52xx_uart_init(void)
1497 return ret; 1494 return ret;
1498 } 1495 }
1499 1496
1500 ret = of_register_platform_driver(&mpc52xx_uart_of_driver); 1497 ret = platform_driver_register(&mpc52xx_uart_of_driver);
1501 if (ret) { 1498 if (ret) {
1502 printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n", 1499 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
1503 __FILE__, ret); 1500 __FILE__, ret);
1504 uart_unregister_driver(&mpc52xx_uart_driver); 1501 uart_unregister_driver(&mpc52xx_uart_driver);
1505 return ret; 1502 return ret;
@@ -1514,7 +1511,7 @@ mpc52xx_uart_exit(void)
1514 if (psc_ops->fifoc_uninit) 1511 if (psc_ops->fifoc_uninit)
1515 psc_ops->fifoc_uninit(); 1512 psc_ops->fifoc_uninit();
1516 1513
1517 of_unregister_platform_driver(&mpc52xx_uart_of_driver); 1514 platform_driver_unregister(&mpc52xx_uart_of_driver);
1518 uart_unregister_driver(&mpc52xx_uart_driver); 1515 uart_unregister_driver(&mpc52xx_uart_driver);
1519} 1516}
1520 1517
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 6a18ca6ddaa9..0e8eec516df4 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,
80/* 80/*
81 * Try to register a serial port 81 * Try to register a serial port
82 */ 82 */
83static int __devinit of_platform_serial_probe(struct platform_device *ofdev, 83static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
84 const struct of_device_id *id)
85{ 84{
86 struct of_serial_info *info; 85 struct of_serial_info *info;
87 struct uart_port port; 86 struct uart_port port;
88 int port_type; 87 int port_type;
89 int ret; 88 int ret;
90 89
90 if (!ofdev->dev.of_match)
91 return -EINVAL;
92
91 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) 93 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
92 return -EBUSY; 94 return -EBUSY;
93 95
@@ -95,7 +97,7 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev,
95 if (info == NULL) 97 if (info == NULL)
96 return -ENOMEM; 98 return -ENOMEM;
97 99
98 port_type = (unsigned long)id->data; 100 port_type = (unsigned long)ofdev->dev.of_match->data;
99 ret = of_platform_serial_setup(ofdev, port_type, &port); 101 ret = of_platform_serial_setup(ofdev, port_type, &port);
100 if (ret) 102 if (ret)
101 goto out; 103 goto out;
@@ -174,7 +176,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
174 { /* end of list */ }, 176 { /* end of list */ },
175}; 177};
176 178
177static struct of_platform_driver of_platform_serial_driver = { 179static struct platform_driver of_platform_serial_driver = {
178 .driver = { 180 .driver = {
179 .name = "of_serial", 181 .name = "of_serial",
180 .owner = THIS_MODULE, 182 .owner = THIS_MODULE,
@@ -186,13 +188,13 @@ static struct of_platform_driver of_platform_serial_driver = {
186 188
187static int __init of_platform_serial_init(void) 189static int __init of_platform_serial_init(void)
188{ 190{
189 return of_register_platform_driver(&of_platform_serial_driver); 191 return platform_driver_register(&of_platform_serial_driver);
190} 192}
191module_init(of_platform_serial_init); 193module_init(of_platform_serial_init);
192 194
193static void __exit of_platform_serial_exit(void) 195static void __exit of_platform_serial_exit(void)
194{ 196{
195 return of_unregister_platform_driver(&of_platform_serial_driver); 197 return platform_driver_unregister(&of_platform_serial_driver);
196}; 198};
197module_exit(of_platform_serial_exit); 199module_exit(of_platform_serial_exit);
198 200
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index c9014868297d..c0b7246d7339 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -519,7 +519,7 @@ static struct console sunhv_console = {
519 .data = &sunhv_reg, 519 .data = &sunhv_reg,
520}; 520};
521 521
522static int __devinit hv_probe(struct platform_device *op, const struct of_device_id *match) 522static int __devinit hv_probe(struct platform_device *op)
523{ 523{
524 struct uart_port *port; 524 struct uart_port *port;
525 unsigned long minor; 525 unsigned long minor;
@@ -629,7 +629,7 @@ static const struct of_device_id hv_match[] = {
629}; 629};
630MODULE_DEVICE_TABLE(of, hv_match); 630MODULE_DEVICE_TABLE(of, hv_match);
631 631
632static struct of_platform_driver hv_driver = { 632static struct platform_driver hv_driver = {
633 .driver = { 633 .driver = {
634 .name = "hv", 634 .name = "hv",
635 .owner = THIS_MODULE, 635 .owner = THIS_MODULE,
@@ -644,12 +644,12 @@ static int __init sunhv_init(void)
644 if (tlb_type != hypervisor) 644 if (tlb_type != hypervisor)
645 return -ENODEV; 645 return -ENODEV;
646 646
647 return of_register_platform_driver(&hv_driver); 647 return platform_driver_register(&hv_driver);
648} 648}
649 649
650static void __exit sunhv_exit(void) 650static void __exit sunhv_exit(void)
651{ 651{
652 of_unregister_platform_driver(&hv_driver); 652 platform_driver_unregister(&hv_driver);
653} 653}
654 654
655module_init(sunhv_init); 655module_init(sunhv_init);
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5b246b18f42f..b5fa2a57b9da 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,
1006 return 0; 1006 return 0;
1007} 1007}
1008 1008
1009static int __devinit sab_probe(struct platform_device *op, const struct of_device_id *match) 1009static int __devinit sab_probe(struct platform_device *op)
1010{ 1010{
1011 static int inst; 1011 static int inst;
1012 struct uart_sunsab_port *up; 1012 struct uart_sunsab_port *up;
@@ -1092,7 +1092,7 @@ static const struct of_device_id sab_match[] = {
1092}; 1092};
1093MODULE_DEVICE_TABLE(of, sab_match); 1093MODULE_DEVICE_TABLE(of, sab_match);
1094 1094
1095static struct of_platform_driver sab_driver = { 1095static struct platform_driver sab_driver = {
1096 .driver = { 1096 .driver = {
1097 .name = "sab", 1097 .name = "sab",
1098 .owner = THIS_MODULE, 1098 .owner = THIS_MODULE,
@@ -1130,12 +1130,12 @@ static int __init sunsab_init(void)
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 return of_register_platform_driver(&sab_driver); 1133 return platform_driver_register(&sab_driver);
1134} 1134}
1135 1135
1136static void __exit sunsab_exit(void) 1136static void __exit sunsab_exit(void)
1137{ 1137{
1138 of_unregister_platform_driver(&sab_driver); 1138 platform_driver_unregister(&sab_driver);
1139 if (sunsab_reg.nr) { 1139 if (sunsab_reg.nr) {
1140 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr); 1140 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
1141 } 1141 }
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 551ebfe3ccbb..92aa54550e84 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)
1406 return SU_PORT_PORT; 1406 return SU_PORT_PORT;
1407} 1407}
1408 1408
1409static int __devinit su_probe(struct platform_device *op, const struct of_device_id *match) 1409static int __devinit su_probe(struct platform_device *op)
1410{ 1410{
1411 static int inst; 1411 static int inst;
1412 struct device_node *dp = op->dev.of_node; 1412 struct device_node *dp = op->dev.of_node;
@@ -1543,7 +1543,7 @@ static const struct of_device_id su_match[] = {
1543}; 1543};
1544MODULE_DEVICE_TABLE(of, su_match); 1544MODULE_DEVICE_TABLE(of, su_match);
1545 1545
1546static struct of_platform_driver su_driver = { 1546static struct platform_driver su_driver = {
1547 .driver = { 1547 .driver = {
1548 .name = "su", 1548 .name = "su",
1549 .owner = THIS_MODULE, 1549 .owner = THIS_MODULE,
@@ -1586,7 +1586,7 @@ static int __init sunsu_init(void)
1586 return err; 1586 return err;
1587 } 1587 }
1588 1588
1589 err = of_register_platform_driver(&su_driver); 1589 err = platform_driver_register(&su_driver);
1590 if (err && num_uart) 1590 if (err && num_uart)
1591 sunserial_unregister_minors(&sunsu_reg, num_uart); 1591 sunserial_unregister_minors(&sunsu_reg, num_uart);
1592 1592
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index c1967ac1c07f..99ff9abf57ce 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)
1399 1399
1400static int zilog_irq = -1; 1400static int zilog_irq = -1;
1401 1401
1402static int __devinit zs_probe(struct platform_device *op, const struct of_device_id *match) 1402static int __devinit zs_probe(struct platform_device *op)
1403{ 1403{
1404 static int kbm_inst, uart_inst; 1404 static int kbm_inst, uart_inst;
1405 int inst; 1405 int inst;
@@ -1540,7 +1540,7 @@ static const struct of_device_id zs_match[] = {
1540}; 1540};
1541MODULE_DEVICE_TABLE(of, zs_match); 1541MODULE_DEVICE_TABLE(of, zs_match);
1542 1542
1543static struct of_platform_driver zs_driver = { 1543static struct platform_driver zs_driver = {
1544 .driver = { 1544 .driver = {
1545 .name = "zs", 1545 .name = "zs",
1546 .owner = THIS_MODULE, 1546 .owner = THIS_MODULE,
@@ -1576,7 +1576,7 @@ static int __init sunzilog_init(void)
1576 goto out_free_tables; 1576 goto out_free_tables;
1577 } 1577 }
1578 1578
1579 err = of_register_platform_driver(&zs_driver); 1579 err = platform_driver_register(&zs_driver);
1580 if (err) 1580 if (err)
1581 goto out_unregister_uart; 1581 goto out_unregister_uart;
1582 1582
@@ -1604,7 +1604,7 @@ out:
1604 return err; 1604 return err;
1605 1605
1606out_unregister_driver: 1606out_unregister_driver:
1607 of_unregister_platform_driver(&zs_driver); 1607 platform_driver_unregister(&zs_driver);
1608 1608
1609out_unregister_uart: 1609out_unregister_uart:
1610 if (num_sunzilog) { 1610 if (num_sunzilog) {
@@ -1619,7 +1619,7 @@ out_free_tables:
1619 1619
1620static void __exit sunzilog_exit(void) 1620static void __exit sunzilog_exit(void)
1621{ 1621{
1622 of_unregister_platform_driver(&zs_driver); 1622 platform_driver_unregister(&zs_driver);
1623 1623
1624 if (zilog_irq != -1) { 1624 if (zilog_irq != -1) {
1625 struct uart_sunzilog_port *up = sunzilog_irq_chain; 1625 struct uart_sunzilog_port *up = sunzilog_irq_chain;
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index d2fce865b731..8af1ed83a4c0 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -19,22 +19,11 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
23#include <linux/of.h> 22#include <linux/of.h>
24#include <linux/of_address.h> 23#include <linux/of_address.h>
25#include <linux/of_device.h> 24#include <linux/of_device.h>
26#include <linux/of_platform.h> 25#include <linux/of_platform.h>
27 26
28/* Match table for of_platform binding */
29static struct of_device_id ulite_of_match[] __devinitdata = {
30 { .compatible = "xlnx,opb-uartlite-1.00.b", },
31 { .compatible = "xlnx,xps-uartlite-1.00.a", },
32 {}
33};
34MODULE_DEVICE_TABLE(of, ulite_of_match);
35
36#endif
37
38#define ULITE_NAME "ttyUL" 27#define ULITE_NAME "ttyUL"
39#define ULITE_MAJOR 204 28#define ULITE_MAJOR 204
40#define ULITE_MINOR 187 29#define ULITE_MINOR 187
@@ -571,9 +560,29 @@ static int __devexit ulite_release(struct device *dev)
571 * Platform bus binding 560 * Platform bus binding
572 */ 561 */
573 562
563#if defined(CONFIG_OF)
564/* Match table for of_platform binding */
565static struct of_device_id ulite_of_match[] __devinitdata = {
566 { .compatible = "xlnx,opb-uartlite-1.00.b", },
567 { .compatible = "xlnx,xps-uartlite-1.00.a", },
568 {}
569};
570MODULE_DEVICE_TABLE(of, ulite_of_match);
571#else /* CONFIG_OF */
572#define ulite_of_match NULL
573#endif /* CONFIG_OF */
574
574static int __devinit ulite_probe(struct platform_device *pdev) 575static int __devinit ulite_probe(struct platform_device *pdev)
575{ 576{
576 struct resource *res, *res2; 577 struct resource *res, *res2;
578 int id = pdev->id;
579#ifdef CONFIG_OF
580 const __be32 *prop;
581
582 prop = of_get_property(pdev->dev.of_node, "port-number", NULL);
583 if (prop)
584 id = be32_to_cpup(prop);
585#endif
577 586
578 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 587 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
579 if (!res) 588 if (!res)
@@ -583,7 +592,7 @@ static int __devinit ulite_probe(struct platform_device *pdev)
583 if (!res2) 592 if (!res2)
584 return -ENODEV; 593 return -ENODEV;
585 594
586 return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start); 595 return ulite_assign(&pdev->dev, id, res->start, res2->start);
587} 596}
588 597
589static int __devexit ulite_remove(struct platform_device *pdev) 598static int __devexit ulite_remove(struct platform_device *pdev)
@@ -595,72 +604,15 @@ static int __devexit ulite_remove(struct platform_device *pdev)
595MODULE_ALIAS("platform:uartlite"); 604MODULE_ALIAS("platform:uartlite");
596 605
597static struct platform_driver ulite_platform_driver = { 606static struct platform_driver ulite_platform_driver = {
598 .probe = ulite_probe, 607 .probe = ulite_probe,
599 .remove = __devexit_p(ulite_remove), 608 .remove = __devexit_p(ulite_remove),
600 .driver = {
601 .owner = THIS_MODULE,
602 .name = "uartlite",
603 },
604};
605
606/* ---------------------------------------------------------------------
607 * OF bus bindings
608 */
609#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
610static int __devinit
611ulite_of_probe(struct platform_device *op, const struct of_device_id *match)
612{
613 struct resource res;
614 const unsigned int *id;
615 int irq, rc;
616
617 dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match);
618
619 rc = of_address_to_resource(op->dev.of_node, 0, &res);
620 if (rc) {
621 dev_err(&op->dev, "invalid address\n");
622 return rc;
623 }
624
625 irq = irq_of_parse_and_map(op->dev.of_node, 0);
626
627 id = of_get_property(op->dev.of_node, "port-number", NULL);
628
629 return ulite_assign(&op->dev, id ? *id : -1, res.start, irq);
630}
631
632static int __devexit ulite_of_remove(struct platform_device *op)
633{
634 return ulite_release(&op->dev);
635}
636
637static struct of_platform_driver ulite_of_driver = {
638 .probe = ulite_of_probe,
639 .remove = __devexit_p(ulite_of_remove),
640 .driver = { 609 .driver = {
641 .name = "uartlite",
642 .owner = THIS_MODULE, 610 .owner = THIS_MODULE,
611 .name = "uartlite",
643 .of_match_table = ulite_of_match, 612 .of_match_table = ulite_of_match,
644 }, 613 },
645}; 614};
646 615
647/* Registration helpers to keep the number of #ifdefs to a minimum */
648static inline int __init ulite_of_register(void)
649{
650 pr_debug("uartlite: calling of_register_platform_driver()\n");
651 return of_register_platform_driver(&ulite_of_driver);
652}
653
654static inline void __exit ulite_of_unregister(void)
655{
656 of_unregister_platform_driver(&ulite_of_driver);
657}
658#else /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
659/* Appropriate config not enabled; do nothing helpers */
660static inline int __init ulite_of_register(void) { return 0; }
661static inline void __exit ulite_of_unregister(void) { }
662#endif /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */
663
664/* --------------------------------------------------------------------- 616/* ---------------------------------------------------------------------
665 * Module setup/teardown 617 * Module setup/teardown
666 */ 618 */
@@ -674,10 +626,6 @@ int __init ulite_init(void)
674 if (ret) 626 if (ret)
675 goto err_uart; 627 goto err_uart;
676 628
677 ret = ulite_of_register();
678 if (ret)
679 goto err_of;
680
681 pr_debug("uartlite: calling platform_driver_register()\n"); 629 pr_debug("uartlite: calling platform_driver_register()\n");
682 ret = platform_driver_register(&ulite_platform_driver); 630 ret = platform_driver_register(&ulite_platform_driver);
683 if (ret) 631 if (ret)
@@ -686,8 +634,6 @@ int __init ulite_init(void)
686 return 0; 634 return 0;
687 635
688err_plat: 636err_plat:
689 ulite_of_unregister();
690err_of:
691 uart_unregister_driver(&ulite_uart_driver); 637 uart_unregister_driver(&ulite_uart_driver);
692err_uart: 638err_uart:
693 printk(KERN_ERR "registering uartlite driver failed: err=%i", ret); 639 printk(KERN_ERR "registering uartlite driver failed: err=%i", ret);
@@ -697,7 +643,6 @@ err_uart:
697void __exit ulite_exit(void) 643void __exit ulite_exit(void)
698{ 644{
699 platform_driver_unregister(&ulite_platform_driver); 645 platform_driver_unregister(&ulite_platform_driver);
700 ulite_of_unregister();
701 uart_unregister_driver(&ulite_uart_driver); 646 uart_unregister_driver(&ulite_uart_driver);
702} 647}
703 648
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 3f4848e2174a..ff51dae1df0c 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)
1194 release_firmware(fw); 1194 release_firmware(fw);
1195} 1195}
1196 1196
1197static int ucc_uart_probe(struct platform_device *ofdev, 1197static int ucc_uart_probe(struct platform_device *ofdev)
1198 const struct of_device_id *match)
1199{ 1198{
1200 struct device_node *np = ofdev->dev.of_node; 1199 struct device_node *np = ofdev->dev.of_node;
1201 const unsigned int *iprop; /* Integer OF properties */ 1200 const unsigned int *iprop; /* Integer OF properties */
@@ -1485,7 +1484,7 @@ static struct of_device_id ucc_uart_match[] = {
1485}; 1484};
1486MODULE_DEVICE_TABLE(of, ucc_uart_match); 1485MODULE_DEVICE_TABLE(of, ucc_uart_match);
1487 1486
1488static struct of_platform_driver ucc_uart_of_driver = { 1487static struct platform_driver ucc_uart_of_driver = {
1489 .driver = { 1488 .driver = {
1490 .name = "ucc_uart", 1489 .name = "ucc_uart",
1491 .owner = THIS_MODULE, 1490 .owner = THIS_MODULE,
@@ -1510,7 +1509,7 @@ static int __init ucc_uart_init(void)
1510 return ret; 1509 return ret;
1511 } 1510 }
1512 1511
1513 ret = of_register_platform_driver(&ucc_uart_of_driver); 1512 ret = platform_driver_register(&ucc_uart_of_driver);
1514 if (ret) 1513 if (ret)
1515 printk(KERN_ERR 1514 printk(KERN_ERR
1516 "ucc-uart: could not register platform driver\n"); 1515 "ucc-uart: could not register platform driver\n");
@@ -1523,7 +1522,7 @@ static void __exit ucc_uart_exit(void)
1523 printk(KERN_INFO 1522 printk(KERN_INFO
1524 "Freescale QUICC Engine UART device driver unloading\n"); 1523 "Freescale QUICC Engine UART device driver unloading\n");
1525 1524
1526 of_unregister_platform_driver(&ucc_uart_of_driver); 1525 platform_driver_unregister(&ucc_uart_of_driver);
1527 uart_unregister_driver(&ucc_uart_driver); 1526 uart_unregister_driver(&ucc_uart_driver);
1528} 1527}
1529 1528
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 792d5ef40137..aee7e3c53c38 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)
2523} 2523}
2524 2524
2525/* Driver probe functions */ 2525/* Driver probe functions */
2526static int __devinit qe_udc_probe(struct platform_device *ofdev, 2526static int __devinit qe_udc_probe(struct platform_device *ofdev)
2527 const struct of_device_id *match)
2528{ 2527{
2529 struct device_node *np = ofdev->dev.of_node; 2528 struct device_node *np = ofdev->dev.of_node;
2530 struct qe_ep *ep; 2529 struct qe_ep *ep;
@@ -2532,6 +2531,9 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
2532 unsigned int i; 2531 unsigned int i;
2533 const void *prop; 2532 const void *prop;
2534 2533
2534 if (!ofdev->dev.of_match)
2535 return -EINVAL;
2536
2535 prop = of_get_property(np, "mode", NULL); 2537 prop = of_get_property(np, "mode", NULL);
2536 if (!prop || strcmp(prop, "peripheral")) 2538 if (!prop || strcmp(prop, "peripheral"))
2537 return -ENODEV; 2539 return -ENODEV;
@@ -2543,7 +2545,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev,
2543 return -ENOMEM; 2545 return -ENOMEM;
2544 } 2546 }
2545 2547
2546 udc_controller->soc_type = (unsigned long)match->data; 2548 udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data;
2547 udc_controller->usb_regs = of_iomap(np, 0); 2549 udc_controller->usb_regs = of_iomap(np, 0);
2548 if (!udc_controller->usb_regs) { 2550 if (!udc_controller->usb_regs) {
2549 ret = -ENOMEM; 2551 ret = -ENOMEM;
@@ -2768,7 +2770,7 @@ static const struct of_device_id qe_udc_match[] __devinitconst = {
2768 2770
2769MODULE_DEVICE_TABLE(of, qe_udc_match); 2771MODULE_DEVICE_TABLE(of, qe_udc_match);
2770 2772
2771static struct of_platform_driver udc_driver = { 2773static struct platform_driver udc_driver = {
2772 .driver = { 2774 .driver = {
2773 .name = (char *)driver_name, 2775 .name = (char *)driver_name,
2774 .owner = THIS_MODULE, 2776 .owner = THIS_MODULE,
@@ -2786,12 +2788,12 @@ static int __init qe_udc_init(void)
2786{ 2788{
2787 printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc, 2789 printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc,
2788 DRIVER_VERSION); 2790 DRIVER_VERSION);
2789 return of_register_platform_driver(&udc_driver); 2791 return platform_driver_register(&udc_driver);
2790} 2792}
2791 2793
2792static void __exit qe_udc_exit(void) 2794static void __exit qe_udc_exit(void)
2793{ 2795{
2794 of_unregister_platform_driver(&udc_driver); 2796 platform_driver_unregister(&udc_driver);
2795} 2797}
2796 2798
2797module_init(qe_udc_init); 2799module_init(qe_udc_init);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d30c4e08c137..78561d112c04 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1317,24 +1317,24 @@ static int __init ehci_hcd_init(void)
1317#endif 1317#endif
1318 1318
1319#ifdef OF_PLATFORM_DRIVER 1319#ifdef OF_PLATFORM_DRIVER
1320 retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); 1320 retval = platform_driver_register(&OF_PLATFORM_DRIVER);
1321 if (retval < 0) 1321 if (retval < 0)
1322 goto clean3; 1322 goto clean3;
1323#endif 1323#endif
1324 1324
1325#ifdef XILINX_OF_PLATFORM_DRIVER 1325#ifdef XILINX_OF_PLATFORM_DRIVER
1326 retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER); 1326 retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER);
1327 if (retval < 0) 1327 if (retval < 0)
1328 goto clean4; 1328 goto clean4;
1329#endif 1329#endif
1330 return retval; 1330 return retval;
1331 1331
1332#ifdef XILINX_OF_PLATFORM_DRIVER 1332#ifdef XILINX_OF_PLATFORM_DRIVER
1333 /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */ 1333 /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */
1334clean4: 1334clean4:
1335#endif 1335#endif
1336#ifdef OF_PLATFORM_DRIVER 1336#ifdef OF_PLATFORM_DRIVER
1337 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1337 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1338clean3: 1338clean3:
1339#endif 1339#endif
1340#ifdef PS3_SYSTEM_BUS_DRIVER 1340#ifdef PS3_SYSTEM_BUS_DRIVER
@@ -1362,10 +1362,10 @@ module_init(ehci_hcd_init);
1362static void __exit ehci_hcd_cleanup(void) 1362static void __exit ehci_hcd_cleanup(void)
1363{ 1363{
1364#ifdef XILINX_OF_PLATFORM_DRIVER 1364#ifdef XILINX_OF_PLATFORM_DRIVER
1365 of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); 1365 platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER);
1366#endif 1366#endif
1367#ifdef OF_PLATFORM_DRIVER 1367#ifdef OF_PLATFORM_DRIVER
1368 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1368 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1369#endif 1369#endif
1370#ifdef PLATFORM_DRIVER 1370#ifdef PLATFORM_DRIVER
1371 platform_driver_unregister(&PLATFORM_DRIVER); 1371 platform_driver_unregister(&PLATFORM_DRIVER);
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index ba52be473027..1f09f253697e 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)
105} 105}
106 106
107 107
108static int __devinit 108static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
109ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
110{ 109{
111 struct device_node *dn = op->dev.of_node; 110 struct device_node *dn = op->dev.of_node;
112 struct usb_hcd *hcd; 111 struct usb_hcd *hcd;
@@ -255,14 +254,12 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)
255} 254}
256 255
257 256
258static int ehci_hcd_ppc_of_shutdown(struct platform_device *op) 257static void ehci_hcd_ppc_of_shutdown(struct platform_device *op)
259{ 258{
260 struct usb_hcd *hcd = dev_get_drvdata(&op->dev); 259 struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
261 260
262 if (hcd->driver->shutdown) 261 if (hcd->driver->shutdown)
263 hcd->driver->shutdown(hcd); 262 hcd->driver->shutdown(hcd);
264
265 return 0;
266} 263}
267 264
268 265
@@ -275,7 +272,7 @@ static const struct of_device_id ehci_hcd_ppc_of_match[] = {
275MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match); 272MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match);
276 273
277 274
278static struct of_platform_driver ehci_hcd_ppc_of_driver = { 275static struct platform_driver ehci_hcd_ppc_of_driver = {
279 .probe = ehci_hcd_ppc_of_probe, 276 .probe = ehci_hcd_ppc_of_probe,
280 .remove = ehci_hcd_ppc_of_remove, 277 .remove = ehci_hcd_ppc_of_remove,
281 .shutdown = ehci_hcd_ppc_of_shutdown, 278 .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 a6f21b891f68..effc58d7af8b 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -143,15 +143,13 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = {
143/** 143/**
144 * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller 144 * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller
145 * @op: pointer to the platform_device bound to the host controller 145 * @op: pointer to the platform_device bound to the host controller
146 * @match: pointer to of_device_id structure, not used
147 * 146 *
148 * This function requests resources and sets up appropriate properties for the 147 * This function requests resources and sets up appropriate properties for the
149 * host controller. Because the Xilinx USB host controller can be configured 148 * host controller. Because the Xilinx USB host controller can be configured
150 * as HS only or HS/FS only, it checks the configuration in the device tree 149 * as HS only or HS/FS only, it checks the configuration in the device tree
151 * entry, and sets an appropriate value for hcd->has_tt. 150 * entry, and sets an appropriate value for hcd->has_tt.
152 */ 151 */
153static int __devinit 152static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
154ehci_hcd_xilinx_of_probe(struct platform_device *op, const struct of_device_id *match)
155{ 153{
156 struct device_node *dn = op->dev.of_node; 154 struct device_node *dn = op->dev.of_node;
157 struct usb_hcd *hcd; 155 struct usb_hcd *hcd;
@@ -289,7 +287,7 @@ static const struct of_device_id ehci_hcd_xilinx_of_match[] = {
289}; 287};
290MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match); 288MODULE_DEVICE_TABLE(of, ehci_hcd_xilinx_of_match);
291 289
292static struct of_platform_driver ehci_hcd_xilinx_of_driver = { 290static struct platform_driver ehci_hcd_xilinx_of_driver = {
293 .probe = ehci_hcd_xilinx_of_probe, 291 .probe = ehci_hcd_xilinx_of_probe,
294 .remove = ehci_hcd_xilinx_of_remove, 292 .remove = ehci_hcd_xilinx_of_remove,
295 .shutdown = ehci_hcd_xilinx_of_shutdown, 293 .shutdown = ehci_hcd_xilinx_of_shutdown,
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 12fd184226f2..b84ff7e51896 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 = {
561 .hub_control = fhci_hub_control, 561 .hub_control = fhci_hub_control,
562}; 562};
563 563
564static int __devinit of_fhci_probe(struct platform_device *ofdev, 564static int __devinit of_fhci_probe(struct platform_device *ofdev)
565 const struct of_device_id *ofid)
566{ 565{
567 struct device *dev = &ofdev->dev; 566 struct device *dev = &ofdev->dev;
568 struct device_node *node = dev->of_node; 567 struct device_node *node = dev->of_node;
@@ -812,7 +811,7 @@ static const struct of_device_id of_fhci_match[] = {
812}; 811};
813MODULE_DEVICE_TABLE(of, of_fhci_match); 812MODULE_DEVICE_TABLE(of, of_fhci_match);
814 813
815static struct of_platform_driver of_fhci_driver = { 814static struct platform_driver of_fhci_driver = {
816 .driver = { 815 .driver = {
817 .name = "fsl,usb-fhci", 816 .name = "fsl,usb-fhci",
818 .owner = THIS_MODULE, 817 .owner = THIS_MODULE,
@@ -824,13 +823,13 @@ static struct of_platform_driver of_fhci_driver = {
824 823
825static int __init fhci_module_init(void) 824static int __init fhci_module_init(void)
826{ 825{
827 return of_register_platform_driver(&of_fhci_driver); 826 return platform_driver_register(&of_fhci_driver);
828} 827}
829module_init(fhci_module_init); 828module_init(fhci_module_init);
830 829
831static void __exit fhci_module_exit(void) 830static void __exit fhci_module_exit(void)
832{ 831{
833 of_unregister_platform_driver(&of_fhci_driver); 832 platform_driver_unregister(&of_fhci_driver);
834} 833}
835module_exit(fhci_module_exit); 834module_exit(fhci_module_exit);
836 835
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index 3b28dbfca058..7ee30056f373 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -27,8 +27,7 @@
27#endif 27#endif
28 28
29#ifdef CONFIG_PPC_OF 29#ifdef CONFIG_PPC_OF
30static int of_isp1760_probe(struct platform_device *dev, 30static int of_isp1760_probe(struct platform_device *dev)
31 const struct of_device_id *match)
32{ 31{
33 struct usb_hcd *hcd; 32 struct usb_hcd *hcd;
34 struct device_node *dp = dev->dev.of_node; 33 struct device_node *dp = dev->dev.of_node;
@@ -119,7 +118,7 @@ static const struct of_device_id of_isp1760_match[] = {
119}; 118};
120MODULE_DEVICE_TABLE(of, of_isp1760_match); 119MODULE_DEVICE_TABLE(of, of_isp1760_match);
121 120
122static struct of_platform_driver isp1760_of_driver = { 121static struct platform_driver isp1760_of_driver = {
123 .driver = { 122 .driver = {
124 .name = "nxp-isp1760", 123 .name = "nxp-isp1760",
125 .owner = THIS_MODULE, 124 .owner = THIS_MODULE,
@@ -398,7 +397,7 @@ static int __init isp1760_init(void)
398 if (!ret) 397 if (!ret)
399 any_ret = 0; 398 any_ret = 0;
400#ifdef CONFIG_PPC_OF 399#ifdef CONFIG_PPC_OF
401 ret = of_register_platform_driver(&isp1760_of_driver); 400 ret = platform_driver_register(&isp1760_of_driver);
402 if (!ret) 401 if (!ret)
403 any_ret = 0; 402 any_ret = 0;
404#endif 403#endif
@@ -418,7 +417,7 @@ static void __exit isp1760_exit(void)
418{ 417{
419 platform_driver_unregister(&isp1760_plat_driver); 418 platform_driver_unregister(&isp1760_plat_driver);
420#ifdef CONFIG_PPC_OF 419#ifdef CONFIG_PPC_OF
421 of_unregister_platform_driver(&isp1760_of_driver); 420 platform_driver_unregister(&isp1760_of_driver);
422#endif 421#endif
423#ifdef CONFIG_PCI 422#ifdef CONFIG_PCI
424 pci_unregister_driver(&isp1761_pci_driver); 423 pci_unregister_driver(&isp1761_pci_driver);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index fb035751e4b2..f4062bba9d04 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1168,7 +1168,7 @@ static int __init ohci_hcd_mod_init(void)
1168#endif 1168#endif
1169 1169
1170#ifdef OF_PLATFORM_DRIVER 1170#ifdef OF_PLATFORM_DRIVER
1171 retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); 1171 retval = platform_driver_register(&OF_PLATFORM_DRIVER);
1172 if (retval < 0) 1172 if (retval < 0)
1173 goto error_of_platform; 1173 goto error_of_platform;
1174#endif 1174#endif
@@ -1227,7 +1227,7 @@ static int __init ohci_hcd_mod_init(void)
1227 error_sa1111: 1227 error_sa1111:
1228#endif 1228#endif
1229#ifdef OF_PLATFORM_DRIVER 1229#ifdef OF_PLATFORM_DRIVER
1230 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1230 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1231 error_of_platform: 1231 error_of_platform:
1232#endif 1232#endif
1233#ifdef PLATFORM_DRIVER 1233#ifdef PLATFORM_DRIVER
@@ -1275,7 +1275,7 @@ static void __exit ohci_hcd_mod_exit(void)
1275 sa1111_driver_unregister(&SA1111_DRIVER); 1275 sa1111_driver_unregister(&SA1111_DRIVER);
1276#endif 1276#endif
1277#ifdef OF_PLATFORM_DRIVER 1277#ifdef OF_PLATFORM_DRIVER
1278 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1278 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1279#endif 1279#endif
1280#ifdef PLATFORM_DRIVER 1280#ifdef PLATFORM_DRIVER
1281 platform_driver_unregister(&PLATFORM_DRIVER); 1281 platform_driver_unregister(&PLATFORM_DRIVER);
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index b2c2dbf08766..1ca1821320f4 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 = {
80}; 80};
81 81
82 82
83static int __devinit 83static int __devinit ohci_hcd_ppc_of_probe(struct platform_device *op)
84ohci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match)
85{ 84{
86 struct device_node *dn = op->dev.of_node; 85 struct device_node *dn = op->dev.of_node;
87 struct usb_hcd *hcd; 86 struct usb_hcd *hcd;
@@ -201,14 +200,12 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op)
201 return 0; 200 return 0;
202} 201}
203 202
204static int ohci_hcd_ppc_of_shutdown(struct platform_device *op) 203static void ohci_hcd_ppc_of_shutdown(struct platform_device *op)
205{ 204{
206 struct usb_hcd *hcd = dev_get_drvdata(&op->dev); 205 struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
207 206
208 if (hcd->driver->shutdown) 207 if (hcd->driver->shutdown)
209 hcd->driver->shutdown(hcd); 208 hcd->driver->shutdown(hcd);
210
211 return 0;
212} 209}
213 210
214 211
@@ -243,7 +240,7 @@ MODULE_DEVICE_TABLE(of, ohci_hcd_ppc_of_match);
243#endif 240#endif
244 241
245 242
246static struct of_platform_driver ohci_hcd_ppc_of_driver = { 243static struct platform_driver ohci_hcd_ppc_of_driver = {
247 .probe = ohci_hcd_ppc_of_probe, 244 .probe = ohci_hcd_ppc_of_probe,
248 .remove = ohci_hcd_ppc_of_remove, 245 .remove = ohci_hcd_ppc_of_remove,
249 .shutdown = ohci_hcd_ppc_of_shutdown, 246 .shutdown = ohci_hcd_ppc_of_shutdown,
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index 4dc13467281d..7ba74cd4be61 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,
273 return 0; 273 return 0;
274} 274}
275 275
276static int __devinit bw2_probe(struct platform_device *op, const struct of_device_id *match) 276static int __devinit bw2_probe(struct platform_device *op)
277{ 277{
278 struct device_node *dp = op->dev.of_node; 278 struct device_node *dp = op->dev.of_node;
279 struct fb_info *info; 279 struct fb_info *info;
@@ -375,7 +375,7 @@ static const struct of_device_id bw2_match[] = {
375}; 375};
376MODULE_DEVICE_TABLE(of, bw2_match); 376MODULE_DEVICE_TABLE(of, bw2_match);
377 377
378static struct of_platform_driver bw2_driver = { 378static struct platform_driver bw2_driver = {
379 .driver = { 379 .driver = {
380 .name = "bw2", 380 .name = "bw2",
381 .owner = THIS_MODULE, 381 .owner = THIS_MODULE,
@@ -390,12 +390,12 @@ static int __init bw2_init(void)
390 if (fb_get_options("bw2fb", NULL)) 390 if (fb_get_options("bw2fb", NULL))
391 return -ENODEV; 391 return -ENODEV;
392 392
393 return of_register_platform_driver(&bw2_driver); 393 return platform_driver_register(&bw2_driver);
394} 394}
395 395
396static void __exit bw2_exit(void) 396static void __exit bw2_exit(void)
397{ 397{
398 of_unregister_platform_driver(&bw2_driver); 398 platform_driver_unregister(&bw2_driver);
399} 399}
400 400
401module_init(bw2_init); 401module_init(bw2_init);
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index 24249535ac86..e2c85b0db632 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,
463 info->screen_base, info->fix.smem_len); 463 info->screen_base, info->fix.smem_len);
464} 464}
465 465
466static int __devinit cg14_probe(struct platform_device *op, const struct of_device_id *match) 466static int __devinit cg14_probe(struct platform_device *op)
467{ 467{
468 struct device_node *dp = op->dev.of_node; 468 struct device_node *dp = op->dev.of_node;
469 struct fb_info *info; 469 struct fb_info *info;
@@ -595,7 +595,7 @@ static const struct of_device_id cg14_match[] = {
595}; 595};
596MODULE_DEVICE_TABLE(of, cg14_match); 596MODULE_DEVICE_TABLE(of, cg14_match);
597 597
598static struct of_platform_driver cg14_driver = { 598static struct platform_driver cg14_driver = {
599 .driver = { 599 .driver = {
600 .name = "cg14", 600 .name = "cg14",
601 .owner = THIS_MODULE, 601 .owner = THIS_MODULE,
@@ -610,12 +610,12 @@ static int __init cg14_init(void)
610 if (fb_get_options("cg14fb", NULL)) 610 if (fb_get_options("cg14fb", NULL))
611 return -ENODEV; 611 return -ENODEV;
612 612
613 return of_register_platform_driver(&cg14_driver); 613 return platform_driver_register(&cg14_driver);
614} 614}
615 615
616static void __exit cg14_exit(void) 616static void __exit cg14_exit(void)
617{ 617{
618 of_unregister_platform_driver(&cg14_driver); 618 platform_driver_unregister(&cg14_driver);
619} 619}
620 620
621module_init(cg14_init); 621module_init(cg14_init);
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index 09c0c3c42482..f927a7b1a8d4 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)
346 return 0; 346 return 0;
347} 347}
348 348
349static int __devinit cg3_probe(struct platform_device *op, 349static int __devinit cg3_probe(struct platform_device *op)
350 const struct of_device_id *match)
351{ 350{
352 struct device_node *dp = op->dev.of_node; 351 struct device_node *dp = op->dev.of_node;
353 struct fb_info *info; 352 struct fb_info *info;
@@ -462,7 +461,7 @@ static const struct of_device_id cg3_match[] = {
462}; 461};
463MODULE_DEVICE_TABLE(of, cg3_match); 462MODULE_DEVICE_TABLE(of, cg3_match);
464 463
465static struct of_platform_driver cg3_driver = { 464static struct platform_driver cg3_driver = {
466 .driver = { 465 .driver = {
467 .name = "cg3", 466 .name = "cg3",
468 .owner = THIS_MODULE, 467 .owner = THIS_MODULE,
@@ -477,12 +476,12 @@ static int __init cg3_init(void)
477 if (fb_get_options("cg3fb", NULL)) 476 if (fb_get_options("cg3fb", NULL))
478 return -ENODEV; 477 return -ENODEV;
479 478
480 return of_register_platform_driver(&cg3_driver); 479 return platform_driver_register(&cg3_driver);
481} 480}
482 481
483static void __exit cg3_exit(void) 482static void __exit cg3_exit(void)
484{ 483{
485 of_unregister_platform_driver(&cg3_driver); 484 platform_driver_unregister(&cg3_driver);
486} 485}
487 486
488module_init(cg3_init); 487module_init(cg3_init);
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 2b5a97058b08..4ffad90bde42 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,
737 info->fix.smem_len); 737 info->fix.smem_len);
738} 738}
739 739
740static int __devinit cg6_probe(struct platform_device *op, 740static int __devinit cg6_probe(struct platform_device *op)
741 const struct of_device_id *match)
742{ 741{
743 struct device_node *dp = op->dev.of_node; 742 struct device_node *dp = op->dev.of_node;
744 struct fb_info *info; 743 struct fb_info *info;
@@ -855,7 +854,7 @@ static const struct of_device_id cg6_match[] = {
855}; 854};
856MODULE_DEVICE_TABLE(of, cg6_match); 855MODULE_DEVICE_TABLE(of, cg6_match);
857 856
858static struct of_platform_driver cg6_driver = { 857static struct platform_driver cg6_driver = {
859 .driver = { 858 .driver = {
860 .name = "cg6", 859 .name = "cg6",
861 .owner = THIS_MODULE, 860 .owner = THIS_MODULE,
@@ -870,12 +869,12 @@ static int __init cg6_init(void)
870 if (fb_get_options("cg6fb", NULL)) 869 if (fb_get_options("cg6fb", NULL))
871 return -ENODEV; 870 return -ENODEV;
872 871
873 return of_register_platform_driver(&cg6_driver); 872 return platform_driver_register(&cg6_driver);
874} 873}
875 874
876static void __exit cg6_exit(void) 875static void __exit cg6_exit(void)
877{ 876{
878 of_unregister_platform_driver(&cg6_driver); 877 platform_driver_unregister(&cg6_driver);
879} 878}
880 879
881module_init(cg6_init); 880module_init(cg6_init);
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 6739b2af3bc0..910c5e6f6702 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -893,8 +893,7 @@ static void ffb_init_fix(struct fb_info *info)
893 info->fix.accel = FB_ACCEL_SUN_CREATOR; 893 info->fix.accel = FB_ACCEL_SUN_CREATOR;
894} 894}
895 895
896static int __devinit ffb_probe(struct platform_device *op, 896static int __devinit ffb_probe(struct platform_device *op)
897 const struct of_device_id *match)
898{ 897{
899 struct device_node *dp = op->dev.of_node; 898 struct device_node *dp = op->dev.of_node;
900 struct ffb_fbc __iomem *fbc; 899 struct ffb_fbc __iomem *fbc;
@@ -1052,7 +1051,7 @@ static const struct of_device_id ffb_match[] = {
1052}; 1051};
1053MODULE_DEVICE_TABLE(of, ffb_match); 1052MODULE_DEVICE_TABLE(of, ffb_match);
1054 1053
1055static struct of_platform_driver ffb_driver = { 1054static struct platform_driver ffb_driver = {
1056 .driver = { 1055 .driver = {
1057 .name = "ffb", 1056 .name = "ffb",
1058 .owner = THIS_MODULE, 1057 .owner = THIS_MODULE,
@@ -1067,12 +1066,12 @@ static int __init ffb_init(void)
1067 if (fb_get_options("ffb", NULL)) 1066 if (fb_get_options("ffb", NULL))
1068 return -ENODEV; 1067 return -ENODEV;
1069 1068
1070 return of_register_platform_driver(&ffb_driver); 1069 return platform_driver_register(&ffb_driver);
1071} 1070}
1072 1071
1073static void __exit ffb_exit(void) 1072static void __exit ffb_exit(void)
1074{ 1073{
1075 of_unregister_platform_driver(&ffb_driver); 1074 platform_driver_unregister(&ffb_driver);
1076} 1075}
1077 1076
1078module_init(ffb_init); 1077module_init(ffb_init);
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 8bbbf08fa3ce..9048f87fa8c1 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,
1487 return diu_ops.show_monitor_port(machine_data->monitor_port, buf); 1487 return diu_ops.show_monitor_port(machine_data->monitor_port, buf);
1488} 1488}
1489 1489
1490static int __devinit fsl_diu_probe(struct platform_device *ofdev, 1490static int __devinit fsl_diu_probe(struct platform_device *ofdev)
1491 const struct of_device_id *match)
1492{ 1491{
1493 struct device_node *np = ofdev->dev.of_node; 1492 struct device_node *np = ofdev->dev.of_node;
1494 struct mfb_info *mfbi; 1493 struct mfb_info *mfbi;
@@ -1735,7 +1734,7 @@ static struct of_device_id fsl_diu_match[] = {
1735}; 1734};
1736MODULE_DEVICE_TABLE(of, fsl_diu_match); 1735MODULE_DEVICE_TABLE(of, fsl_diu_match);
1737 1736
1738static struct of_platform_driver fsl_diu_driver = { 1737static struct platform_driver fsl_diu_driver = {
1739 .driver = { 1738 .driver = {
1740 .name = "fsl_diu", 1739 .name = "fsl_diu",
1741 .owner = THIS_MODULE, 1740 .owner = THIS_MODULE,
@@ -1797,7 +1796,7 @@ static int __init fsl_diu_init(void)
1797 if (!coherence_data) 1796 if (!coherence_data)
1798 return -ENOMEM; 1797 return -ENOMEM;
1799#endif 1798#endif
1800 ret = of_register_platform_driver(&fsl_diu_driver); 1799 ret = platform_driver_register(&fsl_diu_driver);
1801 if (ret) { 1800 if (ret) {
1802 printk(KERN_ERR 1801 printk(KERN_ERR
1803 "fsl-diu: failed to register platform driver\n"); 1802 "fsl-diu: failed to register platform driver\n");
@@ -1811,7 +1810,7 @@ static int __init fsl_diu_init(void)
1811 1810
1812static void __exit fsl_diu_exit(void) 1811static void __exit fsl_diu_exit(void)
1813{ 1812{
1814 of_unregister_platform_driver(&fsl_diu_driver); 1813 platform_driver_unregister(&fsl_diu_driver);
1815#if defined(CONFIG_NOT_COHERENT_CACHE) 1814#if defined(CONFIG_NOT_COHERENT_CACHE)
1816 vfree(coherence_data); 1815 vfree(coherence_data);
1817#endif 1816#endif
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index b599e5e36ced..9e946e2c1da9 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,
547 of_iounmap(&op->resource[0], info->screen_base, 0x800000); 547 of_iounmap(&op->resource[0], info->screen_base, 0x800000);
548} 548}
549 549
550static int __devinit leo_probe(struct platform_device *op, 550static int __devinit leo_probe(struct platform_device *op)
551 const struct of_device_id *match)
552{ 551{
553 struct device_node *dp = op->dev.of_node; 552 struct device_node *dp = op->dev.of_node;
554 struct fb_info *info; 553 struct fb_info *info;
@@ -662,7 +661,7 @@ static const struct of_device_id leo_match[] = {
662}; 661};
663MODULE_DEVICE_TABLE(of, leo_match); 662MODULE_DEVICE_TABLE(of, leo_match);
664 663
665static struct of_platform_driver leo_driver = { 664static struct platform_driver leo_driver = {
666 .driver = { 665 .driver = {
667 .name = "leo", 666 .name = "leo",
668 .owner = THIS_MODULE, 667 .owner = THIS_MODULE,
@@ -677,12 +676,12 @@ static int __init leo_init(void)
677 if (fb_get_options("leofb", NULL)) 676 if (fb_get_options("leofb", NULL))
678 return -ENODEV; 677 return -ENODEV;
679 678
680 return of_register_platform_driver(&leo_driver); 679 return platform_driver_register(&leo_driver);
681} 680}
682 681
683static void __exit leo_exit(void) 682static void __exit leo_exit(void)
684{ 683{
685 of_unregister_platform_driver(&leo_driver); 684 platform_driver_unregister(&leo_driver);
686} 685}
687 686
688module_init(leo_init); 687module_init(leo_init);
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c
index b1c4374cf940..c76e663a6cd4 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)
550 return 0; 550 return 0;
551} 551}
552 552
553static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev, 553static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev)
554 const struct of_device_id *id)
555{ 554{
556 struct device_node *np = ofdev->dev.of_node; 555 struct device_node *np = ofdev->dev.of_node;
557 struct device *dev = &ofdev->dev; 556 struct device *dev = &ofdev->dev;
@@ -717,7 +716,7 @@ static struct of_device_id __devinitdata of_platform_mb862xx_tbl[] = {
717 { /* end */ } 716 { /* end */ }
718}; 717};
719 718
720static struct of_platform_driver of_platform_mb862xxfb_driver = { 719static struct platform_driver of_platform_mb862xxfb_driver = {
721 .driver = { 720 .driver = {
722 .name = DRV_NAME, 721 .name = DRV_NAME,
723 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
@@ -1038,7 +1037,7 @@ static int __devinit mb862xxfb_init(void)
1038 int ret = -ENODEV; 1037 int ret = -ENODEV;
1039 1038
1040#if defined(CONFIG_FB_MB862XX_LIME) 1039#if defined(CONFIG_FB_MB862XX_LIME)
1041 ret = of_register_platform_driver(&of_platform_mb862xxfb_driver); 1040 ret = platform_driver_register(&of_platform_mb862xxfb_driver);
1042#endif 1041#endif
1043#if defined(CONFIG_FB_MB862XX_PCI_GDC) 1042#if defined(CONFIG_FB_MB862XX_PCI_GDC)
1044 ret = pci_register_driver(&mb862xxfb_pci_driver); 1043 ret = pci_register_driver(&mb862xxfb_pci_driver);
@@ -1049,7 +1048,7 @@ static int __devinit mb862xxfb_init(void)
1049static void __exit mb862xxfb_exit(void) 1048static void __exit mb862xxfb_exit(void)
1050{ 1049{
1051#if defined(CONFIG_FB_MB862XX_LIME) 1050#if defined(CONFIG_FB_MB862XX_LIME)
1052 of_unregister_platform_driver(&of_platform_mb862xxfb_driver); 1051 platform_driver_unregister(&of_platform_mb862xxfb_driver);
1053#endif 1052#endif
1054#if defined(CONFIG_FB_MB862XX_PCI_GDC) 1053#if defined(CONFIG_FB_MB862XX_PCI_GDC)
1055 pci_unregister_driver(&mb862xxfb_pci_driver); 1054 pci_unregister_driver(&mb862xxfb_pci_driver);
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index b6c3fc2db632..d57cc58c5168 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
249 info->fix.accel = FB_ACCEL_SUN_CGTHREE; 249 info->fix.accel = FB_ACCEL_SUN_CGTHREE;
250} 250}
251 251
252static int __devinit p9100_probe(struct platform_device *op, const struct of_device_id *match) 252static int __devinit p9100_probe(struct platform_device *op)
253{ 253{
254 struct device_node *dp = op->dev.of_node; 254 struct device_node *dp = op->dev.of_node;
255 struct fb_info *info; 255 struct fb_info *info;
@@ -352,7 +352,7 @@ static const struct of_device_id p9100_match[] = {
352}; 352};
353MODULE_DEVICE_TABLE(of, p9100_match); 353MODULE_DEVICE_TABLE(of, p9100_match);
354 354
355static struct of_platform_driver p9100_driver = { 355static struct platform_driver p9100_driver = {
356 .driver = { 356 .driver = {
357 .name = "p9100", 357 .name = "p9100",
358 .owner = THIS_MODULE, 358 .owner = THIS_MODULE,
@@ -367,12 +367,12 @@ static int __init p9100_init(void)
367 if (fb_get_options("p9100fb", NULL)) 367 if (fb_get_options("p9100fb", NULL))
368 return -ENODEV; 368 return -ENODEV;
369 369
370 return of_register_platform_driver(&p9100_driver); 370 return platform_driver_register(&p9100_driver);
371} 371}
372 372
373static void __exit p9100_exit(void) 373static void __exit p9100_exit(void)
374{ 374{
375 of_unregister_platform_driver(&p9100_driver); 375 platform_driver_unregister(&p9100_driver);
376} 376}
377 377
378module_init(p9100_init); 378module_init(p9100_init);
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index a50e1977b316..ef532d9d3c99 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -533,8 +533,7 @@ static int __init platinumfb_setup(char *options)
533#define invalidate_cache(addr) 533#define invalidate_cache(addr)
534#endif 534#endif
535 535
536static int __devinit platinumfb_probe(struct platform_device* odev, 536static int __devinit platinumfb_probe(struct platform_device* odev)
537 const struct of_device_id *match)
538{ 537{
539 struct device_node *dp = odev->dev.of_node; 538 struct device_node *dp = odev->dev.of_node;
540 struct fb_info *info; 539 struct fb_info *info;
@@ -677,7 +676,7 @@ static struct of_device_id platinumfb_match[] =
677 {}, 676 {},
678}; 677};
679 678
680static struct of_platform_driver platinum_driver = 679static struct platform_driver platinum_driver =
681{ 680{
682 .driver = { 681 .driver = {
683 .name = "platinumfb", 682 .name = "platinumfb",
@@ -697,14 +696,14 @@ static int __init platinumfb_init(void)
697 return -ENODEV; 696 return -ENODEV;
698 platinumfb_setup(option); 697 platinumfb_setup(option);
699#endif 698#endif
700 of_register_platform_driver(&platinum_driver); 699 platform_driver_register(&platinum_driver);
701 700
702 return 0; 701 return 0;
703} 702}
704 703
705static void __exit platinumfb_exit(void) 704static void __exit platinumfb_exit(void)
706{ 705{
707 of_unregister_platform_driver(&platinum_driver); 706 platform_driver_unregister(&platinum_driver);
708} 707}
709 708
710MODULE_LICENSE("GPL"); 709MODULE_LICENSE("GPL");
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c
index 5dbe06af2226..b7f27acaf817 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)
111 return 0; 111 return 0;
112} 112}
113 113
114static int __devinit gfb_probe(struct platform_device *op, 114static int __devinit gfb_probe(struct platform_device *op)
115 const struct of_device_id *match)
116{ 115{
117 struct device_node *dp = op->dev.of_node; 116 struct device_node *dp = op->dev.of_node;
118 struct fb_info *info; 117 struct fb_info *info;
@@ -198,7 +197,7 @@ static const struct of_device_id gfb_match[] = {
198}; 197};
199MODULE_DEVICE_TABLE(of, ffb_match); 198MODULE_DEVICE_TABLE(of, ffb_match);
200 199
201static struct of_platform_driver gfb_driver = { 200static struct platform_driver gfb_driver = {
202 .probe = gfb_probe, 201 .probe = gfb_probe,
203 .remove = __devexit_p(gfb_remove), 202 .remove = __devexit_p(gfb_remove),
204 .driver = { 203 .driver = {
@@ -213,12 +212,12 @@ static int __init gfb_init(void)
213 if (fb_get_options("gfb", NULL)) 212 if (fb_get_options("gfb", NULL))
214 return -ENODEV; 213 return -ENODEV;
215 214
216 return of_register_platform_driver(&gfb_driver); 215 return platform_driver_register(&gfb_driver);
217} 216}
218 217
219static void __exit gfb_exit(void) 218static void __exit gfb_exit(void)
220{ 219{
221 of_unregister_platform_driver(&gfb_driver); 220 platform_driver_unregister(&gfb_driver);
222} 221}
223 222
224module_init(gfb_init); 223module_init(gfb_init);
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index 77ad27955cf0..855b71993f61 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,
362 info->screen_base, info->fix.smem_len); 362 info->screen_base, info->fix.smem_len);
363} 363}
364 364
365static int __devinit tcx_probe(struct platform_device *op, 365static int __devinit tcx_probe(struct platform_device *op)
366 const struct of_device_id *match)
367{ 366{
368 struct device_node *dp = op->dev.of_node; 367 struct device_node *dp = op->dev.of_node;
369 struct fb_info *info; 368 struct fb_info *info;
@@ -511,7 +510,7 @@ static const struct of_device_id tcx_match[] = {
511}; 510};
512MODULE_DEVICE_TABLE(of, tcx_match); 511MODULE_DEVICE_TABLE(of, tcx_match);
513 512
514static struct of_platform_driver tcx_driver = { 513static struct platform_driver tcx_driver = {
515 .driver = { 514 .driver = {
516 .name = "tcx", 515 .name = "tcx",
517 .owner = THIS_MODULE, 516 .owner = THIS_MODULE,
@@ -526,12 +525,12 @@ static int __init tcx_init(void)
526 if (fb_get_options("tcxfb", NULL)) 525 if (fb_get_options("tcxfb", NULL))
527 return -ENODEV; 526 return -ENODEV;
528 527
529 return of_register_platform_driver(&tcx_driver); 528 return platform_driver_register(&tcx_driver);
530} 529}
531 530
532static void __exit tcx_exit(void) 531static void __exit tcx_exit(void)
533{ 532{
534 of_unregister_platform_driver(&tcx_driver); 533 platform_driver_unregister(&tcx_driver);
535} 534}
536 535
537module_init(tcx_init); 536module_init(tcx_init);
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 68bd23476c64..77dea015ff69 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -404,8 +404,7 @@ static int xilinxfb_release(struct device *dev)
404 * OF bus binding 404 * OF bus binding
405 */ 405 */
406 406
407static int __devinit 407static int __devinit xilinxfb_of_probe(struct platform_device *op)
408xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match)
409{ 408{
410 const u32 *prop; 409 const u32 *prop;
411 u32 *p; 410 u32 *p;
@@ -418,8 +417,6 @@ xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match)
418 /* Copy with the default pdata (not a ptr reference!) */ 417 /* Copy with the default pdata (not a ptr reference!) */
419 pdata = xilinx_fb_default_pdata; 418 pdata = xilinx_fb_default_pdata;
420 419
421 dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match);
422
423 /* Allocate the driver data region */ 420 /* Allocate the driver data region */
424 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); 421 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
425 if (!drvdata) { 422 if (!drvdata) {
@@ -505,7 +502,7 @@ static struct of_device_id xilinxfb_of_match[] __devinitdata = {
505}; 502};
506MODULE_DEVICE_TABLE(of, xilinxfb_of_match); 503MODULE_DEVICE_TABLE(of, xilinxfb_of_match);
507 504
508static struct of_platform_driver xilinxfb_of_driver = { 505static struct platform_driver xilinxfb_of_driver = {
509 .probe = xilinxfb_of_probe, 506 .probe = xilinxfb_of_probe,
510 .remove = __devexit_p(xilinxfb_of_remove), 507 .remove = __devexit_p(xilinxfb_of_remove),
511 .driver = { 508 .driver = {
@@ -523,13 +520,13 @@ static struct of_platform_driver xilinxfb_of_driver = {
523static int __init 520static int __init
524xilinxfb_init(void) 521xilinxfb_init(void)
525{ 522{
526 return of_register_platform_driver(&xilinxfb_of_driver); 523 return platform_driver_register(&xilinxfb_of_driver);
527} 524}
528 525
529static void __exit 526static void __exit
530xilinxfb_cleanup(void) 527xilinxfb_cleanup(void)
531{ 528{
532 of_unregister_platform_driver(&xilinxfb_of_driver); 529 platform_driver_unregister(&xilinxfb_of_driver);
533} 530}
534 531
535module_init(xilinxfb_init); 532module_init(xilinxfb_init);
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index 3de4ba0260a5..65911678453d 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -528,8 +528,7 @@ static const struct file_operations cpwd_fops = {
528 .llseek = no_llseek, 528 .llseek = no_llseek,
529}; 529};
530 530
531static int __devinit cpwd_probe(struct platform_device *op, 531static int __devinit cpwd_probe(struct platform_device *op)
532 const struct of_device_id *match)
533{ 532{
534 struct device_node *options; 533 struct device_node *options;
535 const char *str_prop; 534 const char *str_prop;
@@ -678,7 +677,7 @@ static const struct of_device_id cpwd_match[] = {
678}; 677};
679MODULE_DEVICE_TABLE(of, cpwd_match); 678MODULE_DEVICE_TABLE(of, cpwd_match);
680 679
681static struct of_platform_driver cpwd_driver = { 680static struct platform_driver cpwd_driver = {
682 .driver = { 681 .driver = {
683 .name = DRIVER_NAME, 682 .name = DRIVER_NAME,
684 .owner = THIS_MODULE, 683 .owner = THIS_MODULE,
@@ -690,12 +689,12 @@ static struct of_platform_driver cpwd_driver = {
690 689
691static int __init cpwd_init(void) 690static int __init cpwd_init(void)
692{ 691{
693 return of_register_platform_driver(&cpwd_driver); 692 return platform_driver_register(&cpwd_driver);
694} 693}
695 694
696static void __exit cpwd_exit(void) 695static void __exit cpwd_exit(void)
697{ 696{
698 of_unregister_platform_driver(&cpwd_driver); 697 platform_driver_unregister(&cpwd_driver);
699} 698}
700 699
701module_init(cpwd_init); 700module_init(cpwd_init);
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index f6bd6f10fcec..29a7cd4b90c8 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -261,8 +261,7 @@ static struct miscdevice gef_wdt_miscdev = {
261}; 261};
262 262
263 263
264static int __devinit gef_wdt_probe(struct platform_device *dev, 264static int __devinit gef_wdt_probe(struct platform_device *dev)
265 const struct of_device_id *match)
266{ 265{
267 int timeout = 10; 266 int timeout = 10;
268 u32 freq; 267 u32 freq;
@@ -303,7 +302,7 @@ static const struct of_device_id gef_wdt_ids[] = {
303 {}, 302 {},
304}; 303};
305 304
306static struct of_platform_driver gef_wdt_driver = { 305static struct platform_driver gef_wdt_driver = {
307 .driver = { 306 .driver = {
308 .name = "gef_wdt", 307 .name = "gef_wdt",
309 .owner = THIS_MODULE, 308 .owner = THIS_MODULE,
@@ -315,12 +314,12 @@ static struct of_platform_driver gef_wdt_driver = {
315static int __init gef_wdt_init(void) 314static int __init gef_wdt_init(void)
316{ 315{
317 printk(KERN_INFO "GE watchdog driver\n"); 316 printk(KERN_INFO "GE watchdog driver\n");
318 return of_register_platform_driver(&gef_wdt_driver); 317 return platform_driver_register(&gef_wdt_driver);
319} 318}
320 319
321static void __exit gef_wdt_exit(void) 320static void __exit gef_wdt_exit(void)
322{ 321{
323 of_unregister_platform_driver(&gef_wdt_driver); 322 platform_driver_unregister(&gef_wdt_driver);
324} 323}
325 324
326module_init(gef_wdt_init); 325module_init(gef_wdt_init);
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 8fa213cdb499..ea438ad53055 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -185,15 +185,18 @@ static struct miscdevice mpc8xxx_wdt_miscdev = {
185 .fops = &mpc8xxx_wdt_fops, 185 .fops = &mpc8xxx_wdt_fops,
186}; 186};
187 187
188static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev, 188static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev)
189 const struct of_device_id *match)
190{ 189{
191 int ret; 190 int ret;
192 struct device_node *np = ofdev->dev.of_node; 191 struct device_node *np = ofdev->dev.of_node;
193 struct mpc8xxx_wdt_type *wdt_type = match->data; 192 struct mpc8xxx_wdt_type *wdt_type;
194 u32 freq = fsl_get_sys_freq(); 193 u32 freq = fsl_get_sys_freq();
195 bool enabled; 194 bool enabled;
196 195
196 if (!ofdev->dev.of_match)
197 return -EINVAL;
198 wdt_type = match->data;
199
197 if (!freq || freq == -1) 200 if (!freq || freq == -1)
198 return -EINVAL; 201 return -EINVAL;
199 202
@@ -272,7 +275,7 @@ static const struct of_device_id mpc8xxx_wdt_match[] = {
272}; 275};
273MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match); 276MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);
274 277
275static struct of_platform_driver mpc8xxx_wdt_driver = { 278static struct platform_driver mpc8xxx_wdt_driver = {
276 .probe = mpc8xxx_wdt_probe, 279 .probe = mpc8xxx_wdt_probe,
277 .remove = __devexit_p(mpc8xxx_wdt_remove), 280 .remove = __devexit_p(mpc8xxx_wdt_remove),
278 .driver = { 281 .driver = {
@@ -308,13 +311,13 @@ module_init(mpc8xxx_wdt_init_late);
308 311
309static int __init mpc8xxx_wdt_init(void) 312static int __init mpc8xxx_wdt_init(void)
310{ 313{
311 return of_register_platform_driver(&mpc8xxx_wdt_driver); 314 return platform_driver_register(&mpc8xxx_wdt_driver);
312} 315}
313arch_initcall(mpc8xxx_wdt_init); 316arch_initcall(mpc8xxx_wdt_init);
314 317
315static void __exit mpc8xxx_wdt_exit(void) 318static void __exit mpc8xxx_wdt_exit(void)
316{ 319{
317 of_unregister_platform_driver(&mpc8xxx_wdt_driver); 320 platform_driver_unregister(&mpc8xxx_wdt_driver);
318} 321}
319module_exit(mpc8xxx_wdt_exit); 322module_exit(mpc8xxx_wdt_exit);
320 323
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index 3faee1ae64bd..109b533896b7 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -172,8 +172,7 @@ static struct miscdevice riowd_miscdev = {
172 .fops = &riowd_fops 172 .fops = &riowd_fops
173}; 173};
174 174
175static int __devinit riowd_probe(struct platform_device *op, 175static int __devinit riowd_probe(struct platform_device *op)
176 const struct of_device_id *match)
177{ 176{
178 struct riowd *p; 177 struct riowd *p;
179 int err = -EINVAL; 178 int err = -EINVAL;
@@ -238,7 +237,7 @@ static const struct of_device_id riowd_match[] = {
238}; 237};
239MODULE_DEVICE_TABLE(of, riowd_match); 238MODULE_DEVICE_TABLE(of, riowd_match);
240 239
241static struct of_platform_driver riowd_driver = { 240static struct platform_driver riowd_driver = {
242 .driver = { 241 .driver = {
243 .name = DRIVER_NAME, 242 .name = DRIVER_NAME,
244 .owner = THIS_MODULE, 243 .owner = THIS_MODULE,
@@ -250,12 +249,12 @@ static struct of_platform_driver riowd_driver = {
250 249
251static int __init riowd_init(void) 250static int __init riowd_init(void)
252{ 251{
253 return of_register_platform_driver(&riowd_driver); 252 return platform_driver_register(&riowd_driver);
254} 253}
255 254
256static void __exit riowd_exit(void) 255static void __exit riowd_exit(void)
257{ 256{
258 of_unregister_platform_driver(&riowd_driver); 257 platform_driver_unregister(&riowd_driver);
259} 258}
260 259
261module_init(riowd_init); 260module_init(riowd_init);
diff --git a/include/linux/device.h b/include/linux/device.h
index dba775a68752..144ec135875f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -442,6 +442,7 @@ struct device {
442 struct dev_archdata archdata; 442 struct dev_archdata archdata;
443 443
444 struct device_node *of_node; /* associated device tree node */ 444 struct device_node *of_node; /* associated device tree node */
445 const struct of_device_id *of_match; /* matching of_device_id from driver */
445 446
446 dev_t devt; /* dev_t, creates the sysfs "dev" */ 447 dev_t devt; /* dev_t, creates the sysfs "dev" */
447 448
diff --git a/include/linux/of.h b/include/linux/of.h
index 266db1d0baa9..bfc0ed1b0ced 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -108,7 +108,7 @@ extern void of_node_put(struct device_node *node);
108#endif 108#endif
109 109
110/* 110/*
111 * OF address retreival & translation 111 * OF address retrieval & translation
112 */ 112 */
113 113
114/* Helper to read a big number; size is in cells (not bytes) */ 114/* Helper to read a big number; size is in cells (not bytes) */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 975d347079d9..8bfe6c1d4365 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);
18 * @drv: the device_driver structure to test 18 * @drv: the device_driver structure to test
19 * @dev: the device structure to match against 19 * @dev: the device structure to match against
20 */ 20 */
21static inline int of_driver_match_device(const struct device *dev, 21static inline int of_driver_match_device(struct device *dev,
22 const struct device_driver *drv) 22 const struct device_driver *drv)
23{ 23{
24 return of_match_device(drv->of_match_table, dev) != NULL; 24 dev->of_match = of_match_device(drv->of_match_table, dev);
25 return dev->of_match != NULL;
25} 26}
26 27
27extern struct platform_device *of_dev_get(struct platform_device *dev); 28extern struct platform_device *of_dev_get(struct platform_device *dev);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a68716ad38ce..17c7e21c0bd7 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -23,13 +23,7 @@
23 * of_platform_driver - Legacy of-aware driver for platform devices. 23 * of_platform_driver - Legacy of-aware driver for platform devices.
24 * 24 *
25 * An of_platform_driver driver is attached to a basic platform_device on 25 * An of_platform_driver driver is attached to a basic platform_device on
26 * ether the "platform bus" (platform_bus_type), or the ibm ebus 26 * the ibm ebus (ibmebus_bus_type).
27 * (ibmebus_bus_type).
28 *
29 * of_platform_driver is being phased out when used with the platform_bus_type,
30 * and regular platform_drivers should be used instead. When the transition
31 * is complete, only ibmebus will be using this structure, and the
32 * platform_driver member of this structure will be removed.
33 */ 27 */
34struct of_platform_driver 28struct of_platform_driver
35{ 29{
@@ -42,26 +36,16 @@ struct of_platform_driver
42 int (*shutdown)(struct platform_device* dev); 36 int (*shutdown)(struct platform_device* dev);
43 37
44 struct device_driver driver; 38 struct device_driver driver;
45 struct platform_driver platform_driver;
46}; 39};
47#define to_of_platform_driver(drv) \ 40#define to_of_platform_driver(drv) \
48 container_of(drv,struct of_platform_driver, driver) 41 container_of(drv,struct of_platform_driver, driver)
49 42
50extern int of_register_driver(struct of_platform_driver *drv,
51 struct bus_type *bus);
52extern void of_unregister_driver(struct of_platform_driver *drv);
53
54/* Platform drivers register/unregister */ 43/* Platform drivers register/unregister */
55extern int of_register_platform_driver(struct of_platform_driver *drv);
56extern void of_unregister_platform_driver(struct of_platform_driver *drv);
57
58extern struct platform_device *of_device_alloc(struct device_node *np, 44extern struct platform_device *of_device_alloc(struct device_node *np,
59 const char *bus_id, 45 const char *bus_id,
60 struct device *parent); 46 struct device *parent);
61extern struct platform_device *of_find_device_by_node(struct device_node *np); 47extern struct platform_device *of_find_device_by_node(struct device_node *np);
62 48
63extern int of_bus_type_init(struct bus_type *bus, const char *name);
64
65#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ 49#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
66/* Platform devices and busses creation */ 50/* Platform devices and busses creation */
67extern struct platform_device *of_platform_device_create(struct device_node *np, 51extern struct platform_device *of_platform_device_create(struct device_node *np,
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 4cf98c03af22..15dac0f20cd8 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 = {
896 .pointer = fsl_dma_pointer, 896 .pointer = fsl_dma_pointer,
897}; 897};
898 898
899static int __devinit fsl_soc_dma_probe(struct platform_device *pdev, 899static int __devinit fsl_soc_dma_probe(struct platform_device *pdev)
900 const struct of_device_id *match)
901 { 900 {
902 struct dma_object *dma; 901 struct dma_object *dma;
903 struct device_node *np = pdev->dev.of_node; 902 struct device_node *np = pdev->dev.of_node;
@@ -979,7 +978,7 @@ static const struct of_device_id fsl_soc_dma_ids[] = {
979}; 978};
980MODULE_DEVICE_TABLE(of, fsl_soc_dma_ids); 979MODULE_DEVICE_TABLE(of, fsl_soc_dma_ids);
981 980
982static struct of_platform_driver fsl_soc_dma_driver = { 981static struct platform_driver fsl_soc_dma_driver = {
983 .driver = { 982 .driver = {
984 .name = "fsl-pcm-audio", 983 .name = "fsl-pcm-audio",
985 .owner = THIS_MODULE, 984 .owner = THIS_MODULE,
@@ -993,12 +992,12 @@ static int __init fsl_soc_dma_init(void)
993{ 992{
994 pr_info("Freescale Elo DMA ASoC PCM Driver\n"); 993 pr_info("Freescale Elo DMA ASoC PCM Driver\n");
995 994
996 return of_register_platform_driver(&fsl_soc_dma_driver); 995 return platform_driver_register(&fsl_soc_dma_driver);
997} 996}
998 997
999static void __exit fsl_soc_dma_exit(void) 998static void __exit fsl_soc_dma_exit(void)
1000{ 999{
1001 of_unregister_platform_driver(&fsl_soc_dma_driver); 1000 platform_driver_unregister(&fsl_soc_dma_driver);
1002} 1001}
1003 1002
1004module_init(fsl_soc_dma_init); 1003module_init(fsl_soc_dma_init);
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 4cc167a7aeb8..313e0ccedd5b 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)
624 } 624 }
625} 625}
626 626
627static int __devinit fsl_ssi_probe(struct platform_device *pdev, 627static int __devinit fsl_ssi_probe(struct platform_device *pdev)
628 const struct of_device_id *match)
629{ 628{
630 struct fsl_ssi_private *ssi_private; 629 struct fsl_ssi_private *ssi_private;
631 int ret = 0; 630 int ret = 0;
@@ -774,7 +773,7 @@ static const struct of_device_id fsl_ssi_ids[] = {
774}; 773};
775MODULE_DEVICE_TABLE(of, fsl_ssi_ids); 774MODULE_DEVICE_TABLE(of, fsl_ssi_ids);
776 775
777static struct of_platform_driver fsl_ssi_driver = { 776static struct platform_driver fsl_ssi_driver = {
778 .driver = { 777 .driver = {
779 .name = "fsl-ssi-dai", 778 .name = "fsl-ssi-dai",
780 .owner = THIS_MODULE, 779 .owner = THIS_MODULE,
@@ -788,12 +787,12 @@ static int __init fsl_ssi_init(void)
788{ 787{
789 printk(KERN_INFO "Freescale Synchronous Serial Interface (SSI) ASoC Driver\n"); 788 printk(KERN_INFO "Freescale Synchronous Serial Interface (SSI) ASoC Driver\n");
790 789
791 return of_register_platform_driver(&fsl_ssi_driver); 790 return platform_driver_register(&fsl_ssi_driver);
792} 791}
793 792
794static void __exit fsl_ssi_exit(void) 793static void __exit fsl_ssi_exit(void)
795{ 794{
796 of_unregister_platform_driver(&fsl_ssi_driver); 795 platform_driver_unregister(&fsl_ssi_driver);
797} 796}
798 797
799module_init(fsl_ssi_init); 798module_init(fsl_ssi_init);
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index f92dca07cd35..fff695ccdd3e 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 = {
368 .pcm_free = &psc_dma_free, 368 .pcm_free = &psc_dma_free,
369}; 369};
370 370
371static int mpc5200_hpcd_probe(struct of_device *op, 371static int mpc5200_hpcd_probe(struct of_device *op)
372 const struct of_device_id *match)
373{ 372{
374 phys_addr_t fifo; 373 phys_addr_t fifo;
375 struct psc_dma *psc_dma; 374 struct psc_dma *psc_dma;
@@ -511,32 +510,31 @@ static int mpc5200_hpcd_remove(struct of_device *op)
511} 510}
512 511
513static struct of_device_id mpc5200_hpcd_match[] = { 512static struct of_device_id mpc5200_hpcd_match[] = {
514 { 513 { .compatible = "fsl,mpc5200-pcm", },
515 .compatible = "fsl,mpc5200-pcm",
516 },
517 {} 514 {}
518}; 515};
519MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match); 516MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match);
520 517
521static struct of_platform_driver mpc5200_hpcd_of_driver = { 518static struct platform_driver mpc5200_hpcd_of_driver = {
522 .owner = THIS_MODULE,
523 .name = "mpc5200-pcm-audio",
524 .match_table = mpc5200_hpcd_match,
525 .probe = mpc5200_hpcd_probe, 519 .probe = mpc5200_hpcd_probe,
526 .remove = mpc5200_hpcd_remove, 520 .remove = mpc5200_hpcd_remove,
521 .dev = {
522 .owner = THIS_MODULE,
523 .name = "mpc5200-pcm-audio",
524 .of_match_table = mpc5200_hpcd_match,
525 }
527}; 526};
528 527
529static int __init mpc5200_hpcd_init(void) 528static int __init mpc5200_hpcd_init(void)
530{ 529{
531 return of_register_platform_driver(&mpc5200_hpcd_of_driver); 530 return platform_driver_register(&mpc5200_hpcd_of_driver);
532} 531}
532module_init(mpc5200_hpcd_init);
533 533
534static void __exit mpc5200_hpcd_exit(void) 534static void __exit mpc5200_hpcd_exit(void)
535{ 535{
536 of_unregister_platform_driver(&mpc5200_hpcd_of_driver); 536 platform_driver_unregister(&mpc5200_hpcd_of_driver);
537} 537}
538
539module_init(mpc5200_hpcd_init);
540module_exit(mpc5200_hpcd_exit); 538module_exit(mpc5200_hpcd_exit);
541 539
542MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); 540MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 40acc8e2b1ca..ad36b095bb79 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[] = {
272 * - Probe/remove operations 272 * - Probe/remove operations
273 * - OF device match table 273 * - OF device match table
274 */ 274 */
275static int __devinit psc_ac97_of_probe(struct platform_device *op, 275static int __devinit psc_ac97_of_probe(struct platform_device *op)
276 const struct of_device_id *match)
277{ 276{
278 int rc; 277 int rc;
279 struct snd_ac97 ac97; 278 struct snd_ac97 ac97;
@@ -316,7 +315,7 @@ static struct of_device_id psc_ac97_match[] __devinitdata = {
316}; 315};
317MODULE_DEVICE_TABLE(of, psc_ac97_match); 316MODULE_DEVICE_TABLE(of, psc_ac97_match);
318 317
319static struct of_platform_driver psc_ac97_driver = { 318static struct platform_driver psc_ac97_driver = {
320 .probe = psc_ac97_of_probe, 319 .probe = psc_ac97_of_probe,
321 .remove = __devexit_p(psc_ac97_of_remove), 320 .remove = __devexit_p(psc_ac97_of_remove),
322 .driver = { 321 .driver = {
@@ -332,13 +331,13 @@ static struct of_platform_driver psc_ac97_driver = {
332 */ 331 */
333static int __init psc_ac97_init(void) 332static int __init psc_ac97_init(void)
334{ 333{
335 return of_register_platform_driver(&psc_ac97_driver); 334 return platform_driver_register(&psc_ac97_driver);
336} 335}
337module_init(psc_ac97_init); 336module_init(psc_ac97_init);
338 337
339static void __exit psc_ac97_exit(void) 338static void __exit psc_ac97_exit(void)
340{ 339{
341 of_unregister_platform_driver(&psc_ac97_driver); 340 platform_driver_unregister(&psc_ac97_driver);
342} 341}
343module_exit(psc_ac97_exit); 342module_exit(psc_ac97_exit);
344 343
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 9018fa5bf0db..87cf2a5c2b2c 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[] = {{
150 * - Probe/remove operations 150 * - Probe/remove operations
151 * - OF device match table 151 * - OF device match table
152 */ 152 */
153static int __devinit psc_i2s_of_probe(struct platform_device *op, 153static int __devinit psc_i2s_of_probe(struct platform_device *op)
154 const struct of_device_id *match)
155{ 154{
156 int rc; 155 int rc;
157 struct psc_dma *psc_dma; 156 struct psc_dma *psc_dma;
@@ -213,7 +212,7 @@ static struct of_device_id psc_i2s_match[] __devinitdata = {
213}; 212};
214MODULE_DEVICE_TABLE(of, psc_i2s_match); 213MODULE_DEVICE_TABLE(of, psc_i2s_match);
215 214
216static struct of_platform_driver psc_i2s_driver = { 215static struct platform_driver psc_i2s_driver = {
217 .probe = psc_i2s_of_probe, 216 .probe = psc_i2s_of_probe,
218 .remove = __devexit_p(psc_i2s_of_remove), 217 .remove = __devexit_p(psc_i2s_of_remove),
219 .driver = { 218 .driver = {
@@ -229,13 +228,13 @@ static struct of_platform_driver psc_i2s_driver = {
229 */ 228 */
230static int __init psc_i2s_init(void) 229static int __init psc_i2s_init(void)
231{ 230{
232 return of_register_platform_driver(&psc_i2s_driver); 231 return platform_driver_register(&psc_i2s_driver);
233} 232}
234module_init(psc_i2s_init); 233module_init(psc_i2s_init);
235 234
236static void __exit psc_i2s_exit(void) 235static void __exit psc_i2s_exit(void)
237{ 236{
238 of_unregister_platform_driver(&psc_i2s_driver); 237 platform_driver_unregister(&psc_i2s_driver);
239} 238}
240module_exit(psc_i2s_exit); 239module_exit(psc_i2s_exit);
241 240
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index f8bcfc30f800..ad7d4d7d9237 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,
1002 return 0; 1002 return 0;
1003} 1003}
1004 1004
1005static int __devinit amd7930_sbus_probe(struct platform_device *op, const struct of_device_id *match) 1005static int __devinit amd7930_sbus_probe(struct platform_device *op)
1006{ 1006{
1007 struct resource *rp = &op->resource[0]; 1007 struct resource *rp = &op->resource[0];
1008 static int dev_num; 1008 static int dev_num;
@@ -1064,7 +1064,7 @@ static const struct of_device_id amd7930_match[] = {
1064 {}, 1064 {},
1065}; 1065};
1066 1066
1067static struct of_platform_driver amd7930_sbus_driver = { 1067static struct platform_driver amd7930_sbus_driver = {
1068 .driver = { 1068 .driver = {
1069 .name = "audio", 1069 .name = "audio",
1070 .owner = THIS_MODULE, 1070 .owner = THIS_MODULE,
@@ -1075,7 +1075,7 @@ static struct of_platform_driver amd7930_sbus_driver = {
1075 1075
1076static int __init amd7930_init(void) 1076static int __init amd7930_init(void)
1077{ 1077{
1078 return of_register_platform_driver(&amd7930_sbus_driver); 1078 return platform_driver_register(&amd7930_sbus_driver);
1079} 1079}
1080 1080
1081static void __exit amd7930_exit(void) 1081static void __exit amd7930_exit(void)
@@ -1092,7 +1092,7 @@ static void __exit amd7930_exit(void)
1092 1092
1093 amd7930_list = NULL; 1093 amd7930_list = NULL;
1094 1094
1095 of_unregister_platform_driver(&amd7930_sbus_driver); 1095 platform_driver_unregister(&amd7930_sbus_driver);
1096} 1096}
1097 1097
1098module_init(amd7930_init); 1098module_init(amd7930_init);
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index c276086c3b57..0e618f82808c 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,
1856 return 0; 1856 return 0;
1857} 1857}
1858 1858
1859static int __devinit cs4231_sbus_probe(struct platform_device *op, const struct of_device_id *match) 1859static int __devinit cs4231_sbus_probe(struct platform_device *op)
1860{ 1860{
1861 struct resource *rp = &op->resource[0]; 1861 struct resource *rp = &op->resource[0];
1862 struct snd_card *card; 1862 struct snd_card *card;
@@ -2048,7 +2048,7 @@ static int __devinit snd_cs4231_ebus_create(struct snd_card *card,
2048 return 0; 2048 return 0;
2049} 2049}
2050 2050
2051static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct of_device_id *match) 2051static int __devinit cs4231_ebus_probe(struct platform_device *op)
2052{ 2052{
2053 struct snd_card *card; 2053 struct snd_card *card;
2054 int err; 2054 int err;
@@ -2072,16 +2072,16 @@ static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct
2072} 2072}
2073#endif 2073#endif
2074 2074
2075static int __devinit cs4231_probe(struct platform_device *op, const struct of_device_id *match) 2075static int __devinit cs4231_probe(struct platform_device *op)
2076{ 2076{
2077#ifdef EBUS_SUPPORT 2077#ifdef EBUS_SUPPORT
2078 if (!strcmp(op->dev.of_node->parent->name, "ebus")) 2078 if (!strcmp(op->dev.of_node->parent->name, "ebus"))
2079 return cs4231_ebus_probe(op, match); 2079 return cs4231_ebus_probe(op);
2080#endif 2080#endif
2081#ifdef SBUS_SUPPORT 2081#ifdef SBUS_SUPPORT
2082 if (!strcmp(op->dev.of_node->parent->name, "sbus") || 2082 if (!strcmp(op->dev.of_node->parent->name, "sbus") ||
2083 !strcmp(op->dev.of_node->parent->name, "sbi")) 2083 !strcmp(op->dev.of_node->parent->name, "sbi"))
2084 return cs4231_sbus_probe(op, match); 2084 return cs4231_sbus_probe(op);
2085#endif 2085#endif
2086 return -ENODEV; 2086 return -ENODEV;
2087} 2087}
@@ -2108,7 +2108,7 @@ static const struct of_device_id cs4231_match[] = {
2108 2108
2109MODULE_DEVICE_TABLE(of, cs4231_match); 2109MODULE_DEVICE_TABLE(of, cs4231_match);
2110 2110
2111static struct of_platform_driver cs4231_driver = { 2111static struct platform_driver cs4231_driver = {
2112 .driver = { 2112 .driver = {
2113 .name = "audio", 2113 .name = "audio",
2114 .owner = THIS_MODULE, 2114 .owner = THIS_MODULE,
@@ -2120,12 +2120,12 @@ static struct of_platform_driver cs4231_driver = {
2120 2120
2121static int __init cs4231_init(void) 2121static int __init cs4231_init(void)
2122{ 2122{
2123 return of_register_platform_driver(&cs4231_driver); 2123 return platform_driver_register(&cs4231_driver);
2124} 2124}
2125 2125
2126static void __exit cs4231_exit(void) 2126static void __exit cs4231_exit(void)
2127{ 2127{
2128 of_unregister_platform_driver(&cs4231_driver); 2128 platform_driver_unregister(&cs4231_driver);
2129} 2129}
2130 2130
2131module_init(cs4231_init); 2131module_init(cs4231_init);
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 39cd5d69d051..73f9cbacc077 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2592,7 +2592,7 @@ static void snd_dbri_free(struct snd_dbri *dbri)
2592 (void *)dbri->dma, dbri->dma_dvma); 2592 (void *)dbri->dma, dbri->dma_dvma);
2593} 2593}
2594 2594
2595static int __devinit dbri_probe(struct platform_device *op, const struct of_device_id *match) 2595static int __devinit dbri_probe(struct platform_device *op)
2596{ 2596{
2597 struct snd_dbri *dbri; 2597 struct snd_dbri *dbri;
2598 struct resource *rp; 2598 struct resource *rp;
@@ -2686,7 +2686,7 @@ static const struct of_device_id dbri_match[] = {
2686 2686
2687MODULE_DEVICE_TABLE(of, dbri_match); 2687MODULE_DEVICE_TABLE(of, dbri_match);
2688 2688
2689static struct of_platform_driver dbri_sbus_driver = { 2689static struct platform_driver dbri_sbus_driver = {
2690 .driver = { 2690 .driver = {
2691 .name = "dbri", 2691 .name = "dbri",
2692 .owner = THIS_MODULE, 2692 .owner = THIS_MODULE,
@@ -2699,12 +2699,12 @@ static struct of_platform_driver dbri_sbus_driver = {
2699/* Probe for the dbri chip and then attach the driver. */ 2699/* Probe for the dbri chip and then attach the driver. */
2700static int __init dbri_init(void) 2700static int __init dbri_init(void)
2701{ 2701{
2702 return of_register_platform_driver(&dbri_sbus_driver); 2702 return platform_driver_register(&dbri_sbus_driver);
2703} 2703}
2704 2704
2705static void __exit dbri_exit(void) 2705static void __exit dbri_exit(void)
2706{ 2706{
2707 of_unregister_platform_driver(&dbri_sbus_driver); 2707 platform_driver_unregister(&dbri_sbus_driver);
2708} 2708}
2709 2709
2710module_init(dbri_init); 2710module_init(dbri_init);