[PATCH 2/2] s390: qeth: Avoid unneeded command name lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While it is generally a good practice to store the result of a lookup
function in a local variable if you need it more than once, in this
specific case it is not such a good idea because both uses are
conditional (one depends on an error, the other on debugging). On top
of that, they are mutually exclusive, so in the worst case the result
of the lookup function will only be used once anyway.

So better call qeth_get_ipa_cmd_name() where it is needed, so that in
the best (and most frequent) case it is never called at all. It
should improve the qeth driver performance a little bit.

Signed-off-by: Jean Delvare <jdelvare@xxxxxxx>
Cc: Julian Wiedmann <jwi@xxxxxxxxxxxxx>
Cc: Ursula Braun <ubraun@xxxxxxxxxxxxx>
Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
---
Note: build-tested only.

 drivers/s390/net/qeth_core_main.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- linux-4.19-rc2.orig/drivers/s390/net/qeth_core_main.c	2018-09-08 15:19:47.225337133 +0200
+++ linux-4.19-rc2/drivers/s390/net/qeth_core_main.c	2018-09-10 10:41:15.552350012 +0200
@@ -609,18 +609,19 @@ static void qeth_put_reply(struct qeth_r
 static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc,
 		struct qeth_card *card)
 {
-	const char *ipa_name;
 	int com = cmd->hdr.command;
-	ipa_name = qeth_get_ipa_cmd_name(com);
+
 	if (rc)
 		QETH_DBF_MESSAGE(2, "IPA: %s(x%X) for %s/%s returned "
 				"x%X \"%s\"\n",
-				ipa_name, com, dev_name(&card->gdev->dev),
+				qeth_get_ipa_cmd_name(com), com,
+				dev_name(&card->gdev->dev),
 				QETH_CARD_IFNAME(card), rc,
 				qeth_get_ipa_msg(rc));
 	else
 		QETH_DBF_MESSAGE(5, "IPA: %s(x%X) for %s/%s succeeded\n",
-				ipa_name, com, dev_name(&card->gdev->dev),
+				qeth_get_ipa_cmd_name(com), com,
+				dev_name(&card->gdev->dev),
 				QETH_CARD_IFNAME(card));
 }
 

-- 
Jean Delvare
SUSE L3 Support



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux