提交 66aea23f 编写于 作者: C Cornelia Huck 提交者: Linus Torvalds

[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: NFrank Pavlic <pavlic@de.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8b83bc77
...@@ -8120,20 +8120,22 @@ static struct notifier_block qeth_ip6_notifier = { ...@@ -8120,20 +8120,22 @@ static struct notifier_block qeth_ip6_notifier = {
#endif #endif
static int static int
qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) __qeth_reboot_event_card(struct device *dev, void *data)
{ {
struct device *entry;
struct qeth_card *card; struct qeth_card *card;
down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); card = (struct qeth_card *) dev->driver_data;
list_for_each_entry(entry, &qeth_ccwgroup_driver.driver.devices, qeth_clear_ip_list(card, 0, 0);
driver_list) { qeth_qdio_clear_card(card, 0);
card = (struct qeth_card *) entry->driver_data; return 0;
qeth_clear_ip_list(card, 0, 0); }
qeth_qdio_clear_card(card, 0);
} static int
up_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr)
{
driver_for_each_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
__qeth_reboot_event_card);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
...@@ -27,23 +27,33 @@ const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $"; ...@@ -27,23 +27,33 @@ const char *VERSION_QETH_PROC_C = "$Revision: 1.13 $";
#define QETH_PROCFILE_NAME "qeth" #define QETH_PROCFILE_NAME "qeth"
static struct proc_dir_entry *qeth_procfile; static struct proc_dir_entry *qeth_procfile;
static int
qeth_procfile_seq_match(struct device *dev, void *data)
{
return 1;
}
static void * static void *
qeth_procfile_seq_start(struct seq_file *s, loff_t *offset) qeth_procfile_seq_start(struct seq_file *s, loff_t *offset)
{ {
struct list_head *next_card = NULL; struct device *dev;
int i = 0; loff_t nr;
down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
if (*offset == 0) nr = *offset;
if (nr == 0)
return SEQ_START_TOKEN; return SEQ_START_TOKEN;
/* get card at pos *offset */ dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL,
list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices) NULL, qeth_procfile_seq_match);
if (++i == *offset)
return next_card;
return NULL; /* get card at pos *offset */
nr = *offset;
while (nr-- > 1 && dev)
dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
NULL, qeth_procfile_seq_match);
return (void *) dev;
} }
static void static void
...@@ -55,23 +65,21 @@ qeth_procfile_seq_stop(struct seq_file *s, void* it) ...@@ -55,23 +65,21 @@ qeth_procfile_seq_stop(struct seq_file *s, void* it)
static void * static void *
qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
{ {
struct list_head *next_card = NULL; struct device *prev, *next;
struct list_head *current_card;
if (it == SEQ_START_TOKEN) { if (it == SEQ_START_TOKEN) {
next_card = qeth_ccwgroup_driver.driver.devices.next; next = driver_find_device(&qeth_ccwgroup_driver.driver,
if (next_card->next == next_card) /* list empty */ NULL, NULL, qeth_procfile_seq_match);
return NULL; if (next)
(*offset)++; (*offset)++;
} else { return (void *) next;
current_card = (struct list_head *)it;
if (current_card->next == &qeth_ccwgroup_driver.driver.devices)
return NULL; /* end of list reached */
next_card = current_card->next;
(*offset)++;
} }
prev = (struct device *) it;
return next_card; next = driver_find_device(&qeth_ccwgroup_driver.driver,
prev, NULL, qeth_procfile_seq_match);
if (next)
(*offset)++;
return (void *) next;
} }
static inline const char * static inline const char *
...@@ -126,7 +134,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it) ...@@ -126,7 +134,7 @@ qeth_procfile_seq_show(struct seq_file *s, void *it)
"-------------- ---- ------ ---------- ---- " "-------------- ---- ------ ---------- ---- "
"---- ----- -----\n"); "---- ----- -----\n");
} else { } else {
device = list_entry(it, struct device, driver_list); device = (struct device *) it;
card = device->driver_data; card = device->driver_data;
seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ", seq_printf(s, "%s/%s/%s x%02X %-10s %-14s %-4i ",
CARD_RDEV_ID(card), CARD_RDEV_ID(card),
...@@ -180,17 +188,20 @@ static struct proc_dir_entry *qeth_perf_procfile; ...@@ -180,17 +188,20 @@ static struct proc_dir_entry *qeth_perf_procfile;
static void * static void *
qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset) qeth_perf_procfile_seq_start(struct seq_file *s, loff_t *offset)
{ {
struct list_head *next_card = NULL; struct device *dev = NULL;
int i = 0; int nr;
down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
/* get card at pos *offset */ /* get card at pos *offset */
list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
if (i == *offset) qeth_procfile_seq_match);
return next_card;
i++; /* get card at pos *offset */
} nr = *offset;
return NULL; while (nr-- > 1 && dev)
dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
NULL, qeth_procfile_seq_match);
return (void *) dev;
} }
static void static void
...@@ -202,12 +213,14 @@ qeth_perf_procfile_seq_stop(struct seq_file *s, void* it) ...@@ -202,12 +213,14 @@ qeth_perf_procfile_seq_stop(struct seq_file *s, void* it)
static void * static void *
qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) qeth_perf_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
{ {
struct list_head *current_card = (struct list_head *)it; struct device *prev, *next;
if (current_card->next == &qeth_ccwgroup_driver.driver.devices) prev = (struct device *) it;
return NULL; /* end of list reached */ next = driver_find_device(&qeth_ccwgroup_driver.driver, prev,
(*offset)++; NULL, qeth_procfile_seq_match);
return current_card->next; if (next)
(*offset)++;
return (void *) next;
} }
static int static int
...@@ -216,7 +229,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it) ...@@ -216,7 +229,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it)
struct device *device; struct device *device;
struct qeth_card *card; struct qeth_card *card;
device = list_entry(it, struct device, driver_list); device = (struct device *) it;
card = device->driver_data; card = device->driver_data;
seq_printf(s, "For card with devnos %s/%s/%s (%s):\n", seq_printf(s, "For card with devnos %s/%s/%s (%s):\n",
CARD_RDEV_ID(card), CARD_RDEV_ID(card),
...@@ -318,8 +331,8 @@ static struct proc_dir_entry *qeth_ipato_procfile; ...@@ -318,8 +331,8 @@ static struct proc_dir_entry *qeth_ipato_procfile;
static void * static void *
qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset)
{ {
struct list_head *next_card = NULL; struct device *dev;
int i = 0; loff_t nr;
down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem); down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
/* TODO: finish this */ /* TODO: finish this */
...@@ -328,13 +341,16 @@ qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset) ...@@ -328,13 +341,16 @@ qeth_ipato_procfile_seq_start(struct seq_file *s, loff_t *offset)
* output driver settings then; * output driver settings then;
* else output setting for respective card * else output setting for respective card
*/ */
dev = driver_find_device(&qeth_ccwgroup_driver.driver, NULL, NULL,
qeth_procfile_seq_match);
/* get card at pos *offset */ /* get card at pos *offset */
list_for_each(next_card, &qeth_ccwgroup_driver.driver.devices){ nr = *offset;
if (i == *offset) while (nr-- > 1 && dev)
return next_card; dev = driver_find_device(&qeth_ccwgroup_driver.driver, dev,
i++; NULL, qeth_procfile_seq_match);
} return (void *) dev;
return NULL;
} }
static void static void
...@@ -346,18 +362,14 @@ qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it) ...@@ -346,18 +362,14 @@ qeth_ipato_procfile_seq_stop(struct seq_file *s, void* it)
static void * static void *
qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset) qeth_ipato_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
{ {
struct list_head *current_card = (struct list_head *)it; struct device *prev, *next;
/* TODO: finish this */ prev = (struct device *) it;
/* next = driver_find_device(&qeth_ccwgroup_driver.driver, prev,
* maybe SEQ_SATRT_TOKEN can be returned for offset 0 NULL, qeth_procfile_seq_match);
* output driver settings then; if (next)
* else output setting for respective card (*offset)++;
*/ return (void *) next;
if (current_card->next == &qeth_ccwgroup_driver.driver.devices)
return NULL; /* end of list reached */
(*offset)++;
return current_card->next;
} }
static int static int
...@@ -372,7 +384,7 @@ qeth_ipato_procfile_seq_show(struct seq_file *s, void *it) ...@@ -372,7 +384,7 @@ qeth_ipato_procfile_seq_show(struct seq_file *s, void *it)
* output driver settings then; * output driver settings then;
* else output setting for respective card * else output setting for respective card
*/ */
device = list_entry(it, struct device, driver_list); device = (struct device *) it;
card = device->driver_data; card = device->driver_data;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册