diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-08-26 03:34:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-31 07:16:24 -0400 |
commit | 68d9671a845e11c4eec1976876c1af5687a55279 (patch) | |
tree | 4e7b5afc87c0c64ba7858894ee3dd5dc77b152f9 /include/linux/mcb.h | |
parent | ffc7bb3857e42acab131271e485735cbf673d0f0 (diff) |
mcb: Introduce type safety for to_mcb_*
The to_mcb_{bus,device,driver}() macros lacked type safety, so convert them to
inline functions to enforce compile time type checking.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/mcb.h')
-rw-r--r-- | include/linux/mcb.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/include/linux/mcb.h b/include/linux/mcb.h index ead13d233a97..a6733d3fe72b 100644 --- a/include/linux/mcb.h +++ b/include/linux/mcb.h | |||
@@ -41,7 +41,11 @@ struct mcb_bus { | |||
41 | char name[CHAMELEON_FILENAME_LEN + 1]; | 41 | char name[CHAMELEON_FILENAME_LEN + 1]; |
42 | int (*get_irq)(struct mcb_device *dev); | 42 | int (*get_irq)(struct mcb_device *dev); |
43 | }; | 43 | }; |
44 | #define to_mcb_bus(b) container_of((b), struct mcb_bus, dev) | 44 | |
45 | static inline struct mcb_bus *to_mcb_bus(struct device *dev) | ||
46 | { | ||
47 | return container_of(dev, struct mcb_bus, dev); | ||
48 | } | ||
45 | 49 | ||
46 | /** | 50 | /** |
47 | * struct mcb_device - MEN Chameleon Bus device | 51 | * struct mcb_device - MEN Chameleon Bus device |
@@ -77,7 +81,11 @@ struct mcb_device { | |||
77 | struct resource irq; | 81 | struct resource irq; |
78 | struct resource mem; | 82 | struct resource mem; |
79 | }; | 83 | }; |
80 | #define to_mcb_device(x) container_of((x), struct mcb_device, dev) | 84 | |
85 | static inline struct mcb_device *to_mcb_device(struct device *dev) | ||
86 | { | ||
87 | return container_of(dev, struct mcb_device, dev); | ||
88 | } | ||
81 | 89 | ||
82 | /** | 90 | /** |
83 | * struct mcb_driver - MEN Chameleon Bus device driver | 91 | * struct mcb_driver - MEN Chameleon Bus device driver |
@@ -95,7 +103,11 @@ struct mcb_driver { | |||
95 | void (*remove)(struct mcb_device *mdev); | 103 | void (*remove)(struct mcb_device *mdev); |
96 | void (*shutdown)(struct mcb_device *mdev); | 104 | void (*shutdown)(struct mcb_device *mdev); |
97 | }; | 105 | }; |
98 | #define to_mcb_driver(x) container_of((x), struct mcb_driver, driver) | 106 | |
107 | static inline struct mcb_driver *to_mcb_driver(struct device_driver *drv) | ||
108 | { | ||
109 | return container_of(drv, struct mcb_driver, driver); | ||
110 | } | ||
99 | 111 | ||
100 | static inline void *mcb_get_drvdata(struct mcb_device *dev) | 112 | static inline void *mcb_get_drvdata(struct mcb_device *dev) |
101 | { | 113 | { |