diff options
author | Cornelia Huck <cohuck@de.ibm.com> | 2005-08-08 12:22:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-08 14:49:57 -0400 |
commit | 66aea23ff84ca81bfaeaf7d63e248b873f5c2616 (patch) | |
tree | 1dfa4af1f8b33c7d7b069c407d9c37ddd1ecae32 /drivers/s390/net | |
parent | 8b83bc77bf77cc8459cb94e52b08e775104c4c48 (diff) |
[PATCH] s390: use klist in qeth driver
From: Martin Schwidesky <schwidefsky@de.ibm.com>
Convert qeth to the new klist interface and make it compiling again.
Signed-off-by: Frank Pavlic <pavlic@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/qeth_main.c | 24 | ||||
-rw-r--r-- | drivers/s390/net/qeth_proc.c | 126 |
2 files changed, 82 insertions, 68 deletions
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 8f4d2999af8e..79c74f3a11f5 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -8120,20 +8120,22 @@ static struct notifier_block qeth_ip6_notifier = { | |||
8120 | #endif | 8120 | #endif |
8121 | 8121 | ||
8122 | static int | 8122 | static int |
8123 | qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) | 8123 | __qeth_reboot_event_card(struct device *dev, void *data) |
8124 | { | 8124 | { |
8125 | |||
8126 | struct device *entry; | ||
8127 | struct qeth_card *card; | 8125 | struct qeth_card *card; |
8128 | 8126 | ||
8129 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 8127 | card = (struct qeth_card *) dev->driver_data; |
8130 | list_for_each_entry(entry, &qeth_ccwgroup_driver.driver.devices, | 8128 | qeth_clear_ip_list(card, 0, 0); |
8131 | driver_list) { | 8129 | qeth_qdio_clear_card(card, 0); |
8132 | card = (struct qeth_card *) entry->driver_data; | 8130 | return 0; |
8133 | qeth_clear_ip_list(card, 0, 0); | 8131 | } |
8134 | qeth_qdio_clear_card(card, 0); | 8132 | |
8135 | } | 8133 | static int |
8136 | up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 8134 | qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) |
8135 | { | ||
8136 | |||
8137 | driver_for_each_device(&qeth_ccwgroup_driver.driver, NULL, NULL, | ||
8138 | __qeth_reboot_event_card); | ||
8137 | return NOTIFY_DONE; | 8139 | return NOTIFY_DONE; |
8138 | } | 8140 | } |
8139 | 8141 | ||
diff --git a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c index 04719196fd20..f2ccfea8fdb8 100644 --- a/drivers/s390/net/qeth_proc.c +++ b/drivers/s390/net/qeth_proc.c | |||
@@ -27,23 +27,33 @@ const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; | |||
27 | #define QETH_PROCFILE_NAME "qeth" | 27 | #define QETH_PROCFILE_NAME "qeth" |
28 | static struct proc_dir_entry *qeth_procfile; | 28 | static struct proc_dir_entry *qeth_procfile; |
29 | 29 | ||
30 | static int | ||
31 | qeth_procfile_seq_match(struct device *dev, void *data) | ||
32 | { | ||
33 | return 1; | ||
34 | } | ||
35 | |||
30 | static void * | 36 | static void * |
31 | qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) | 37 | qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) |
32 | { | 38 | { |
33 | struct list_head *next_card = NULL; | 39 | struct device *dev; |
34 | int i = 0; | 40 | loff_t nr; |
35 | 41 | ||
36 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 42 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
37 | 43 | ||
38 | if (*offset == 0) | 44 | nr = *offset; |
45 | if (nr == 0) | ||
39 | return SEQ_START_TOKEN; | 46 | return SEQ_START_TOKEN; |
40 | 47 | ||
41 | /* get card at pos *offset */ | 48 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, |
42 | list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices) | 49 | NULL, qeth_procfile_seq_match); |
43 | if (++i == *offset) | ||
44 | return next_card; | ||
45 | 50 | ||
46 | return NULL; | 51 | /* get card at pos *offset */ |
52 | nr = *offset; | ||
53 | while (nr-- > 1 && dev) | ||
54 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, | ||
55 | NULL, qeth_procfile_seq_match); | ||
56 | return (void *) dev; | ||
47 | } | 57 | } |
48 | 58 | ||
49 | static void | 59 | static void |
@@ -55,23 +65,21 @@ qeth_procfile_seq_stop(struct seq_file *s, void* it) | |||
55 | static void * | 65 | static void * |
56 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 66 | qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
57 | { | 67 | { |
58 | struct list_head *next_card = NULL; | 68 | struct device *prev, *next; |
59 | struct list_head *current_card; | ||
60 | 69 | ||
61 | if (it == SEQ_START_TOKEN) { | 70 | if (it == SEQ_START_TOKEN) { |
62 | next_card = qeth_ccwgroup_driver.driver.devices.next; | 71 | next = driver_find_device(&qeth_ccwgroup_driver.driver, |
63 | if (next_card->next == next_card) /* list empty */ | 72 | NULL, NULL, qeth_procfile_seq_match); |
64 | return NULL; | 73 | if (next) |
65 | (*offset)++; | 74 | (*offset)++; |
66 | } else { | 75 | return (void *) next; |
67 | current_card = (struct list_head *)it; | ||
68 | if (current_card->next == &qeth_ccwgroup_driver.driver.devices) | ||
69 | return NULL; /* end of list reached */ | ||
70 | next_card = current_card->next; | ||
71 | (*offset)++; | ||
72 | } | 76 | } |
73 | 77 | prev = (struct device *) it; | |
74 | return next_card; | 78 | next = driver_find_device(&qeth_ccwgroup_driver.driver, |
79 | prev, NULL, qeth_procfile_seq_match); | ||
80 | if (next) | ||
81 | (*offset)++; | ||
82 | return (void *) next; | ||
75 | } | 83 | } |
76 | 84 | ||
77 | static inline const char * | 85 | static inline const char * |
@@ -126,7 +134,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it) | |||
126 | "-------------- ---- ------ ---------- ---- " | 134 | "-------------- ---- ------ ---------- ---- " |
127 | "---- ----- -----\n"); | 135 | "---- ----- -----\n"); |
128 | } else { | 136 | } else { |
129 | device = list_entry(it, struct device, driver_list); | 137 | device = (struct device *) it; |
130 | card = device->driver_data; | 138 | card = device->driver_data; |
131 | seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ", | 139 | seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ", |
132 | CARD_RDEV_ID(card), | 140 | CARD_RDEV_ID(card), |
@@ -180,17 +188,20 @@ static struct proc_dir_entry *qeth_perf_procfile; | |||
180 | static void * | 188 | static void * |
181 | qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) | 189 | qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) |
182 | { | 190 | { |
183 | struct list_head *next_card = NULL; | 191 | struct device *dev = NULL; |
184 | int i = 0; | 192 | int nr; |
185 | 193 | ||
186 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 194 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
187 | /* get card at pos *offset */ | 195 | /* get card at pos *offset */ |
188 | list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ | 196 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, |
189 | if (i == *offset) | 197 | qeth_procfile_seq_match); |
190 | return next_card; | 198 | |
191 | i++; | 199 | /* get card at pos *offset */ |
192 | } | 200 | nr = *offset; |
193 | return NULL; | 201 | while (nr-- > 1 && dev) |
202 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, | ||
203 | NULL, qeth_procfile_seq_match); | ||
204 | return (void *) dev; | ||
194 | } | 205 | } |
195 | 206 | ||
196 | static void | 207 | static void |
@@ -202,12 +213,14 @@ qeth_perf_procfile_seq_stop(struct seq_file *s, void* it) | |||
202 | static void * | 213 | static void * |
203 | qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 214 | qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
204 | { | 215 | { |
205 | struct list_head *current_card = (struct list_head *)it; | 216 | struct device *prev, *next; |
206 | 217 | ||
207 | if (current_card->next == &qeth_ccwgroup_driver.driver.devices) | 218 | prev = (struct device *) it; |
208 | return NULL; /* end of list reached */ | 219 | next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, |
209 | (*offset)++; | 220 | NULL, qeth_procfile_seq_match); |
210 | return current_card->next; | 221 | if (next) |
222 | (*offset)++; | ||
223 | return (void *) next; | ||
211 | } | 224 | } |
212 | 225 | ||
213 | static int | 226 | static int |
@@ -216,7 +229,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) | |||
216 | struct device *device; | 229 | struct device *device; |
217 | struct qeth_card *card; | 230 | struct qeth_card *card; |
218 | 231 | ||
219 | device = list_entry(it, struct device, driver_list); | 232 | device = (struct device *) it; |
220 | card = device->driver_data; | 233 | card = device->driver_data; |
221 | seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", | 234 | seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", |
222 | CARD_RDEV_ID(card), | 235 | CARD_RDEV_ID(card), |
@@ -318,8 +331,8 @@ static struct proc_dir_entry *qeth_ipato_procfile; | |||
318 | static void * | 331 | static void * |
319 | qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) | 332 | qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) |
320 | { | 333 | { |
321 | struct list_head *next_card = NULL; | 334 | struct device *dev; |
322 | int i = 0; | 335 | loff_t nr; |
323 | 336 | ||
324 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); | 337 | down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); |
325 | /* TODO: finish this */ | 338 | /* TODO: finish this */ |
@@ -328,13 +341,16 @@ qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) | |||
328 | * output driver settings then; | 341 | * output driver settings then; |
329 | * else output setting for respective card | 342 | * else output setting for respective card |
330 | */ | 343 | */ |
344 | |||
345 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL, | ||
346 | qeth_procfile_seq_match); | ||
347 | |||
331 | /* get card at pos *offset */ | 348 | /* get card at pos *offset */ |
332 | list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ | 349 | nr = *offset; |
333 | if (i == *offset) | 350 | while (nr-- > 1 && dev) |
334 | return next_card; | 351 | dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev, |
335 | i++; | 352 | NULL, qeth_procfile_seq_match); |
336 | } | 353 | return (void *) dev; |
337 | return NULL; | ||
338 | } | 354 | } |
339 | 355 | ||
340 | static void | 356 | static void |
@@ -346,18 +362,14 @@ qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it) | |||
346 | static void * | 362 | static void * |
347 | qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) | 363 | qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) |
348 | { | 364 | { |
349 | struct list_head *current_card = (struct list_head *)it; | 365 | struct device *prev, *next; |
350 | 366 | ||
351 | /* TODO: finish this */ | 367 | prev = (struct device *) it; |
352 | /* | 368 | next = driver_find_device(&qeth_ccwgroup_driver.driver, prev, |
353 | * maybe SEQ_SATRT_TOKEN can be returned for offset 0 | 369 | NULL, qeth_procfile_seq_match); |
354 | * output driver settings then; | 370 | if (next) |
355 | * else output setting for respective card | 371 | (*offset)++; |
356 | */ | 372 | return (void *) next; |
357 | if (current_card->next == &qeth_ccwgroup_driver.driver.devices) | ||
358 | return NULL; /* end of list reached */ | ||
359 | (*offset)++; | ||
360 | return current_card->next; | ||
361 | } | 373 | } |
362 | 374 | ||
363 | static int | 375 | static int |
@@ -372,7 +384,7 @@ qeth_ipato_procfile_seq_show(struct seq_file *s, void *it) | |||
372 | * output driver settings then; | 384 | * output driver settings then; |
373 | * else output setting for respective card | 385 | * else output setting for respective card |
374 | */ | 386 | */ |
375 | device = list_entry(it, struct device, driver_list); | 387 | device = (struct device *) it; |
376 | card = device->driver_data; | 388 | card = device->driver_data; |
377 | 389 | ||
378 | return 0; | 390 | return 0; |