diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-04-04 12:03:20 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-04-04 12:03:20 +0200 |
commit | 0e291a853ac24b25a068cd71b907fc1d427cee4b (patch) | |
tree | e8c81eccac7cd863129a07fc75fcd350869cbcda /include | |
parent | 2c504d5c82bf3425b5bcdca196164ee24b40600e (diff) | |
parent | e4588cf31166be16a8993acdebf5752ccf48b3a4 (diff) | |
download | barebox-0e291a853ac24b25a068cd71b907fc1d427cee4b.tar.gz barebox-0e291a853ac24b25a068cd71b907fc1d427cee4b.tar.xz |
Merge branch 'for-next/device-driver-macros'
Diffstat (limited to 'include')
-rw-r--r-- | include/driver.h | 15 | ||||
-rw-r--r-- | include/i2c/i2c.h | 2 | ||||
-rw-r--r-- | include/spi/spi.h | 5 |
3 files changed, 15 insertions, 7 deletions
diff --git a/include/driver.h b/include/driver.h index 46c56c0acf..8598a39af2 100644 --- a/include/driver.h +++ b/include/driver.h @@ -395,16 +395,21 @@ extern struct bus_type platform_bus; int platform_driver_register(struct driver_d *drv); -/* device_platform_driver() - Helper macro for drivers that don't do +/* register_driver_macro() - Helper macro for drivers that don't do * anything special in module registration. This eliminates a lot of * boilerplate. Each module may only use this macro once. */ -#define device_platform_driver(drv) \ - static int __init drv ## _register(void) \ +#define register_driver_macro(level,bus,drv) \ + static int __init drv##_register(void) \ { \ - return platform_driver_register(&drv); \ + return bus##_driver_register(&drv); \ } \ - device_initcall(drv ## _register) + level##_initcall(drv##_register) + +#define device_platform_driver(drv) \ + register_driver_macro(device,platform,drv) +#define console_platform_driver(drv) \ + register_driver_macro(console,platform,drv) int platform_device_register(struct device_d *new_device); diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h index dc5e5fc99b..7b59a5102d 100644 --- a/include/i2c/i2c.h +++ b/include/i2c/i2c.h @@ -151,7 +151,7 @@ extern int i2c_write_reg(struct i2c_client *client, u32 addr, const u8 *buf, u16 extern struct bus_type i2c_bus; -static inline int i2c_register_driver(struct driver_d *drv) +static inline int i2c_driver_register(struct driver_d *drv) { drv->bus = &i2c_bus; return register_driver(drv); diff --git a/include/spi/spi.h b/include/spi/spi.h index fa76e9b59f..3da13e85ec 100644 --- a/include/spi/spi.h +++ b/include/spi/spi.h @@ -436,12 +436,15 @@ extern struct bus_type spi_bus; struct spi_master *spi_get_master(int bus); -static inline int spi_register_driver(struct driver_d *drv) +static inline int spi_driver_register(struct driver_d *drv) { drv->bus = &spi_bus; return register_driver(drv); } +#define device_spi_driver(drv) \ + register_driver_macro(device,spi,drv) + void spi_of_register_slaves(struct spi_master *master, struct device_node *node); #endif /* __INCLUDE_SPI_H */ |