From: zhong jiang <zhongjiang@huawei.com>
To: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
jwi@linux.ibm.com, ubraun@linux.ibm.com, jdelvare@suse.de
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] s390: qeth_core_mpc: Use ARRAY_SIZE instead of reimplementing its function
Date: Sat, 8 Sep 2018 18:26:28 +0800 [thread overview]
Message-ID: <1536402388-23872-3-git-send-email-zhongjiang@huawei.com> (raw)
In-Reply-To: <1536402388-23872-1-git-send-email-zhongjiang@huawei.com>
ARRAY_SIZE has implemented its function. we prefer to use the function
rather than the open code.
Signed-off-by: zhong jiang <zhongjiang@huawei.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 5bcb8da..e8263de 100644
--- a/drivers/s390/net/qeth_core_mpc.c
+++ b/drivers/s390/net/qeth_core_mpc.c
@@ -222,8 +222,7 @@ struct 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;
@@ -270,9 +269,7 @@ struct 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;
--
1.7.12.4
next prev parent reply other threads:[~2018-09-08 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-08 10:26 [PATCH 0/2] s390: Use ARRAY_SIZE instead of reimplementing its function zhong jiang
2018-09-08 10:26 ` [PATCH 1/2] s390: vmlogrdr: " zhong jiang
2018-09-08 13:00 ` Jean Delvare
2018-09-08 10:26 ` zhong jiang [this message]
2018-09-08 13:11 ` [PATCH 2/2] s390: qeth_core_mpc: " Jean Delvare
2018-09-10 6:37 ` [PATCH 0/2] s390: " Martin Schwidefsky
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=1536402388-23872-3-git-send-email-zhongjiang@huawei.com \
--to=zhongjiang@huawei.com \
--cc=heiko.carstens@de.ibm.com \
--cc=jdelvare@suse.de \
--cc=jwi@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=schwidefsky@de.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).