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.c | |
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.c')
-rw-r--r-- | drivers/w1/w1.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index b2fe0f7b0b7c..39888af6d33d 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -89,15 +89,13 @@ static int w1_master_remove(struct device *dev) | |||
89 | 89 | ||
90 | static void w1_master_release(struct device *dev) | 90 | static void w1_master_release(struct device *dev) |
91 | { | 91 | { |
92 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 92 | struct w1_master *md = dev_to_w1_master(dev); |
93 | |||
94 | complete(&md->dev_released); | 93 | complete(&md->dev_released); |
95 | } | 94 | } |
96 | 95 | ||
97 | static void w1_slave_release(struct device *dev) | 96 | static void w1_slave_release(struct device *dev) |
98 | { | 97 | { |
99 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 98 | struct w1_slave *sl = dev_to_w1_slave(dev); |
100 | |||
101 | complete(&sl->dev_released); | 99 | complete(&sl->dev_released); |
102 | } | 100 | } |
103 | 101 | ||
@@ -162,7 +160,7 @@ struct device w1_slave_device = { | |||
162 | 160 | ||
163 | static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf) | 161 | static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf) |
164 | { | 162 | { |
165 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 163 | struct w1_master *md = dev_to_w1_master(dev); |
166 | ssize_t count; | 164 | ssize_t count; |
167 | 165 | ||
168 | if (down_interruptible (&md->mutex)) | 166 | if (down_interruptible (&md->mutex)) |
@@ -179,7 +177,7 @@ static ssize_t w1_master_attribute_store_search(struct device * dev, | |||
179 | struct device_attribute *attr, | 177 | struct device_attribute *attr, |
180 | const char * buf, size_t count) | 178 | const char * buf, size_t count) |
181 | { | 179 | { |
182 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 180 | struct w1_master *md = dev_to_w1_master(dev); |
183 | 181 | ||
184 | if (down_interruptible (&md->mutex)) | 182 | if (down_interruptible (&md->mutex)) |
185 | return -EBUSY; | 183 | return -EBUSY; |
@@ -195,7 +193,7 @@ static ssize_t w1_master_attribute_show_search(struct device *dev, | |||
195 | struct device_attribute *attr, | 193 | struct device_attribute *attr, |
196 | char *buf) | 194 | char *buf) |
197 | { | 195 | { |
198 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 196 | struct w1_master *md = dev_to_w1_master(dev); |
199 | ssize_t count; | 197 | ssize_t count; |
200 | 198 | ||
201 | if (down_interruptible (&md->mutex)) | 199 | if (down_interruptible (&md->mutex)) |
@@ -210,7 +208,7 @@ static ssize_t w1_master_attribute_show_search(struct device *dev, | |||
210 | 208 | ||
211 | static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct device_attribute *attr, char *buf) | 209 | static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct device_attribute *attr, char *buf) |
212 | { | 210 | { |
213 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 211 | struct w1_master *md = dev_to_w1_master(dev); |
214 | ssize_t count; | 212 | ssize_t count; |
215 | 213 | ||
216 | if (down_interruptible(&md->mutex)) | 214 | if (down_interruptible(&md->mutex)) |
@@ -231,7 +229,7 @@ static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct devic | |||
231 | 229 | ||
232 | static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, struct device_attribute *attr, char *buf) | 230 | static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, struct device_attribute *attr, char *buf) |
233 | { | 231 | { |
234 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 232 | struct w1_master *md = dev_to_w1_master(dev); |
235 | ssize_t count; | 233 | ssize_t count; |
236 | 234 | ||
237 | if (down_interruptible(&md->mutex)) | 235 | if (down_interruptible(&md->mutex)) |
@@ -245,7 +243,7 @@ static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, stru | |||
245 | 243 | ||
246 | static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct device_attribute *attr, char *buf) | 244 | static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct device_attribute *attr, char *buf) |
247 | { | 245 | { |
248 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 246 | struct w1_master *md = dev_to_w1_master(dev); |
249 | ssize_t count; | 247 | ssize_t count; |
250 | 248 | ||
251 | if (down_interruptible(&md->mutex)) | 249 | if (down_interruptible(&md->mutex)) |
@@ -259,7 +257,7 @@ static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct devi | |||
259 | 257 | ||
260 | static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct device_attribute *attr, char *buf) | 258 | static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct device_attribute *attr, char *buf) |
261 | { | 259 | { |
262 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 260 | struct w1_master *md = dev_to_w1_master(dev); |
263 | ssize_t count; | 261 | ssize_t count; |
264 | 262 | ||
265 | if (down_interruptible(&md->mutex)) | 263 | if (down_interruptible(&md->mutex)) |
@@ -273,7 +271,7 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct d | |||
273 | 271 | ||
274 | static ssize_t w1_master_attribute_show_slaves(struct device *dev, struct device_attribute *attr, char *buf) | 272 | static ssize_t w1_master_attribute_show_slaves(struct device *dev, struct device_attribute *attr, char *buf) |
275 | { | 273 | { |
276 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 274 | struct w1_master *md = dev_to_w1_master(dev); |
277 | int c = PAGE_SIZE; | 275 | int c = PAGE_SIZE; |
278 | 276 | ||
279 | if (down_interruptible(&md->mutex)) | 277 | if (down_interruptible(&md->mutex)) |