Fix WARNING on Linux 3.9 (Closes GH-55)

Patch by amonakov. This stops the following error:

    bbswitch: disabling discrete graphics
    ------------[ cut here ]------------
    WARNING: at drivers/pci/pci.c:1393 pci_disable_device+0x84/0x90()
    Hardware name: B7130
    [44B blob data]
    Modules linked in:
     bbswitch(O+) ip_set_hash_ip xt_set ip_set nfnetlink ipt_REJECT xt_recent xt_tcpudp xt_owner nf_conntrack_ipv6 nf_defrag
    Pid: 2653, comm: modprobe Tainted: G           O 3.9.1-1-custom #1
    Call Trace:
     [<ffffffff8103fe60>] warn_slowpath_common+0x70/0xa0
     [<ffffffff8103fedc>] warn_slowpath_fmt+0x4c/0x50
     [<ffffffff8130712c>] ? pci_bus_write_config_word+0x1c/0x20
     [<ffffffff8130d794>] pci_disable_device+0x84/0x90
     [<ffffffffa05b21f6>] bbswitch_off+0xa6/0x1d0 [bbswitch]
     [<ffffffffa0104248>] bbswitch_init+0x248/0x1000 [bbswitch]
     [<ffffffffa0104000>] ? 0xffffffffa0103fff
     [<ffffffff810002da>] do_one_initcall+0x10a/0x160
     [<ffffffff810a8720>] load_module+0x1d40/0x24a0
     [<ffffffff810a4410>] ? store_uevent+0x40/0x40
     [<ffffffff810a8fce>] sys_finit_module+0x7e/0x80
     [<ffffffff815afcc6>] system_call_fastpath+0x1a/0x1f
    ---[ end trace 1b312a60aa1b0ed6 ]---
    pci 0000:01:00.0: Refused to change power state, currently in D0
master
Peter Wu 12 years ago
parent e21cdd7b3f
commit c665a74def

@ -456,6 +456,12 @@ static int __init bbswitch_init(void) {
dis_dev_get();
if (!is_card_disabled()) {
/* We think the card is enabled, so ensure the kernel does as well */
if (pci_enable_device(dis_dev))
pr_warn("failed to enable %s\n", dev_name(&dis_dev->dev));
}
if (load_state == CARD_ON)
bbswitch_on();
else if (load_state == CARD_OFF)

Loading…
Cancel
Save