2021-09-10 16:07:32

by Jérôme Pouiller

[permalink] [raw]
Subject: [PATCH 17/31] staging: wfx: simplify hif_join()

From: Jérôme Pouiller <[email protected]>

The new code is smaller.

Signed-off-by: Jérôme Pouiller <[email protected]>
---
drivers/staging/wfx/hif_tx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 6ffbae32028b..aea0ed55edc6 100644
--- a/drivers/staging/wfx/hif_tx.c
+++ b/drivers/staging/wfx/hif_tx.c
@@ -306,10 +306,7 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
return -ENOMEM;
body->infrastructure_bss_mode = !conf->ibss_joined;
body->short_preamble = conf->use_short_preamble;
- if (channel->flags & IEEE80211_CHAN_NO_IR)
- body->probe_for_join = 0;
- else
- body->probe_for_join = 1;
+ body->probe_for_join = !(channel->flags & IEEE80211_CHAN_NO_IR);
body->channel_number = channel->hw_value;
body->beacon_interval = cpu_to_le32(conf->beacon_int);
body->basic_rate_set =
--
2.33.0


2021-09-10 16:38:58

by Kari Argillander

[permalink] [raw]
Subject: Re: [PATCH 17/31] staging: wfx: simplify hif_join()

On Fri, Sep 10, 2021 at 06:04:50PM +0200, Jerome Pouiller wrote:
> From: J?r?me Pouiller <[email protected]>
>
> The new code is smaller.
>
> Signed-off-by: J?r?me Pouiller <[email protected]>
> ---
> drivers/staging/wfx/hif_tx.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
> index 6ffbae32028b..aea0ed55edc6 100644
> --- a/drivers/staging/wfx/hif_tx.c
> +++ b/drivers/staging/wfx/hif_tx.c
> @@ -306,10 +306,7 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
> return -ENOMEM;
> body->infrastructure_bss_mode = !conf->ibss_joined;
> body->short_preamble = conf->use_short_preamble;
> - if (channel->flags & IEEE80211_CHAN_NO_IR)
> - body->probe_for_join = 0;
> - else
> - body->probe_for_join = 1;
> + body->probe_for_join = !(channel->flags & IEEE80211_CHAN_NO_IR);

Also harder to read imo because this is negative. But I see that whole
code is made for really really really compact so maybe it's same style
as you have done in past.

> body->channel_number = channel->hw_value;
> body->beacon_interval = cpu_to_le32(conf->beacon_int);
> body->basic_rate_set =
> --
> 2.33.0
>