summaryrefslogtreecommitdiffstats
path: root/drivers/w1/w1.h
diff options
context:
space:
mode:
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>2005-08-11 17:27:49 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 14:41:26 -0700
commitdb2d0008de519c5db6baec45f7831e08790301cf (patch)
treef100b05ab42f54740b967a24ba07d79518337f8e /drivers/w1/w1.h
parent5e8eb8501212eb92826ccf191f9ca8c186f531c3 (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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/w1/w1.h b/drivers/w1/w1.h
index 4f0a986e33e..f8308266d8d 100644
--- a/drivers/w1/w1.h
+++ b/drivers/w1/w1.h
@@ -191,6 +191,21 @@ struct w1_master
int w1_create_master_attributes(struct w1_master *);
void w1_search(struct w1_master *dev, w1_slave_found_callback cb);
+static inline struct w1_slave* dev_to_w1_slave(struct device *dev)
+{
+ return container_of(dev, struct w1_slave, dev);
+}
+
+static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
+{
+ return dev_to_w1_slave(container_of(kobj, struct device, kobj));
+}
+
+static inline struct w1_master* dev_to_w1_master(struct device *dev)
+{
+ return container_of(dev, struct w1_master, dev);
+}
+
#endif /* __KERNEL__ */
#endif /* __W1_H */