From: mabbas <mabbas@linux.intel.com>
To: Jiri Benc <jbenc@suse.cz>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/7] d80211: add SIOCSIWTXPOW, SIOCGIWTXPOW, SIOCSIWPOWER and SIOCGIWPOWER
Date: Thu, 21 Sep 2006 09:43:31 -0700 [thread overview]
Message-ID: <4512C133.7010509@linux.intel.com> (raw)
In-Reply-To: <20060921183040.12d679f2@logostar.upir.cz>
Jiri Benc wrote:
> Hi,
>
> sorry for the long delay.
>
> On Mon, 28 Aug 2006 13:45:18 -0700, mabbas wrote:
>
>> [...]
>> +static int ieee80211_ioctl_siwtxpow(struct net_device *dev,
>> + struct iw_request_info *info,
>> + union iwreq_data *wrqu,
>> + char *extra)
>> +{
>> + int rc = 0;
>> + struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
>> +
>> + if (wrqu->txpower.flags != IW_TXPOW_DBM)
>> + rc = -EINVAL;
>> + else
>> + conf->power_level = wrqu->txpower.value;
>> +
>> +
>> + ieee80211_ioctl_set_radio_enabled(dev, !wrqu->txpower.disabled);
>>
>
> Expecting implicit call of ieee80211_hw_config in
> ieee80211_ioctl_set_radio_enabled doesn't look like a good idea. If the
> latter function is changed (to call hw_config only if the radio_enabled
> field isn't the same as before), the SIOCSIWTXPOW ioctl won't have any
> effect.
>
> I'd prefer setting conf->radio_enabled directly and calling of
> ieee80211_hw_config explicitly.
>
> Also, always double check that you do error handling correctly (functions
> usually return something on purpose). (Hm, I already told you in this
> specific case. Please also double check that you haven't missed any comment
> before resending patches.)
>
>
What about adding a new callback function fot txpower.
ieee80211_hw_config callback still confusing if txpower was
changed for channel change or because the user setting txpower limit.
>> + return rc;
>> +}
>> +
>> +static int ieee80211_ioctl_siwpower(struct net_device *dev,
>> + struct iw_request_info *info,
>> + union iwreq_data *wrqu,
>> + char *extra)
>> +{
>> + struct ieee80211_conf *conf = ieee80211_get_hw_conf(dev);
>> +
>> + if (wrqu->power.disabled) {
>> + conf->power_management_enable = 0;
>> + if (ieee80211_hw_config(dev))
>> + return -EINVAL;
>> + return 0;
>>
>
> This is wrong. Return the error code you've got from ieee80211_hw_config.
>
Ok
>
>> + }
>> +
>> + if (wrqu->power.flags & IW_POWER_TYPE)
>> + return -EINVAL;
>> +
>> + switch (wrqu->power.flags & IW_POWER_MODE) {
>> + case IW_POWER_ON: /* If not specified */
>> + case IW_POWER_MODE: /* If set all mask */
>> + case IW_POWER_ALL_R: /* If explicitely state all */
>> + break;
>> + default: /* Otherwise we don't support it */
>> + return -EINVAL;
>> + }
>> +
>> + conf->power_management_enable = 1;
>> +
>> + if (ieee80211_hw_config(dev))
>> + return -EINVAL;
>>
>
> Ditto.
>
> Thanks,
>
> Jiri
>
>
next prev parent reply other threads:[~2006-09-21 16:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-28 20:45 [PATCH 1/7] d80211: add SIOCSIWTXPOW, SIOCGIWTXPOW, SIOCSIWPOWER and SIOCGIWPOWER mabbas
2006-09-21 16:30 ` Jiri Benc
2006-09-21 16:43 ` mabbas [this message]
2006-09-21 18:33 ` Jiri Benc
2006-09-21 19:57 ` mabbas
2006-09-21 22:13 ` Jiri Benc
2006-09-21 22:39 ` mabbas
2006-09-22 11:16 ` Jiri Benc
2006-09-22 13:24 ` Larry Finger
2006-09-22 13:30 ` Johannes Berg
2006-09-22 13:54 ` Larry Finger
2006-09-25 8:42 ` Johannes Berg
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=4512C133.7010509@linux.intel.com \
--to=mabbas@linux.intel.com \
--cc=jbenc@suse.cz \
--cc=netdev@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.