Commit d7d18da1 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: remove card list

Re-implement the card-by-RDEV lookup by using device model concepts, and
remove the now redundant list of all qeth card instances in the system.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 81ec5439
...@@ -774,7 +774,6 @@ struct qeth_switch_info { ...@@ -774,7 +774,6 @@ struct qeth_switch_info {
#define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT #define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT
struct qeth_card { struct qeth_card {
struct list_head list;
enum qeth_card_states state; enum qeth_card_states state;
spinlock_t lock; spinlock_t lock;
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
...@@ -826,11 +825,6 @@ struct qeth_card { ...@@ -826,11 +825,6 @@ struct qeth_card {
struct work_struct close_dev_work; struct work_struct close_dev_work;
}; };
struct qeth_card_list_struct {
struct list_head list;
rwlock_t rwlock;
};
struct qeth_trap_id { struct qeth_trap_id {
__u16 lparnr; __u16 lparnr;
char vmname[8]; char vmname[8];
...@@ -977,11 +971,11 @@ int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); ...@@ -977,11 +971,11 @@ int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id);
void qeth_core_free_discipline(struct qeth_card *); void qeth_core_free_discipline(struct qeth_card *);
/* exports for qeth discipline device drivers */ /* exports for qeth discipline device drivers */
extern struct qeth_card_list_struct qeth_core_card_list;
extern struct kmem_cache *qeth_core_header_cache; extern struct kmem_cache *qeth_core_header_cache;
extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS];
struct net_device *qeth_clone_netdev(struct net_device *orig); struct net_device *qeth_clone_netdev(struct net_device *orig);
struct qeth_card *qeth_get_card_by_busid(char *bus_id);
void qeth_set_recovery_task(struct qeth_card *); void qeth_set_recovery_task(struct qeth_card *);
void qeth_clear_recovery_task(struct qeth_card *); void qeth_clear_recovery_task(struct qeth_card *);
void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int);
......
...@@ -54,8 +54,6 @@ struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS] = { ...@@ -54,8 +54,6 @@ struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS] = {
}; };
EXPORT_SYMBOL_GPL(qeth_dbf); EXPORT_SYMBOL_GPL(qeth_dbf);
struct qeth_card_list_struct qeth_core_card_list;
EXPORT_SYMBOL_GPL(qeth_core_card_list);
struct kmem_cache *qeth_core_header_cache; struct kmem_cache *qeth_core_header_cache;
EXPORT_SYMBOL_GPL(qeth_core_header_cache); EXPORT_SYMBOL_GPL(qeth_core_header_cache);
static struct kmem_cache *qeth_qdio_outbuf_cache; static struct kmem_cache *qeth_qdio_outbuf_cache;
...@@ -5806,9 +5804,6 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) ...@@ -5806,9 +5804,6 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
break; break;
} }
write_lock_irq(&qeth_core_card_list.rwlock);
list_add_tail(&card->list, &qeth_core_card_list.list);
write_unlock_irq(&qeth_core_card_list.rwlock);
return 0; return 0;
err_disc: err_disc:
...@@ -5833,9 +5828,6 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev) ...@@ -5833,9 +5828,6 @@ static void qeth_core_remove_device(struct ccwgroup_device *gdev)
qeth_core_free_discipline(card); qeth_core_free_discipline(card);
} }
write_lock_irq(&qeth_core_card_list.rwlock);
list_del(&card->list);
write_unlock_irq(&qeth_core_card_list.rwlock);
free_netdev(card->dev); free_netdev(card->dev);
qeth_core_free_card(card); qeth_core_free_card(card);
put_device(&gdev->dev); put_device(&gdev->dev);
...@@ -5950,6 +5942,21 @@ static struct ccwgroup_driver qeth_core_ccwgroup_driver = { ...@@ -5950,6 +5942,21 @@ static struct ccwgroup_driver qeth_core_ccwgroup_driver = {
.restore = qeth_core_restore, .restore = qeth_core_restore,
}; };
struct qeth_card *qeth_get_card_by_busid(char *bus_id)
{
struct ccwgroup_device *gdev;
struct qeth_card *card;
gdev = get_ccwgroupdev_by_busid(&qeth_core_ccwgroup_driver, bus_id);
if (!gdev)
return NULL;
card = dev_get_drvdata(&gdev->dev);
put_device(&gdev->dev);
return card;
}
EXPORT_SYMBOL_GPL(qeth_get_card_by_busid);
int qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) int qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct qeth_card *card = dev->ml_priv; struct qeth_card *card = dev->ml_priv;
...@@ -6688,8 +6695,6 @@ static int __init qeth_core_init(void) ...@@ -6688,8 +6695,6 @@ static int __init qeth_core_init(void)
int rc; int rc;
pr_info("loading core functions\n"); pr_info("loading core functions\n");
INIT_LIST_HEAD(&qeth_core_card_list.list);
rwlock_init(&qeth_core_card_list.rwlock);
qeth_wq = create_singlethread_workqueue("qeth_wq"); qeth_wq = create_singlethread_workqueue("qeth_wq");
if (!qeth_wq) { if (!qeth_wq) {
......
...@@ -36,28 +36,6 @@ static void qeth_l2_vnicc_init(struct qeth_card *card); ...@@ -36,28 +36,6 @@ static void qeth_l2_vnicc_init(struct qeth_card *card);
static bool qeth_l2_vnicc_recover_timeout(struct qeth_card *card, u32 vnicc, static bool qeth_l2_vnicc_recover_timeout(struct qeth_card *card, u32 vnicc,
u32 *timeout); u32 *timeout);
static struct net_device *qeth_l2_netdev_by_devno(unsigned char *read_dev_no)
{
struct qeth_card *card;
struct net_device *ndev;
__u16 temp_dev_no;
unsigned long flags;
struct ccw_dev_id read_devid;
ndev = NULL;
memcpy(&temp_dev_no, read_dev_no, 2);
read_lock_irqsave(&qeth_core_card_list.rwlock, flags);
list_for_each_entry(card, &qeth_core_card_list.list, list) {
ccw_device_get_id(CARD_RDEV(card), &read_devid);
if (read_devid.devno == temp_dev_no) {
ndev = card->dev;
break;
}
}
read_unlock_irqrestore(&qeth_core_card_list.rwlock, flags);
return ndev;
}
static int qeth_setdelmac_makerc(struct qeth_card *card, int retcode) static int qeth_setdelmac_makerc(struct qeth_card *card, int retcode)
{ {
int rc; int rc;
...@@ -1286,13 +1264,16 @@ int qeth_osn_register(unsigned char *read_dev_no, struct net_device **dev, ...@@ -1286,13 +1264,16 @@ int qeth_osn_register(unsigned char *read_dev_no, struct net_device **dev,
int (*data_cb)(struct sk_buff *)) int (*data_cb)(struct sk_buff *))
{ {
struct qeth_card *card; struct qeth_card *card;
char bus_id[16];
u16 devno;
*dev = qeth_l2_netdev_by_devno(read_dev_no); memcpy(&devno, read_dev_no, 2);
if (*dev == NULL) sprintf(bus_id, "0.0.%04x", devno);
return -ENODEV; card = qeth_get_card_by_busid(bus_id);
card = (*dev)->ml_priv; if (!card || !IS_OSN(card))
if (!card)
return -ENODEV; return -ENODEV;
*dev = card->dev;
QETH_CARD_TEXT(card, 2, "osnreg"); QETH_CARD_TEXT(card, 2, "osnreg");
if ((assist_cb == NULL) || (data_cb == NULL)) if ((assist_cb == NULL) || (data_cb == NULL))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment