Re: [PATCH v2 1/2] b43: Remove unused phy_a code

2016-06-04 Thread Michael Büsch
On Fri,  3 Jun 2016 21:11:51 -0700
Guenter Roeck  wrote:

> +static void __b43_phy_initg(struct b43_wldev *dev)
> +{
> + struct b43_phy *phy = >phy;
> +
> + might_sleep();
> +
> + if (phy->rev >= 6) {
> + if (b43_phy_read(dev, B43_PHY_ENCORE) & B43_PHY_ENCORE_EN)
> + b43_phy_set(dev, B43_PHY_ENCORE, 0x0010);
> + else
> + b43_phy_mask(dev, B43_PHY_ENCORE, ~0x1010);
> + }
> +
> + b43_wa_all(dev);
> +
> + if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL)
> + b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF);
> +}
> +
>  static void b43_phy_initg(struct b43_wldev *dev)
>  {
>   struct b43_phy *phy = >phy;
> @@ -1999,7 +2019,7 @@ static void b43_phy_initg(struct b43_wldev *dev)
>   b43_phy_initb6(dev);
>  
>   if (phy->rev >= 2 || phy->gmode)
> - b43_phy_inita(dev);
> + __b43_phy_initg(dev);

This actually is correctly called inita(), because there are A-phy parts
in the G-phy.
So I wasn't 100% correct saying that _all_ a-phy code is unused.
I'm Ok with moving that into the g-phy file though. But don't rename it.


-- 
Michael


pgp1mgBgFViAO.pgp
Description: OpenPGP digital signature


[PATCH v2 1/2] b43: Remove unused phy_a code

2016-06-03 Thread Guenter Roeck
gcc-6 reports the following error with -Werror=unused-const-variable.

drivers/net/wireless/broadcom/b43/phy_a.c:576:40: error:
'b43_phyops_a' defined but not used

Per Michael Büsch: "All a-phy code is usused", so remove phy_a.c
completely. Move the remaining Type-G initialization code into phy_g.c.

Reported-by: Fengguang Wu  [0-day test robot]
Signed-off-by: Guenter Roeck 
---
v2: Remove phy_a.c; move left-over code into phy_g.c
Remove now unused data structure

 drivers/net/wireless/broadcom/b43/Makefile |   2 +-
 drivers/net/wireless/broadcom/b43/phy_a.c  | 595 -
 drivers/net/wireless/broadcom/b43/phy_a.h  |  22 -
 drivers/net/wireless/broadcom/b43/phy_common.h |   3 -
 drivers/net/wireless/broadcom/b43/phy_g.c  |  27 +-
 5 files changed, 22 insertions(+), 627 deletions(-)
 delete mode 100644 drivers/net/wireless/broadcom/b43/phy_a.c

diff --git a/drivers/net/wireless/broadcom/b43/Makefile 
b/drivers/net/wireless/broadcom/b43/Makefile
index ddc4df46656f..27fab958e3d5 100644
--- a/drivers/net/wireless/broadcom/b43/Makefile
+++ b/drivers/net/wireless/broadcom/b43/Makefile
@@ -1,6 +1,6 @@
 b43-y  += main.o
 b43-y  += bus.o
-b43-$(CONFIG_B43_PHY_G)+= phy_a.o phy_g.o tables.o lo.o wa.o
+b43-$(CONFIG_B43_PHY_G)+= phy_g.o tables.o lo.o wa.o
 b43-$(CONFIG_B43_PHY_N)+= tables_nphy.o
 b43-$(CONFIG_B43_PHY_N)+= radio_2055.o
 b43-$(CONFIG_B43_PHY_N)+= radio_2056.o
diff --git a/drivers/net/wireless/broadcom/b43/phy_a.c 
b/drivers/net/wireless/broadcom/b43/phy_a.c
deleted file mode 100644
index 99c036f5ecb7..
--- a/drivers/net/wireless/broadcom/b43/phy_a.c
+++ /dev/null
@@ -1,595 +0,0 @@
-/*
-
-  Broadcom B43 wireless driver
-  IEEE 802.11a PHY driver
-
-  Copyright (c) 2005 Martin Langer ,
-  Copyright (c) 2005-2007 Stefano Brivio 
-  Copyright (c) 2005-2008 Michael Buesch 
-  Copyright (c) 2005, 2006 Danny van Dyk 
-  Copyright (c) 2005, 2006 Andreas Jaggi 
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; see the file COPYING.  If not, write to
-  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
-  Boston, MA 02110-1301, USA.
-
-*/
-
-#include 
-
-#include "b43.h"
-#include "phy_a.h"
-#include "phy_common.h"
-#include "wa.h"
-#include "tables.h"
-#include "main.h"
-
-
-/* Get the freq, as it has to be written to the device. */
-static inline u16 channel2freq_a(u8 channel)
-{
-   B43_WARN_ON(channel > 200);
-
-   return (5000 + 5 * channel);
-}
-
-static inline u16 freq_r3A_value(u16 frequency)
-{
-   u16 value;
-
-   if (frequency < 5091)
-   value = 0x0040;
-   else if (frequency < 5321)
-   value = 0x;
-   else if (frequency < 5806)
-   value = 0x0080;
-   else
-   value = 0x0040;
-
-   return value;
-}
-
-#if 0
-/* This function converts a TSSI value to dBm in Q5.2 */
-static s8 b43_aphy_estimate_power_out(struct b43_wldev *dev, s8 tssi)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-   s8 dbm = 0;
-   s32 tmp;
-
-   tmp = (aphy->tgt_idle_tssi - aphy->cur_idle_tssi + tssi);
-   tmp += 0x80;
-   tmp = clamp_val(tmp, 0x00, 0xFF);
-   dbm = aphy->tssi2dbm[tmp];
-   //TODO: There's a FIXME on the specs
-
-   return dbm;
-}
-#endif
-
-static void b43_radio_set_tx_iq(struct b43_wldev *dev)
-{
-   static const u8 data_high[5] = { 0x00, 0x40, 0x80, 0x90, 0xD0 };
-   static const u8 data_low[5] = { 0x00, 0x01, 0x05, 0x06, 0x0A };
-   u16 tmp = b43_radio_read16(dev, 0x001E);
-   int i, j;
-
-   for (i = 0; i < 5; i++) {
-   for (j = 0; j < 5; j++) {
-   if (tmp == (data_high[i] << 4 | data_low[j])) {
-   b43_phy_write(dev, 0x0069,
- (i - j) << 8 | 0x00C0);
-   return;
-   }
-   }
-   }
-}
-
-static void aphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
-{
-   u16 freq, r8, tmp;
-
-   freq = channel2freq_a(channel);
-
-   r8 = b43_radio_read16(dev, 0x0008);
-