sandbox fix + bus
Subsystems (35)
v3 cover sandbox fix + bus
HI,
now register_driver/device are for bus usage ONLY
v3:
- drop check on NULL pointer
- add platform_driver/device_register
- use bus_for_each
v2:
- on the sandbox we register device before barebox started this is working today as nothing need to be initialized before regisering a device. But as I attached device to bus this will no be the case anymore so fix it
- net/tap fix allocated data to be set to 0
The following changes since commit 4f2aa8ffb124a7f40da2a5bc1a2c225554b24bdd:
Merge branch 'for-next/testing-menu' into next (2012-09-17 12:15:53 +0200)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/bus
for you to fetch changes up to dd3578c2b219dd5c11b1d657ddb81471d6a3f9de:
switch all platform_bus device/driver registering to platform_driver/device_register (2012-09-20 04:00:27 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (6):
sandbox: check only image option in the second getopt
sandbox: do not register device before barebox is started
net/tap: use xzalloc to allocate data
driver: register bus
driver: search device and driver based on the bus instead of all switch all platform_bus device/driver registering to platform_driver/device_register
Documentation/porting.txt | 2 +- arch/arm/boards/nhk8815/setup.c | 2 +- arch/arm/boards/pcm038/pcm970.c | 2 +- arch/arm/mach-imx/clocksource.c | 2 +- arch/arm/mach-imx/gpio.c | 2 +- arch/arm/mach-imx/iim.c | 2 +- arch/arm/mach-imx/include/mach/devices-imx51.h | 2 +- arch/arm/mach-imx/include/mach/devices-imx53.h | 2 +- arch/arm/mach-mxs/ocotp.c | 2 +- arch/arm/mach-omap/arch-omap.dox | 2 +- arch/nios2/boards/generic/generic.c | 2 +- arch/sandbox/board/Makefile | 1 + arch/sandbox/board/board.c | 2 +- arch/sandbox/board/console.c | 2 +- arch/sandbox/board/devices.c | 33 +++++++++++++++++++++++++++++++++ arch/sandbox/board/hostfile.c | 21 ++++++++++++++++++--- arch/sandbox/mach-sandbox/include/mach/linux.h | 3 +++ arch/sandbox/os/common.c | 12 +----------- commands/mem.c | 2 +- common/console.c | 2 +- common/globalvar.c | 2 +- drivers/ata/disk_bios_drive.c | 2 +- drivers/ata/intf_platform_ide.c | 2 +- drivers/base/Makefile | 1 + drivers/base/bus.c | 37 +++++++++++++++++++++++++++++++++++++ drivers/base/driver.c | 29 +++++++---------------------- drivers/base/platform.c | 40 ++++++++++++++++++++++++++++++---------- drivers/base/resource.c | 2 +- drivers/gpio/gpio-stmpe.c | 2 +- drivers/i2c/busses/i2c-imx.c | 2 +- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/i2c/i2c.c | 7 +++++++ drivers/input/gpio_keys.c | 2 +- drivers/input/imx_keypad.c | 2 +- drivers/mci/atmel_mci.c | 2 +- drivers/mci/imx-esdhc.c | 2 +- drivers/mci/imx.c | 2 +- drivers/mci/mci-core.c | 4 ++-- drivers/mci/mxs.c | 2 +- drivers/mci/omap_hsmmc.c | 2 +- drivers/mci/pxamci.c | 2 +- drivers/mci/s3c.c | 2 +- drivers/misc/jtag.c | 2 +- drivers/mtd/core.c | 2 +- drivers/mtd/devices/docg3.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/nand_imx.c | 2 +- drivers/mtd/nand/nand_mxs.c | 2 +- drivers/mtd/nand/nand_omap_gpmc.c | 2 +- drivers/mtd/nand/nand_s3c24xx.c | 2 +- drivers/mtd/nand/nomadik_nand.c | 2 +- drivers/net/altera_tse.c | 2 +- drivers/net/at91_ether.c | 2 +- drivers/net/cs8900.c | 2 +- drivers/net/davinci_emac.c | 2 +- drivers/net/designware.c | 2 +- drivers/net/dm9k.c | 2 +- drivers/net/ep93xx.c | 2 +- drivers/net/fec_imx.c | 2 +- drivers/net/fec_mpc5200.c | 2 +- drivers/net/gianfar.c | 2 +- drivers/net/ks8851_mll.c | 2 +- drivers/net/macb.c | 2 +- drivers/net/miidev.c | 4 ++-- drivers/net/netx_eth.c | 2 +- drivers/net/phy/phy.c | 7 +++++++ drivers/net/smc91111.c | 2 +- drivers/net/smc911x.c | 2 +- drivers/net/tap.c | 6 +++--- drivers/nor/cfi_flash.c | 2 +- drivers/of/base.c | 2 +- drivers/pwm/pxa_pwm.c | 2 +- drivers/serial/arm_dcc.c | 4 ++-- drivers/serial/atmel.c | 2 +- drivers/serial/linux_console.c | 2 +- drivers/serial/serial_altera.c | 2 +- drivers/serial/serial_altera_jtag.c | 2 +- drivers/serial/serial_blackfin.c | 2 +- drivers/serial/serial_imx.c | 2 +- drivers/serial/serial_mpc5xxx.c | 2 +- drivers/serial/serial_netx.c | 2 +- drivers/serial/serial_ns16550.c | 4 ++-- drivers/serial/serial_pl010.c | 2 +- drivers/serial/serial_pxa.c | 2 +- drivers/serial/serial_s3c.c | 2 +- drivers/serial/stm-serial.c | 2 +- drivers/spi/altera_spi.c | 2 +- drivers/spi/atmel_spi.c | 2 +- drivers/spi/imx_spi.c | 2 +- drivers/spi/omap3_spi.c | 2 +- drivers/spi/spi.c | 6 ++++++ drivers/usb/core/usb.c | 5 +++++ drivers/usb/gadget/at91_udc.c | 2 +- drivers/usb/gadget/fsl_udc.c | 2 +- drivers/usb/gadget/pxa27x_udc.c | 2 +- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/ohci-at91.c | 2 +- drivers/usb/host/ohci-hcd.c | 2 +- drivers/video/fb.c | 4 ++-- drivers/video/imx-ipu-fb.c | 2 +- drivers/video/imx.c | 2 +- drivers/video/pxa.c | 2 +- drivers/video/s3c24xx.c | 2 +- drivers/video/stm.c | 2 +- drivers/watchdog/im28wd.c | 2 +- fs/fs.c | 6 ++++++ include/driver.h | 23 +++++++++++++++++++++++ net/eth.c | 2 +- net/net.c | 2 +- 109 files changed, 286 insertions(+), 147 deletions(-) create mode 100644 arch/sandbox/board/devices.c create mode 100644 drivers/base/bus.c
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 1/6 sandbox: check only image option in the second getopt
--- arch/sandbox/os/common.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
arch/sandbox/os/common.c +1 -11
@@ -358,10 +358,6 @@ int main(int argc, char *argv[])break ;switch (opt) { -case 'h' : -break ; -case 'm' : -break ;case 'i' :sprintf (str,"fd%d" , fdno); ret =add_image (optarg, str);
@@ -369,14 +365,8 @@ int main(int argc, char *argv[])exit (1 ); fdno++;break ; -case 'e' : -break ; -case 'O' : -break ; -case 'I' : -break ;default : -exit (1 ); +break ; } }
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 2/6 sandbox: do not register device before barebox is started
This will crash when use registered bus with device registered to it.
--- arch/sandbox/board/Makefile | 1 + arch/sandbox/board/console.c | 2 +- arch/sandbox/board/devices.c | 33 ++++++++++++++++++++++++ arch/sandbox/board/hostfile.c | 19 ++++++++++++-- arch/sandbox/mach-sandbox/include/mach/linux.h | 3 +++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 arch/sandbox/board/devices.c
arch/sandbox/board/Makefile +1 -0
@@ -2,5 +2,6 @@ obj-y += board.o obj-y += clock.o obj-y += hostfile.o obj-y += console.o +obj-y += devices.o extra-y += barebox.lds
arch/sandbox/board/console.c +1 -1
@@ -44,6 +44,6 @@ int barebox_register_console(char *name, int stdinfd, int stdoutfd) data->stdoutfd = stdoutfd; data->stdinfd = stdinfd; -return register_device (dev); +return sandbox_add_device (dev); }
arch/sandbox/board/devices.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* Under GPLv2 only +*/ + +#include <common.h> +#include <driver.h> +#include <init.h> + +static LIST_HEAD (sandbox_device_list); + +int sandbox_add_device (struct device_d *dev) +{ +list_add (&dev->list, &sandbox_device_list); + +return 0 ; +} + +static int sandbox_device_init (void ) +{ +struct device_d *dev, *tmp; + +list_for_each_entry_safe (dev, tmp, &sandbox_device_list, list) { +/* reset the list_head before registering for real */ + dev->list.prev =NULL ; + dev->list.next =NULL ; +register_device (dev); + } + +return 0 ; +} +postcore_initcall (sandbox_device_init);
arch/sandbox/board/hostfile.c +17 -2
@@ -99,7 +99,22 @@ device_initcall(hf_init);int barebox_register_filedev (struct hf_platform_data *hf) { -return !add_generic_device ("hostfile" ,DEVICE_ID_DYNAMIC ,NULL , hf->base, hf->size, -IORESOURCE_MEM , hf); +struct device_d *dev; +struct resource *res; + + dev =xzalloc (sizeof (*dev)); +strcpy (dev->name,"hostfile" ); + dev->id =DEVICE_ID_DYNAMIC ; + dev->platform_data = hf; + + res =xzalloc (sizeof (struct resource )); + res[0 ].start = hf->base; + res[0 ].end = hf->base + hf->size -1 ; + res[0 ].flags =IORESOURCE_MEM ; + + dev->resource = res; + dev->num_resources =1 ; + +return sandbox_add_device (dev); }
arch/sandbox/mach-sandbox/include/mach/linux.h +3 -0
@@ -1,6 +1,9 @@#ifndef __ASM_ARCH_LINUX_H#define __ASM_ARCH_LINUX_H +struct device_d ; + +int sandbox_add_device (struct device_d *dev);int linux_register_device (const char *name,void *start,void *end);int tap_alloc (char *dev);uint64_t linux_get_time (void );
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 3/6 net/tap: use xzalloc to allocate data
In reply to Jean-Christophe PLAGNIOL-VILLARDthis will ensure the data are set to 0 (list as example)
--- drivers/net/tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/tap.c +2 -2
@@ -76,7 +76,7 @@ int tap_probe(struct device_d *dev)struct tap_priv *priv;int ret =0 ; - priv =xmalloc (sizeof (struct tap_priv )); + priv =xzalloc (sizeof (struct tap_priv )); priv->name ="barebox" ; priv->fd =tap_alloc (priv->name);
@@ -85,7 +85,7 @@ int tap_probe(struct device_d *dev) goto out; } - edev =xmalloc (sizeof (struct eth_device )); + edev =xzalloc (sizeof (struct eth_device )); edev->priv = priv; edev->parent = dev;
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 4/6 driver: register bus
In reply to Jean-Christophe PLAGNIOL-VILLARD--- drivers/base/Makefile | 1 + drivers/base/bus.c | 34 ++++++++++++++++++++++++++++++++++ drivers/base/platform.c | 14 ++++---------- drivers/i2c/i2c.c | 7 +++++++ drivers/net/phy/phy.c | 7 +++++++ drivers/spi/spi.c | 6 ++++++ drivers/usb/core/usb.c | 5 +++++ fs/fs.c | 6 ++++++ include/driver.h | 8 ++++++++ 9 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 drivers/base/bus.c
drivers/base/Makefile +1 -0
@@ -1,3 +1,4 @@ +obj-y += bus.o obj-y += driver.o obj-y += platform.o obj-y += resource.o
drivers/base/bus.c new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* Under GPLv2 +*/ + +#include <common.h> +#include <driver.h> +#include <errno.h> + +LIST_HEAD (bus_list); +EXPORT_SYMBOL (bus_list); + +struct bus_type *get_bus_by_name (const char *name) +{ +struct bus_type *bus; + +for_each_bus (bus) { +if (!strcmp (bus->name, name)) +return bus; + } + +return NULL ; +} + +int bus_register (struct bus_type *bus) +{ +if (get_bus_by_name (bus->name)) +return -EEXIST ; + +list_add_tail (&bus->list, &bus_list); + +return 0 ; +}
drivers/base/platform.c +4 -10
@@ -19,6 +19,7 @@#include <common.h> #include <driver.h> #include <errno.h> +#include <init.h> static int platform_match (struct device_d *dev,struct driver_d *drv) {
@@ -61,15 +62,8 @@ struct bus_type platform_bus = { .remove = platform_remove, }; -#if 0 -LIST_HEAD (bus_list); -EXPORT_SYMBOL (bus_list); - -int bus_register (struct bus_type *bus) +static int plarform_init (void ) { -list_add_tail (&bus->list, &bus_list); - -return 0 ; +return bus_register (&platform_bus); } -#endif - +pure_initcall (plarform_init);
drivers/i2c/i2c.c +7 -0
@@ -21,6 +21,7 @@#include <errno.h> #include <malloc.h> #include <xfuncs.h> +#include <init.h> #include <i2c/i2c.h>
@@ -395,3 +396,9 @@ struct bus_type i2c_bus = { .probe = i2c_probe, .remove = i2c_remove, }; + +static int i2c_bus_init (void ) +{ +return bus_register (&i2c_bus); +} +pure_initcall (i2c_bus_init);
drivers/net/phy/phy.c +7 -0
@@ -22,6 +22,7 @@#include <net.h> #include <malloc.h> #include <miidev.h> +#include <init.h> #include <linux/phy.h> #include <linux/err.h>
@@ -685,3 +686,9 @@ int phy_driver_register(struct phy_driver *phydrv)return register_driver (&phydrv->drv); } + +static int phy_bus_init (void ) +{ +return bus_register (&phy_bustype); +} +pure_initcall (phy_bus_init);
drivers/spi/spi.c +6 -0
@@ -291,3 +291,9 @@ struct bus_type spi_bus = { .probe = spi_probe, .remove = spi_remove, }; + +static int spi_bus_init (void ) +{ +return bus_register (&spi_bus); +} +pure_initcall (spi_bus_init);
drivers/usb/core/usb.c +5 -0
@@ -1418,3 +1418,8 @@ struct bus_type usb_bus_type = { .remove = usb_remove, }; +static int usb_bus_init (void ) +{ +return bus_register (&usb_bus_type); +} +pure_initcall (usb_bus_init);
fs/fs.c +6 -0
@@ -1138,6 +1138,12 @@ struct bus_type fs_bus = { .remove = fs_remove, }; +static int fs_bus_init (void ) +{ +return bus_register (&fs_bus); +} +pure_initcall (fs_bus_init); +int register_fs_driver (struct fs_driver_d *fsdrv) { fsdrv->drv.bus = &fs_bus;
include/driver.h +8 -0
@@ -379,6 +379,14 @@ struct bus_type {struct list_head list; }; +int bus_register (struct bus_type *bus); + +extern struct list_head bus_list; + +/* Iterate over all buses +*/ +#define for_each_bus (bus) list_for_each_entry(bus, &bus_list, list) +extern struct bus_type platform_bus;struct file_operations {
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 5/6 driver: search device and driver based on the bus instead of all
In reply to Jean-Christophe PLAGNIOL-VILLARDThis will allow reduce the number of driver and device to search on.
--- drivers/base/bus.c | 3 +++ drivers/base/driver.c | 11 ++++++----- include/driver.h | 12 ++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-)
drivers/base/bus.c +3 -0
@@ -28,6 +28,9 @@ int bus_register(struct bus_type *bus)if (get_bus_by_name (bus->name))return -EEXIST ; +INIT_LIST_HEAD (&bus->device_list); +INIT_LIST_HEAD (&bus->driver_list); +list_add_tail (&bus->list, &bus_list);return 0 ;
drivers/base/driver.c +6 -5
@@ -82,8 +82,6 @@ static int match(struct driver_d *drv, struct device_d *dev) dev->driver = drv; -if (dev->bus != drv->bus) - goto err_out;if (dev->bus->match (dev, drv)) goto err_out;if (dev->bus->probe (dev))
@@ -119,7 +117,7 @@ int register_device(struct device_d *new_device)if (new_device->bus == &platform_bus && new_device->resource) {struct device_d *dev; -for_each_device (dev) { +bus_for_each_device (new_device->bus, dev) {if (!dev->resource)continue ;if (dev->resource->start == new_device->resource->start) {
@@ -129,12 +127,13 @@ int register_device(struct device_d *new_device) }list_add_tail (&new_device->list, &device_list); +list_add_tail (&new_device->bus_list, &new_device->bus->device_list);INIT_LIST_HEAD (&new_device->children);INIT_LIST_HEAD (&new_device->cdevs);INIT_LIST_HEAD (&new_device->parameters);INIT_LIST_HEAD (&new_device->active); -for_each_driver (drv) { +bus_for_each_driver (new_device->bus, drv) {if (!match (drv, new_device))break ; }
@@ -166,6 +165,7 @@ int unregister_device(struct device_d *old_dev) }list_del (&old_dev->list); +list_del (&old_dev->bus_list);list_del (&old_dev->active);/* remove device from parents child list */
@@ -219,13 +219,14 @@ int register_driver(struct driver_d *drv) }list_add_tail (&drv->list, &driver_list); +list_add_tail (&drv->bus_list, &drv->bus->driver_list);if (!drv->info) drv->info = noinfo;if (!drv->shortinfo) drv->shortinfo = noshortinfo; -for_each_device (dev) +bus_for_each_device (drv->bus, dev)match (drv, dev);return 0 ;
include/driver.h +12 -0
@@ -88,6 +88,7 @@ struct device_d {struct driver_d *driver;/*! The driver for this device */ struct list_head list;/* The list of all devices */ +struct list_head bus_list;/* our bus */ struct list_head children;/* our children */ struct list_head sibling;struct list_head active;/* The list of all devices which have a driver */
@@ -115,6 +116,7 @@ struct driver_d {const char *name;struct list_head list; +struct list_head bus_list;/* our bus */ /*! Called if an instance of a device is found */ int (*probe) (struct device_d *);
@@ -377,6 +379,8 @@ struct bus_type {void (*remove)(struct device_d *dev);struct list_head list; +struct list_head device_list; +struct list_head driver_list; };int bus_register (struct bus_type *bus);
@@ -387,6 +391,14 @@ extern struct list_head bus_list;*/ #define for_each_bus (bus) list_for_each_entry(bus, &bus_list, list) +/* Iterate over all devices of a bus +*/ +#define bus_for_each_device (bus, dev) list_for_each_entry(dev, &bus->device_list, bus_list) + +/* Iterate over all drivers of a bus +*/ +#define bus_for_each_driver (bus, drv) list_for_each_entry(drv, &bus->driver_list, bus_list) +extern struct bus_type platform_bus;struct file_operations {
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 6/6 switch all platform_bus device/driver registering to platform_driver/device_register
In reply to Jean-Christophe PLAGNIOL-VILLARDnow register_driver and register_device are for bus only usage.
--- Documentation/porting.txt | 2 +- arch/arm/boards/nhk8815/setup.c | 2 +- arch/arm/boards/pcm038/pcm970.c | 2 +- arch/arm/mach-imx/clocksource.c | 2 +- arch/arm/mach-imx/gpio.c | 2 +- arch/arm/mach-imx/iim.c | 2 +- arch/arm/mach-imx/include/mach/devices-imx51.h | 2 +- arch/arm/mach-imx/include/mach/devices-imx53.h | 2 +- arch/arm/mach-mxs/ocotp.c | 2 +- arch/arm/mach-omap/arch-omap.dox | 2 +- arch/nios2/boards/generic/generic.c | 2 +- arch/sandbox/board/board.c | 2 +- arch/sandbox/board/devices.c | 2 +- arch/sandbox/board/hostfile.c | 2 +- commands/mem.c | 2 +- common/console.c | 2 +- common/globalvar.c | 2 +- drivers/ata/disk_bios_drive.c | 2 +- drivers/ata/intf_platform_ide.c | 2 +- drivers/base/driver.c | 20 ++---------------- drivers/base/platform.c | 26 ++++++++++++++++++++++++ drivers/base/resource.c | 2 +- drivers/gpio/gpio-stmpe.c | 2 +- drivers/i2c/busses/i2c-imx.c | 2 +- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/input/gpio_keys.c | 2 +- drivers/input/imx_keypad.c | 2 +- drivers/mci/atmel_mci.c | 2 +- drivers/mci/imx-esdhc.c | 2 +- drivers/mci/imx.c | 2 +- drivers/mci/mci-core.c | 4 ++-- drivers/mci/mxs.c | 2 +- drivers/mci/omap_hsmmc.c | 2 +- drivers/mci/pxamci.c | 2 +- drivers/mci/s3c.c | 2 +- drivers/misc/jtag.c | 2 +- drivers/mtd/core.c | 2 +- drivers/mtd/devices/docg3.c | 2 +- drivers/mtd/nand/atmel_nand.c | 2 +- drivers/mtd/nand/nand_imx.c | 2 +- drivers/mtd/nand/nand_mxs.c | 2 +- drivers/mtd/nand/nand_omap_gpmc.c | 2 +- drivers/mtd/nand/nand_s3c24xx.c | 2 +- drivers/mtd/nand/nomadik_nand.c | 2 +- drivers/net/altera_tse.c | 2 +- drivers/net/at91_ether.c | 2 +- drivers/net/cs8900.c | 2 +- drivers/net/davinci_emac.c | 2 +- drivers/net/designware.c | 2 +- drivers/net/dm9k.c | 2 +- drivers/net/ep93xx.c | 2 +- drivers/net/fec_imx.c | 2 +- drivers/net/fec_mpc5200.c | 2 +- drivers/net/gianfar.c | 2 +- drivers/net/ks8851_mll.c | 2 +- drivers/net/macb.c | 2 +- drivers/net/miidev.c | 4 ++-- drivers/net/netx_eth.c | 2 +- drivers/net/smc91111.c | 2 +- drivers/net/smc911x.c | 2 +- drivers/net/tap.c | 2 +- drivers/nor/cfi_flash.c | 2 +- drivers/of/base.c | 2 +- drivers/pwm/pxa_pwm.c | 2 +- drivers/serial/arm_dcc.c | 4 ++-- drivers/serial/atmel.c | 2 +- drivers/serial/linux_console.c | 2 +- drivers/serial/serial_altera.c | 2 +- drivers/serial/serial_altera_jtag.c | 2 +- drivers/serial/serial_blackfin.c | 2 +- drivers/serial/serial_imx.c | 2 +- drivers/serial/serial_mpc5xxx.c | 2 +- drivers/serial/serial_netx.c | 2 +- drivers/serial/serial_ns16550.c | 4 ++-- drivers/serial/serial_pl010.c | 2 +- drivers/serial/serial_pxa.c | 2 +- drivers/serial/serial_s3c.c | 2 +- drivers/serial/stm-serial.c | 2 +- drivers/spi/altera_spi.c | 2 +- drivers/spi/atmel_spi.c | 2 +- drivers/spi/imx_spi.c | 2 +- drivers/spi/omap3_spi.c | 2 +- drivers/usb/gadget/at91_udc.c | 2 +- drivers/usb/gadget/fsl_udc.c | 2 +- drivers/usb/gadget/pxa27x_udc.c | 2 +- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/ohci-at91.c | 2 +- drivers/usb/host/ohci-hcd.c | 2 +- drivers/video/fb.c | 4 ++-- drivers/video/imx-ipu-fb.c | 2 +- drivers/video/imx.c | 2 +- drivers/video/pxa.c | 2 +- drivers/video/s3c24xx.c | 2 +- drivers/video/stm.c | 2 +- drivers/watchdog/im28wd.c | 2 +- include/driver.h | 3 +++ net/eth.c | 2 +- net/net.c | 2 +- 98 files changed, 131 insertions(+), 118 deletions(-)
Documentation/porting.txt +1 -1
@@ -40,7 +40,7 @@ extra-y += barebox.lds static int scb9328_console_init(void) { - register_device(&scb9328_serial_device); + platform_device_register(&scb9328_serial_device); return 0; }
arch/arm/boards/nhk8815/setup.c +1 -1
@@ -94,7 +94,7 @@ static int nhk8815_devices_init(void)add_generic_device ("smc91c111" ,DEVICE_ID_DYNAMIC ,NULL ,0x34000300 ,16 ,IORESOURCE_MEM ,NULL ); -register_device (&nhk8815_nand_device); +platform_device_register (&nhk8815_nand_device);armlinux_set_architecture (MACH_TYPE_NOMADIK );armlinux_set_bootparams ((void *)(0x00000100 ));
arch/arm/boards/pcm038/pcm970.c +1 -1
@@ -141,7 +141,7 @@ static void pcm970_ide_init(void)/* Make PCMCIA bank0 valid */ writel (readl (PCMCIA_POR (0 )) | (1 <<29 ),PCMCIA_POR (0 )); - register_device(&pcm970_ide_device); + platform_device_register(&pcm970_ide_device); }#endif
arch/arm/mach-imx/clocksource.c +1 -1
@@ -167,7 +167,7 @@ static struct driver_d imx_gpt_driver = {static int imx_gpt_init (void ) { -return register_driver (&imx_gpt_driver); +return platform_driver_register (&imx_gpt_driver); }coredevice_initcall (imx_gpt_init);
arch/arm/mach-imx/gpio.c +1 -1
@@ -201,7 +201,7 @@ static struct driver_d imx_gpio_driver = {static int imx_gpio_add (void ) { -register_driver (&imx_gpio_driver); +platform_driver_register (&imx_gpio_driver);return 0 ; }coredevice_initcall (imx_gpio_add);
arch/arm/mach-imx/iim.c +1 -1
@@ -295,7 +295,7 @@ static struct driver_d imx_iim_driver = {static int imx_iim_init (void ) { -register_driver (&imx_iim_driver); +platform_driver_register (&imx_iim_driver);return 0 ; }
arch/arm/mach-imx/include/mach/devices-imx51.h +1 -1
@@ -84,7 +84,7 @@ static inline struct device_d *imx51_add_nand(struct imx_nand_platform_data *pda dev->id =DEVICE_ID_DYNAMIC ; dev->platform_data = pdata; -register_device (dev); +platform_device_register (dev);return dev; }
arch/arm/mach-imx/include/mach/devices-imx53.h +1 -1
@@ -78,7 +78,7 @@ static inline struct device_d *imx53_add_nand(struct imx_nand_platform_data *pda dev->id =DEVICE_ID_DYNAMIC ; dev->platform_data = pdata; -register_device (dev); +platform_device_register (dev);return dev; }
arch/arm/mach-mxs/ocotp.c +1 -1
@@ -232,7 +232,7 @@ static struct driver_d mxs_ocotp_driver = {static int mxs_ocotp_init (void ) { -register_driver (&mxs_ocotp_driver); +platform_driver_register (&mxs_ocotp_driver);return 0 ; }
arch/arm/mach-omap/arch-omap.dox +1 -1
@@ -85,7 +85,7 @@ static struct device_d my_little_device = { }; static int my_board_devices_init(void) { /* Do Blah Blah Blah */ - return register_device(&my_little_device); + return platform_device_register(&my_little_device); } device_initcall(my_board_devices_init);
arch/nios2/boards/generic/generic.c +1 -1
@@ -37,7 +37,7 @@ static int generic_devices_init(void)add_cfi_flash_device (DEVICE_ID_DYNAMIC ,NIOS_SOPC_FLASH_BASE ,NIOS_SOPC_FLASH_SIZE ,0 );add_mem_device ("ram0" ,NIOS_SOPC_MEMORY_BASE ,NIOS_SOPC_MEMORY_SIZE ,IORESOURCE_MEM_WRITEABLE ); -register_device (&mac_dev); +platform_device_register (&mac_dev);/*register_device(&epcs_flash_device);*/ devfs_add_partition ("nor0" ,0x00000 ,0x40000 ,DEVFS_PARTITION_FIXED ,"self0" );
arch/sandbox/board/board.c +1 -1
@@ -31,7 +31,7 @@ static struct device_d tap_device = {static int devices_init (void ) { -register_device (&tap_device); +platform_device_register (&tap_device);return 0 ; }
arch/sandbox/board/devices.c +1 -1
@@ -25,7 +25,7 @@ static int sandbox_device_init(void)/* reset the list_head before registering for real */ dev->list.prev =NULL ; dev->list.next =NULL ; -register_device (dev); +platform_device_register (dev); }return 0 ;
arch/sandbox/board/hostfile.c +1 -1
@@ -92,7 +92,7 @@ static struct driver_d hf_drv = {static int hf_init (void ) { -return register_driver (&hf_drv); +return platform_driver_register (&hf_drv); }device_initcall (hf_init);
commands/mem.c +1 -1
@@ -614,7 +614,7 @@ static int mem_init(void) }add_mem_device ("mem" ,0 , ~0 ,IORESOURCE_MEM_WRITEABLE ); -register_driver (&mem_drv); +platform_driver_register (&mem_drv);return 0 ; }
common/console.c +1 -1
@@ -141,7 +141,7 @@ int console_register(struct console_device *newcdev)strcpy (dev->name,"cs" );if (newcdev->dev)dev_add_child (newcdev->dev, dev); -register_device (dev); +platform_device_register (dev);if (newcdev->setbrg) {dev_add_param (dev,"baudrate" , console_baudrate_set,NULL ,0 );
common/globalvar.c +1 -1
@@ -68,7 +68,7 @@ int globalvar_add_simple(const char *name)static int globalvar_init (void ) { -register_device (&global_device); +platform_device_register (&global_device);return 0 ; }
drivers/ata/disk_bios_drive.c +1 -1
@@ -295,7 +295,7 @@ static int biosdisk_init(void)return -EIO ; } -register_driver (&biosdisk_driver); +platform_driver_register (&biosdisk_driver);return 0 ; }
drivers/ata/intf_platform_ide.c +1 -1
@@ -111,7 +111,7 @@ static struct driver_d platform_ide_driver = {static int platform_ide_init (void ) { -return register_driver (&platform_ide_driver); +return platform_driver_register (&platform_ide_driver); }device_initcall (platform_ide_init);
drivers/base/driver.c +2 -18
@@ -111,20 +111,7 @@ int register_device(struct device_d *new_device)debug ("register_device: %s\n" ,dev_name (new_device)); -if (!new_device->bus) - new_device->bus = &platform_bus; - -if (new_device->bus == &platform_bus && new_device->resource) { -struct device_d *dev; - -bus_for_each_device (new_device->bus, dev) { -if (!dev->resource) -continue ; -if (dev->resource->start == new_device->resource->start) { -return -EBUSY ; - } - } - } +BUG_ON (!new_device->bus);list_add_tail (&new_device->list, &device_list);list_add_tail (&new_device->bus_list, &new_device->bus->device_list);
@@ -213,10 +200,7 @@ int register_driver(struct driver_d *drv)debug ("register_driver: %s\n" , drv->name); -if (!drv->bus) { -// pr_err("driver %s has no bus type associated. Needs fixup\n", drv->name); - drv->bus = &platform_bus; - } +BUG_ON (!drv->bus);list_add_tail (&drv->list, &driver_list);list_add_tail (&drv->bus_list, &drv->bus->driver_list);
drivers/base/platform.c +26 -0
@@ -55,6 +55,32 @@ static void platform_remove(struct device_d *dev) dev->driver->remove (dev); } +int platform_driver_register (struct driver_d *drv) +{ + drv->bus = &platform_bus; + +return register_driver (drv); +} + +int platform_device_register (struct device_d *new_device) +{ + new_device->bus = &platform_bus; + +if (new_device->resource) { +struct device_d *dev; + +bus_for_each_device (new_device->bus, dev) { +if (!dev->resource) +continue ; +if (dev->resource->start == new_device->resource->start) { +return -EBUSY ; + } + } + } + +return register_device (new_device); +} +struct bus_type platform_bus = { .name ="platform" , .match = platform_match,
drivers/base/resource.c +1 -1
@@ -59,7 +59,7 @@ struct device_d *add_generic_device_res(const char* devname, int id, dev->resource = res; dev->num_resources = nb; -register_device (dev); +platform_device_register (dev);return dev; }
drivers/gpio/gpio-stmpe.c +1 -1
@@ -156,6 +156,6 @@ static struct driver_d stmpe_gpio_driver = {static int stmpe_gpio_add (void ) { -return register_driver (&stmpe_gpio_driver); +return platform_driver_register (&stmpe_gpio_driver); }coredevice_initcall (stmpe_gpio_add);
drivers/i2c/busses/i2c-imx.c +1 -1
@@ -573,6 +573,6 @@ static struct driver_d i2c_fsl_driver = {static int __init i2c_adap_fsl_init (void ) { -return register_driver (&i2c_fsl_driver); +return platform_driver_register (&i2c_fsl_driver); }device_initcall (i2c_adap_fsl_init);
drivers/i2c/busses/i2c-omap.c +1 -1
@@ -864,7 +864,7 @@ static struct driver_d omap_i2c_driver = {/* I2C may be needed to bring up other drivers */ static int __init omap_i2c_init_driver (void ) { -return register_driver (&omap_i2c_driver); +return platform_driver_register (&omap_i2c_driver); }device_initcall (omap_i2c_init_driver);
drivers/input/gpio_keys.c +1 -1
@@ -109,7 +109,7 @@ static struct driver_d gpio_keys_driver = {static int gpio_keys_init (void ) { -register_driver (&gpio_keys_driver); +platform_driver_register (&gpio_keys_driver);return 0 ; }device_initcall (gpio_keys_init);
drivers/input/imx_keypad.c +1 -1
@@ -457,7 +457,7 @@ static struct driver_d imx_keypad_driver = {static int imx_keypad_init (void ) { -register_driver (&imx_keypad_driver); +platform_driver_register (&imx_keypad_driver);return 0 ; }device_initcall (imx_keypad_init);
drivers/mci/atmel_mci.c +1 -1
@@ -494,7 +494,7 @@ static struct driver_d atmel_mci_driver = {static int atmel_mci_init_driver (void ) { -register_driver (&atmel_mci_driver); +platform_driver_register (&atmel_mci_driver);return 0 ; }
drivers/mci/imx-esdhc.c +1 -1
@@ -586,7 +586,7 @@ static struct driver_d fsl_esdhc_driver = {static int fsl_esdhc_init_driver (void ) { -register_driver (&fsl_esdhc_driver); +platform_driver_register (&fsl_esdhc_driver);return 0 ; }
drivers/mci/imx.c +1 -1
@@ -518,7 +518,7 @@ static struct driver_d mxcmci_driver = {static int mxcmci_init_driver (void ) { -register_driver (&mxcmci_driver); +platform_driver_register (&mxcmci_driver);return 0 ; }
drivers/mci/mci-core.c +2 -2
@@ -1497,7 +1497,7 @@ static struct driver_d mci_driver = {static int mci_init (void ) { sector_buf =xmemalign (32 ,512 ); -return register_driver (&mci_driver); +return platform_driver_register (&mci_driver); }device_initcall (mci_init);
@@ -1516,5 +1516,5 @@ int mci_register(struct mci_host *host) mci_dev->platform_data = host;dev_add_child (host->hw_dev, mci_dev); -return register_device (mci_dev); +return platform_device_register (mci_dev); }
drivers/mci/mxs.c +1 -1
@@ -763,7 +763,7 @@ static struct driver_d mxs_mci_driver = {static int mxs_mci_init_driver (void ) { -register_driver (&mxs_mci_driver); +platform_driver_register (&mxs_mci_driver);return 0 ; }
drivers/mci/omap_hsmmc.c +1 -1
@@ -599,7 +599,7 @@ static struct driver_d omap_mmc_driver = {static int omap_mmc_init_driver (void ) { -register_driver (&omap_mmc_driver); +platform_driver_register (&omap_mmc_driver);return 0 ; }
drivers/mci/pxamci.c +1 -1
@@ -381,7 +381,7 @@ static struct driver_d pxamci_driver = {static int __init pxamci_init_driver (void ) { -register_driver (&pxamci_driver); +platform_driver_register (&pxamci_driver);return 0 ; }
drivers/mci/s3c.c +1 -1
@@ -770,7 +770,7 @@ static struct driver_d s3c_mci_driver = {static int s3c_mci_init_driver (void ) { -register_driver (&s3c_mci_driver); +platform_driver_register (&s3c_mci_driver);return 0 ; }
drivers/misc/jtag.c +1 -1
@@ -381,7 +381,7 @@ static struct driver_d jtag_driver = {static int jtag_module_init (void ) { -return register_driver (&jtag_driver); +return platform_driver_register (&jtag_driver); }device_initcall (jtag_module_init);
drivers/mtd/core.c +1 -1
@@ -224,7 +224,7 @@ int add_mtd_device(struct mtd_info *mtd, char *devname) devname ="mtd" ;strcpy (mtd->class_dev.name, devname); mtd->class_dev.id =DEVICE_ID_DYNAMIC ; -register_device (&mtd->class_dev); +platform_device_register (&mtd->class_dev); mtd->cdev.ops = &mtd_ops; mtd->cdev.size = mtd->size;
drivers/mtd/devices/docg3.c +1 -1
@@ -1201,7 +1201,7 @@ static struct driver_d g3_driver = {static int __init docg3_init (void ) { -return register_driver (&g3_driver); +return platform_driver_register (&g3_driver); }device_initcall (docg3_init);
drivers/mtd/nand/atmel_nand.c +1 -1
@@ -484,7 +484,7 @@ static struct driver_d atmel_nand_driver = {static int __init atmel_nand_init (void ) { -return register_driver (&atmel_nand_driver); +return platform_driver_register (&atmel_nand_driver); }device_initcall (atmel_nand_init);
drivers/mtd/nand/nand_imx.c +1 -1
@@ -1288,7 +1288,7 @@ static struct driver_d imx_nand_driver = {*/ static int __init imx_nand_init (void ) { -return register_driver (&imx_nand_driver); +return platform_driver_register (&imx_nand_driver); }device_initcall (imx_nand_init);
drivers/mtd/nand/nand_mxs.c +1 -1
@@ -1248,7 +1248,7 @@ static struct driver_d mxs_nand_driver = {static int __init mxs_nand_init (void ) { -return register_driver (&mxs_nand_driver); +return platform_driver_register (&mxs_nand_driver); }device_initcall (mxs_nand_init);
drivers/mtd/nand/nand_omap_gpmc.c +1 -1
@@ -1084,7 +1084,7 @@ static struct driver_d gpmc_nand_driver = {static int gpmc_nand_init (void ) { -return register_driver (&gpmc_nand_driver); +return platform_driver_register (&gpmc_nand_driver); }device_initcall (gpmc_nand_init);
drivers/mtd/nand/nand_s3c24xx.c +1 -1
@@ -651,7 +651,7 @@ BAREBOX_CMD_END*/ static int __init s3c24x0_nand_init (void ) { -return register_driver (&s3c24x0_nand_driver); +return platform_driver_register (&s3c24x0_nand_driver); }device_initcall (s3c24x0_nand_init);
drivers/mtd/nand/nomadik_nand.c +1 -1
@@ -237,7 +237,7 @@ static struct driver_d nomadik_nand_driver = {static int __init nand_nomadik_init (void ) {pr_info ("Nomadik NAND driver\n" ); -return register_driver (&nomadik_nand_driver); +return platform_driver_register (&nomadik_nand_driver); }device_initcall (nand_nomadik_init);
drivers/net/altera_tse.c +1 -1
@@ -561,7 +561,7 @@ static struct driver_d altera_tse_driver = {static int tse_init (void ) { -register_driver (&altera_tse_driver); +platform_driver_register (&altera_tse_driver);return 0 ; }
drivers/net/at91_ether.c +1 -1
@@ -370,7 +370,7 @@ static struct driver_d at91_ether_driver = {static int at91_ether_driver_init (void ) { -register_driver (&at91_ether_driver); +platform_driver_register (&at91_ether_driver);return 0 ; }device_initcall (at91_ether_driver_init);
drivers/net/cs8900.c +1 -1
@@ -471,7 +471,7 @@ static struct driver_d cs8900_driver = {static int cs8900_init (void ) { -register_driver (&cs8900_driver); +platform_driver_register (&cs8900_driver);return 0 ; }
drivers/net/davinci_emac.c +1 -1
@@ -611,7 +611,7 @@ static struct driver_d davinci_emac_driver = {static int davinci_emac_register (void ) { -register_driver (&davinci_emac_driver); +platform_driver_register (&davinci_emac_driver);return 0 ; }
drivers/net/designware.c +1 -1
@@ -435,7 +435,7 @@ static struct driver_d dwc_ether_driver = {static int dwc_ether_driver_init (void ) { -register_driver (&dwc_ether_driver); +platform_driver_register (&dwc_ether_driver);return 0 ; }device_initcall (dwc_ether_driver_init);
drivers/net/dm9k.c +1 -1
@@ -784,7 +784,7 @@ static struct driver_d dm9k_driver = {static int dm9k_init (void ) { -register_driver (&dm9k_driver); +platform_driver_register (&dm9k_driver);return 0 ; }
drivers/net/ep93xx.c +1 -1
@@ -667,7 +667,7 @@ static struct driver_d ep93xx_eth_driver = {static int ep93xx_eth_init (void ) { -register_driver (&ep93xx_eth_driver); +platform_driver_register (&ep93xx_eth_driver);return 0 ; }
drivers/net/fec_imx.c +1 -1
@@ -722,7 +722,7 @@ static struct driver_d fec_driver = {static int fec_register (void ) { -register_driver (&fec_driver); +platform_driver_register (&fec_driver);return 0 ; }
drivers/net/fec_mpc5200.c +1 -1
@@ -722,7 +722,7 @@ static struct driver_d mpc5xxx_driver = {static int mpc5xxx_fec_register (void ) { -register_driver (&mpc5xxx_driver); +platform_driver_register (&mpc5xxx_driver);return 0 ; }
drivers/net/gianfar.c +1 -1
@@ -533,7 +533,7 @@ static struct driver_d gfar_eth_driver = {static int gfar_eth_init (void ) { -register_driver (&gfar_eth_driver); +platform_driver_register (&gfar_eth_driver);return 0 ; }
drivers/net/ks8851_mll.c +1 -1
@@ -877,7 +877,7 @@ static struct driver_d ks8851_driver = {static int ks8851_init (void ) { -register_driver (&ks8851_driver); +platform_driver_register (&ks8851_driver);return 0 ; }
drivers/net/macb.c +1 -1
@@ -495,7 +495,7 @@ static struct driver_d macb_driver = {static int macb_driver_init (void ) {debug ("%s\n" , __func__); -register_driver (&macb_driver); +platform_driver_register (&macb_driver);return 0 ; }
drivers/net/miidev.c +2 -2
@@ -49,7 +49,7 @@ int mii_register(struct mii_device *mdev)if (mdev->parent)dev_add_child (mdev->parent, &mdev->dev); -return register_device (&mdev->dev); +return platform_device_register (&mdev->dev); }void mii_unregister (struct mii_device *mdev)
@@ -59,7 +59,7 @@ void mii_unregister(struct mii_device *mdev)static int miidev_init (void ) { -register_driver (&miidev_drv); +platform_driver_register (&miidev_drv);return 0 ; }device_initcall (miidev_init);
drivers/net/netx_eth.c +1 -1
@@ -280,7 +280,7 @@ static struct driver_d netx_eth_driver = {static int netx_eth_init (void ) { -register_driver (&netx_eth_driver); +platform_driver_register (&netx_eth_driver);return 0 ; }
drivers/net/smc91111.c +1 -1
@@ -1323,7 +1323,7 @@ static struct driver_d smc91c111_driver = {static int smc91c111_init (void ) { -register_driver (&smc91c111_driver); +platform_driver_register (&smc91c111_driver);return 0 ; }
drivers/net/smc911x.c +1 -1
@@ -553,7 +553,7 @@ static struct driver_d smc911x_driver = {static int smc911x_init (void ) { -register_driver (&smc911x_driver); +platform_driver_register (&smc911x_driver);return 0 ; }
drivers/net/tap.c +1 -1
@@ -112,7 +112,7 @@ static struct driver_d tap_driver = {static int tap_init (void ) { -register_driver (&tap_driver); +platform_driver_register (&tap_driver);return 0 ; }
drivers/nor/cfi_flash.c +1 -1
@@ -1034,7 +1034,7 @@ static struct driver_d cfi_driver = {static int cfi_init (void ) { -return register_driver (&cfi_driver); +return platform_driver_register (&cfi_driver); }device_initcall (cfi_init);
drivers/of/base.c +1 -1
@@ -604,7 +604,7 @@ static struct device_d *add_of_device(struct device_node *node)debug ("register device 0x%08x\n" , node->resource[0 ].start); -register_device (dev); +platform_device_register (dev);free (name);
drivers/pwm/pxa_pwm.c +1 -1
@@ -150,7 +150,7 @@ static struct driver_d pxa_pwm_driver = {static int __init pxa_pwm_init_driver (void ) {CKEN &= ~CKEN_PWM0 & ~CKEN_PWM1 ; -register_driver (&pxa_pwm_driver); +platform_driver_register (&pxa_pwm_driver);return 0 ; }
drivers/serial/arm_dcc.c +2 -2
@@ -157,8 +157,8 @@ static struct device_d arm_dcc_device = {static int arm_dcc_init (void ) { -register_device (&arm_dcc_device); -register_driver (&arm_dcc_driver); +platform_device_register (&arm_dcc_device); +platform_driver_register (&arm_dcc_driver);return 0 ; }
drivers/serial/atmel.c +1 -1
@@ -421,7 +421,7 @@ static struct driver_d atmel_serial_driver = {static int atmel_serial_init (void ) { -register_driver (&atmel_serial_driver); +platform_driver_register (&atmel_serial_driver);return 0 ; }
drivers/serial/linux_console.c +1 -1
@@ -81,7 +81,7 @@ static struct driver_d linux_console_driver = {static int console_init (void ) { -return register_driver (&linux_console_driver); +return platform_driver_register (&linux_console_driver); }console_initcall (console_init);
drivers/serial/serial_altera.c +1 -1
@@ -104,7 +104,7 @@ static struct driver_d altera_serial_driver = {static int altera_serial_init (void ) { -return register_driver (&altera_serial_driver); +return platform_driver_register (&altera_serial_driver); }console_initcall (altera_serial_init);
drivers/serial/serial_altera_jtag.c +1 -1
@@ -109,7 +109,7 @@ static struct driver_d altera_serial_jtag_driver = {static int altera_serial_jtag_init (void ) { -return register_driver (&altera_serial_jtag_driver); +return platform_driver_register (&altera_serial_jtag_driver); }console_initcall (altera_serial_jtag_init);
drivers/serial/serial_blackfin.c +1 -1
@@ -133,7 +133,7 @@ static struct driver_d blackfin_serial_driver = {static int blackfin_serial_init (void ) { -register_driver (&blackfin_serial_driver); +platform_driver_register (&blackfin_serial_driver);return 0 ; }
drivers/serial/serial_imx.c +1 -1
@@ -375,7 +375,7 @@ static struct driver_d imx_serial_driver = {static int imx_serial_init (void ) { -register_driver (&imx_serial_driver); +platform_driver_register (&imx_serial_driver);return 0 ; }
drivers/serial/serial_mpc5xxx.c +1 -1
@@ -169,7 +169,7 @@ static struct driver_d mpc5xxx_serial_driver = {static int mpc5xxx_serial_register (void ) { -register_driver (&mpc5xxx_serial_driver); +platform_driver_register (&mpc5xxx_serial_driver);return 0 ; }
drivers/serial/serial_netx.c +1 -1
@@ -158,7 +158,7 @@ static struct driver_d netx_serial_driver = {static int netx_serial_init (void ) { -register_driver (&netx_serial_driver); +platform_driver_register (&netx_serial_driver);return 0 ; }
drivers/serial/serial_ns16550.c +2 -2
@@ -266,11 +266,11 @@ static struct driver_d ns16550_serial_driver = {/** * @brief driver initialization function * -* @return result of register_driver +* @return result of platform_driver_register */ static int ns16550_serial_init (void ) { -return register_driver (&ns16550_serial_driver); +return platform_driver_register (&ns16550_serial_driver); }console_initcall (ns16550_serial_init);
drivers/serial/serial_pl010.c +1 -1
@@ -160,7 +160,7 @@ static struct driver_d pl010_driver = {static int pl010_init (void ) { -register_driver (&pl010_driver); +platform_driver_register (&pl010_driver);return 0 ; }
drivers/serial/serial_pxa.c +1 -1
@@ -198,7 +198,7 @@ static struct driver_d pxa_serial_driver = {static int pxa_serial_init (void ) { -return register_driver (&pxa_serial_driver); +return platform_driver_register (&pxa_serial_driver); }console_initcall (pxa_serial_init);
drivers/serial/serial_s3c.c +1 -1
@@ -216,7 +216,7 @@ static struct driver_d s3c_serial_driver = {static int s3c_serial_init (void ) { -register_driver (&s3c_serial_driver); +platform_driver_register (&s3c_serial_driver);return 0 ; }
drivers/serial/stm-serial.c +1 -1
@@ -190,7 +190,7 @@ static struct driver_d stm_serial_driver = {static int stm_serial_init (void ) { -register_driver (&stm_serial_driver); +platform_driver_register (&stm_serial_driver);return 0 ; }
drivers/spi/altera_spi.c +1 -1
@@ -242,7 +242,7 @@ static struct driver_d altera_spi_driver = {static int altera_spi_driver_init (void ) { -return register_driver (&altera_spi_driver); +return platform_driver_register (&altera_spi_driver); }device_initcall (altera_spi_driver_init);
drivers/spi/atmel_spi.c +1 -1
@@ -312,7 +312,7 @@ static struct driver_d atmel_spi_driver = {static int atmel_spi_init (void ) { -register_driver (&atmel_spi_driver); +platform_driver_register (&atmel_spi_driver);return 0 ; }
drivers/spi/imx_spi.c +1 -1
@@ -584,7 +584,7 @@ static struct driver_d imx_spi_driver = {static int imx_spi_init (void ) { -register_driver (&imx_spi_driver); +platform_driver_register (&imx_spi_driver);return 0 ; }
drivers/spi/omap3_spi.c +1 -1
@@ -393,7 +393,7 @@ static struct driver_d omap3_spi_driver = {static int omap3_spi_init (void ) { -return register_driver (&omap3_spi_driver); +return platform_driver_register (&omap3_spi_driver); }device_initcall (omap3_spi_init);
drivers/usb/gadget/at91_udc.c +1 -1
@@ -1533,7 +1533,7 @@ static struct driver_d at91_udc_driver = {static int at91_udc_init (void ) { -register_driver (&at91_udc_driver); +platform_driver_register (&at91_udc_driver);return 0 ; }device_initcall (at91_udc_init);
drivers/usb/gadget/fsl_udc.c +1 -1
@@ -2333,7 +2333,7 @@ static struct driver_d fsl_udc_driver = {static int fsl_udc_init (void ) { -register_driver (&fsl_udc_driver); +platform_driver_register (&fsl_udc_driver);return 0 ; }
drivers/usb/gadget/pxa27x_udc.c +1 -1
@@ -1515,7 +1515,7 @@ static struct driver_d udc_driver = {static int __init pxa27x_udc_init (void ) { -register_driver (&udc_driver); +platform_driver_register (&udc_driver);return 0 ; }
drivers/usb/host/ehci-hcd.c +1 -1
@@ -868,7 +868,7 @@ static struct driver_d ehci_driver = {static int ehcil_init (void ) { -register_driver (&ehci_driver); +platform_driver_register (&ehci_driver);return 0 ; }
drivers/usb/host/ohci-at91.c +1 -1
@@ -88,7 +88,7 @@ static struct driver_d at91_ohci_driver = {static int at91_ohci_init (void ) { -register_driver (&at91_ohci_driver); +platform_driver_register (&at91_ohci_driver);return 0 ; }device_initcall (at91_ohci_init);
drivers/usb/host/ohci-hcd.c +1 -1
@@ -1822,7 +1822,7 @@ static struct driver_d ohci_driver = {static int ohcil_init (void ) { -register_driver (&ohci_driver); +platform_driver_register (&ohci_driver);return 0 ; }
drivers/video/fb.c +2 -2
@@ -125,7 +125,7 @@ int register_framebuffer(struct fb_info *info)sprintf (dev->name,"fb" ); -register_device (&info->dev); +platform_device_register (&info->dev);dev_add_param (dev,"enable" , fb_enable_set,NULL ,0 );dev_set_param (dev,"enable" ,"0" );
@@ -173,7 +173,7 @@ static struct driver_d fb_driver = {static int fb_init_driver (void ) { -register_driver (&fb_driver); +platform_driver_register (&fb_driver);return 0 ; }device_initcall (fb_init_driver);
drivers/video/imx-ipu-fb.c +1 -1
@@ -1036,7 +1036,7 @@ static struct driver_d imx3fb_driver = {static int imx3fb_init (void ) { -return register_driver (&imx3fb_driver); +return platform_driver_register (&imx3fb_driver); }device_initcall (imx3fb_init);
drivers/video/imx.c +1 -1
@@ -614,7 +614,7 @@ static struct driver_d imxfb_driver = {static int imxfb_init (void ) { -return register_driver (&imxfb_driver); +return platform_driver_register (&imxfb_driver); }device_initcall (imxfb_init);
drivers/video/pxa.c +1 -1
@@ -548,7 +548,7 @@ static struct driver_d pxafb_driver = {static int pxafb_init (void ) { -return register_driver (&pxafb_driver); +return platform_driver_register (&pxafb_driver); }device_initcall (pxafb_init);
drivers/video/s3c24xx.c +1 -1
@@ -409,7 +409,7 @@ static struct driver_d s3cfb_driver = {static int s3cfb_init (void ) { -return register_driver (&s3cfb_driver); +return platform_driver_register (&s3cfb_driver); }device_initcall (s3cfb_init);
drivers/video/stm.c +1 -1
@@ -519,7 +519,7 @@ static struct driver_d stmfb_driver = {static int stmfb_init (void ) { -return register_driver (&stmfb_driver); +return platform_driver_register (&stmfb_driver); }device_initcall (stmfb_init);
drivers/watchdog/im28wd.c +1 -1
@@ -142,7 +142,7 @@ static struct driver_d imx28_wd_driver = {static int imx28_wd_init (void ) { -register_driver (&imx28_wd_driver); +platform_driver_register (&imx28_wd_driver);return 0 ; }
include/driver.h +3 -0
@@ -401,6 +401,9 @@ extern struct list_head bus_list;extern struct bus_type platform_bus; +int platform_driver_register (struct driver_d *drv); +int platform_device_register (struct device_d *new_device); +struct file_operations {/*! Called in response of reading from this device. Required */ ssize_t (*read)(struct cdev *,void * buf,size_t count,loff_t offset,ulong flags);
net/eth.c +1 -1
@@ -222,7 +222,7 @@ int eth_register(struct eth_device *edev)if (edev->parent)dev_add_child (edev->parent, &edev->dev); -register_device (&edev->dev); +platform_device_register (&edev->dev);dev_add_param (dev,"ipaddr" , eth_set_ipaddr,NULL ,0 );dev_add_param (dev,"ethaddr" , eth_set_ethaddr,NULL ,0 );
net/net.c +1 -1
@@ -676,7 +676,7 @@ static int net_init(void)for (i =0 ; i <PKTBUFSRX ; i++) NetRxPackets[i] =net_alloc_packet (); -register_device (&net_device); +platform_device_register (&net_device);dev_add_param (&net_device,"nameserver" ,NULL ,NULL ,0 );dev_add_param (&net_device,"domainname" ,NULL ,NULL ,0 );
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerQuoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
HI,
now register_driver/device are for bus usage ONLY
v3:
- drop check on NULL pointer
- add platform_driver/device_register
- usebus_for_eachv2:
- on the sandbox we register device before barebox started this is working today as nothing need to be initialized before regisering a device. But as I attached device to bus this will no be the case anymore so fix it
Quoted 5 lines
- net/tap fix allocated data to be set to 0
The following changes since commit
4f2aa8ffb124a7f40da2a5bc1a2c225554b24bdd:Merge branch 'for-next/testing-menu' into next (2012-09-17 12:15:53 +0200)
Applied 1-3 to master and 4-5 to next. Will also apply patch 6, but I currently have no branch to apply this on. I'll probably declare some -next branch as next-stable and apply this onto that branch.
Thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox