Search Linux Wireless

Re: [PATCH v2 01/13] cfg80211: allow drivers to iterate over matching combinations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28 March 2014 14:05, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote:
> On Fri, 2014-03-21 at 14:47 +0100, Michal Kazior wrote:
>
>> +int cfg80211_iter_combinations(struct wiphy *wiphy,
>> +                            const int num_different_channels,
>> +                            const u8 radar_detect,
>> +                            const int iftype_num[NUM_NL80211_IFTYPES],
>> +                            void (*iter)(const struct ieee80211_iface_combination *c,
>> +                                         void *data),
>> +                            void *data);
>
> Maybe *iter should have a non-void return value and allow aborting the
> loop somehow?

I don't see much of use for that. You can still use *data for that.


>> +static void
>> +cfg80211_iter_sum_ifcombs(const struct ieee80211_iface_combination *c,
>> +                       void *data)
>> +{
>> +     int *num = data;
>> +     (*num)++;
>> +}
>> +
>> +int cfg80211_check_combinations(struct wiphy *wiphy,
>> +                             const int num_different_channels,
>> +                             const u8 radar_detect,
>> +                             const int iftype_num[NUM_NL80211_IFTYPES])
>> +{
>> +     int err, num = 0;
>> +
>> +     err = cfg80211_iter_combinations(wiphy, num_different_channels,
>> +                                      radar_detect, iftype_num,
>> +                                      cfg80211_iter_sum_ifcombs, &num);
>> +     if (err)
>> +             return err;
>> +     if (num == 0)
>> +             return -EBUSY;
>> +
>> +     return 0;
>>  }
>
> This also seems a bit pointless - why not just have an int instead of
> num and set it to -EBUSY outside, and to 0 inside, and then just return
> it? You don't need the number of available combinations.

Hmm.. Well, that works too I guess.


Michał
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux