netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julian Wiedmann <jwi@linux.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-s390@vger.kernel.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Stefan Raspl <raspl@linux.ibm.com>,
	Ursula Braun <ubraun@linux.ibm.com>,
	Julian Wiedmann <jwi@linux.ibm.com>
Subject: [PATCH net-next 03/13] s390/qeth: simplify DOWN state handling
Date: Tue, 11 Jun 2019 18:37:50 +0200	[thread overview]
Message-ID: <20190611163800.64730-4-jwi@linux.ibm.com> (raw)
In-Reply-To: <20190611163800.64730-1-jwi@linux.ibm.com>

When the tear down sequence in qeth_l?_stop_card() has finished, the
card is guaranteed to be in DOWN state and we don't have to check for
it again.
With this insight we can also remove the redundant setting of
card->state in qeth_l?_set_online()'s error path.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 7 ++-----
 drivers/s390/net/qeth_l3_main.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index ff8a6cd790b1..40e2f6bd0f09 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -292,11 +292,9 @@ static void qeth_l2_stop_card(struct qeth_card *card)
 		qeth_clear_working_pool_list(card);
 		card->state = CARD_STATE_DOWN;
 	}
-	if (card->state == CARD_STATE_DOWN) {
-		qeth_clear_cmd_buffers(&card->read);
-		qeth_clear_cmd_buffers(&card->write);
-	}
 
+	qeth_clear_cmd_buffers(&card->read);
+	qeth_clear_cmd_buffers(&card->write);
 	flush_workqueue(card->event_wq);
 	card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED;
 }
@@ -882,7 +880,6 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev)
 	ccw_device_set_offline(CARD_WDEV(card));
 	ccw_device_set_offline(CARD_RDEV(card));
 	qdio_free(CARD_DDEV(card));
-	card->state = CARD_STATE_DOWN;
 
 	mutex_unlock(&card->conf_mutex);
 	mutex_unlock(&card->discipline_mutex);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 13bf3e2e9cea..99ca38164b99 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1436,11 +1436,9 @@ static void qeth_l3_stop_card(struct qeth_card *card)
 		qeth_clear_working_pool_list(card);
 		card->state = CARD_STATE_DOWN;
 	}
-	if (card->state == CARD_STATE_DOWN) {
-		qeth_clear_cmd_buffers(&card->read);
-		qeth_clear_cmd_buffers(&card->write);
-	}
 
+	qeth_clear_cmd_buffers(&card->read);
+	qeth_clear_cmd_buffers(&card->write);
 	flush_workqueue(card->event_wq);
 }
 
@@ -2420,7 +2418,6 @@ static int qeth_l3_set_online(struct ccwgroup_device *gdev)
 	ccw_device_set_offline(CARD_WDEV(card));
 	ccw_device_set_offline(CARD_RDEV(card));
 	qdio_free(CARD_DDEV(card));
-	card->state = CARD_STATE_DOWN;
 
 	mutex_unlock(&card->conf_mutex);
 	mutex_unlock(&card->discipline_mutex);
-- 
2.17.1


  parent reply	other threads:[~2019-06-11 16:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 16:37 [PATCH net-next 00/13] s390/qeth: updates 2019-06-11 Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 01/13] s390/qeth: don't mask TX errors on IQD devices Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 02/13] s390/qeth: use mm helpers Julian Wiedmann
2019-06-11 16:37 ` Julian Wiedmann [this message]
2019-06-11 16:37 ` [PATCH net-next 04/13] s390/qeth: restart pending READ cmd from callback Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 05/13] s390/qeth: clean up setting of BLKT defaults Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 06/13] s390/qeth: remove qeth_wait_for_buffer() Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 07/13] s390/qeth: remove OSN-specific IO code Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 08/13] s390/qeth: convert device-specific trace entries Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 09/13] s390/qeth: remove 'channel' parameter from callbacks Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 10/13] s390/qeth: add support for dynamically allocated cmds Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 11/13] s390/qeth: convert RCD code to common IO infrastructure Julian Wiedmann
2019-06-11 16:37 ` [PATCH net-next 12/13] s390/qeth: command-chain the IDX sequence Julian Wiedmann
2019-06-11 16:38 ` [PATCH net-next 13/13] s390/qeth: allocate a single cmd on read channel Julian Wiedmann
2019-06-14  5:41 ` [PATCH net-next 00/13] s390/qeth: updates 2019-06-11 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190611163800.64730-4-jwi@linux.ibm.com \
    --to=jwi@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raspl@linux.ibm.com \
    --cc=ubraun@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).