Commit 505fb019 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

b43: bus: add helpers for checking host type

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d48ae5c8
...@@ -46,6 +46,17 @@ struct b43_bus_dev { ...@@ -46,6 +46,17 @@ struct b43_bus_dev {
u8 core_rev; u8 core_rev;
}; };
static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev)
{
return (dev->bus_type == B43_BUS_SSB &&
dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA);
}
static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
{
return (dev->bus_type == B43_BUS_SSB &&
dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
}
struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
#endif /* B43_BUS_H_ */ #endif /* B43_BUS_H_ */
...@@ -1645,7 +1645,7 @@ static void b43_beacon_update_trigger_work(struct work_struct *work) ...@@ -1645,7 +1645,7 @@ static void b43_beacon_update_trigger_work(struct work_struct *work)
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
dev = wl->current_dev; dev = wl->current_dev;
if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) {
if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { if (b43_bus_host_is_sdio(dev->dev)) {
/* wl->mutex is enough. */ /* wl->mutex is enough. */
b43_do_beacon_update_trigger_work(dev); b43_do_beacon_update_trigger_work(dev);
mmiowb(); mmiowb();
...@@ -3955,7 +3955,7 @@ static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev) ...@@ -3955,7 +3955,7 @@ static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev)
/* Disable interrupts on the device. */ /* Disable interrupts on the device. */
b43_set_status(dev, B43_STAT_INITIALIZED); b43_set_status(dev, B43_STAT_INITIALIZED);
if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { if (b43_bus_host_is_sdio(dev->dev)) {
/* wl->mutex is locked. That is enough. */ /* wl->mutex is locked. That is enough. */
b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0);
b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */
...@@ -3968,7 +3968,7 @@ static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev) ...@@ -3968,7 +3968,7 @@ static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev)
/* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */
orig_dev = dev; orig_dev = dev;
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { if (b43_bus_host_is_sdio(dev->dev)) {
b43_sdio_free_irq(dev); b43_sdio_free_irq(dev);
} else { } else {
synchronize_irq(dev->dev->irq); synchronize_irq(dev->dev->irq);
...@@ -4005,7 +4005,7 @@ static int b43_wireless_core_start(struct b43_wldev *dev) ...@@ -4005,7 +4005,7 @@ static int b43_wireless_core_start(struct b43_wldev *dev)
B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED); B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED);
drain_txstatus_queue(dev); drain_txstatus_queue(dev);
if (dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) { if (b43_bus_host_is_sdio(dev->dev)) {
err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler); err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler);
if (err) { if (err) {
b43err(dev->wl, "Cannot request SDIO IRQ\n"); b43err(dev->wl, "Cannot request SDIO IRQ\n");
...@@ -4405,8 +4405,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev) ...@@ -4405,8 +4405,8 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
/* Maximum Contention Window */ /* Maximum Contention Window */
b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF);
if ((dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA) || if (b43_bus_host_is_pcmcia(dev->dev) ||
(dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO) || b43_bus_host_is_sdio(dev->dev) ||
dev->use_pio) { dev->use_pio) {
dev->__using_pio_transfers = 1; dev->__using_pio_transfers = 1;
err = b43_pio_init(dev); err = b43_pio_init(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment