b43: use condition for SSB specific ops
RFC PATCH 1/1 b43: use condition for SSB specific ops
---
Abstracting bus by b43_bus_dev works fine, but there are few places where we calls SSB functions in uniq way. That calls happen only once in the whole code and so there is not much sense in putting them in bus abstraction.
In this situation I have decided to use simple switches. It does not make code look lovely, but I do not have any better idea. If anyone have - comments are really welcome.
--- drivers/net/wireless/b43/b43.h | 1 - drivers/net/wireless/b43/dma.c | 7 ++- drivers/net/wireless/b43/main.c | 132 ++++++++++++++++++++++++++------------ drivers/net/wireless/b43/phy_n.c | 33 +++++++--- 5 files changed, 120 insertions(+), 55 deletions(-)
drivers/net/wireless/b43/b43.h +0 -1
@@ -709,7 +709,6 @@ enum {/* Data structure for one wireless device (802.11 core) */ struct b43_wldev { -struct ssb_device *sdev;/* TODO: remove when b43_bus_dev is ready */ struct b43_bus_dev *dev;struct b43_wl *wl;
drivers/net/wireless/b43/dma.c +6 -1
@@ -1055,7 +1055,12 @@ int b43_dma_init(struct b43_wldev *dev) err =b43_dma_set_mask (dev, dmamask);if (err)return err; - dma->translation =ssb_dma_translation (dev->sdev); + +switch (dev->dev->bus_type) { +case B43_BUS_SSB : + dma->translation =ssb_dma_translation (dev->dev->sdev); +break ; + } err = -ENOMEM ;/* setup TX DMA channels. */
drivers/net/wireless/b43/main.c +90 -42
234 lines not on this page · raw message
drivers/net/wireless/b43/phy_n.c +23 -10
@@ -603,17 +603,21 @@ static void b43_nphy_tx_lp_fbw(struct b43_wldev *dev)/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/BmacPhyClkFgc */ static void b43_nphy_bmac_clock_fgc (struct b43_wldev *dev,bool force) { -u32 tmslow; +u32 tmp;if (dev->phy.type !=B43_PHYTYPE_N )return ; - tmslow =ssb_read32 (dev->sdev,SSB_TMSLOW ); -if (force) - tmslow |=SSB_TMSLOW_FGC ; -else - tmslow &= ~SSB_TMSLOW_FGC ; -ssb_write32 (dev->sdev,SSB_TMSLOW , tmslow); +switch (dev->dev->bus_type) { +case B43_BUS_SSB : + tmp =ssb_read32 (dev->dev->sdev,SSB_TMSLOW ); +if (force) + tmp |=SSB_TMSLOW_FGC ; +else + tmp &= ~SSB_TMSLOW_FGC ; +ssb_write32 (dev->dev->sdev,SSB_TMSLOW , tmp); +break ; + } }/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
@@ -958,8 +962,12 @@ static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)b43_phy_write (dev,B43_NPHY_GPIO_LOOEN ,0 );b43_phy_write (dev,B43_NPHY_GPIO_HIOEN ,0 ); -ssb_chipco_gpio_control (&dev->sdev->bus->chipco,0xFC00 , -0xFC00 ); +switch (dev->dev->bus_type) { +case B43_BUS_SSB : +ssb_chipco_gpio_control (&dev->dev->sdev->bus->chipco, +0xFC00 ,0xFC00 ); +break ; + }b43_write32 (dev,B43_MMIO_MACCTL ,b43_read32 (dev,B43_MMIO_MACCTL ) & ~B43_MACCTL_GPOUTSMSK );
@@ -3600,7 +3608,12 @@ int b43_phy_initn(struct b43_wldev *dev)if ((dev->phy.rev >=3 ) && (sprom->boardflags_lo &B43_BFL_EXTLNA ) && (b43_current_band (dev->wl) ==IEEE80211_BAND_2GHZ )) { -chipco_set32 (&dev->sdev->bus->chipco,SSB_CHIPCO_CHIPCTL ,0x40 ); +switch (dev->dev->bus_type) { +case B43_BUS_SSB : +chipco_set32 (&dev->dev->sdev->bus->chipco, +SSB_CHIPCO_CHIPCTL ,0x40 ); +break ; + } } nphy->deaf_count =0 ;b43_nphy_tables_init (dev);
Signature · 1 line
1.7.3.4
RFC PATCH 1/1 b43: use condition for SSB specific ops
W dniu 2 czerwca 2011 13:11 u?ytkownik Rafa? Mi?ecki <[email protected]> napisa?:
Quoted 11 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
Abstracting bus byb43_bus_devworks fine, but there are few places where we calls SSB functions in uniq way. That calls happen only once in the whole code and so there is not much sense in putting them in bus abstraction.In this situation I have decided to use simple switches. It does not make code look lovely, but I do not have any better idea. If anyone have - comments are really welcome.
This final code would need to be something like:
switch (dev->dev->bus_type) {
#ifdef CONFIG_B43_BCMA
case B43_BUS_BCMA:
dma->translation = bcma_dma_translation(dev->dev->bdev); break; #endif #ifdef CONFIG_B43_SSB case B43_BUS_SSB: dma->translation = ssb_dma_translation(dev->dev->sdev); break;
#endif
}
So something nicer would be welcome. But what? :| Putting this in bus.c? Even if that are once-callers?
Signature · 1 line
Rafa?