ssb: Remove SSB_WARN_ON, SSB_BUG_ON and SSB_DEBUG

Use the standard WARN_ON instead.
If a small kernel is desired, WARN_ON can be disabled globally.

Also remove SSB_DEBUG. Besides WARN_ON it only adds a tiny debug check.
Include this check unconditionally.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Michael Büsch 2018-07-31 22:15:09 +02:00 committed by Kalle Valo
parent b8b6069cf2
commit 209b43759d
16 changed files with 63 additions and 96 deletions

View File

@ -66,7 +66,6 @@ CONFIG_HW_RANDOM=y
CONFIG_GPIO_SYSFS=y CONFIG_GPIO_SYSFS=y
CONFIG_WATCHDOG=y CONFIG_WATCHDOG=y
CONFIG_BCM47XX_WDT=y CONFIG_BCM47XX_WDT=y
CONFIG_SSB_DEBUG=y
CONFIG_SSB_DRIVER_GIGE=y CONFIG_SSB_DRIVER_GIGE=y
CONFIG_BCMA_DRIVER_GMAC_CMN=y CONFIG_BCMA_DRIVER_GMAC_CMN=y
CONFIG_USB=y CONFIG_USB=y

View File

@ -78,7 +78,6 @@ CONFIG_GPIO_HLWD=y
CONFIG_POWER_RESET=y CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_GPIO=y CONFIG_POWER_RESET_GPIO=y
# CONFIG_HWMON is not set # CONFIG_HWMON is not set
CONFIG_SSB_DEBUG=y
CONFIG_FB=y CONFIG_FB=y
# CONFIG_VGA_CONSOLE is not set # CONFIG_VGA_CONSOLE is not set
CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y

View File

@ -89,15 +89,6 @@ config SSB_HOST_SOC
If unsure, say N If unsure, say N
config SSB_DEBUG
bool "SSB debugging"
depends on SSB
help
This turns on additional runtime checks and debugging
messages. Turn this on for SSB troubleshooting.
If unsure, say N
config SSB_SERIAL config SSB_SERIAL
bool bool
depends on SSB depends on SSB

View File

@ -56,7 +56,7 @@ void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
if (cc->capabilities & SSB_CHIPCO_CAP_PMU) if (cc->capabilities & SSB_CHIPCO_CAP_PMU)
return; /* PMU controls clockmode, separated function needed */ return; /* PMU controls clockmode, separated function needed */
SSB_WARN_ON(ccdev->id.revision >= 20); WARN_ON(ccdev->id.revision >= 20);
/* chipcommon cores prior to rev6 don't support dynamic clock control */ /* chipcommon cores prior to rev6 don't support dynamic clock control */
if (ccdev->id.revision < 6) if (ccdev->id.revision < 6)
@ -111,7 +111,7 @@ void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
} }
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
} }
@ -164,7 +164,7 @@ static int chipco_pctl_clockfreqlimit(struct ssb_chipcommon *cc, int get_max)
divisor = 32; divisor = 32;
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
} else if (cc->dev->id.revision < 10) { } else if (cc->dev->id.revision < 10) {
switch (clocksrc) { switch (clocksrc) {
@ -277,7 +277,7 @@ static void calc_fast_powerup_delay(struct ssb_chipcommon *cc)
minfreq = chipco_pctl_clockfreqlimit(cc, 0); minfreq = chipco_pctl_clockfreqlimit(cc, 0);
pll_on_delay = chipco_read32(cc, SSB_CHIPCO_PLLONDELAY); pll_on_delay = chipco_read32(cc, SSB_CHIPCO_PLLONDELAY);
tmp = (((pll_on_delay + 2) * 1000000) + (minfreq - 1)) / minfreq; tmp = (((pll_on_delay + 2) * 1000000) + (minfreq - 1)) / minfreq;
SSB_WARN_ON(tmp & ~0xFFFF); WARN_ON(tmp & ~0xFFFF);
cc->fast_pwrup_delay = tmp; cc->fast_pwrup_delay = tmp;
} }

View File

@ -128,7 +128,7 @@ static void ssb_pmu0_pllinit_r0(struct ssb_chipcommon *cc,
~(1 << SSB_PMURES_5354_BB_PLL_PU)); ~(1 << SSB_PMURES_5354_BB_PLL_PU));
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
for (i = 1500; i; i--) { for (i = 1500; i; i--) {
tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
@ -265,7 +265,7 @@ static void ssb_pmu1_pllinit_r0(struct ssb_chipcommon *cc,
buffer_strength = 0x222222; buffer_strength = 0x222222;
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
for (i = 1500; i; i--) { for (i = 1500; i; i--) {
tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
@ -501,7 +501,7 @@ static void ssb_pmu_resources_init(struct ssb_chipcommon *cc)
~(depend_tab[i].depend)); ~(depend_tab[i].depend));
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
} }
} }
@ -568,12 +568,12 @@ void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc,
mask = 0x3F; mask = 0x3F;
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
return; return;
} }
break; break;
case 0x4312: case 0x4312:
if (SSB_WARN_ON(id != LDO_PAREF)) if (WARN_ON(id != LDO_PAREF))
return; return;
addr = 0; addr = 0;
shift = 21; shift = 21;

View File

@ -461,7 +461,7 @@ int ssb_gpio_init(struct ssb_bus *bus)
else if (ssb_extif_available(&bus->extif)) else if (ssb_extif_available(&bus->extif))
return ssb_gpio_extif_init(bus); return ssb_gpio_extif_init(bus);
else else
SSB_WARN_ON(1); WARN_ON(1);
return -1; return -1;
} }
@ -473,7 +473,7 @@ int ssb_gpio_unregister(struct ssb_bus *bus)
gpiochip_remove(&bus->gpio); gpiochip_remove(&bus->gpio);
return 0; return 0;
} else { } else {
SSB_WARN_ON(1); WARN_ON(1);
} }
return -1; return -1;

View File

@ -115,7 +115,7 @@ static int ssb_extpci_read_config(struct ssb_pcicore *pc,
u32 addr, val; u32 addr, val;
void __iomem *mmio; void __iomem *mmio;
SSB_WARN_ON(!pc->hostmode); WARN_ON(!pc->hostmode);
if (unlikely(len != 1 && len != 2 && len != 4)) if (unlikely(len != 1 && len != 2 && len != 4))
goto out; goto out;
addr = get_cfgspace_addr(pc, bus, dev, func, off); addr = get_cfgspace_addr(pc, bus, dev, func, off);
@ -161,7 +161,7 @@ static int ssb_extpci_write_config(struct ssb_pcicore *pc,
u32 addr, val = 0; u32 addr, val = 0;
void __iomem *mmio; void __iomem *mmio;
SSB_WARN_ON(!pc->hostmode); WARN_ON(!pc->hostmode);
if (unlikely(len != 1 && len != 2 && len != 4)) if (unlikely(len != 1 && len != 2 && len != 4))
goto out; goto out;
addr = get_cfgspace_addr(pc, bus, dev, func, off); addr = get_cfgspace_addr(pc, bus, dev, func, off);
@ -702,7 +702,7 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
/* Calculate the "coremask" for the device. */ /* Calculate the "coremask" for the device. */
coremask = (1 << dev->core_index); coremask = (1 << dev->core_index);
SSB_WARN_ON(bus->bustype != SSB_BUSTYPE_PCI); WARN_ON(bus->bustype != SSB_BUSTYPE_PCI);
err = pci_read_config_dword(bus->host_pci, SSB_PCI_IRQMASK, &tmp); err = pci_read_config_dword(bus->host_pci, SSB_PCI_IRQMASK, &tmp);
if (err) if (err)
goto out; goto out;

View File

@ -77,7 +77,7 @@ u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask)
else if (ssb_extif_available(&bus->extif)) else if (ssb_extif_available(&bus->extif))
res = ssb_extif_gpio_in(&bus->extif, mask); res = ssb_extif_gpio_in(&bus->extif, mask);
else else
SSB_WARN_ON(1); WARN_ON(1);
spin_unlock_irqrestore(&bus->gpio_lock, flags); spin_unlock_irqrestore(&bus->gpio_lock, flags);
return res; return res;
@ -95,7 +95,7 @@ u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value)
else if (ssb_extif_available(&bus->extif)) else if (ssb_extif_available(&bus->extif))
res = ssb_extif_gpio_out(&bus->extif, mask, value); res = ssb_extif_gpio_out(&bus->extif, mask, value);
else else
SSB_WARN_ON(1); WARN_ON(1);
spin_unlock_irqrestore(&bus->gpio_lock, flags); spin_unlock_irqrestore(&bus->gpio_lock, flags);
return res; return res;
@ -113,7 +113,7 @@ u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value)
else if (ssb_extif_available(&bus->extif)) else if (ssb_extif_available(&bus->extif))
res = ssb_extif_gpio_outen(&bus->extif, mask, value); res = ssb_extif_gpio_outen(&bus->extif, mask, value);
else else
SSB_WARN_ON(1); WARN_ON(1);
spin_unlock_irqrestore(&bus->gpio_lock, flags); spin_unlock_irqrestore(&bus->gpio_lock, flags);
return res; return res;
@ -145,7 +145,7 @@ u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value)
else if (ssb_extif_available(&bus->extif)) else if (ssb_extif_available(&bus->extif))
res = ssb_extif_gpio_intmask(&bus->extif, mask, value); res = ssb_extif_gpio_intmask(&bus->extif, mask, value);
else else
SSB_WARN_ON(1); WARN_ON(1);
spin_unlock_irqrestore(&bus->gpio_lock, flags); spin_unlock_irqrestore(&bus->gpio_lock, flags);
return res; return res;
@ -163,7 +163,7 @@ u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value)
else if (ssb_extif_available(&bus->extif)) else if (ssb_extif_available(&bus->extif))
res = ssb_extif_gpio_polarity(&bus->extif, mask, value); res = ssb_extif_gpio_polarity(&bus->extif, mask, value);
else else
SSB_WARN_ON(1); WARN_ON(1);
spin_unlock_irqrestore(&bus->gpio_lock, flags); spin_unlock_irqrestore(&bus->gpio_lock, flags);
return res; return res;

View File

@ -61,7 +61,7 @@ static void ssb_host_soc_block_read(struct ssb_device *dev, void *buffer,
case sizeof(u16): { case sizeof(u16): {
__le16 *buf = buffer; __le16 *buf = buffer;
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
while (count) { while (count) {
*buf = (__force __le16)__raw_readw(addr); *buf = (__force __le16)__raw_readw(addr);
buf++; buf++;
@ -72,7 +72,7 @@ static void ssb_host_soc_block_read(struct ssb_device *dev, void *buffer,
case sizeof(u32): { case sizeof(u32): {
__le32 *buf = buffer; __le32 *buf = buffer;
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
while (count) { while (count) {
*buf = (__force __le32)__raw_readl(addr); *buf = (__force __le32)__raw_readl(addr);
buf++; buf++;
@ -81,7 +81,7 @@ static void ssb_host_soc_block_read(struct ssb_device *dev, void *buffer,
break; break;
} }
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
} }
#endif /* CONFIG_SSB_BLOCKIO */ #endif /* CONFIG_SSB_BLOCKIO */
@ -134,7 +134,7 @@ static void ssb_host_soc_block_write(struct ssb_device *dev, const void *buffer,
case sizeof(u16): { case sizeof(u16): {
const __le16 *buf = buffer; const __le16 *buf = buffer;
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
while (count) { while (count) {
__raw_writew((__force u16)(*buf), addr); __raw_writew((__force u16)(*buf), addr);
buf++; buf++;
@ -145,7 +145,7 @@ static void ssb_host_soc_block_write(struct ssb_device *dev, const void *buffer,
case sizeof(u32): { case sizeof(u32): {
const __le32 *buf = buffer; const __le32 *buf = buffer;
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
while (count) { while (count) {
__raw_writel((__force u32)(*buf), addr); __raw_writel((__force u32)(*buf), addr);
buf++; buf++;
@ -154,7 +154,7 @@ static void ssb_host_soc_block_write(struct ssb_device *dev, const void *buffer,
break; break;
} }
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
} }
#endif /* CONFIG_SSB_BLOCKIO */ #endif /* CONFIG_SSB_BLOCKIO */

View File

@ -209,7 +209,7 @@ int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
memset(ctx, 0, sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx));
ctx->bus = bus; ctx->bus = bus;
SSB_WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen)); WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen));
for (i = 0; i < bus->nr_devices; i++) { for (i = 0; i < bus->nr_devices; i++) {
sdev = ssb_device_get(&bus->devices[i]); sdev = ssb_device_get(&bus->devices[i]);
@ -220,7 +220,7 @@ int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
continue; continue;
} }
sdrv = drv_to_ssb_drv(sdev->dev->driver); sdrv = drv_to_ssb_drv(sdev->dev->driver);
if (SSB_WARN_ON(!sdrv->remove)) if (WARN_ON(!sdrv->remove))
continue; continue;
sdrv->remove(sdev); sdrv->remove(sdev);
ctx->device_frozen[i] = 1; ctx->device_frozen[i] = 1;
@ -248,10 +248,10 @@ int ssb_devices_thaw(struct ssb_freeze_context *ctx)
continue; continue;
sdev = &bus->devices[i]; sdev = &bus->devices[i];
if (SSB_WARN_ON(!sdev->dev || !sdev->dev->driver)) if (WARN_ON(!sdev->dev || !sdev->dev->driver))
continue; continue;
sdrv = drv_to_ssb_drv(sdev->dev->driver); sdrv = drv_to_ssb_drv(sdev->dev->driver);
if (SSB_WARN_ON(!sdrv || !sdrv->probe)) if (WARN_ON(!sdrv || !sdrv->probe))
continue; continue;
err = sdrv->probe(sdev, &sdev->id); err = sdrv->probe(sdev, &sdev->id);
@ -861,13 +861,13 @@ u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m)
case SSB_PLLTYPE_2: /* 48Mhz, 4 dividers */ case SSB_PLLTYPE_2: /* 48Mhz, 4 dividers */
n1 += SSB_CHIPCO_CLK_T2_BIAS; n1 += SSB_CHIPCO_CLK_T2_BIAS;
n2 += SSB_CHIPCO_CLK_T2_BIAS; n2 += SSB_CHIPCO_CLK_T2_BIAS;
SSB_WARN_ON(!((n1 >= 2) && (n1 <= 7))); WARN_ON(!((n1 >= 2) && (n1 <= 7)));
SSB_WARN_ON(!((n2 >= 5) && (n2 <= 23))); WARN_ON(!((n2 >= 5) && (n2 <= 23)));
break; break;
case SSB_PLLTYPE_5: /* 25Mhz, 4 dividers */ case SSB_PLLTYPE_5: /* 25Mhz, 4 dividers */
return 100000000; return 100000000;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
switch (plltype) { switch (plltype) {
@ -916,9 +916,9 @@ u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m)
m1 += SSB_CHIPCO_CLK_T2_BIAS; m1 += SSB_CHIPCO_CLK_T2_BIAS;
m2 += SSB_CHIPCO_CLK_T2M2_BIAS; m2 += SSB_CHIPCO_CLK_T2M2_BIAS;
m3 += SSB_CHIPCO_CLK_T2_BIAS; m3 += SSB_CHIPCO_CLK_T2_BIAS;
SSB_WARN_ON(!((m1 >= 2) && (m1 <= 7))); WARN_ON(!((m1 >= 2) && (m1 <= 7)));
SSB_WARN_ON(!((m2 >= 3) && (m2 <= 10))); WARN_ON(!((m2 >= 3) && (m2 <= 10)));
SSB_WARN_ON(!((m3 >= 2) && (m3 <= 7))); WARN_ON(!((m3 >= 2) && (m3 <= 7)));
if (!(mc & SSB_CHIPCO_CLK_T2MC_M1BYP)) if (!(mc & SSB_CHIPCO_CLK_T2MC_M1BYP))
clock /= m1; clock /= m1;
@ -928,7 +928,7 @@ u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m)
clock /= m3; clock /= m3;
return clock; return clock;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
return 0; return 0;
} }
@ -1169,9 +1169,7 @@ int ssb_bus_may_powerdown(struct ssb_bus *bus)
if (err) if (err)
goto error; goto error;
out: out:
#ifdef CONFIG_SSB_DEBUG
bus->powered_up = 0; bus->powered_up = 0;
#endif
return err; return err;
error: error:
pr_err("Bus powerdown failed\n"); pr_err("Bus powerdown failed\n");
@ -1188,9 +1186,7 @@ int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl)
if (err) if (err)
goto error; goto error;
#ifdef CONFIG_SSB_DEBUG
bus->powered_up = 1; bus->powered_up = 1;
#endif
mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST; mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST;
ssb_chipco_set_clockmode(&bus->chipco, mode); ssb_chipco_set_clockmode(&bus->chipco, mode);
@ -1242,15 +1238,15 @@ u32 ssb_admatch_base(u32 adm)
base = (adm & SSB_ADM_BASE0); base = (adm & SSB_ADM_BASE0);
break; break;
case SSB_ADM_TYPE1: case SSB_ADM_TYPE1:
SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ WARN_ON(adm & SSB_ADM_NEG); /* unsupported */
base = (adm & SSB_ADM_BASE1); base = (adm & SSB_ADM_BASE1);
break; break;
case SSB_ADM_TYPE2: case SSB_ADM_TYPE2:
SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ WARN_ON(adm & SSB_ADM_NEG); /* unsupported */
base = (adm & SSB_ADM_BASE2); base = (adm & SSB_ADM_BASE2);
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
return base; return base;
@ -1266,15 +1262,15 @@ u32 ssb_admatch_size(u32 adm)
size = ((adm & SSB_ADM_SZ0) >> SSB_ADM_SZ0_SHIFT); size = ((adm & SSB_ADM_SZ0) >> SSB_ADM_SZ0_SHIFT);
break; break;
case SSB_ADM_TYPE1: case SSB_ADM_TYPE1:
SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ WARN_ON(adm & SSB_ADM_NEG); /* unsupported */
size = ((adm & SSB_ADM_SZ1) >> SSB_ADM_SZ1_SHIFT); size = ((adm & SSB_ADM_SZ1) >> SSB_ADM_SZ1_SHIFT);
break; break;
case SSB_ADM_TYPE2: case SSB_ADM_TYPE2:
SSB_WARN_ON(adm & SSB_ADM_NEG); /* unsupported */ WARN_ON(adm & SSB_ADM_NEG); /* unsupported */
size = ((adm & SSB_ADM_SZ2) >> SSB_ADM_SZ2_SHIFT); size = ((adm & SSB_ADM_SZ2) >> SSB_ADM_SZ2_SHIFT);
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
size = (1 << (size + 1)); size = (1 << (size + 1));

View File

@ -946,7 +946,6 @@ out:
return err; return err;
} }
#ifdef CONFIG_SSB_DEBUG
static int ssb_pci_assert_buspower(struct ssb_bus *bus) static int ssb_pci_assert_buspower(struct ssb_bus *bus)
{ {
if (likely(bus->powered_up)) if (likely(bus->powered_up))
@ -960,12 +959,6 @@ static int ssb_pci_assert_buspower(struct ssb_bus *bus)
return -ENODEV; return -ENODEV;
} }
#else /* DEBUG */
static inline int ssb_pci_assert_buspower(struct ssb_bus *bus)
{
return 0;
}
#endif /* DEBUG */
static u8 ssb_pci_read8(struct ssb_device *dev, u16 offset) static u8 ssb_pci_read8(struct ssb_device *dev, u16 offset)
{ {
@ -1024,15 +1017,15 @@ static void ssb_pci_block_read(struct ssb_device *dev, void *buffer,
ioread8_rep(addr, buffer, count); ioread8_rep(addr, buffer, count);
break; break;
case sizeof(u16): case sizeof(u16):
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
ioread16_rep(addr, buffer, count >> 1); ioread16_rep(addr, buffer, count >> 1);
break; break;
case sizeof(u32): case sizeof(u32):
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
ioread32_rep(addr, buffer, count >> 2); ioread32_rep(addr, buffer, count >> 2);
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
return; return;
@ -1098,15 +1091,15 @@ static void ssb_pci_block_write(struct ssb_device *dev, const void *buffer,
iowrite8_rep(addr, buffer, count); iowrite8_rep(addr, buffer, count);
break; break;
case sizeof(u16): case sizeof(u16):
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
iowrite16_rep(addr, buffer, count >> 1); iowrite16_rep(addr, buffer, count >> 1);
break; break;
case sizeof(u32): case sizeof(u32):
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
iowrite32_rep(addr, buffer, count >> 2); iowrite32_rep(addr, buffer, count >> 2);
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
} }
#endif /* CONFIG_SSB_BLOCKIO */ #endif /* CONFIG_SSB_BLOCKIO */

View File

@ -169,7 +169,7 @@ int ssb_pcmcia_switch_segment(struct ssb_bus *bus, u8 seg)
int err; int err;
u8 val; u8 val;
SSB_WARN_ON((seg != 0) && (seg != 1)); WARN_ON((seg != 0) && (seg != 1));
while (1) { while (1) {
err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_MEMSEG, seg); err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_MEMSEG, seg);
if (err) if (err)
@ -299,7 +299,7 @@ static void ssb_pcmcia_block_read(struct ssb_device *dev, void *buffer,
case sizeof(u16): { case sizeof(u16): {
__le16 *buf = buffer; __le16 *buf = buffer;
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
while (count) { while (count) {
*buf = (__force __le16)__raw_readw(addr); *buf = (__force __le16)__raw_readw(addr);
buf++; buf++;
@ -310,7 +310,7 @@ static void ssb_pcmcia_block_read(struct ssb_device *dev, void *buffer,
case sizeof(u32): { case sizeof(u32): {
__le16 *buf = buffer; __le16 *buf = buffer;
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
while (count) { while (count) {
*buf = (__force __le16)__raw_readw(addr); *buf = (__force __le16)__raw_readw(addr);
buf++; buf++;
@ -321,7 +321,7 @@ static void ssb_pcmcia_block_read(struct ssb_device *dev, void *buffer,
break; break;
} }
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
unlock: unlock:
spin_unlock_irqrestore(&bus->bar_lock, flags); spin_unlock_irqrestore(&bus->bar_lock, flags);
@ -399,7 +399,7 @@ static void ssb_pcmcia_block_write(struct ssb_device *dev, const void *buffer,
case sizeof(u16): { case sizeof(u16): {
const __le16 *buf = buffer; const __le16 *buf = buffer;
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
while (count) { while (count) {
__raw_writew((__force u16)(*buf), addr); __raw_writew((__force u16)(*buf), addr);
buf++; buf++;
@ -410,7 +410,7 @@ static void ssb_pcmcia_block_write(struct ssb_device *dev, const void *buffer,
case sizeof(u32): { case sizeof(u32): {
const __le16 *buf = buffer; const __le16 *buf = buffer;
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
while (count) { while (count) {
__raw_writew((__force u16)(*buf), addr); __raw_writew((__force u16)(*buf), addr);
buf++; buf++;
@ -421,7 +421,7 @@ static void ssb_pcmcia_block_write(struct ssb_device *dev, const void *buffer,
break; break;
} }
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
unlock: unlock:
mmiowb(); mmiowb();

View File

@ -210,7 +210,7 @@ void ssb_iounmap(struct ssb_bus *bus)
#ifdef CONFIG_SSB_PCIHOST #ifdef CONFIG_SSB_PCIHOST
pci_iounmap(bus->host_pci, bus->mmio); pci_iounmap(bus->host_pci, bus->mmio);
#else #else
SSB_BUG_ON(1); /* Can't reach this code. */ WARN_ON(1); /* Can't reach this code. */
#endif #endif
break; break;
case SSB_BUSTYPE_SDIO: case SSB_BUSTYPE_SDIO:
@ -236,7 +236,7 @@ static void __iomem *ssb_ioremap(struct ssb_bus *bus,
#ifdef CONFIG_SSB_PCIHOST #ifdef CONFIG_SSB_PCIHOST
mmio = pci_iomap(bus->host_pci, 0, ~0UL); mmio = pci_iomap(bus->host_pci, 0, ~0UL);
#else #else
SSB_BUG_ON(1); /* Can't reach this code. */ WARN_ON(1); /* Can't reach this code. */
#endif #endif
break; break;
case SSB_BUSTYPE_SDIO: case SSB_BUSTYPE_SDIO:

View File

@ -316,18 +316,18 @@ static void ssb_sdio_block_read(struct ssb_device *dev, void *buffer,
break; break;
} }
case sizeof(u16): { case sizeof(u16): {
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
error = sdio_readsb(bus->host_sdio, buffer, offset, count); error = sdio_readsb(bus->host_sdio, buffer, offset, count);
break; break;
} }
case sizeof(u32): { case sizeof(u32): {
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
offset |= SBSDIO_SB_ACCESS_2_4B_FLAG; /* 32 bit data access */ offset |= SBSDIO_SB_ACCESS_2_4B_FLAG; /* 32 bit data access */
error = sdio_readsb(bus->host_sdio, buffer, offset, count); error = sdio_readsb(bus->host_sdio, buffer, offset, count);
break; break;
} }
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
if (!error) if (!error)
goto out; goto out;
@ -423,18 +423,18 @@ static void ssb_sdio_block_write(struct ssb_device *dev, const void *buffer,
(void *)buffer, count); (void *)buffer, count);
break; break;
case sizeof(u16): case sizeof(u16):
SSB_WARN_ON(count & 1); WARN_ON(count & 1);
error = sdio_writesb(bus->host_sdio, offset, error = sdio_writesb(bus->host_sdio, offset,
(void *)buffer, count); (void *)buffer, count);
break; break;
case sizeof(u32): case sizeof(u32):
SSB_WARN_ON(count & 3); WARN_ON(count & 3);
offset |= SBSDIO_SB_ACCESS_2_4B_FLAG; /* 32 bit data access */ offset |= SBSDIO_SB_ACCESS_2_4B_FLAG; /* 32 bit data access */
error = sdio_writesb(bus->host_sdio, offset, error = sdio_writesb(bus->host_sdio, offset,
(void *)buffer, count); (void *)buffer, count);
break; break;
default: default:
SSB_WARN_ON(1); WARN_ON(1);
} }
if (!error) if (!error)
goto out; goto out;

View File

@ -9,15 +9,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/bcm47xx_wdt.h> #include <linux/bcm47xx_wdt.h>
#ifdef CONFIG_SSB_DEBUG
# define SSB_WARN_ON(x) WARN_ON(x)
# define SSB_BUG_ON(x) BUG_ON(x)
#else
static inline int __ssb_do_nothing(int x) { return x; }
# define SSB_WARN_ON(x) __ssb_do_nothing(unlikely(!!(x)))
# define SSB_BUG_ON(x) __ssb_do_nothing(unlikely(!!(x)))
#endif
/* pci.c */ /* pci.c */
#ifdef CONFIG_SSB_PCIHOST #ifdef CONFIG_SSB_PCIHOST

View File

@ -499,11 +499,9 @@ struct ssb_bus {
/* Internal-only stuff follows. Do not touch. */ /* Internal-only stuff follows. Do not touch. */
struct list_head list; struct list_head list;
#ifdef CONFIG_SSB_DEBUG
/* Is the bus already powered up? */ /* Is the bus already powered up? */
bool powered_up; bool powered_up;
int power_warn_count; int power_warn_count;
#endif /* DEBUG */
}; };
enum ssb_quirks { enum ssb_quirks {