diff options
author | Philipp Hortmann <philipp.g.hortmann@gmail.com> | 2022-02-22 00:25:16 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-25 12:01:35 +0300 |
commit | efc72b11b3eb5dc6f9d63224da8e1dde2bed24c3 (patch) | |
tree | 27598f03fa540316ba5ad6612718ef5c732aa750 /drivers/staging/vt6656 | |
parent | ac1569b7dca22e6bc05585093c90cb11fcc10fbd (diff) |
staging: vt6656: Change macro to function and moved to better file
This patch fixes the checkpatch.pl warning like:
- CHECK: Macro argument reuse 'uVar' - possible side-effects?
Moved the only twice used function to the file where it is used.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/fa37dde640cfe5093ff23ca0881aba4673751a49.1645477326.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r-- | drivers/staging/vt6656/device.h | 7 | ||||
-rw-r--r-- | drivers/staging/vt6656/wcmd.c | 13 |
2 files changed, 11 insertions, 9 deletions
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 0ab2d60204e8..ca974d61d3f4 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -381,13 +381,6 @@ struct vnt_private { struct ieee80211_low_level_stats low_stats; }; -#define ADD_ONE_WITH_WRAP_AROUND(var, modulo) { \ - if ((var) >= ((modulo) - 1)) \ - (var) = 0; \ - else \ - (var)++; \ -} - int vnt_init(struct vnt_private *priv); #endif diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index e8ee2fbee76c..14b8aa587119 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 var, u8 modulo) +{ + if (var >= (modulo - 1)) + var = 0; + else + var++; + return 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) |