From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrea Merello <andrea.merello@gmail.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
Larry.Finger@lwfinger.net, bernhard@schiffner-limbach.de
Subject: Re: [PATCH 1/3] rtl818x_pci: make RSSI code more readable
Date: Sat, 31 May 2014 23:05:56 +0300 [thread overview]
Message-ID: <20140531200556.GL17724@mwanda> (raw)
In-Reply-To: <1401553786-7603-1-git-send-email-andrea.merello@gmail.com>
On Sat, May 31, 2014 at 06:29:46PM +0200, Andrea Merello wrote:
> remove the if-else chains and use switch-case to make code more
> readable and avoiding long lines that broke in several lines
>
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
> ---
> drivers/net/wireless/rtl818x/rtl8180/dev.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
> index 2c1c02b..c2dd5e6 100644
> --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
> +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
> @@ -209,7 +209,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
> struct rtl8180_priv *priv = dev->priv;
> struct rtl818x_rx_cmd_desc *cmd_desc;
> unsigned int count = 32;
> - u8 signal, agc, sq;
> + u8 agc, sq, signal = 1;
Shouldn't the 1 be 10? Why did the defaults change?
regards,
dan carpenter
> dma_addr_t mapping;
>
> while (count--) {
> @@ -266,18 +266,21 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
> rx_status.rate_idx = (flags >> 20) & 0xF;
> agc = (flags2 >> 17) & 0x7F;
>
> - if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8185) {
> + switch (priv->chip_family) {
> + case RTL818X_CHIP_FAMILY_RTL8185:
> if (rx_status.rate_idx > 3)
> signal = 90 - clamp_t(u8, agc, 25, 90);
> else
> signal = 95 - clamp_t(u8, agc, 30, 95);
> - } else if (priv->chip_family ==
> - RTL818X_CHIP_FAMILY_RTL8180) {
> + break;
> + case RTL818X_CHIP_FAMILY_RTL8180:
> sq = flags2 & 0xff;
> signal = priv->rf->calc_rssi(agc, sq);
> - } else {
> + break;
> + case RTL818X_CHIP_FAMILY_RTL8187SE:
> /* TODO: rtl8187se rssi */
> signal = 10;
> + break;
> }
> rx_status.signal = signal;
> rx_status.freq = dev->conf.chandef.chan->center_freq;
> --
> 1.9.1
next prev parent reply other threads:[~2014-05-31 20:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-31 16:29 [PATCH 1/3] rtl818x_pci: make RSSI code more readable Andrea Merello
2014-05-31 20:05 ` Dan Carpenter [this message]
2014-06-01 0:37 ` Andrea Merello
2014-06-01 5:26 ` Dan Carpenter
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=20140531200556.GL17724@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Larry.Finger@lwfinger.net \
--cc=andrea.merello@gmail.com \
--cc=bernhard@schiffner-limbach.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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