Re: [PATCH] b43: Remove unused phy_a code

2016-06-03 Thread Guenter Roeck

On 06/03/2016 02:35 PM, Michael Büsch wrote:

On Fri,  3 Jun 2016 14:32:46 -0700
Guenter Roeck  wrote:


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

Turns out a lot of code in this file is unused, so let's remove it.



All a-phy code is usused.
So you can basically remove the whole file and any other A-PHY code.


I love removing code. I'll resend with more code removed.

Guenter



Re: [PATCH] b43: Remove unused phy_a code

2016-06-03 Thread Guenter Roeck

On 06/03/2016 02:35 PM, Michael Büsch wrote:

On Fri,  3 Jun 2016 14:32:46 -0700
Guenter Roeck  wrote:


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

Turns out a lot of code in this file is unused, so let's remove it.



All a-phy code is usused.
So you can basically remove the whole file and any other A-PHY code.


I love removing code. I'll resend with more code removed.

Guenter



Re: [PATCH] b43: Remove unused phy_a code

2016-06-03 Thread Michael Büsch
On Fri,  3 Jun 2016 14:32:46 -0700
Guenter Roeck  wrote:

> 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
> 
> Turns out a lot of code in this file is unused, so let's remove it.


All a-phy code is usused.
So you can basically remove the whole file and any other A-PHY code.
... or just leave it as-is.


-- 
Michael


pgpYJAY10nnbY.pgp
Description: OpenPGP digital signature


Re: [PATCH] b43: Remove unused phy_a code

2016-06-03 Thread Michael Büsch
On Fri,  3 Jun 2016 14:32:46 -0700
Guenter Roeck  wrote:

> 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
> 
> Turns out a lot of code in this file is unused, so let's remove it.


All a-phy code is usused.
So you can basically remove the whole file and any other A-PHY code.
... or just leave it as-is.


-- 
Michael


pgpYJAY10nnbY.pgp
Description: OpenPGP digital signature


[PATCH] 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

Turns out a lot of code in this file is unused, so let's remove it.

Reported-by: Fengguang Wu  [0-day test robot]
Signed-off-by: Guenter Roeck 
---
 drivers/net/wireless/broadcom/b43/phy_a.c | 298 --
 1 file changed, 298 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43/phy_a.c 
b/drivers/net/wireless/broadcom/b43/phy_a.c
index 99c036f5ecb7..d9212dc276d0 100644
--- a/drivers/net/wireless/broadcom/b43/phy_a.c
+++ b/drivers/net/wireless/broadcom/b43/phy_a.c
@@ -60,25 +60,6 @@ static inline u16 freq_r3A_value(u16 frequency)
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 };
@@ -314,282 +295,3 @@ void b43_phy_inita(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF);
}
 }
-
-/* Initialise the TSSI->dBm lookup table */
-static int b43_aphy_init_tssi2dbm_table(struct b43_wldev *dev)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-   s16 pab0, pab1, pab2;
-
-   pab0 = (s16) (dev->dev->bus_sprom->pa1b0);
-   pab1 = (s16) (dev->dev->bus_sprom->pa1b1);
-   pab2 = (s16) (dev->dev->bus_sprom->pa1b2);
-
-   if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
-   pab0 != -1 && pab1 != -1 && pab2 != -1) {
-   /* The pabX values are set in SPROM. Use them. */
-   if ((s8) dev->dev->bus_sprom->itssi_a != 0 &&
-   (s8) dev->dev->bus_sprom->itssi_a != -1)
-   aphy->tgt_idle_tssi =
-   (s8) (dev->dev->bus_sprom->itssi_a);
-   else
-   aphy->tgt_idle_tssi = 62;
-   aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
-  pab1, pab2);
-   if (!aphy->tssi2dbm)
-   return -ENOMEM;
-   } else {
-   /* pabX values not set in SPROM,
-* but APHY needs a generated table. */
-   aphy->tssi2dbm = NULL;
-   b43err(dev->wl, "Could not generate tssi2dBm "
-  "table (wrong SPROM info)!\n");
-   return -ENODEV;
-   }
-
-   return 0;
-}
-
-static int b43_aphy_op_allocate(struct b43_wldev *dev)
-{
-   struct b43_phy_a *aphy;
-   int err;
-
-   aphy = kzalloc(sizeof(*aphy), GFP_KERNEL);
-   if (!aphy)
-   return -ENOMEM;
-   dev->phy.a = aphy;
-
-   err = b43_aphy_init_tssi2dbm_table(dev);
-   if (err)
-   goto err_free_aphy;
-
-   return 0;
-
-err_free_aphy:
-   kfree(aphy);
-   dev->phy.a = NULL;
-
-   return err;
-}
-
-static void b43_aphy_op_prepare_structs(struct b43_wldev *dev)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-   const void *tssi2dbm;
-   int tgt_idle_tssi;
-
-   /* tssi2dbm table is constant, so it is initialized at alloc time.
-* Save a copy of the pointer. */
-   tssi2dbm = aphy->tssi2dbm;
-   tgt_idle_tssi = aphy->tgt_idle_tssi;
-
-   /* Zero out the whole PHY structure. */
-   memset(aphy, 0, sizeof(*aphy));
-
-   aphy->tssi2dbm = tssi2dbm;
-   aphy->tgt_idle_tssi = tgt_idle_tssi;
-
-   //TODO init struct b43_phy_a
-
-}
-
-static void b43_aphy_op_free(struct b43_wldev *dev)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-
-   kfree(aphy->tssi2dbm);
-   aphy->tssi2dbm = NULL;
-
-   kfree(aphy);
-   dev->phy.a = NULL;
-}
-
-static int b43_aphy_op_init(struct b43_wldev *dev)
-{
-   b43_phy_inita(dev);
-
-   return 0;
-}
-
-static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset)
-{
-   /* OFDM registers are base-registers for the A-PHY. */
-   if ((offset & B43_PHYROUTE) == B43_PHYROUTE_OFDM_GPHY) {
-   offset &= ~B43_PHYROUTE;
-   offset |= B43_PHYROUTE_BASE;
-   }
-
-#if B43_DEBUG
-   if ((offset & B43_PHYROUTE) == B43_PHYROUTE_EXT_GPHY) {
-   /* Ext-G registers are only available on G-PHYs */
-   b43err(dev->wl, "Invalid EXT-G PHY access at "
-  "0x%04X on 

[PATCH] 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

Turns out a lot of code in this file is unused, so let's remove it.

Reported-by: Fengguang Wu  [0-day test robot]
Signed-off-by: Guenter Roeck 
---
 drivers/net/wireless/broadcom/b43/phy_a.c | 298 --
 1 file changed, 298 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43/phy_a.c 
b/drivers/net/wireless/broadcom/b43/phy_a.c
index 99c036f5ecb7..d9212dc276d0 100644
--- a/drivers/net/wireless/broadcom/b43/phy_a.c
+++ b/drivers/net/wireless/broadcom/b43/phy_a.c
@@ -60,25 +60,6 @@ static inline u16 freq_r3A_value(u16 frequency)
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 };
@@ -314,282 +295,3 @@ void b43_phy_inita(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF);
}
 }
-
-/* Initialise the TSSI->dBm lookup table */
-static int b43_aphy_init_tssi2dbm_table(struct b43_wldev *dev)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-   s16 pab0, pab1, pab2;
-
-   pab0 = (s16) (dev->dev->bus_sprom->pa1b0);
-   pab1 = (s16) (dev->dev->bus_sprom->pa1b1);
-   pab2 = (s16) (dev->dev->bus_sprom->pa1b2);
-
-   if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
-   pab0 != -1 && pab1 != -1 && pab2 != -1) {
-   /* The pabX values are set in SPROM. Use them. */
-   if ((s8) dev->dev->bus_sprom->itssi_a != 0 &&
-   (s8) dev->dev->bus_sprom->itssi_a != -1)
-   aphy->tgt_idle_tssi =
-   (s8) (dev->dev->bus_sprom->itssi_a);
-   else
-   aphy->tgt_idle_tssi = 62;
-   aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0,
-  pab1, pab2);
-   if (!aphy->tssi2dbm)
-   return -ENOMEM;
-   } else {
-   /* pabX values not set in SPROM,
-* but APHY needs a generated table. */
-   aphy->tssi2dbm = NULL;
-   b43err(dev->wl, "Could not generate tssi2dBm "
-  "table (wrong SPROM info)!\n");
-   return -ENODEV;
-   }
-
-   return 0;
-}
-
-static int b43_aphy_op_allocate(struct b43_wldev *dev)
-{
-   struct b43_phy_a *aphy;
-   int err;
-
-   aphy = kzalloc(sizeof(*aphy), GFP_KERNEL);
-   if (!aphy)
-   return -ENOMEM;
-   dev->phy.a = aphy;
-
-   err = b43_aphy_init_tssi2dbm_table(dev);
-   if (err)
-   goto err_free_aphy;
-
-   return 0;
-
-err_free_aphy:
-   kfree(aphy);
-   dev->phy.a = NULL;
-
-   return err;
-}
-
-static void b43_aphy_op_prepare_structs(struct b43_wldev *dev)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-   const void *tssi2dbm;
-   int tgt_idle_tssi;
-
-   /* tssi2dbm table is constant, so it is initialized at alloc time.
-* Save a copy of the pointer. */
-   tssi2dbm = aphy->tssi2dbm;
-   tgt_idle_tssi = aphy->tgt_idle_tssi;
-
-   /* Zero out the whole PHY structure. */
-   memset(aphy, 0, sizeof(*aphy));
-
-   aphy->tssi2dbm = tssi2dbm;
-   aphy->tgt_idle_tssi = tgt_idle_tssi;
-
-   //TODO init struct b43_phy_a
-
-}
-
-static void b43_aphy_op_free(struct b43_wldev *dev)
-{
-   struct b43_phy *phy = >phy;
-   struct b43_phy_a *aphy = phy->a;
-
-   kfree(aphy->tssi2dbm);
-   aphy->tssi2dbm = NULL;
-
-   kfree(aphy);
-   dev->phy.a = NULL;
-}
-
-static int b43_aphy_op_init(struct b43_wldev *dev)
-{
-   b43_phy_inita(dev);
-
-   return 0;
-}
-
-static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset)
-{
-   /* OFDM registers are base-registers for the A-PHY. */
-   if ((offset & B43_PHYROUTE) == B43_PHYROUTE_OFDM_GPHY) {
-   offset &= ~B43_PHYROUTE;
-   offset |= B43_PHYROUTE_BASE;
-   }
-
-#if B43_DEBUG
-   if ((offset & B43_PHYROUTE) == B43_PHYROUTE_EXT_GPHY) {
-   /* Ext-G registers are only available on G-PHYs */
-   b43err(dev->wl, "Invalid EXT-G PHY access at "
-  "0x%04X on A-PHY\n", offset);
-   dump_stack();