* [PATCH 02/12] platform: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 03/12] amba: " Jean-Christophe PLAGNIOL-VILLARD
` (9 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add it as parent if the device does not have a parent already
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/platform.c | 18 ++++++++++++++----
include/driver.h | 3 ++-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index ea4e37b..08787f6 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -57,19 +57,28 @@ static void platform_remove(struct device_d *dev)
int platform_driver_register(struct driver_d *drv)
{
- drv->bus = &platform_bus;
+ drv->bus = &platform_bus_type;
return register_driver(drv);
}
int platform_device_register(struct device_d *new_device)
{
- new_device->bus = &platform_bus;
+ new_device->bus = &platform_bus_type;
+ if (!new_device->parent) {
+ new_device->parent = &platform_bus;
+ dev_add_child(new_device->parent, new_device);
+ }
return register_device(new_device);
}
-struct bus_type platform_bus = {
+struct device_d platform_bus = {
+ .name = "platfrom",
+ .id = DEVICE_ID_SINGLE,
+};
+
+struct bus_type platform_bus_type = {
.name = "platform",
.match = platform_match,
.probe = platform_probe,
@@ -78,6 +87,7 @@ struct bus_type platform_bus = {
static int plarform_init(void)
{
- return bus_register(&platform_bus);
+ register_device(&platform_bus);
+ return bus_register(&platform_bus_type);
}
pure_initcall(plarform_init);
diff --git a/include/driver.h b/include/driver.h
index dd22c77..5d85c1d 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -399,7 +399,8 @@ extern struct list_head bus_list;
*/
#define bus_for_each_driver(bus, drv) list_for_each_entry(drv, &(bus)->driver_list, bus_list)
-extern struct bus_type platform_bus;
+extern struct bus_type platform_bus_type;
+extern struct device_d platform_bus;
int platform_driver_register(struct driver_d *drv);
int platform_device_register(struct device_d *new_device);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 03/12] amba: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 02/12] platform: add bus device Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 04/12] fs: " Jean-Christophe PLAGNIOL-VILLARD
` (8 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add amba_device as parent of any amba device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/amba/bus.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index f0a40b6..581a25c 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -72,6 +72,11 @@ static void amba_remove(struct device_d *dev)
drv->remove(pcdev);
}
+struct device_d amba_bus = {
+ .name = "amba",
+ .id = DEVICE_ID_SINGLE,
+};
+
struct bus_type amba_bustype = {
.name = "amba",
.match = amba_match,
@@ -153,6 +158,8 @@ int amba_device_add(struct amba_device *dev)
goto err_release;
skip_probe:
+ dev->dev.parent = &amba_bus;
+ dev_add_child(dev->dev.parent, &dev->dev);
ret = register_device(&dev->dev);
if (ret)
goto err_release;
@@ -212,6 +219,7 @@ struct amba_device *amba_device_alloc(const char *name, int id, resource_size_t
static int amba_bus_init(void)
{
+ register_device(&amba_bus);
return bus_register(&amba_bustype);
}
pure_initcall(amba_bus_init);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 04/12] fs: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 02/12] platform: add bus device Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 03/12] amba: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 05/12] mdio: " Jean-Christophe PLAGNIOL-VILLARD
` (7 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add it as parent of any fs device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
fs/fs.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index b9a1f17..b63a005 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1131,7 +1131,12 @@ static void fs_remove(struct device_d *dev)
free(fsdev);
}
-struct bus_type fs_bus = {
+struct device_d fs_bus = {
+ .name = "fs",
+ .id = DEVICE_ID_SINGLE,
+};
+
+struct bus_type fs_bus_type = {
.name = "fs",
.match = fs_match,
.probe = fs_probe,
@@ -1140,13 +1145,14 @@ struct bus_type fs_bus = {
static int fs_bus_init(void)
{
- return bus_register(&fs_bus);
+ register_device(&fs_bus);
+ return bus_register(&fs_bus_type);
}
pure_initcall(fs_bus_init);
int register_fs_driver(struct fs_driver_d *fsdrv)
{
- fsdrv->drv.bus = &fs_bus;
+ fsdrv->drv.bus = &fs_bus_type;
register_driver(&fsdrv->drv);
return 0;
@@ -1162,10 +1168,7 @@ static const char *detect_fs(const char *filename)
if (type == filetype_unknown)
return NULL;
- for_each_driver(drv) {
- if (drv->bus != &fs_bus)
- continue;
-
+ bus_for_each_driver(&fs_bus_type, drv) {
fdrv = drv_to_fs_driver(drv);
if (type == fdrv->type)
@@ -1217,11 +1220,15 @@ int mount(const char *device, const char *fsname, const char *_path)
safe_strncpy(fsdev->dev.name, fsname, MAX_DRIVER_NAME);
fsdev->dev.id = get_free_deviceid(fsdev->dev.name);
fsdev->path = xstrdup(path);
- fsdev->dev.bus = &fs_bus;
+ fsdev->dev.bus = &fs_bus_type;
if (!strncmp(device, "/dev/", 5))
fsdev->cdev = cdev_by_name(device + 5);
+ if (!fsdev->dev.parent) {
+ fsdev->dev.parent = &fs_bus;
+ dev_add_child(fsdev->dev.parent, &fsdev->dev);
+ }
ret = register_device(&fsdev->dev);
if (ret)
goto err_register;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 05/12] mdio: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 04/12] fs: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 06/12] i2c: " Jean-Christophe PLAGNIOL-VILLARD
` (6 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/net/phy/mdio_bus.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index b49f714..eba3e1f 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -233,6 +233,11 @@ static void mdio_bus_remove(struct device_d *_dev)
devfs_remove(&dev->cdev);
}
+struct device_d mdio_bus = {
+ .name = "mdio_bus",
+ .id = DEVICE_ID_SINGLE,
+};
+
struct bus_type mdio_bus_type = {
.name = "mdio_bus",
.match = mdio_bus_match,
@@ -243,6 +248,7 @@ EXPORT_SYMBOL(mdio_bus_type);
static int mdio_bus_init(void)
{
+ register_device(&mdio_bus);
return bus_register(&mdio_bus_type);
}
pure_initcall(mdio_bus_init);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 06/12] i2c: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (3 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 05/12] mdio: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 07/12] spi: " Jean-Christophe PLAGNIOL-VILLARD
` (5 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add it as parent if the device does not have a parent already
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/i2c/i2c.c | 26 +++++++++++++++++++-------
include/i2c/i2c.h | 5 +++--
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 27fd256..dd7dfd7 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -252,12 +252,20 @@ struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
strcpy(client->dev.name, chip->type);
client->dev.type_data = client;
client->dev.platform_data = chip->platform_data;
- client->dev.bus = &i2c_bus;
+ client->dev.bus = &i2c_bus_type;
client->adapter = adapter;
client->addr = chip->addr;
status = register_device(&client->dev);
+ if (status)
+ goto fail;
+
+ if (!client->dev.parent) {
+ client->dev.parent = &i2c_bus;
+ dev_add_child(client->dev.parent, &client->dev);
+ }
+
#if 0
/* drivers may modify this initial i/o setup */
status = master->setup(client);
@@ -270,11 +278,9 @@ struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
return client;
-#if 0
- fail:
- free(proxy);
+fail:
+ free(client);
return NULL;
-#endif
}
EXPORT_SYMBOL(i2c_new_device);
@@ -390,7 +396,12 @@ static void i2c_remove(struct device_d *dev)
dev->driver->remove(dev);
}
-struct bus_type i2c_bus = {
+struct device_d i2c_bus = {
+ .name = "i2c",
+ .id = DEVICE_ID_SINGLE,
+};
+
+struct bus_type i2c_bus_type = {
.name = "i2c",
.match = i2c_match,
.probe = i2c_probe,
@@ -399,6 +410,7 @@ struct bus_type i2c_bus = {
static int i2c_bus_init(void)
{
- return bus_register(&i2c_bus);
+ register_device(&i2c_bus);
+ return bus_register(&i2c_bus_type);
}
pure_initcall(i2c_bus_init);
diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h
index de2a7ea..20d7f65 100644
--- a/include/i2c/i2c.h
+++ b/include/i2c/i2c.h
@@ -139,11 +139,12 @@ extern int i2c_write_reg(struct i2c_client *client, u32 addr, const u8 *buf, u16
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-extern struct bus_type i2c_bus;
+extern struct device_d i2c_bus;
+extern struct bus_type i2c_bus_type;
static inline int i2c_register_driver(struct driver_d *drv)
{
- drv->bus = &i2c_bus;
+ drv->bus = &i2c_bus_type;
return register_driver(drv);
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 07/12] spi: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (4 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 06/12] i2c: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 08/12] usb: " Jean-Christophe PLAGNIOL-VILLARD
` (4 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add it as parent if the device does not have a parent already
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/spi/spi.c | 17 ++++++++++++++---
include/spi/spi.h | 5 +++--
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 44040e5..51892a7 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -75,7 +75,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
proxy->mode = chip->mode;
proxy->bits_per_word = chip->bits_per_word ? chip->bits_per_word : 8;
proxy->dev.platform_data = chip->platform_data;
- proxy->dev.bus = &spi_bus;
+ proxy->dev.bus = &spi_bus_type;
strcpy(proxy->dev.name, chip->name);
/* allocate a free id for this chip */
proxy->dev.id = DEVICE_ID_DYNAMIC;
@@ -93,6 +93,11 @@ struct spi_device *spi_new_device(struct spi_master *master,
register_device(&proxy->dev);
+ if (!proxy->dev.parent) {
+ proxy->dev.parent = &spi_bus;
+ dev_add_child(proxy->dev.parent, &proxy->dev);
+ }
+
return proxy;
fail:
free(proxy);
@@ -285,7 +290,12 @@ static void spi_remove(struct device_d *dev)
dev->driver->remove(dev);
}
-struct bus_type spi_bus = {
+struct device_d spi_bus = {
+ .name = "spi",
+ .id = DEVICE_ID_SINGLE,
+};
+
+struct bus_type spi_bus_type = {
.name = "spi",
.match = spi_match,
.probe = spi_probe,
@@ -294,6 +304,7 @@ struct bus_type spi_bus = {
static int spi_bus_init(void)
{
- return bus_register(&spi_bus);
+ register_device(&spi_bus);
+ return bus_register(&spi_bus_type);
}
pure_initcall(spi_bus_init);
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 1773ca2..fe9c809 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -430,11 +430,12 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-extern struct bus_type spi_bus;
+extern struct device_d spi_bus;
+extern struct bus_type spi_bus_type;
static inline int spi_register_driver(struct driver_d *drv)
{
- drv->bus = &spi_bus;
+ drv->bus = &spi_bus_type;
return register_driver(drv);
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 08/12] usb: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (5 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 07/12] spi: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 09/12] fb: " Jean-Christophe PLAGNIOL-VILLARD
` (3 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add usb_device to it if they do not have a parent already
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/usb/core/usb.c | 11 +++++++++++
include/usb/usb.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 9dc931b..0d610d6 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -437,6 +437,11 @@ static int usb_new_device(struct usb_device *dev)
print_usb_device(dev);
+ if (!dev->dev.parent) {
+ dev->dev.parent = &usb_bus;
+ dev_add_child(dev->dev.parent, &dev->dev);
+ }
+
register_device(&dev->dev);
list_add_tail(&dev->list, &usb_device_list);
@@ -1411,6 +1416,11 @@ static void usb_remove(struct device_d *dev)
usbdrv->disconnect(usbdev);
}
+struct device_d usb_bus = {
+ .name = "usb",
+ .id = DEVICE_ID_SINGLE,
+};
+
struct bus_type usb_bus_type = {
.name = "usb",
.match = usb_match,
@@ -1420,6 +1430,7 @@ struct bus_type usb_bus_type = {
static int usb_bus_init(void)
{
+ register_device(&usb_bus);
return bus_register(&usb_bus_type);
}
pure_initcall(usb_bus_init);
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 4649ee2..a0c26c1 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -193,6 +193,7 @@ struct usb_driver {
struct driver_d driver;
};
+extern struct device_d usb_bus;
extern struct bus_type usb_bus_type;
int usb_driver_register(struct usb_driver *);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 09/12] fb: add bus device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (6 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 08/12] usb: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 10/12] mtd: register device a pure device Jean-Christophe PLAGNIOL-VILLARD
` (2 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
automatically add it as parent of any fb device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/video/fb.c | 17 +++++++++++++----
include/fb.h | 3 ++-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index ee53272..0933a57 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -125,7 +125,10 @@ int register_framebuffer(struct fb_info *info)
sprintf(dev->name, "fb");
- info->dev.bus = &fb_bus;
+ info->dev.bus = &fb_bus_type;
+ info->dev.parent = &fb_bus;
+ dev_add_child(info->dev.parent, &info->dev);
+
register_device(&info->dev);
return 0;
@@ -181,7 +184,12 @@ static void fb_remove(struct device_d *dev)
{
}
-struct bus_type fb_bus = {
+struct device_d fb_bus = {
+ .name = "fb",
+ .id = DEVICE_ID_SINGLE,
+};
+
+struct bus_type fb_bus_type = {
.name = "fb",
.match = fb_match,
.probe = fb_probe,
@@ -190,13 +198,14 @@ struct bus_type fb_bus = {
static int fb_bus_init(void)
{
- return bus_register(&fb_bus);
+ register_device(&fb_bus);
+ return bus_register(&fb_bus_type);
}
pure_initcall(fb_bus_init);
static int fb_init_driver(void)
{
- fb_driver.bus = &fb_bus;
+ fb_driver.bus = &fb_bus_type;
register_driver(&fb_driver);
return 0;
}
diff --git a/include/fb.h b/include/fb.h
index c594418..9631733 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -110,7 +110,8 @@ int register_framebuffer(struct fb_info *info);
#define FBIO_ENABLE _IO('F', 2)
#define FBIO_DISABLE _IO('F', 3)
-extern struct bus_type fb_bus;
+extern struct device_d fb_bus;
+extern struct bus_type fb_bus_type;
#endif /* __FB_H */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 10/12] mtd: register device a pure device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (7 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 09/12] fb: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 11/12] mtd: add parent support Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 12/12] eth: register device a pure device Jean-Christophe PLAGNIOL-VILLARD
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
as we do not need to probe them and they have no driver or bus attached
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/mtd/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 7c323a1..a91ef04 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -225,7 +225,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;
- platform_device_register(&mtd->class_dev);
+ register_device(&mtd->class_dev);
mtd->cdev.ops = &mtd_ops;
mtd->cdev.size = mtd->size;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 11/12] mtd: add parent support
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (8 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 10/12] mtd: register device a pure device Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-14 21:01 ` [PATCH 12/12] eth: register device a pure device Jean-Christophe PLAGNIOL-VILLARD
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/mtd/core.c | 4 ++++
drivers/mtd/devices/docg3.c | 1 +
drivers/mtd/nand/atmel_nand.c | 1 +
drivers/mtd/nand/nand_imx.c | 2 +-
drivers/mtd/nand/nand_mxs.c | 1 +
drivers/mtd/nand/nand_omap_gpmc.c | 1 +
drivers/mtd/nand/nand_s3c24xx.c | 1 +
drivers/mtd/nand/nomadik_nand.c | 1 +
include/linux/mtd/mtd.h | 2 +-
9 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index a91ef04..94b7171 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -225,6 +225,10 @@ 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;
+ if (mtd->parent) {
+ mtd->class_dev.parent = mtd->parent;
+ dev_add_child(mtd->class_dev.parent, &mtd->class_dev);
+ }
register_device(&mtd->class_dev);
mtd->cdev.ops = &mtd_ops;
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 0fe6799..2f89900 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1172,6 +1172,7 @@ static int __init docg3_probe(struct device_d *dev)
continue;
}
docg3_floors[floor] = mtd;
+ mtd->parent = dev;
ret = add_mtd_device(mtd, NULL);
if (ret)
goto err_probe;
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index aa01124..2784e39 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -363,6 +363,7 @@ static int __init atmel_nand_probe(struct device_d *dev)
nand_chip->priv = host; /* link the private data structures */
mtd->priv = nand_chip;
+ mtd->parent = dev;
/* Set address of NAND IO lines */
nand_chip->IO_ADDR_R = host->io_base;
diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
index b1b7f55..0dcf34a 100644
--- a/drivers/mtd/nand/nand_imx.c
+++ b/drivers/mtd/nand/nand_imx.c
@@ -1182,7 +1182,7 @@ static int __init imxnd_probe(struct device_d *dev)
this = &host->nand;
mtd = &host->mtd;
mtd->priv = this;
- mtd->dev = dev;
+ mtd->parent = dev;
/* 50 us command delay time */
this->chip_delay = 5;
diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 8aeb14d..d71983a 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -1201,6 +1201,7 @@ static int mxs_nand_probe(struct device_d *dev)
nand = &nand_info->nand_chip;
mtd = &nand_info->mtd;
mtd->priv = nand;
+ mtd->parent = dev;
nand->priv = nand_info;
nand->options |= NAND_NO_SUBPAGE_WRITE;
diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index cc356f7..f4f5335 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -929,6 +929,7 @@ static int gpmc_nand_probe(struct device_d *pdev)
minfo = &oinfo->minfo;
minfo->priv = (void *)nand;
+ minfo->parent = dev;
if (pdata->cs >= GPMC_NUM_CS) {
dev_dbg(pdev, "Invalid CS!\n");
diff --git a/drivers/mtd/nand/nand_s3c24xx.c b/drivers/mtd/nand/nand_s3c24xx.c
index 12db692..aef7fa9 100644
--- a/drivers/mtd/nand/nand_s3c24xx.c
+++ b/drivers/mtd/nand/nand_s3c24xx.c
@@ -425,6 +425,7 @@ static int s3c24x0_nand_probe(struct device_d *dev)
chip = &host->nand;
mtd = &host->mtd;
mtd->priv = chip;
+ mtd->parent = dev;
/* init the default settings */
diff --git a/drivers/mtd/nand/nomadik_nand.c b/drivers/mtd/nand/nomadik_nand.c
index 6fc9398..d7e4ae5 100644
--- a/drivers/mtd/nand/nomadik_nand.c
+++ b/drivers/mtd/nand/nomadik_nand.c
@@ -197,6 +197,7 @@ static int nomadik_nand_probe(struct device_d *dev)
nand = &host->nand;
mtd->priv = nand;
nand->priv = host;
+ mtd->parent = dev;
nand->IO_ADDR_W = nand->IO_ADDR_R = dev_request_mem_region(dev, 2);
nand->cmd_ctrl = nomadik_cmd_ctrl;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 71d3c6f..8114967 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -200,7 +200,7 @@ struct mtd_info {
void (*put_device) (struct mtd_info *mtd);
struct device_d class_dev;
- struct device_d *dev;
+ struct device_d *parent;
struct cdev cdev;
struct param_d param_size;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 12/12] eth: register device a pure device
2012-10-14 21:01 ` [PATCH 01/12] bus_for_each_device/bus_for_each_driver: add () to allow use &bus Jean-Christophe PLAGNIOL-VILLARD
` (9 preceding siblings ...)
2012-10-14 21:01 ` [PATCH 11/12] mtd: add parent support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-10-14 21:01 ` Jean-Christophe PLAGNIOL-VILLARD
10 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-14 21:01 UTC (permalink / raw)
To: barebox
as we do not need to probe them and they have no driver or bus attached
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
net/eth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/eth.c b/net/eth.c
index f3d7bfe..220edcf 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -261,7 +261,7 @@ int eth_register(struct eth_device *edev)
if (edev->parent)
dev_add_child(edev->parent, &edev->dev);
- platform_device_register(&edev->dev);
+ register_device(&edev->dev);
dev_add_param(dev, "ipaddr", eth_set_ipaddr, NULL, 0);
dev_add_param(dev, "ethaddr", eth_set_ethaddr, NULL, 0);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 19+ messages in thread