diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2005-08-11 13:27:49 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 21:41:26 (GMT) |
commit | db2d0008de519c5db6baec45f7831e08790301cf (patch) | |
tree | f100b05ab42f54740b967a24ba07d79518337f8e /drivers/w1/w1.h | |
parent | 5e8eb8501212eb92826ccf191f9ca8c186f531c3 (diff) | |
download | linux-db2d0008de519c5db6baec45f7831e08790301cf.tar.xz |
[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 4f0a986..f830826 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 */ |