aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Crosser <Eugene.Crosser@ru.ibm.com>2015-01-16 08:05:47 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-17 23:54:59 -0500
commitc3521254b16dbd270e194f81aa2cbdbcd6cc9f18 (patch)
tree3cf4eee432adc7f9e35c88b32f93185005eceab3
parentb646c08e12c1879e1cfb94d3875e62024b706c4a (diff)
qeth: use qeth_card_hw_is_reachable() everywhere
qeth_card_hw_is_reachable() was introduced as part of a new functionality, but it is a useful abstraction that can replace verbose checks througout the rest of the `qeth` driver. Signed-off-by: Eugene Crosser <Eugene.Crosser@ru.ibm.com> Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Reviewed-by: Thomas-Mich Richter <tmricht@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/s390/net/qeth_core_sys.c7
-rw-r--r--drivers/s390/net/qeth_l2_main.c6
-rw-r--r--drivers/s390/net/qeth_l3_main.c7
-rw-r--r--drivers/s390/net/qeth_l3_sys.c3
4 files changed, 8 insertions, 15 deletions
diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 15523f0e4c03..8c76574e7270 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -531,8 +531,7 @@ static ssize_t qeth_dev_isolation_store(struct device *dev,
531 /* defer IP assist if device is offline (until discipline->set_online)*/ 531 /* defer IP assist if device is offline (until discipline->set_online)*/
532 card->options.prev_isolation = card->options.isolation; 532 card->options.prev_isolation = card->options.isolation;
533 card->options.isolation = isolation; 533 card->options.isolation = isolation;
534 if (card->state == CARD_STATE_SOFTSETUP || 534 if (qeth_card_hw_is_reachable(card)) {
535 card->state == CARD_STATE_UP) {
536 int ipa_rc = qeth_set_access_ctrl_online(card, 1); 535 int ipa_rc = qeth_set_access_ctrl_online(card, 1);
537 if (ipa_rc != 0) 536 if (ipa_rc != 0)
538 rc = ipa_rc; 537 rc = ipa_rc;
@@ -555,7 +554,7 @@ static ssize_t qeth_dev_switch_attrs_show(struct device *dev,
555 if (!card) 554 if (!card)
556 return -EINVAL; 555 return -EINVAL;
557 556
558 if (card->state != CARD_STATE_SOFTSETUP && card->state != CARD_STATE_UP) 557 if (!qeth_card_hw_is_reachable(card))
559 return sprintf(buf, "n/a\n"); 558 return sprintf(buf, "n/a\n");
560 559
561 rc = qeth_query_switch_attributes(card, &sw_info); 560 rc = qeth_query_switch_attributes(card, &sw_info);
@@ -606,7 +605,7 @@ static ssize_t qeth_hw_trap_store(struct device *dev,
606 return -EINVAL; 605 return -EINVAL;
607 606
608 mutex_lock(&card->conf_mutex); 607 mutex_lock(&card->conf_mutex);
609 if (card->state == CARD_STATE_SOFTSETUP || card->state == CARD_STATE_UP) 608 if (qeth_card_hw_is_reachable(card))
610 state = 1; 609 state = 1;
611 tmp = strsep(&curtoken, "\n"); 610 tmp = strsep(&curtoken, "\n");
612 611
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index d02cd1a67943..f5f409d85295 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -48,8 +48,7 @@ static int qeth_l2_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
48 if (!card) 48 if (!card)
49 return -ENODEV; 49 return -ENODEV;
50 50
51 if ((card->state != CARD_STATE_UP) && 51 if (!qeth_card_hw_is_reachable(card))
52 (card->state != CARD_STATE_SOFTSETUP))
53 return -ENODEV; 52 return -ENODEV;
54 53
55 if (card->info.type == QETH_CARD_TYPE_OSN) 54 if (card->info.type == QETH_CARD_TYPE_OSN)
@@ -1344,8 +1343,7 @@ int qeth_osn_assist(struct net_device *dev, void *data, int data_len)
1344 if (!card) 1343 if (!card)
1345 return -ENODEV; 1344 return -ENODEV;
1346 QETH_CARD_TEXT(card, 2, "osnsdmc"); 1345 QETH_CARD_TEXT(card, 2, "osnsdmc");
1347 if ((card->state != CARD_STATE_UP) && 1346 if (!qeth_card_hw_is_reachable(card))
1348 (card->state != CARD_STATE_SOFTSETUP))
1349 return -ENODEV; 1347 return -ENODEV;
1350 iob = qeth_wait_for_buffer(&card->write); 1348 iob = qeth_wait_for_buffer(&card->write);
1351 memcpy(iob->data+IPA_PDU_HEADER_SIZE, data, data_len); 1349 memcpy(iob->data+IPA_PDU_HEADER_SIZE, data, data_len);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index dd4ab8d73d34..1432b10e95ad 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -432,10 +432,8 @@ void qeth_l3_set_ip_addr_list(struct qeth_card *card)
432 QETH_CARD_TEXT(card, 2, "sdiplist"); 432 QETH_CARD_TEXT(card, 2, "sdiplist");
433 QETH_CARD_HEX(card, 2, &card, sizeof(void *)); 433 QETH_CARD_HEX(card, 2, &card, sizeof(void *));
434 434
435 if ((card->state != CARD_STATE_UP && 435 if (!qeth_card_hw_is_reachable(card) || card->options.sniffer)
436 card->state != CARD_STATE_SOFTSETUP) || card->options.sniffer) {
437 return; 436 return;
438 }
439 437
440 spin_lock_irqsave(&card->ip_lock, flags); 438 spin_lock_irqsave(&card->ip_lock, flags);
441 tbd_list = card->ip_tbd_list; 439 tbd_list = card->ip_tbd_list;
@@ -2626,8 +2624,7 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2626 if (!card) 2624 if (!card)
2627 return -ENODEV; 2625 return -ENODEV;
2628 2626
2629 if ((card->state != CARD_STATE_UP) && 2627 if (!qeth_card_hw_is_reachable(card))
2630 (card->state != CARD_STATE_SOFTSETUP))
2631 return -ENODEV; 2628 return -ENODEV;
2632 2629
2633 switch (cmd) { 2630 switch (cmd) {
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index adef5f5de118..c4dcd667c894 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -78,8 +78,7 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card,
78 rc = -EINVAL; 78 rc = -EINVAL;
79 goto out; 79 goto out;
80 } 80 }
81 if (((card->state == CARD_STATE_SOFTSETUP) || 81 if (qeth_card_hw_is_reachable(card) &&
82 (card->state == CARD_STATE_UP)) &&
83 (old_route_type != route->type)) { 82 (old_route_type != route->type)) {
84 if (prot == QETH_PROT_IPV4) 83 if (prot == QETH_PROT_IPV4)
85 rc = qeth_l3_setrouting_v4(card); 84 rc = qeth_l3_setrouting_v4(card);