From: "Benjamin Stürz" <benni@stuerz.xyz>
To: Joe Perches <joe@perches.com>, Kalle Valo <kvalo@kernel.org>
Cc: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 20/22 v3] ray_cs: Improve card_status[]
Date: Mon, 28 Mar 2022 21:54:13 +0200 [thread overview]
Message-ID: <6cae7be8-0329-7b0f-9a61-695f3d0cceb4@stuerz.xyz> (raw)
In-Reply-To: <683c72536c0672aa69c285ee505ec552fa76935f.camel@perches.com>
On 28.03.22 21:23, Joe Perches wrote:
> On Mon, 2022-03-28 at 20:21 +0200, Benjamin Stürz wrote:
>> Replace comments with C99's designated initializers.
> []
>> diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
> []
>> @@ -2529,20 +2529,23 @@ static void clear_interrupt(ray_dev_t *local)
>> #define MAXDATA (PAGE_SIZE - 80)
>>
>> static const char *card_status[] = {
>> - "Card inserted - uninitialized", /* 0 */
>> - "Card not downloaded", /* 1 */
>> - "Waiting for download parameters", /* 2 */
>> - "Card doing acquisition", /* 3 */
>> - "Acquisition complete", /* 4 */
>> - "Authentication complete", /* 5 */
>> - "Association complete", /* 6 */
>> - "???", "???", "???", "???", /* 7 8 9 10 undefined */
>> - "Card init error", /* 11 */
>> - "Download parameters error", /* 12 */
>> - "???", /* 13 */
>> - "Acquisition failed", /* 14 */
>> - "Authentication refused", /* 15 */
>> - "Association failed" /* 16 */
>> + [0] = "Card inserted - uninitialized",
>
> If you are going to do this at all, please use the #defines
> in drivers/net/wireless/rayctl.h
>
> [CARD_INSERTED] = "Card inserted - uninitialized",
> [CARD_AWAITING_PARAM] = "Card not downloaded",
>
> etc...
>
> $ git grep -w -P 'CARD_\w+' drivers/net/wireless/rayctl.h
> drivers/net/wireless/rayctl.h:#define CARD_INSERTED (0)
> drivers/net/wireless/rayctl.h:#define CARD_AWAITING_PARAM (1)
> drivers/net/wireless/rayctl.h:#define CARD_INIT_ERROR (11)
> drivers/net/wireless/rayctl.h:#define CARD_DL_PARAM (2)
> drivers/net/wireless/rayctl.h:#define CARD_DL_PARAM_ERROR (12)
> drivers/net/wireless/rayctl.h:#define CARD_DOING_ACQ (3)
> drivers/net/wireless/rayctl.h:#define CARD_ACQ_COMPLETE (4)
> drivers/net/wireless/rayctl.h:#define CARD_ACQ_FAILED (14)
> drivers/net/wireless/rayctl.h:#define CARD_AUTH_COMPLETE (5)
> drivers/net/wireless/rayctl.h:#define CARD_AUTH_REFUSED (15)
> drivers/net/wireless/rayctl.h:#define CARD_ASSOC_COMPLETE (6)
> drivers/net/wireless/rayctl.h:#define CARD_ASSOC_FAILED (16)
>
>> + [1] = "Card not downloaded",
>> + [2] = "Waiting for download parameters",
>> + [3] = "Card doing acquisition",
>> + [4] = "Acquisition complete",
>> + [5] = "Authentication complete",
>> + [6] = "Association complete",
>> + [7] = "???",
>> + [8] = "???",
>> + [9] = "???",
>> + [10] = "???",
>> + [11] = "Card init error",
>> + [12] = "Download parameters error",
>> + [13] = "???",
>> + [14] = "Acquisition failed",
>> + [15] = "Authentication refused",
>> + [16] = "Association failed"
>> };
>>
>> static const char *nettype[] = { "Adhoc", "Infra " };
>
>
- Make card_status[] const, because it should never be modified
- Replace comments with C99's designated initializers to improve
readability and maintainability
Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
---
drivers/net/wireless/ray_cs.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 87e98ab068ed..07f36aaefbde 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -2528,21 +2528,24 @@ static void clear_interrupt(ray_dev_t *local)
#ifdef CONFIG_PROC_FS
#define MAXDATA (PAGE_SIZE - 80)
-static const char *card_status[] = {
- "Card inserted - uninitialized", /* 0 */
- "Card not downloaded", /* 1 */
- "Waiting for download parameters", /* 2 */
- "Card doing acquisition", /* 3 */
- "Acquisition complete", /* 4 */
- "Authentication complete", /* 5 */
- "Association complete", /* 6 */
- "???", "???", "???", "???", /* 7 8 9 10 undefined */
- "Card init error", /* 11 */
- "Download parameters error", /* 12 */
- "???", /* 13 */
- "Acquisition failed", /* 14 */
- "Authentication refused", /* 15 */
- "Association failed" /* 16 */
+static const char * const card_status[] = {
+ [CARD_INSERTED] = "Card inserted - uninitialized",
+ [CARD_AWAITING_PARAM] = "Card not downloaded",
+ [CARD_DL_PARAM] = "Waiting for download parameters",
+ [CARD_DOING_ACQ] = "Card doing acquisition",
+ [CARD_ACQ_COMPLETE] = "Acquisition complete",
+ [CARD_AUTH_COMPLETE] = "Authentication complete",
+ [CARD_ASSOC_COMPLETE] = "Association complete",
+ [7] = "???",
+ [8] = "???",
+ [9] = "???",
+ [10] = "???",
+ [CARD_INIT_ERROR] = "Card init error",
+ [CARD_DL_PARAM_ERROR] = "Download parameters error",
+ [13] = "???",
+ [CARD_ACQ_FAILED] = "Acquisition failed",
+ [CARD_AUTH_REFUSED] = "Authentication refused",
+ [CARD_ASSOC_FAILED] = "Association failed"
};
static const char *nettype[] = { "Adhoc", "Infra " };
--
2.35.1
next prev parent reply other threads:[~2022-03-28 19:54 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-26 16:58 [PATCH 01/22] orion5x: Replace comments with C99 initializers Benjamin Stürz
2022-03-26 16:58 ` [PATCH 02/22] s3c: " Benjamin Stürz
2022-03-26 19:44 ` Joe Perches
2022-03-28 13:37 ` Daniel Thompson
2022-03-26 16:58 ` [PATCH 03/22] ia64: " Benjamin Stürz
2022-03-26 16:58 ` [PATCH 04/22] x86: " Benjamin Stürz
2022-03-28 23:08 ` Thomas Gleixner
2022-03-26 16:58 ` [PATCH 05/22] acpica: " Benjamin Stürz
2022-03-27 19:59 ` Andy Shevchenko
2022-03-31 19:27 ` Moore, Robert
2022-04-01 5:09 ` Christoph Hellwig
2022-04-01 5:10 ` Christoph Hellwig
2022-03-28 12:33 ` Rafael J. Wysocki
2022-03-26 16:58 ` [PATCH 06/22] idt77252: " Benjamin Stürz
2022-03-26 16:58 ` [PATCH 07/22] cm4000: " Benjamin Stürz
2022-03-26 16:58 ` [PATCH 08/22] i5100: " Benjamin Stürz
2022-03-26 16:58 ` [PATCH 09/22] gpio-winbond: Use " Benjamin Stürz
2022-03-27 12:03 ` Linus Walleij
2022-03-29 12:30 ` Bartosz Golaszewski
2022-03-26 16:58 ` [PATCH 10/22] hfi1: Replace comments with " Benjamin Stürz
2022-03-26 16:58 ` [PATCH 11/22] rdmavt: " Benjamin Stürz
2022-03-27 7:04 ` Leon Romanovsky
2022-03-31 17:41 ` Dennis Dalessandro
2022-03-26 16:58 ` [PATCH 12/22] alps: " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 13/22] capi: " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 14/22] mISDN: " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 15/22] macintosh: " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 16/22] dvb-usb: " Benjamin Stürz
2022-03-26 18:24 ` Mauro Carvalho Chehab
2022-03-26 18:27 ` Mauro Carvalho Chehab
2022-03-26 19:51 ` Joe Perches
2022-03-26 20:11 ` Larry Finger
2022-03-26 21:08 ` Mauro Carvalho Chehab
2022-03-28 18:08 ` [PATCH 16/22 v3] " Benjamin Stürz
2022-03-28 20:52 ` Mauro Carvalho Chehab
2022-03-27 13:33 ` [PATCH 16/22 v2] " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 17/22] cxl: " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 18/22] smsc: " Benjamin Stürz
2022-03-26 16:59 ` [PATCH 19/22] wnc36xx: " Benjamin Stürz
2022-03-28 16:17 ` Jeff Johnson
2022-03-28 18:38 ` [PATCH 19/22 v2] wcn36xx: Improve readability of wcn36xx_caps_name Benjamin Stürz
2022-03-28 20:23 ` Jeff Johnson
2022-03-30 7:05 ` Kalle Valo
2022-03-30 8:19 ` Kalle Valo
2022-03-26 16:59 ` [PATCH 20/22] wireless: Replace comments with C99 initializers Benjamin Stürz
2022-03-28 12:06 ` Kalle Valo
2022-03-28 18:21 ` [PATCH 20/22 v2] ray_cs: " Benjamin Stürz
2022-03-28 19:23 ` Joe Perches
2022-03-28 19:54 ` Benjamin Stürz [this message]
2022-04-06 11:31 ` [PATCH 20/22 v3] ray_cs: Improve card_status[] Kalle Valo
2022-03-26 16:59 ` [PATCH 21/22] rtw89: Replace comments with C99 initializers Benjamin Stürz
2022-03-26 18:55 ` Larry Finger
2022-03-28 9:28 ` Kalle Valo
2022-03-28 12:21 ` David Laight
2022-03-26 16:59 ` [PATCH 22/22] pci: " Benjamin Stürz
2022-03-26 18:20 ` [PATCH 01/22] orion5x: " Mauro Carvalho Chehab
2022-03-26 19:23 ` Arnd Bergmann
2022-03-28 13:19 ` Segher Boessenkool
2022-03-27 12:46 ` [PATCH 00/22] " Benjamin Stürz
2022-03-28 9:33 ` Kalle Valo
2022-03-28 11:51 ` Benjamin Stürz
2022-03-28 12:31 ` Kalle Valo
2022-03-28 20:20 ` Jakub Kicinski
2022-03-28 13:47 ` Daniel Thompson
2022-03-28 13:17 ` [PATCH 01/22] orion5x: " Daniel Thompson
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=6cae7be8-0329-7b0f-9a61-695f3d0cceb4@stuerz.xyz \
--to=benni@stuerz.xyz \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).