From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Forest Bond <forest@alittletooquiet.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] staging: vt6656: Add comment and change macro to function
Date: Sun, 20 Feb 2022 21:30:36 +0100 [thread overview]
Message-ID: <3eb14cfaa3f97695bd4db0dd75ac78408c557821.1645386791.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1645386791.git.philipp.g.hortmann@gmail.com>
This patch fixes the checkpatch.pl warnings like:
- CHECK: spinlock_t definition without comment
- CHECK: Avoid CamelCase: <uVar>
- CHECK: Macro argument reuse 'uVar' - possible side-effects?
and moved the only twice used macro to a function in the file
where the function is used.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
drivers/staging/vt6656/device.h | 11 ++---------
drivers/staging/vt6656/wcmd.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 8b6623a751f0..eb84590d5eeb 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -268,8 +268,8 @@ struct vnt_private {
u32 rx_buf_sz;
int mc_list_count;
- spinlock_t lock;
- struct mutex usb_lock;
+ spinlock_t lock; /*prepare tx USB URB*/
+ struct mutex usb_lock; /*USB control messages*/
unsigned long flags;
@@ -381,13 +381,6 @@ struct vnt_private {
struct ieee80211_low_level_stats low_stats;
};
-#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
- if ((uVar) >= ((uModulo) - 1)) \
- (uVar) = 0; \
- else \
- (uVar)++; \
-}
-
int vnt_init(struct vnt_private *priv);
#endif
diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index e8ee2fbee76c..77c6d898f660 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -31,6 +31,15 @@ static void vnt_cmd_timer_wait(struct vnt_private *priv, unsigned long msecs)
schedule_delayed_work(&priv->run_command_work, msecs_to_jiffies(msecs));
}
+static u32 add_one_with_wrap_around(u32 u_var, u8 u_modulo)
+{
+ if (u_var >= (u_modulo - 1))
+ u_var = 0;
+ else
+ u_var++;
+ return u_var;
+}
+
static int vnt_cmd_complete(struct vnt_private *priv)
{
priv->command_state = WLAN_CMD_IDLE;
@@ -42,7 +51,7 @@ static int vnt_cmd_complete(struct vnt_private *priv)
priv->command = priv->cmd_queue[priv->cmd_dequeue_idx];
- ADD_ONE_WITH_WRAP_AROUND(priv->cmd_dequeue_idx, CMD_Q_SIZE);
+ priv->cmd_dequeue_idx = add_one_with_wrap_around(priv->cmd_dequeue_idx, CMD_Q_SIZE);
priv->free_cmd_queue++;
priv->cmd_running = true;
@@ -157,7 +166,7 @@ int vnt_schedule_command(struct vnt_private *priv, enum vnt_cmd command)
priv->cmd_queue[priv->cmd_enqueue_idx] = command;
- ADD_ONE_WITH_WRAP_AROUND(priv->cmd_enqueue_idx, CMD_Q_SIZE);
+ priv->cmd_enqueue_idx = add_one_with_wrap_around(priv->cmd_enqueue_idx, CMD_Q_SIZE);
priv->free_cmd_queue--;
if (!priv->cmd_running)
--
2.25.1
next prev parent reply other threads:[~2022-02-20 20:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-20 20:30 [PATCH 0/3] staging: vt6656: Fix CamelCase, add comments, " Philipp Hortmann
2022-02-20 20:30 ` [PATCH 1/3] staging: vt6656: Fix CamelCase warnings in mac.h and mac.c Philipp Hortmann
2022-02-21 12:27 ` Dan Carpenter
2022-02-20 20:30 ` Philipp Hortmann [this message]
2022-02-21 12:33 ` [PATCH 2/3] staging: vt6656: Add comment and change macro to function Dan Carpenter
2022-02-21 17:15 ` Greg Kroah-Hartman
2022-02-20 20:30 ` [PATCH 3/3] staging: vt6656: Remove ftrace-like logging and unnecessary line breaks Philipp Hortmann
2022-02-21 12:35 ` Dan Carpenter
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=3eb14cfaa3f97695bd4db0dd75ac78408c557821.1645386791.git.philipp.g.hortmann@gmail.com \
--to=philipp.g.hortmann@gmail.com \
--cc=forest@alittletooquiet.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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
all inboxes | Powered by JetHome®