1736759efSBjorn Helgaas // SPDX-License-Identifier: GPL-2.0+ 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * Standard Hot Plug Controller Driver 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Copyright (C) 1995,2001 Compaq Computer Corporation 61da177e4SLinus Torvalds * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com) 71da177e4SLinus Torvalds * Copyright (C) 2001 IBM Corp. 81da177e4SLinus Torvalds * Copyright (C) 2003-2004 Intel Corporation 91da177e4SLinus Torvalds * 101da177e4SLinus Torvalds * All rights reserved. 111da177e4SLinus Torvalds * 128cf4c195SKristen Accardi * Send feedback to <greg@kroah.com>, <kristen.c.accardi@intel.com> 131da177e4SLinus Torvalds * 141da177e4SLinus Torvalds */ 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds #include <linux/module.h> 171da177e4SLinus Torvalds #include <linux/moduleparam.h> 181da177e4SLinus Torvalds #include <linux/kernel.h> 191da177e4SLinus Torvalds #include <linux/types.h> 205a0e3ad6STejun Heo #include <linux/slab.h> 211da177e4SLinus Torvalds #include <linux/pci.h> 221da177e4SLinus Torvalds #include "shpchp.h" 231da177e4SLinus Torvalds 241da177e4SLinus Torvalds /* Global variables */ 2590ab5ee9SRusty Russell bool shpchp_debug; 2690ab5ee9SRusty Russell bool shpchp_poll_mode; 271da177e4SLinus Torvalds int shpchp_poll_time; 281da177e4SLinus Torvalds 291da177e4SLinus Torvalds #define DRIVER_VERSION "0.4" 301da177e4SLinus Torvalds #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" 311da177e4SLinus Torvalds #define DRIVER_DESC "Standard Hot Plug PCI Controller Driver" 321da177e4SLinus Torvalds 331da177e4SLinus Torvalds MODULE_AUTHOR(DRIVER_AUTHOR); 341da177e4SLinus Torvalds MODULE_DESCRIPTION(DRIVER_DESC); 351da177e4SLinus Torvalds MODULE_LICENSE("GPL"); 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds module_param(shpchp_debug, bool, 0644); 381da177e4SLinus Torvalds module_param(shpchp_poll_mode, bool, 0644); 391da177e4SLinus Torvalds module_param(shpchp_poll_time, int, 0644); 401da177e4SLinus Torvalds MODULE_PARM_DESC(shpchp_debug, "Debugging mode enabled or not"); 411da177e4SLinus Torvalds MODULE_PARM_DESC(shpchp_poll_mode, "Using polling mechanism for hot-plug events or not"); 421da177e4SLinus Torvalds MODULE_PARM_DESC(shpchp_poll_time, "Polling mechanism frequency, in seconds"); 431da177e4SLinus Torvalds 441da177e4SLinus Torvalds #define SHPC_MODULE_NAME "shpchp" 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds static int set_attention_status(struct hotplug_slot *slot, u8 value); 471da177e4SLinus Torvalds static int enable_slot(struct hotplug_slot *slot); 481da177e4SLinus Torvalds static int disable_slot(struct hotplug_slot *slot); 491da177e4SLinus Torvalds static int get_power_status(struct hotplug_slot *slot, u8 *value); 501da177e4SLinus Torvalds static int get_attention_status(struct hotplug_slot *slot, u8 *value); 511da177e4SLinus Torvalds static int get_latch_status(struct hotplug_slot *slot, u8 *value); 521da177e4SLinus Torvalds static int get_adapter_status(struct hotplug_slot *slot, u8 *value); 531da177e4SLinus Torvalds 541da177e4SLinus Torvalds static struct hotplug_slot_ops shpchp_hotplug_slot_ops = { 551da177e4SLinus Torvalds .set_attention_status = set_attention_status, 561da177e4SLinus Torvalds .enable_slot = enable_slot, 571da177e4SLinus Torvalds .disable_slot = disable_slot, 581da177e4SLinus Torvalds .get_power_status = get_power_status, 591da177e4SLinus Torvalds .get_attention_status = get_attention_status, 601da177e4SLinus Torvalds .get_latch_status = get_latch_status, 611da177e4SLinus Torvalds .get_adapter_status = get_adapter_status, 621da177e4SLinus Torvalds }; 631da177e4SLinus Torvalds 641da177e4SLinus Torvalds /** 651da177e4SLinus Torvalds * release_slot - free up the memory used by a slot 661da177e4SLinus Torvalds * @hotplug_slot: slot to free 671da177e4SLinus Torvalds */ 681da177e4SLinus Torvalds static void release_slot(struct hotplug_slot *hotplug_slot) 691da177e4SLinus Torvalds { 70ee17fd93SDely Sy struct slot *slot = hotplug_slot->private; 711da177e4SLinus Torvalds 72be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 73f98ca311STaku Izumi __func__, slot_name(slot)); 741da177e4SLinus Torvalds 751da177e4SLinus Torvalds kfree(slot->hotplug_slot->info); 761da177e4SLinus Torvalds kfree(slot->hotplug_slot); 771da177e4SLinus Torvalds kfree(slot); 781da177e4SLinus Torvalds } 791da177e4SLinus Torvalds 801da177e4SLinus Torvalds static int init_slots(struct controller *ctrl) 811da177e4SLinus Torvalds { 82926030f6SKenji Kaneshige struct slot *slot; 83926030f6SKenji Kaneshige struct hotplug_slot *hotplug_slot; 84926030f6SKenji Kaneshige struct hotplug_slot_info *info; 8566f17055SAlex Chiang char name[SLOT_NAME_SIZE]; 8683d05710SJulia Lawall int retval; 875fe6cc60SAlex Chiang int i; 881da177e4SLinus Torvalds 89926030f6SKenji Kaneshige for (i = 0; i < ctrl->num_slots; i++) { 9057c95c0dSKenji Kaneshige slot = kzalloc(sizeof(*slot), GFP_KERNEL); 9183d05710SJulia Lawall if (!slot) { 9283d05710SJulia Lawall retval = -ENOMEM; 931da177e4SLinus Torvalds goto error; 9483d05710SJulia Lawall } 951da177e4SLinus Torvalds 9657c95c0dSKenji Kaneshige hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL); 9783d05710SJulia Lawall if (!hotplug_slot) { 9883d05710SJulia Lawall retval = -ENOMEM; 991da177e4SLinus Torvalds goto error_slot; 10083d05710SJulia Lawall } 101926030f6SKenji Kaneshige slot->hotplug_slot = hotplug_slot; 1021da177e4SLinus Torvalds 10357c95c0dSKenji Kaneshige info = kzalloc(sizeof(*info), GFP_KERNEL); 10483d05710SJulia Lawall if (!info) { 10583d05710SJulia Lawall retval = -ENOMEM; 1061da177e4SLinus Torvalds goto error_hpslot; 10783d05710SJulia Lawall } 108926030f6SKenji Kaneshige hotplug_slot->info = info; 1091da177e4SLinus Torvalds 110926030f6SKenji Kaneshige slot->hp_slot = i; 111926030f6SKenji Kaneshige slot->ctrl = ctrl; 112227b84c7SKenji Kaneshige slot->bus = ctrl->pci_dev->subordinate->number; 113926030f6SKenji Kaneshige slot->device = ctrl->slot_device_offset + i; 114926030f6SKenji Kaneshige slot->hpc_ops = ctrl->hpc_ops; 1156f39be2eSKenji Kaneshige slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); 116f652e7d2SBjorn Helgaas 117d8537548SKees Cook slot->wq = alloc_workqueue("shpchp-%d", 0, 0, slot->number); 118f652e7d2SBjorn Helgaas if (!slot->wq) { 119f652e7d2SBjorn Helgaas retval = -ENOMEM; 120f652e7d2SBjorn Helgaas goto error_info; 121f652e7d2SBjorn Helgaas } 122f652e7d2SBjorn Helgaas 123a246fa4eSKenji Kaneshige mutex_init(&slot->lock); 124e325e1f0SKristen Carlson Accardi INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work); 1251da177e4SLinus Torvalds 1261da177e4SLinus Torvalds /* register this slot with the hotplug pci core */ 127926030f6SKenji Kaneshige hotplug_slot->private = slot; 128926030f6SKenji Kaneshige hotplug_slot->release = &release_slot; 12966f17055SAlex Chiang snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); 130926030f6SKenji Kaneshige hotplug_slot->ops = &shpchp_hotplug_slot_ops; 1311da177e4SLinus Torvalds 132227f0647SRyan Desfosses ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x hp_slot=%x sun=%x slot_device_offset=%x\n", 133be7bce25STaku Izumi pci_domain_nr(ctrl->pci_dev->subordinate), 134be7bce25STaku Izumi slot->bus, slot->device, slot->hp_slot, slot->number, 135be7bce25STaku Izumi ctrl->slot_device_offset); 136f46753c5SAlex Chiang retval = pci_hp_register(slot->hotplug_slot, 13766f17055SAlex Chiang ctrl->pci_dev->subordinate, slot->device, name); 138926030f6SKenji Kaneshige if (retval) { 139f98ca311STaku Izumi ctrl_err(ctrl, "pci_hp_register failed with error %d\n", 140f98ca311STaku Izumi retval); 141f652e7d2SBjorn Helgaas goto error_slotwq; 1421da177e4SLinus Torvalds } 1431da177e4SLinus Torvalds 14466f17055SAlex Chiang get_power_status(hotplug_slot, &info->power_status); 14566f17055SAlex Chiang get_attention_status(hotplug_slot, &info->attention_status); 14666f17055SAlex Chiang get_latch_status(hotplug_slot, &info->latch_status); 14766f17055SAlex Chiang get_adapter_status(hotplug_slot, &info->adapter_status); 14866f17055SAlex Chiang 1495b1a960dSKenji Kaneshige list_add(&slot->slot_list, &ctrl->slot_list); 1501da177e4SLinus Torvalds } 1511da177e4SLinus Torvalds 1521da177e4SLinus Torvalds return 0; 153f652e7d2SBjorn Helgaas error_slotwq: 154f652e7d2SBjorn Helgaas destroy_workqueue(slot->wq); 1551da177e4SLinus Torvalds error_info: 156926030f6SKenji Kaneshige kfree(info); 1571da177e4SLinus Torvalds error_hpslot: 158926030f6SKenji Kaneshige kfree(hotplug_slot); 1591da177e4SLinus Torvalds error_slot: 160926030f6SKenji Kaneshige kfree(slot); 1611da177e4SLinus Torvalds error: 162926030f6SKenji Kaneshige return retval; 1631da177e4SLinus Torvalds } 1641da177e4SLinus Torvalds 165f7391f53SKenji Kaneshige void cleanup_slots(struct controller *ctrl) 1661da177e4SLinus Torvalds { 1672ac83cccSGeliang Tang struct slot *slot, *next; 1681da177e4SLinus Torvalds 1692ac83cccSGeliang Tang list_for_each_entry_safe(slot, next, &ctrl->slot_list, slot_list) { 1705b1a960dSKenji Kaneshige list_del(&slot->slot_list); 171f7391f53SKenji Kaneshige cancel_delayed_work(&slot->work); 172f652e7d2SBjorn Helgaas destroy_workqueue(slot->wq); 1735b1a960dSKenji Kaneshige pci_hp_deregister(slot->hotplug_slot); 1741da177e4SLinus Torvalds } 1751da177e4SLinus Torvalds } 1761da177e4SLinus Torvalds 1771da177e4SLinus Torvalds /* 1781da177e4SLinus Torvalds * set_attention_status - Turns the Amber LED for a slot on, off or blink 1791da177e4SLinus Torvalds */ 1801da177e4SLinus Torvalds static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) 1811da177e4SLinus Torvalds { 1828352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 1831da177e4SLinus Torvalds 184be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 185f98ca311STaku Izumi __func__, slot_name(slot)); 1861da177e4SLinus Torvalds 1871da177e4SLinus Torvalds hotplug_slot->info->attention_status = status; 1881da177e4SLinus Torvalds slot->hpc_ops->set_attention_status(slot, status); 1891da177e4SLinus Torvalds 1901da177e4SLinus Torvalds return 0; 1911da177e4SLinus Torvalds } 1921da177e4SLinus Torvalds 1931da177e4SLinus Torvalds static int enable_slot(struct hotplug_slot *hotplug_slot) 1941da177e4SLinus Torvalds { 1958352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 1961da177e4SLinus Torvalds 197be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 198f98ca311STaku Izumi __func__, slot_name(slot)); 1991da177e4SLinus Torvalds 200a246fa4eSKenji Kaneshige return shpchp_sysfs_enable_slot(slot); 2011da177e4SLinus Torvalds } 2021da177e4SLinus Torvalds 2031da177e4SLinus Torvalds static int disable_slot(struct hotplug_slot *hotplug_slot) 2041da177e4SLinus Torvalds { 2058352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 2061da177e4SLinus Torvalds 207be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 208f98ca311STaku Izumi __func__, slot_name(slot)); 2091da177e4SLinus Torvalds 210a246fa4eSKenji Kaneshige return shpchp_sysfs_disable_slot(slot); 2111da177e4SLinus Torvalds } 2121da177e4SLinus Torvalds 2131da177e4SLinus Torvalds static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 2141da177e4SLinus Torvalds { 2158352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 2161da177e4SLinus Torvalds int retval; 2171da177e4SLinus Torvalds 218be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 219f98ca311STaku Izumi __func__, slot_name(slot)); 2201da177e4SLinus Torvalds 2211da177e4SLinus Torvalds retval = slot->hpc_ops->get_power_status(slot, value); 2221da177e4SLinus Torvalds if (retval < 0) 2231da177e4SLinus Torvalds *value = hotplug_slot->info->power_status; 2241da177e4SLinus Torvalds 2251da177e4SLinus Torvalds return 0; 2261da177e4SLinus Torvalds } 2271da177e4SLinus Torvalds 2281da177e4SLinus Torvalds static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 2291da177e4SLinus Torvalds { 2308352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 2311da177e4SLinus Torvalds int retval; 2321da177e4SLinus Torvalds 233be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 234f98ca311STaku Izumi __func__, slot_name(slot)); 2351da177e4SLinus Torvalds 2361da177e4SLinus Torvalds retval = slot->hpc_ops->get_attention_status(slot, value); 2371da177e4SLinus Torvalds if (retval < 0) 2381da177e4SLinus Torvalds *value = hotplug_slot->info->attention_status; 2391da177e4SLinus Torvalds 2401da177e4SLinus Torvalds return 0; 2411da177e4SLinus Torvalds } 2421da177e4SLinus Torvalds 2431da177e4SLinus Torvalds static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 2441da177e4SLinus Torvalds { 2458352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 2461da177e4SLinus Torvalds int retval; 2471da177e4SLinus Torvalds 248be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 249f98ca311STaku Izumi __func__, slot_name(slot)); 2501da177e4SLinus Torvalds 2511da177e4SLinus Torvalds retval = slot->hpc_ops->get_latch_status(slot, value); 2521da177e4SLinus Torvalds if (retval < 0) 2531da177e4SLinus Torvalds *value = hotplug_slot->info->latch_status; 2541da177e4SLinus Torvalds 2551da177e4SLinus Torvalds return 0; 2561da177e4SLinus Torvalds } 2571da177e4SLinus Torvalds 2581da177e4SLinus Torvalds static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 2591da177e4SLinus Torvalds { 2608352e04eSKenji Kaneshige struct slot *slot = get_slot(hotplug_slot); 2611da177e4SLinus Torvalds int retval; 2621da177e4SLinus Torvalds 263be7bce25STaku Izumi ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 264f98ca311STaku Izumi __func__, slot_name(slot)); 2651da177e4SLinus Torvalds 2661da177e4SLinus Torvalds retval = slot->hpc_ops->get_adapter_status(slot, value); 2671da177e4SLinus Torvalds if (retval < 0) 2681da177e4SLinus Torvalds *value = hotplug_slot->info->adapter_status; 2691da177e4SLinus Torvalds 2701da177e4SLinus Torvalds return 0; 2711da177e4SLinus Torvalds } 2721da177e4SLinus Torvalds 273b03799b0SBjorn Helgaas static bool shpc_capable(struct pci_dev *bridge) 274b03799b0SBjorn Helgaas { 275b03799b0SBjorn Helgaas /* 276b03799b0SBjorn Helgaas * It is assumed that AMD GOLAM chips support SHPC but they do not 277b03799b0SBjorn Helgaas * have SHPC capability. 278b03799b0SBjorn Helgaas */ 279b03799b0SBjorn Helgaas if (bridge->vendor == PCI_VENDOR_ID_AMD && 280b03799b0SBjorn Helgaas bridge->device == PCI_DEVICE_ID_AMD_GOLAM_7450) 281b03799b0SBjorn Helgaas return true; 282b03799b0SBjorn Helgaas 283b03799b0SBjorn Helgaas if (pci_find_capability(bridge, PCI_CAP_ID_SHPC)) 284b03799b0SBjorn Helgaas return true; 285b03799b0SBjorn Helgaas 286b03799b0SBjorn Helgaas return false; 287b03799b0SBjorn Helgaas } 288b03799b0SBjorn Helgaas 2891da177e4SLinus Torvalds static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 2901da177e4SLinus Torvalds { 2911da177e4SLinus Torvalds int rc; 2921da177e4SLinus Torvalds struct controller *ctrl; 2931da177e4SLinus Torvalds 294b03799b0SBjorn Helgaas if (!shpc_capable(pdev)) 295b03799b0SBjorn Helgaas return -ENODEV; 296b03799b0SBjorn Helgaas 29790cc0c3cSMika Westerberg if (acpi_get_hp_hw_control_from_firmware(pdev)) 2981410dc1cSrajesh.shah@intel.com return -ENODEV; 2991410dc1cSrajesh.shah@intel.com 30057c95c0dSKenji Kaneshige ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 301c7abb235SMarkus Elfring if (!ctrl) 3021da177e4SLinus Torvalds goto err_out_none; 303c7abb235SMarkus Elfring 3045b1a960dSKenji Kaneshige INIT_LIST_HEAD(&ctrl->slot_list); 3051da177e4SLinus Torvalds 306ee138334Srajesh.shah@intel.com rc = shpc_init(ctrl, pdev); 3071da177e4SLinus Torvalds if (rc) { 308be7bce25STaku Izumi ctrl_dbg(ctrl, "Controller initialization failed\n"); 3091da177e4SLinus Torvalds goto err_out_free_ctrl; 3101da177e4SLinus Torvalds } 3111da177e4SLinus Torvalds 3121da177e4SLinus Torvalds pci_set_drvdata(pdev, ctrl); 3131da177e4SLinus Torvalds 3141da177e4SLinus Torvalds /* Setup the slot information structures */ 3151da177e4SLinus Torvalds rc = init_slots(ctrl); 3161da177e4SLinus Torvalds if (rc) { 317be7bce25STaku Izumi ctrl_err(ctrl, "Slot initialization failed\n"); 318f7391f53SKenji Kaneshige goto err_out_release_ctlr; 3191da177e4SLinus Torvalds } 3201da177e4SLinus Torvalds 321e1b95dc6SGreg Kroah-Hartman rc = shpchp_create_ctrl_files(ctrl); 322e1b95dc6SGreg Kroah-Hartman if (rc) 323e1b95dc6SGreg Kroah-Hartman goto err_cleanup_slots; 3241da177e4SLinus Torvalds 325b03799b0SBjorn Helgaas pdev->shpc_managed = 1; 3261da177e4SLinus Torvalds return 0; 3271da177e4SLinus Torvalds 328e1b95dc6SGreg Kroah-Hartman err_cleanup_slots: 329e1b95dc6SGreg Kroah-Hartman cleanup_slots(ctrl); 330f7391f53SKenji Kaneshige err_out_release_ctlr: 3311da177e4SLinus Torvalds ctrl->hpc_ops->release_ctlr(ctrl); 3321da177e4SLinus Torvalds err_out_free_ctrl: 3331da177e4SLinus Torvalds kfree(ctrl); 3341da177e4SLinus Torvalds err_out_none: 3351da177e4SLinus Torvalds return -ENODEV; 3361da177e4SLinus Torvalds } 3371da177e4SLinus Torvalds 338e6b82b13SKenji Kaneshige static void shpc_remove(struct pci_dev *dev) 3391da177e4SLinus Torvalds { 340e6b82b13SKenji Kaneshige struct controller *ctrl = pci_get_drvdata(dev); 3411da177e4SLinus Torvalds 342b03799b0SBjorn Helgaas dev->shpc_managed = 0; 343c2608a11Srajesh.shah@intel.com shpchp_remove_ctrl_files(ctrl); 3441da177e4SLinus Torvalds ctrl->hpc_ops->release_ctlr(ctrl); 345a4534560SKenji Kaneshige kfree(ctrl); 3461da177e4SLinus Torvalds } 3471da177e4SLinus Torvalds 3488394264dSArvind Yadav static const struct pci_device_id shpcd_pci_tbl[] = { 349dfcd5f68SKenji Kaneshige {PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0)}, 3501da177e4SLinus Torvalds { /* end: all zeroes */ } 3511da177e4SLinus Torvalds }; 3521da177e4SLinus Torvalds MODULE_DEVICE_TABLE(pci, shpcd_pci_tbl); 3531da177e4SLinus Torvalds 3541da177e4SLinus Torvalds static struct pci_driver shpc_driver = { 3551da177e4SLinus Torvalds .name = SHPC_MODULE_NAME, 3561da177e4SLinus Torvalds .id_table = shpcd_pci_tbl, 3571da177e4SLinus Torvalds .probe = shpc_probe, 358e6b82b13SKenji Kaneshige .remove = shpc_remove, 3591da177e4SLinus Torvalds }; 3601da177e4SLinus Torvalds 3611da177e4SLinus Torvalds static int __init shpcd_init(void) 3621da177e4SLinus Torvalds { 363f652e7d2SBjorn Helgaas int retval; 364e24dcbefSTejun Heo 3651da177e4SLinus Torvalds retval = pci_register_driver(&shpc_driver); 36666bef8c0SHarvey Harrison dbg("%s: pci_register_driver = %d\n", __func__, retval); 3671da177e4SLinus Torvalds info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 368f652e7d2SBjorn Helgaas 3691da177e4SLinus Torvalds return retval; 3701da177e4SLinus Torvalds } 3711da177e4SLinus Torvalds 3721da177e4SLinus Torvalds static void __exit shpcd_cleanup(void) 3731da177e4SLinus Torvalds { 3741da177e4SLinus Torvalds dbg("unload_shpchpd()\n"); 3751da177e4SLinus Torvalds pci_unregister_driver(&shpc_driver); 3761da177e4SLinus Torvalds info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); 3771da177e4SLinus Torvalds } 3781da177e4SLinus Torvalds 3791da177e4SLinus Torvalds module_init(shpcd_init); 3801da177e4SLinus Torvalds module_exit(shpcd_cleanup); 381