diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2005-08-11 09:27:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 17:41:26 -0400 |
commit | db2d0008de519c5db6baec45f7831e08790301cf (patch) | |
tree | f100b05ab42f54740b967a24ba07d79518337f8e /drivers/w1/w1.h | |
parent | 5e8eb8501212eb92826ccf191f9ca8c186f531c3 (diff) |
[PATCH] w1: Added inline functions on top of container_of().
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/w1.h')
-rw-r--r-- | drivers/w1/w1.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h index 4f0a986e33e3..f8308266d8d6 100644 --- a/drivers/w1/w1.h +++ b/drivers/w1/w1.h | |||
@@ -191,6 +191,21 @@ struct w1_master | |||
191 | int w1_create_master_attributes(struct w1_master *); | 191 | int w1_create_master_attributes(struct w1_master *); |
192 | void w1_search(struct w1_master *dev, w1_slave_found_callback cb); | 192 | void w1_search(struct w1_master *dev, w1_slave_found_callback cb); |
193 | 193 | ||
194 | static inline struct w1_slave* dev_to_w1_slave(struct device *dev) | ||
195 | { | ||
196 | return container_of(dev, struct w1_slave, dev); | ||
197 | } | ||
198 | |||
199 | static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj) | ||
200 | { | ||
201 | return dev_to_w1_slave(container_of(kobj, struct device, kobj)); | ||
202 | } | ||
203 | |||
204 | static inline struct w1_master* dev_to_w1_master(struct device *dev) | ||
205 | { | ||
206 | return container_of(dev, struct w1_master, dev); | ||
207 | } | ||
208 | |||
194 | #endif /* __KERNEL__ */ | 209 | #endif /* __KERNEL__ */ |
195 | 210 | ||
196 | #endif /* __W1_H */ | 211 | #endif /* __W1_H */ |