* [PATCH] Replace a set of atomic_add()
@ 2020-11-10 6:58 Yejune Deng
2020-11-10 8:16 ` Kalle Valo
2020-11-24 14:59 ` cw1200: replace " Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Yejune Deng @ 2020-11-10 6:58 UTC (permalink / raw)
To: pizza, kvalo, davem, kuba
Cc: linux-wireless, netdev, linux-kernel, yejune.deng
a set of atomic_inc() looks more readable
Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
drivers/net/wireless/st/cw1200/bh.c | 10 +++++-----
drivers/net/wireless/st/cw1200/wsm.c | 8 ++++----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/st/cw1200/bh.c b/drivers/net/wireless/st/cw1200/bh.c
index 02efe84..c364a39 100644
--- a/drivers/net/wireless/st/cw1200/bh.c
+++ b/drivers/net/wireless/st/cw1200/bh.c
@@ -85,7 +85,7 @@ int cw1200_register_bh(struct cw1200_common *priv)
void cw1200_unregister_bh(struct cw1200_common *priv)
{
- atomic_add(1, &priv->bh_term);
+ atomic_inc(&priv->bh_term);
wake_up(&priv->bh_wq);
flush_workqueue(priv->bh_workqueue);
@@ -107,7 +107,7 @@ void cw1200_irq_handler(struct cw1200_common *priv)
if (/* WARN_ON */(priv->bh_error))
return;
- if (atomic_add_return(1, &priv->bh_rx) == 1)
+ if (atomic_inc_return(&priv->bh_rx) == 1)
wake_up(&priv->bh_wq);
}
EXPORT_SYMBOL_GPL(cw1200_irq_handler);
@@ -120,7 +120,7 @@ void cw1200_bh_wakeup(struct cw1200_common *priv)
return;
}
- if (atomic_add_return(1, &priv->bh_tx) == 1)
+ if (atomic_inc_return(&priv->bh_tx) == 1)
wake_up(&priv->bh_wq);
}
@@ -382,7 +382,7 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv,
BUG_ON(tx_len < sizeof(*wsm));
BUG_ON(__le16_to_cpu(wsm->len) != tx_len);
- atomic_add(1, &priv->bh_tx);
+ atomic_inc(&priv->bh_tx);
tx_len = priv->hwbus_ops->align_size(
priv->hwbus_priv, tx_len);
@@ -537,7 +537,7 @@ static int cw1200_bh(void *arg)
pr_debug("[BH] Device resume.\n");
atomic_set(&priv->bh_suspend, CW1200_BH_RESUMED);
wake_up(&priv->bh_evt_wq);
- atomic_add(1, &priv->bh_rx);
+ atomic_inc(&priv->bh_rx);
goto done;
}
diff --git a/drivers/net/wireless/st/cw1200/wsm.c b/drivers/net/wireless/st/cw1200/wsm.c
index d9b6147..99624dd 100644
--- a/drivers/net/wireless/st/cw1200/wsm.c
+++ b/drivers/net/wireless/st/cw1200/wsm.c
@@ -1139,7 +1139,7 @@ static int wsm_cmd_send(struct cw1200_common *priv,
pr_err("Outstanding outgoing frames: %d\n", priv->hw_bufs_used);
/* Kill BH thread to report the error to the top layer. */
- atomic_add(1, &priv->bh_term);
+ atomic_inc(&priv->bh_term);
wake_up(&priv->bh_wq);
ret = -ETIMEDOUT;
}
@@ -1160,7 +1160,7 @@ static int wsm_cmd_send(struct cw1200_common *priv,
void wsm_lock_tx(struct cw1200_common *priv)
{
wsm_cmd_lock(priv);
- if (atomic_add_return(1, &priv->tx_lock) == 1) {
+ if (atomic_inc_return(&priv->tx_lock) == 1) {
if (wsm_flush_tx(priv))
pr_debug("[WSM] TX is locked.\n");
}
@@ -1169,7 +1169,7 @@ void wsm_lock_tx(struct cw1200_common *priv)
void wsm_lock_tx_async(struct cw1200_common *priv)
{
- if (atomic_add_return(1, &priv->tx_lock) == 1)
+ if (atomic_inc_return(&priv->tx_lock) == 1)
pr_debug("[WSM] TX is locked (async).\n");
}
@@ -1223,7 +1223,7 @@ bool wsm_flush_tx(struct cw1200_common *priv)
void wsm_unlock_tx(struct cw1200_common *priv)
{
int tx_lock;
- tx_lock = atomic_sub_return(1, &priv->tx_lock);
+ tx_lock = atomic_dec_return(&priv->tx_lock);
BUG_ON(tx_lock < 0);
if (tx_lock == 0) {
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Replace a set of atomic_add()
2020-11-10 6:58 [PATCH] Replace a set of atomic_add() Yejune Deng
@ 2020-11-10 8:16 ` Kalle Valo
[not found] ` <CABWKuGXdCffiDYqr_TZpkfkMoKRdCMUZ=fDUqkoU=658miQ3AQ@mail.gmail.com>
2020-11-24 14:59 ` cw1200: replace " Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2020-11-10 8:16 UTC (permalink / raw)
To: Yejune Deng; +Cc: pizza, davem, kuba, linux-wireless, netdev, linux-kernel
Yejune Deng <yejune.deng@gmail.com> writes:
> a set of atomic_inc() looks more readable
>
> Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
> ---
> drivers/net/wireless/st/cw1200/bh.c | 10 +++++-----
> drivers/net/wireless/st/cw1200/wsm.c | 8 ++++----
> 2 files changed, 9 insertions(+), 9 deletions(-)
The subject prefix should be "cw1200:", but I can fix that.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Replace a set of atomic_add()
[not found] ` <CABWKuGXdCffiDYqr_TZpkfkMoKRdCMUZ=fDUqkoU=658miQ3AQ@mail.gmail.com>
@ 2020-11-10 8:53 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-11-10 8:53 UTC (permalink / raw)
To: Yejune Deng; +Cc: pizza, davem, kuba, linux-wireless, netdev, linux-kernel
Yejune Deng <yejune.deng@gmail.com> writes:
> Oh,I was forgetting. thanks.
And you should also disable HTML in your emails :) See the wiki link
below for more.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: cw1200: replace a set of atomic_add()
2020-11-10 6:58 [PATCH] Replace a set of atomic_add() Yejune Deng
2020-11-10 8:16 ` Kalle Valo
@ 2020-11-24 14:59 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-11-24 14:59 UTC (permalink / raw)
To: Yejune Deng
Cc: pizza, davem, kuba, linux-wireless, netdev, linux-kernel, yejune.deng
Yejune Deng <yejune.deng@gmail.com> wrote:
> a set of atomic_inc() looks more readable
>
> Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
Patch applied to wireless-drivers-next.git, thanks.
07f995ca1951 cw1200: replace a set of atomic_add()
--
https://patchwork.kernel.org/project/linux-wireless/patch/1604991491-27908-1-git-send-email-yejune.deng@gmail.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-24 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 6:58 [PATCH] Replace a set of atomic_add() Yejune Deng
2020-11-10 8:16 ` Kalle Valo
[not found] ` <CABWKuGXdCffiDYqr_TZpkfkMoKRdCMUZ=fDUqkoU=658miQ3AQ@mail.gmail.com>
2020-11-10 8:53 ` Kalle Valo
2020-11-24 14:59 ` cw1200: replace " Kalle Valo
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).