mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
9f2a0fac62
On module removal, the sdio version of b43 generates the following warning: [ 851.560519] ------------[ cut here ]------------ [ 851.560531] WARNING: at drivers/mmc/core/core.c:237 mmc_wait_for_cmd+0x88/0x90() [ 851.560534] Hardware name: 20552PG [ 851.560536] Modules linked in: b43(-) ssb mmc_block binfmt_misc rfcomm sco bnep ppdev l2cap ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp kvm_intel kvm arc4 iwlagn snd_hda_codec_conexant snd_hda_intel snd_hda_codec iwlcore snd_hwdep snd_pcm thinkpad_acpi mac80211 snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq r852 joydev snd_timer sm_common pcmcia nand snd_seq_device cfg80211 sdhci_pci btusb psmouse tpm_tis yenta_socket nand_ids lp snd pcmcia_rsrc nand_ecc bluetooth sdhci tpm pcmcia_core parport mtd snd_page_alloc serio_raw tpm_bios soundcore nvram led_class sha256_generic aes_i586 aes_generic dm_crypt i915 drm_kms_helper drm ahci intel_agp i2c_algo_bit intel_gtt e1000e libahci video agpgart output [ 851.560620] Pid: 2504, comm: rmmod Not tainted 2.6.36-titan0+ #1 [ 851.560622] Call Trace: [ 851.560631] [<c014a102>] warn_slowpath_common+0x72/0xa0 [ 851.560636] [<c04d94c8>] ? mmc_wait_for_cmd+0x88/0x90 [ 851.560641] [<c04d94c8>] ? mmc_wait_for_cmd+0x88/0x90 [ 851.560645] [<c014a152>] warn_slowpath_null+0x22/0x30 [ 851.560649] [<c04d94c8>] mmc_wait_for_cmd+0x88/0x90 [ 851.560655] [<c0401585>] ? device_release+0x25/0x80 [ 851.560660] [<c04df210>] mmc_io_rw_direct_host+0xa0/0x150 [ 851.560665] [<c04df370>] mmc_io_rw_direct+0x30/0x40 [ 851.560669] [<c04e06e7>] sdio_disable_func+0x37/0xa0 [ 851.560683] [<f8dfcb80>] b43_sdio_remove+0x30/0x50 [b43] [ 851.560687] [<c04df8cc>] sdio_bus_remove+0x1c/0x60 [ 851.560692] [<c016d39f>] ? blocking_notifier_call_chain+0x1f/0x30 [ 851.560697] [<c0404991>] __device_release_driver+0x51/0xb0 [ 851.560701] [<c0404a7f>] driver_detach+0x8f/0xa0 [ 851.560705] [<c0403c83>] bus_remove_driver+0x63/0xa0 [ 851.560709] [<c0405039>] driver_unregister+0x49/0x80 [ 851.560713] [<c0405039>] ? driver_unregister+0x49/0x80 [ 851.560718] [<c04dfad7>] sdio_unregister_driver+0x17/0x20 [ 851.560727] [<f8dfcb42>] b43_sdio_exit+0x12/0x20 [b43] [ 851.560734] [<f8dfe76f>] b43_exit+0x17/0x3c [b43] [ 851.560740] [<c017fb8d>] sys_delete_module+0x13d/0x200 [ 851.560747] [<c01fd7d2>] ? do_munmap+0x212/0x300 [ 851.560752] [<c010311f>] sysenter_do_call+0x12/0x28 [ 851.560757] ---[ end trace 31e14488072d2f7d ]--- [ 851.560759] ------------[ cut here ]------------ The warning is caused by b43 not claiming the device before calling sdio_disable_func(). Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Reported-by: Arnd Hannemann <arnd@arndnet.de> Tested-by: Arnd Hannemann <arnd@arndnet.de> Cc: Stable <stable@kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
207 lines
4.6 KiB
C
207 lines
4.6 KiB
C
/*
|
|
* Broadcom B43 wireless driver
|
|
*
|
|
* SDIO over Sonics Silicon Backplane bus glue for b43.
|
|
*
|
|
* Copyright (C) 2009 Albert Herranz
|
|
* Copyright (C) 2009 Michael Buesch <mb@bu3sch.de>
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/mmc/card.h>
|
|
#include <linux/mmc/sdio_func.h>
|
|
#include <linux/mmc/sdio_ids.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/ssb/ssb.h>
|
|
|
|
#include "sdio.h"
|
|
#include "b43.h"
|
|
|
|
|
|
#define HNBU_CHIPID 0x01 /* vendor & device id */
|
|
|
|
#define B43_SDIO_BLOCK_SIZE 64 /* rx fifo max size in bytes */
|
|
|
|
|
|
static const struct b43_sdio_quirk {
|
|
u16 vendor;
|
|
u16 device;
|
|
unsigned int quirks;
|
|
} b43_sdio_quirks[] = {
|
|
{ 0x14E4, 0x4318, SSB_QUIRK_SDIO_READ_AFTER_WRITE32, },
|
|
{ },
|
|
};
|
|
|
|
|
|
static unsigned int b43_sdio_get_quirks(u16 vendor, u16 device)
|
|
{
|
|
const struct b43_sdio_quirk *q;
|
|
|
|
for (q = b43_sdio_quirks; q->quirks; q++) {
|
|
if (vendor == q->vendor && device == q->device)
|
|
return q->quirks;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void b43_sdio_interrupt_dispatcher(struct sdio_func *func)
|
|
{
|
|
struct b43_sdio *sdio = sdio_get_drvdata(func);
|
|
struct b43_wldev *dev = sdio->irq_handler_opaque;
|
|
|
|
if (unlikely(b43_status(dev) < B43_STAT_STARTED))
|
|
return;
|
|
|
|
sdio_release_host(func);
|
|
sdio->irq_handler(dev);
|
|
sdio_claim_host(func);
|
|
}
|
|
|
|
int b43_sdio_request_irq(struct b43_wldev *dev,
|
|
void (*handler)(struct b43_wldev *dev))
|
|
{
|
|
struct ssb_bus *bus = dev->dev->bus;
|
|
struct sdio_func *func = bus->host_sdio;
|
|
struct b43_sdio *sdio = sdio_get_drvdata(func);
|
|
int err;
|
|
|
|
sdio->irq_handler_opaque = dev;
|
|
sdio->irq_handler = handler;
|
|
sdio_claim_host(func);
|
|
err = sdio_claim_irq(func, b43_sdio_interrupt_dispatcher);
|
|
sdio_release_host(func);
|
|
|
|
return err;
|
|
}
|
|
|
|
void b43_sdio_free_irq(struct b43_wldev *dev)
|
|
{
|
|
struct ssb_bus *bus = dev->dev->bus;
|
|
struct sdio_func *func = bus->host_sdio;
|
|
struct b43_sdio *sdio = sdio_get_drvdata(func);
|
|
|
|
sdio_claim_host(func);
|
|
sdio_release_irq(func);
|
|
sdio_release_host(func);
|
|
sdio->irq_handler_opaque = NULL;
|
|
sdio->irq_handler = NULL;
|
|
}
|
|
|
|
static int b43_sdio_probe(struct sdio_func *func,
|
|
const struct sdio_device_id *id)
|
|
{
|
|
struct b43_sdio *sdio;
|
|
struct sdio_func_tuple *tuple;
|
|
u16 vendor = 0, device = 0;
|
|
int error;
|
|
|
|
/* Look for the card chip identifier. */
|
|
tuple = func->tuples;
|
|
while (tuple) {
|
|
switch (tuple->code) {
|
|
case 0x80:
|
|
switch (tuple->data[0]) {
|
|
case HNBU_CHIPID:
|
|
if (tuple->size != 5)
|
|
break;
|
|
vendor = tuple->data[1] | (tuple->data[2]<<8);
|
|
device = tuple->data[3] | (tuple->data[4]<<8);
|
|
dev_info(&func->dev, "Chip ID %04x:%04x\n",
|
|
vendor, device);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
tuple = tuple->next;
|
|
}
|
|
if (!vendor || !device) {
|
|
error = -ENODEV;
|
|
goto out;
|
|
}
|
|
|
|
sdio_claim_host(func);
|
|
error = sdio_set_block_size(func, B43_SDIO_BLOCK_SIZE);
|
|
if (error) {
|
|
dev_err(&func->dev, "failed to set block size to %u bytes,"
|
|
" error %d\n", B43_SDIO_BLOCK_SIZE, error);
|
|
goto err_release_host;
|
|
}
|
|
error = sdio_enable_func(func);
|
|
if (error) {
|
|
dev_err(&func->dev, "failed to enable func, error %d\n", error);
|
|
goto err_release_host;
|
|
}
|
|
sdio_release_host(func);
|
|
|
|
sdio = kzalloc(sizeof(*sdio), GFP_KERNEL);
|
|
if (!sdio) {
|
|
error = -ENOMEM;
|
|
dev_err(&func->dev, "failed to allocate ssb bus\n");
|
|
goto err_disable_func;
|
|
}
|
|
error = ssb_bus_sdiobus_register(&sdio->ssb, func,
|
|
b43_sdio_get_quirks(vendor, device));
|
|
if (error) {
|
|
dev_err(&func->dev, "failed to register ssb sdio bus,"
|
|
" error %d\n", error);
|
|
goto err_free_ssb;
|
|
}
|
|
sdio_set_drvdata(func, sdio);
|
|
|
|
return 0;
|
|
|
|
err_free_ssb:
|
|
kfree(sdio);
|
|
err_disable_func:
|
|
sdio_disable_func(func);
|
|
err_release_host:
|
|
sdio_release_host(func);
|
|
out:
|
|
return error;
|
|
}
|
|
|
|
static void b43_sdio_remove(struct sdio_func *func)
|
|
{
|
|
struct b43_sdio *sdio = sdio_get_drvdata(func);
|
|
|
|
ssb_bus_unregister(&sdio->ssb);
|
|
sdio_claim_host(func);
|
|
sdio_disable_func(func);
|
|
sdio_release_host(func);
|
|
kfree(sdio);
|
|
sdio_set_drvdata(func, NULL);
|
|
}
|
|
|
|
static const struct sdio_device_id b43_sdio_ids[] = {
|
|
{ SDIO_DEVICE(0x02d0, 0x044b) }, /* Nintendo Wii WLAN daughter card */
|
|
{ SDIO_DEVICE(0x0092, 0x0004) }, /* C-guys, Inc. EW-CG1102GC */
|
|
{ },
|
|
};
|
|
|
|
static struct sdio_driver b43_sdio_driver = {
|
|
.name = "b43-sdio",
|
|
.id_table = b43_sdio_ids,
|
|
.probe = b43_sdio_probe,
|
|
.remove = b43_sdio_remove,
|
|
};
|
|
|
|
int b43_sdio_init(void)
|
|
{
|
|
return sdio_register_driver(&b43_sdio_driver);
|
|
}
|
|
|
|
void b43_sdio_exit(void)
|
|
{
|
|
sdio_unregister_driver(&b43_sdio_driver);
|
|
}
|