[SRU][Xenial][Bionic][Cosmic][PATCH 1/2] s390: qeth_core_mpc: Use ARRAY_SIZE instead of reimplementing its function

Joseph Salisbury joseph.salisbury at canonical.com
Wed Oct 31 17:54:15 UTC 2018


From: zhong jiang <zhongjiang at huawei.com>

BugLink: https://bugs.launchpad.net/bugs/1800641

Use the common code ARRAY_SIZE macro instead of a private implementation.

Reviewed-by: Jean Delvare <jdelvare at suse.de>
Signed-off-by: zhong jiang <zhongjiang at huawei.com>
Signed-off-by: Martin Schwidefsky <schwidefsky at de.ibm.com>
Signed-off-by: Julian Wiedmann <jwi at linux.ibm.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 065a2cdcbdf8eb9aefb66e1a24b2d684b8b8852b)
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
 drivers/s390/net/qeth_core_mpc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/net/qeth_core_mpc.c b/drivers/s390/net/qeth_core_mpc.c
index 22428b7..c250421 100644
--- a/drivers/s390/net/qeth_core_mpc.c
+++ b/drivers/s390/net/qeth_core_mpc.c
@@ -233,8 +233,7 @@ static struct ipa_rc_msg qeth_ipa_rc_msg[] = {
 char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc)
 {
 	int x = 0;
-	qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) /
-			sizeof(struct ipa_rc_msg) - 1].rc = rc;
+	qeth_ipa_rc_msg[ARRAY_SIZE(qeth_ipa_rc_msg) - 1].rc = rc;
 	while (qeth_ipa_rc_msg[x].rc != rc)
 		x++;
 	return qeth_ipa_rc_msg[x].msg;
@@ -281,9 +280,7 @@ static struct ipa_cmd_names qeth_ipa_cmd_names[] = {
 char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd)
 {
 	int x = 0;
-	qeth_ipa_cmd_names[
-		sizeof(qeth_ipa_cmd_names) /
-			sizeof(struct ipa_cmd_names)-1].cmd = cmd;
+	qeth_ipa_cmd_names[ARRAY_SIZE(qeth_ipa_cmd_names) - 1].cmd = cmd;
 	while (qeth_ipa_cmd_names[x].cmd != cmd)
 		x++;
 	return qeth_ipa_cmd_names[x].name;
-- 
2.7.4





More information about the kernel-team mailing list