diff options
author | Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 2005-05-20 14:33:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-22 00:43:09 -0400 |
commit | 7785925dd8e0d2f389d4a9168f1683c6b249a552 (patch) | |
tree | 5772979184dc9e2b811503fab6ed1119f5c9f93a /drivers/w1/w1_int.c | |
parent | 85e941cc9f10316080a16b121d24d329e5c2a65d (diff) |
[PATCH] w1: cleanups.
- white space changes.
- list_for_each_entry/list_for_each_entry_safe and reverse changes.
- small coding style changes.
- removed redundant NULL checks.
- use attribute group and macros instead of direct device attributes.
Patch is havily based on work from Adrian Bunk and Dmitry Torokhov,
thanks guys.
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/w1/w1_int.c')
-rw-r--r-- | drivers/w1/w1_int.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c index 5f0bafbbd57..ce24e3b3fc2 100644 --- a/drivers/w1/w1_int.c +++ b/drivers/w1/w1_int.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * w1_int.c | 2 | * w1_int.c |
3 | * | 3 | * |
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | 4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -39,8 +39,9 @@ extern spinlock_t w1_mlock; | |||
39 | 39 | ||
40 | extern int w1_process(void *); | 40 | extern int w1_process(void *); |
41 | 41 | ||
42 | struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | 42 | static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, |
43 | struct device_driver *driver, struct device *device) | 43 | struct device_driver *driver, |
44 | struct device *device) | ||
44 | { | 45 | { |
45 | struct w1_master *dev; | 46 | struct w1_master *dev; |
46 | int err; | 47 | int err; |
@@ -60,13 +61,13 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
60 | 61 | ||
61 | dev->bus_master = (struct w1_bus_master *)(dev + 1); | 62 | dev->bus_master = (struct w1_bus_master *)(dev + 1); |
62 | 63 | ||
63 | dev->owner = THIS_MODULE; | 64 | dev->owner = THIS_MODULE; |
64 | dev->max_slave_count = slave_count; | 65 | dev->max_slave_count = slave_count; |
65 | dev->slave_count = 0; | 66 | dev->slave_count = 0; |
66 | dev->attempts = 0; | 67 | dev->attempts = 0; |
67 | dev->kpid = -1; | 68 | dev->kpid = -1; |
68 | dev->initialized = 0; | 69 | dev->initialized = 0; |
69 | dev->id = id; | 70 | dev->id = id; |
70 | dev->slave_ttl = slave_ttl; | 71 | dev->slave_ttl = slave_ttl; |
71 | 72 | ||
72 | atomic_set(&dev->refcnt, 2); | 73 | atomic_set(&dev->refcnt, 2); |
@@ -105,7 +106,7 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, | |||
105 | return dev; | 106 | return dev; |
106 | } | 107 | } |
107 | 108 | ||
108 | void w1_free_dev(struct w1_master *dev) | 109 | static void w1_free_dev(struct w1_master *dev) |
109 | { | 110 | { |
110 | device_unregister(&dev->dev); | 111 | device_unregister(&dev->dev); |
111 | if (dev->nls && dev->nls->sk_socket) | 112 | if (dev->nls && dev->nls->sk_socket) |
@@ -197,10 +198,8 @@ void __w1_remove_master_device(struct w1_master *dev) | |||
197 | void w1_remove_master_device(struct w1_bus_master *bm) | 198 | void w1_remove_master_device(struct w1_bus_master *bm) |
198 | { | 199 | { |
199 | struct w1_master *dev = NULL; | 200 | struct w1_master *dev = NULL; |
200 | struct list_head *ent, *n; | ||
201 | 201 | ||
202 | list_for_each_safe(ent, n, &w1_masters) { | 202 | list_for_each_entry(dev, &w1_masters, w1_master_entry) { |
203 | dev = list_entry(ent, struct w1_master, w1_master_entry); | ||
204 | if (!dev->initialized) | 203 | if (!dev->initialized) |
205 | continue; | 204 | continue; |
206 | 205 | ||