All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH iw] add "channels" PHY command listing frequencies with more details
Date: Tue, 31 May 2016 18:20:31 +0200	[thread overview]
Message-ID: <CACna6rwcbHye5k5vRrvQg0mHwkMA1p+GgJJK4s=RXTjErHUVFQ@mail.gmail.com> (raw)
In-Reply-To: <CACna6rz6N_indSm7WNyJdyWmbKnkx-dTBzwUN=x+m5ooSkbRXA@mail.gmail.com>

On 31 May 2016 at 17:58, Rafał Miłecki <zajec5@gmail.com> wrote:
> On 31 May 2016 at 15:14, Johannes Berg <johannes@sipsolutions.net> wrote:
>> On Tue, 2016-05-31 at 15:10 +0200, Rafał Miłecki wrote:
>>
>>> > Unfortunately, I get compiler warnings about width_* being possibly
>>> > used uninitialized. Can you address that please?
>>> It's nice your compiled got this mistake, my didn't. There were
>>> actually meant to be static. I'll fix that.
>>
>> I actually think the compiler is wrong, and there's no reason for them
>> to be static, is there?
>>
>> The first iteration of the loop should always initialize since -1 is
>> used for initialization?
>>
>> In any case, I'd prefer to avoid static, if necessary pass some kind of
>> context structure in to the function?
>
> I don't know if we can assume getting all three attributes:
> NL80211_BAND_ATTR_HT_CAPA
> NL80211_BAND_ATTR_VHT_CAPA
> NL80211_BAND_ATTR_FREQS
> at the same single handler call. I guess not. That's why I believe we
> need all width_* to be static, so they keep value across separated
> handler calls.

Yes, this is definitely the case. I did some debugging from user space
and printed one line per a single handler call:
[i:0] WIPHY_BANDS:0
[i:1] WIPHY_BANDS:0
[i:2] WIPHY_BANDS:0
[i:3] WIPHY_BANDS:1 ATTR_HT_CAPA:1 ATTR_VHT_CAPA:0 ATTR_FREQS:0
[i:4] WIPHY_BANDS:1 ATTR_HT_CAPA:1 ATTR_VHT_CAPA:1 ATTR_FREQS:0
[i:5] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:6] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:7] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:8] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:9] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:10] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:11] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:12] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:13] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
(...)

As you can see we have ATTR_HT_CAPA and ATTR_VHT_CAPA set only in few
early calls. It means we need to extract info from them and store it
in static variables.

  reply	other threads:[~2016-05-31 16:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 10:13 [PATCH iw] add "channels" PHY command listing frequencies with more details Rafał Miłecki
2016-05-31 10:16 ` Johannes Berg
2016-05-31 13:10   ` Rafał Miłecki
2016-05-31 13:14     ` Johannes Berg
2016-05-31 15:58       ` Rafał Miłecki
2016-05-31 16:20         ` Rafał Miłecki [this message]
2016-05-31 16:28 ` [PATCH V2 " Rafał Miłecki
2016-05-31 18:16   ` Johannes Berg
2016-06-01  5:51   ` [PATCH V3 " Rafał Miłecki

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='CACna6rwcbHye5k5vRrvQg0mHwkMA1p+GgJJK4s=RXTjErHUVFQ@mail.gmail.com' \
    --to=zajec5@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.