Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Artem Mygaiev" <joculator@gmail.com>
To: "Juuso Oikarinen" <juuso.oikarinen@nokia.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] nl80211: Add option to adjust transmit power
Date: Wed, 23 Jun 2010 12:26:00 +0300	[thread overview]
Message-ID: <op.veqxtlvunp38ce@conquistador-pc.synapse.com> (raw)
In-Reply-To: <1277284358-11014-2-git-send-email-juuso.oikarinen@nokia.com>

Hello Juuso

A very minor comment - why do you need 'idx' here? Can't you just directly
access array by NL80211_* index without adding an index variable?

> +	if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
> +		enum nl80211_tx_power_setting type;
> +		int idx, mbm = 0;
> +
> +		if (!rdev->ops->set_tx_power) {
> +			return -EOPNOTSUPP;
> +			goto bad_res;
> +		}
> +
> +		idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING;
> +		type = nla_get_u32(info->attrs[idx]);
> +
> +		if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] &&
> +		    (type != NL80211_TX_POWER_AUTOMATIC)) {
> +			result = -EINVAL;
> +			goto bad_res;
> +		}
> +
> +		if (type != NL80211_TX_POWER_AUTOMATIC) {
> +			idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL;
> +			mbm = nla_get_u32(info->attrs[idx]);
> +		}
> +
> +		result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
> +		if (result)
> +			goto bad_res;
> +	}

-- 
Best regards,
Artem

  reply	other threads:[~2010-06-23  9:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23  9:12 [PATCH 1/2] cfg80211/mac80211: Update set_tx_power to use mBm instead of dBm units Juuso Oikarinen
2010-06-23  9:12 ` [PATCH 2/2] nl80211: Add option to adjust transmit power Juuso Oikarinen
2010-06-23  9:26   ` Artem Mygaiev [this message]
2010-06-23 10:08     ` Juuso Oikarinen

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=op.veqxtlvunp38ce@conquistador-pc.synapse.com \
    --to=joculator@gmail.com \
    --cc=juuso.oikarinen@nokia.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox