From fec738dd48bd33743c12cebe1bf954e487756231 Mon Sep 17 00:00:00 2001 From: Joachim Fenkes Date: Wed, 26 Sep 2007 19:44:12 +1000 Subject: [POWERPC] Move of_device allocation into of_device.[ch] Extract generic of_device allocation code from of_platform_device_create() and move it into of_device.[ch], called of_device_alloc(). Also, there's now of_device_free() which puts the device node. This way, bus drivers that build on of_platform (like ibmebus will) can build upon this code instead of reinventing the wheel. Signed-off-by: Joachim Fenkes Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- include/asm-powerpc/of_device.h | 4 ++++ include/linux/of_device.h | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h index 93262f2546ad..6526e139a463 100644 --- a/include/asm-powerpc/of_device.h +++ b/include/asm-powerpc/of_device.h @@ -17,6 +17,10 @@ struct of_device struct device dev; /* Generic device interface */ }; +extern struct of_device *of_device_alloc(struct device_node *np, + const char *bus_id, + struct device *parent); + extern ssize_t of_device_get_modalias(struct of_device *ofdev, char *str, ssize_t len); extern int of_device_uevent(struct device *dev, diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 91bf84b9d144..212bffb2b174 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -22,5 +22,10 @@ extern int of_device_register(struct of_device *ofdev); extern void of_device_unregister(struct of_device *ofdev); extern void of_release_dev(struct device *dev); +static inline void of_device_free(struct of_device *dev) +{ + of_release_dev(&dev->dev); +} + #endif /* __KERNEL__ */ #endif /* _LINUX_OF_DEVICE_H */ -- cgit v1.2.3-59-g8ed1b