pci_hotplug_core.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. /*
  2. * PCI HotPlug Controller Core
  3. *
  4. * Copyright (C) 2001-2002 Greg Kroah-Hartman (greg@kroah.com)
  5. * Copyright (C) 2001-2002 IBM Corp.
  6. *
  7. * All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or (at
  12. * your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  17. * NON INFRINGEMENT. See the GNU General Public License for more
  18. * details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. * Send feedback to <kristen.c.accardi@intel.com>
  25. *
  26. */
  27. #include <linux/module.h>
  28. #include <linux/moduleparam.h>
  29. #include <linux/kernel.h>
  30. #include <linux/types.h>
  31. #include <linux/list.h>
  32. #include <linux/kobject.h>
  33. #include <linux/sysfs.h>
  34. #include <linux/pagemap.h>
  35. #include <linux/slab.h>
  36. #include <linux/init.h>
  37. #include <linux/mount.h>
  38. #include <linux/namei.h>
  39. #include <linux/mutex.h>
  40. #include <linux/pci.h>
  41. #include <linux/pci_hotplug.h>
  42. #include <asm/uaccess.h>
  43. #include "../pci.h"
  44. #define MY_NAME "pci_hotplug"
  45. #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __func__ , ## arg); } while (0)
  46. #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
  47. #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
  48. #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
  49. /* local variables */
  50. static int debug;
  51. #define DRIVER_VERSION "0.5"
  52. #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Scott Murray <scottm@somanetworks.com>"
  53. #define DRIVER_DESC "PCI Hot Plug PCI Core"
  54. //////////////////////////////////////////////////////////////////
  55. static LIST_HEAD(pci_hotplug_slot_list);
  56. static DEFINE_MUTEX(pci_hp_mutex);
  57. /* these strings match up with the values in pci_bus_speed */
  58. static char *pci_bus_speed_strings[] = {
  59. "33 MHz PCI", /* 0x00 */
  60. "66 MHz PCI", /* 0x01 */
  61. "66 MHz PCIX", /* 0x02 */
  62. "100 MHz PCIX", /* 0x03 */
  63. "133 MHz PCIX", /* 0x04 */
  64. NULL, /* 0x05 */
  65. NULL, /* 0x06 */
  66. NULL, /* 0x07 */
  67. NULL, /* 0x08 */
  68. "66 MHz PCIX 266", /* 0x09 */
  69. "100 MHz PCIX 266", /* 0x0a */
  70. "133 MHz PCIX 266", /* 0x0b */
  71. NULL, /* 0x0c */
  72. NULL, /* 0x0d */
  73. NULL, /* 0x0e */
  74. NULL, /* 0x0f */
  75. NULL, /* 0x10 */
  76. "66 MHz PCIX 533", /* 0x11 */
  77. "100 MHz PCIX 533", /* 0x12 */
  78. "133 MHz PCIX 533", /* 0x13 */
  79. "25 GBps PCI-E", /* 0x14 */
  80. };
  81. #ifdef CONFIG_HOTPLUG_PCI_CPCI
  82. extern int cpci_hotplug_init(int debug);
  83. extern void cpci_hotplug_exit(void);
  84. #else
  85. static inline int cpci_hotplug_init(int debug) { return 0; }
  86. static inline void cpci_hotplug_exit(void) { }
  87. #endif
  88. /* Weee, fun with macros... */
  89. #define GET_STATUS(name,type) \
  90. static int get_##name (struct hotplug_slot *slot, type *value) \
  91. { \
  92. struct hotplug_slot_ops *ops = slot->ops; \
  93. int retval = 0; \
  94. if (!try_module_get(ops->owner)) \
  95. return -ENODEV; \
  96. if (ops->get_##name) \
  97. retval = ops->get_##name(slot, value); \
  98. else \
  99. *value = slot->info->name; \
  100. module_put(ops->owner); \
  101. return retval; \
  102. }
  103. GET_STATUS(power_status, u8)
  104. GET_STATUS(attention_status, u8)
  105. GET_STATUS(latch_status, u8)
  106. GET_STATUS(adapter_status, u8)
  107. GET_STATUS(max_bus_speed, enum pci_bus_speed)
  108. GET_STATUS(cur_bus_speed, enum pci_bus_speed)
  109. static ssize_t power_read_file(struct pci_slot *slot, char *buf)
  110. {
  111. int retval;
  112. u8 value;
  113. retval = get_power_status(slot->hotplug, &value);
  114. if (retval)
  115. goto exit;
  116. retval = sprintf (buf, "%d\n", value);
  117. exit:
  118. return retval;
  119. }
  120. static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
  121. size_t count)
  122. {
  123. struct hotplug_slot *slot = pci_slot->hotplug;
  124. unsigned long lpower;
  125. u8 power;
  126. int retval = 0;
  127. lpower = simple_strtoul (buf, NULL, 10);
  128. power = (u8)(lpower & 0xff);
  129. dbg ("power = %d\n", power);
  130. if (!try_module_get(slot->ops->owner)) {
  131. retval = -ENODEV;
  132. goto exit;
  133. }
  134. switch (power) {
  135. case 0:
  136. if (slot->ops->disable_slot)
  137. retval = slot->ops->disable_slot(slot);
  138. break;
  139. case 1:
  140. if (slot->ops->enable_slot)
  141. retval = slot->ops->enable_slot(slot);
  142. break;
  143. default:
  144. err ("Illegal value specified for power\n");
  145. retval = -EINVAL;
  146. }
  147. module_put(slot->ops->owner);
  148. exit:
  149. if (retval)
  150. return retval;
  151. return count;
  152. }
  153. static struct pci_slot_attribute hotplug_slot_attr_power = {
  154. .attr = {.name = "power", .mode = S_IFREG | S_IRUGO | S_IWUSR},
  155. .show = power_read_file,
  156. .store = power_write_file
  157. };
  158. static ssize_t attention_read_file(struct pci_slot *slot, char *buf)
  159. {
  160. int retval;
  161. u8 value;
  162. retval = get_attention_status(slot->hotplug, &value);
  163. if (retval)
  164. goto exit;
  165. retval = sprintf(buf, "%d\n", value);
  166. exit:
  167. return retval;
  168. }
  169. static ssize_t attention_write_file(struct pci_slot *slot, const char *buf,
  170. size_t count)
  171. {
  172. struct hotplug_slot_ops *ops = slot->hotplug->ops;
  173. unsigned long lattention;
  174. u8 attention;
  175. int retval = 0;
  176. lattention = simple_strtoul (buf, NULL, 10);
  177. attention = (u8)(lattention & 0xff);
  178. dbg (" - attention = %d\n", attention);
  179. if (!try_module_get(ops->owner)) {
  180. retval = -ENODEV;
  181. goto exit;
  182. }
  183. if (ops->set_attention_status)
  184. retval = ops->set_attention_status(slot->hotplug, attention);
  185. module_put(ops->owner);
  186. exit:
  187. if (retval)
  188. return retval;
  189. return count;
  190. }
  191. static struct pci_slot_attribute hotplug_slot_attr_attention = {
  192. .attr = {.name = "attention", .mode = S_IFREG | S_IRUGO | S_IWUSR},
  193. .show = attention_read_file,
  194. .store = attention_write_file
  195. };
  196. static ssize_t latch_read_file(struct pci_slot *slot, char *buf)
  197. {
  198. int retval;
  199. u8 value;
  200. retval = get_latch_status(slot->hotplug, &value);
  201. if (retval)
  202. goto exit;
  203. retval = sprintf (buf, "%d\n", value);
  204. exit:
  205. return retval;
  206. }
  207. static struct pci_slot_attribute hotplug_slot_attr_latch = {
  208. .attr = {.name = "latch", .mode = S_IFREG | S_IRUGO},
  209. .show = latch_read_file,
  210. };
  211. static ssize_t presence_read_file(struct pci_slot *slot, char *buf)
  212. {
  213. int retval;
  214. u8 value;
  215. retval = get_adapter_status(slot->hotplug, &value);
  216. if (retval)
  217. goto exit;
  218. retval = sprintf (buf, "%d\n", value);
  219. exit:
  220. return retval;
  221. }
  222. static struct pci_slot_attribute hotplug_slot_attr_presence = {
  223. .attr = {.name = "adapter", .mode = S_IFREG | S_IRUGO},
  224. .show = presence_read_file,
  225. };
  226. static char *unknown_speed = "Unknown bus speed";
  227. static ssize_t max_bus_speed_read_file(struct pci_slot *slot, char *buf)
  228. {
  229. char *speed_string;
  230. int retval;
  231. enum pci_bus_speed value;
  232. retval = get_max_bus_speed(slot->hotplug, &value);
  233. if (retval)
  234. goto exit;
  235. if (value == PCI_SPEED_UNKNOWN)
  236. speed_string = unknown_speed;
  237. else
  238. speed_string = pci_bus_speed_strings[value];
  239. retval = sprintf (buf, "%s\n", speed_string);
  240. exit:
  241. return retval;
  242. }
  243. static struct pci_slot_attribute hotplug_slot_attr_max_bus_speed = {
  244. .attr = {.name = "max_bus_speed", .mode = S_IFREG | S_IRUGO},
  245. .show = max_bus_speed_read_file,
  246. };
  247. static ssize_t cur_bus_speed_read_file(struct pci_slot *slot, char *buf)
  248. {
  249. char *speed_string;
  250. int retval;
  251. enum pci_bus_speed value;
  252. retval = get_cur_bus_speed(slot->hotplug, &value);
  253. if (retval)
  254. goto exit;
  255. if (value == PCI_SPEED_UNKNOWN)
  256. speed_string = unknown_speed;
  257. else
  258. speed_string = pci_bus_speed_strings[value];
  259. retval = sprintf (buf, "%s\n", speed_string);
  260. exit:
  261. return retval;
  262. }
  263. static struct pci_slot_attribute hotplug_slot_attr_cur_bus_speed = {
  264. .attr = {.name = "cur_bus_speed", .mode = S_IFREG | S_IRUGO},
  265. .show = cur_bus_speed_read_file,
  266. };
  267. static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf,
  268. size_t count)
  269. {
  270. struct hotplug_slot *slot = pci_slot->hotplug;
  271. unsigned long ltest;
  272. u32 test;
  273. int retval = 0;
  274. ltest = simple_strtoul (buf, NULL, 10);
  275. test = (u32)(ltest & 0xffffffff);
  276. dbg ("test = %d\n", test);
  277. if (!try_module_get(slot->ops->owner)) {
  278. retval = -ENODEV;
  279. goto exit;
  280. }
  281. if (slot->ops->hardware_test)
  282. retval = slot->ops->hardware_test(slot, test);
  283. module_put(slot->ops->owner);
  284. exit:
  285. if (retval)
  286. return retval;
  287. return count;
  288. }
  289. static struct pci_slot_attribute hotplug_slot_attr_test = {
  290. .attr = {.name = "test", .mode = S_IFREG | S_IRUGO | S_IWUSR},
  291. .store = test_write_file
  292. };
  293. static int has_power_file(struct pci_slot *pci_slot)
  294. {
  295. struct hotplug_slot *slot = pci_slot->hotplug;
  296. if ((!slot) || (!slot->ops))
  297. return -ENODEV;
  298. if ((slot->ops->enable_slot) ||
  299. (slot->ops->disable_slot) ||
  300. (slot->ops->get_power_status))
  301. return 0;
  302. return -ENOENT;
  303. }
  304. static int has_attention_file(struct pci_slot *pci_slot)
  305. {
  306. struct hotplug_slot *slot = pci_slot->hotplug;
  307. if ((!slot) || (!slot->ops))
  308. return -ENODEV;
  309. if ((slot->ops->set_attention_status) ||
  310. (slot->ops->get_attention_status))
  311. return 0;
  312. return -ENOENT;
  313. }
  314. static int has_latch_file(struct pci_slot *pci_slot)
  315. {
  316. struct hotplug_slot *slot = pci_slot->hotplug;
  317. if ((!slot) || (!slot->ops))
  318. return -ENODEV;
  319. if (slot->ops->get_latch_status)
  320. return 0;
  321. return -ENOENT;
  322. }
  323. static int has_adapter_file(struct pci_slot *pci_slot)
  324. {
  325. struct hotplug_slot *slot = pci_slot->hotplug;
  326. if ((!slot) || (!slot->ops))
  327. return -ENODEV;
  328. if (slot->ops->get_adapter_status)
  329. return 0;
  330. return -ENOENT;
  331. }
  332. static int has_max_bus_speed_file(struct pci_slot *pci_slot)
  333. {
  334. struct hotplug_slot *slot = pci_slot->hotplug;
  335. if ((!slot) || (!slot->ops))
  336. return -ENODEV;
  337. if (slot->ops->get_max_bus_speed)
  338. return 0;
  339. return -ENOENT;
  340. }
  341. static int has_cur_bus_speed_file(struct pci_slot *pci_slot)
  342. {
  343. struct hotplug_slot *slot = pci_slot->hotplug;
  344. if ((!slot) || (!slot->ops))
  345. return -ENODEV;
  346. if (slot->ops->get_cur_bus_speed)
  347. return 0;
  348. return -ENOENT;
  349. }
  350. static int has_test_file(struct pci_slot *pci_slot)
  351. {
  352. struct hotplug_slot *slot = pci_slot->hotplug;
  353. if ((!slot) || (!slot->ops))
  354. return -ENODEV;
  355. if (slot->ops->hardware_test)
  356. return 0;
  357. return -ENOENT;
  358. }
  359. static int fs_add_slot(struct pci_slot *slot)
  360. {
  361. int retval = 0;
  362. if (has_power_file(slot) == 0) {
  363. retval = sysfs_create_file(&slot->kobj, &hotplug_slot_attr_power.attr);
  364. if (retval)
  365. goto exit_power;
  366. }
  367. if (has_attention_file(slot) == 0) {
  368. retval = sysfs_create_file(&slot->kobj,
  369. &hotplug_slot_attr_attention.attr);
  370. if (retval)
  371. goto exit_attention;
  372. }
  373. if (has_latch_file(slot) == 0) {
  374. retval = sysfs_create_file(&slot->kobj,
  375. &hotplug_slot_attr_latch.attr);
  376. if (retval)
  377. goto exit_latch;
  378. }
  379. if (has_adapter_file(slot) == 0) {
  380. retval = sysfs_create_file(&slot->kobj,
  381. &hotplug_slot_attr_presence.attr);
  382. if (retval)
  383. goto exit_adapter;
  384. }
  385. if (has_max_bus_speed_file(slot) == 0) {
  386. retval = sysfs_create_file(&slot->kobj,
  387. &hotplug_slot_attr_max_bus_speed.attr);
  388. if (retval)
  389. goto exit_max_speed;
  390. }
  391. if (has_cur_bus_speed_file(slot) == 0) {
  392. retval = sysfs_create_file(&slot->kobj,
  393. &hotplug_slot_attr_cur_bus_speed.attr);
  394. if (retval)
  395. goto exit_cur_speed;
  396. }
  397. if (has_test_file(slot) == 0) {
  398. retval = sysfs_create_file(&slot->kobj,
  399. &hotplug_slot_attr_test.attr);
  400. if (retval)
  401. goto exit_test;
  402. }
  403. goto exit;
  404. exit_test:
  405. if (has_cur_bus_speed_file(slot) == 0)
  406. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_cur_bus_speed.attr);
  407. exit_cur_speed:
  408. if (has_max_bus_speed_file(slot) == 0)
  409. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_max_bus_speed.attr);
  410. exit_max_speed:
  411. if (has_adapter_file(slot) == 0)
  412. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_presence.attr);
  413. exit_adapter:
  414. if (has_latch_file(slot) == 0)
  415. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr);
  416. exit_latch:
  417. if (has_attention_file(slot) == 0)
  418. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_attention.attr);
  419. exit_attention:
  420. if (has_power_file(slot) == 0)
  421. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr);
  422. exit_power:
  423. exit:
  424. return retval;
  425. }
  426. static void fs_remove_slot(struct pci_slot *slot)
  427. {
  428. if (has_power_file(slot) == 0)
  429. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr);
  430. if (has_attention_file(slot) == 0)
  431. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_attention.attr);
  432. if (has_latch_file(slot) == 0)
  433. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr);
  434. if (has_adapter_file(slot) == 0)
  435. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_presence.attr);
  436. if (has_max_bus_speed_file(slot) == 0)
  437. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_max_bus_speed.attr);
  438. if (has_cur_bus_speed_file(slot) == 0)
  439. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_cur_bus_speed.attr);
  440. if (has_test_file(slot) == 0)
  441. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr);
  442. }
  443. static struct hotplug_slot *get_slot_from_name (const char *name)
  444. {
  445. struct hotplug_slot *slot;
  446. struct list_head *tmp;
  447. list_for_each (tmp, &pci_hotplug_slot_list) {
  448. slot = list_entry (tmp, struct hotplug_slot, slot_list);
  449. if (strcmp(hotplug_slot_name(slot), name) == 0)
  450. return slot;
  451. }
  452. return NULL;
  453. }
  454. /**
  455. * pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem
  456. * @bus: bus this slot is on
  457. * @slot: pointer to the &struct hotplug_slot to register
  458. * @slot_nr: slot number
  459. * @name: name registered with kobject core
  460. *
  461. * Registers a hotplug slot with the pci hotplug subsystem, which will allow
  462. * userspace interaction to the slot.
  463. *
  464. * Returns 0 if successful, anything else for an error.
  465. */
  466. int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr,
  467. const char *name)
  468. {
  469. int result;
  470. struct pci_slot *pci_slot;
  471. if (slot == NULL)
  472. return -ENODEV;
  473. if ((slot->info == NULL) || (slot->ops == NULL))
  474. return -EINVAL;
  475. if (slot->release == NULL) {
  476. dbg("Why are you trying to register a hotplug slot "
  477. "without a proper release function?\n");
  478. return -EINVAL;
  479. }
  480. mutex_lock(&pci_hp_mutex);
  481. /*
  482. * No problems if we call this interface from both ACPI_PCI_SLOT
  483. * driver and call it here again. If we've already created the
  484. * pci_slot, the interface will simply bump the refcount.
  485. */
  486. pci_slot = pci_create_slot(bus, slot_nr, name, slot);
  487. if (IS_ERR(pci_slot)) {
  488. result = PTR_ERR(pci_slot);
  489. goto out;
  490. }
  491. slot->pci_slot = pci_slot;
  492. pci_slot->hotplug = slot;
  493. list_add(&slot->slot_list, &pci_hotplug_slot_list);
  494. result = fs_add_slot(pci_slot);
  495. kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
  496. dbg("Added slot %s to the list\n", name);
  497. out:
  498. mutex_unlock(&pci_hp_mutex);
  499. return result;
  500. }
  501. /**
  502. * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem
  503. * @hotplug: pointer to the &struct hotplug_slot to deregister
  504. *
  505. * The @slot must have been registered with the pci hotplug subsystem
  506. * previously with a call to pci_hp_register().
  507. *
  508. * Returns 0 if successful, anything else for an error.
  509. */
  510. int pci_hp_deregister(struct hotplug_slot *hotplug)
  511. {
  512. struct hotplug_slot *temp;
  513. struct pci_slot *slot;
  514. if (!hotplug)
  515. return -ENODEV;
  516. mutex_lock(&pci_hp_mutex);
  517. temp = get_slot_from_name(hotplug_slot_name(hotplug));
  518. if (temp != hotplug) {
  519. mutex_unlock(&pci_hp_mutex);
  520. return -ENODEV;
  521. }
  522. list_del(&hotplug->slot_list);
  523. slot = hotplug->pci_slot;
  524. fs_remove_slot(slot);
  525. dbg("Removed slot %s from the list\n", hotplug_slot_name(hotplug));
  526. hotplug->release(hotplug);
  527. slot->hotplug = NULL;
  528. pci_destroy_slot(slot);
  529. mutex_unlock(&pci_hp_mutex);
  530. return 0;
  531. }
  532. /**
  533. * pci_hp_change_slot_info - changes the slot's information structure in the core
  534. * @hotplug: pointer to the slot whose info has changed
  535. * @info: pointer to the info copy into the slot's info structure
  536. *
  537. * @slot must have been registered with the pci
  538. * hotplug subsystem previously with a call to pci_hp_register().
  539. *
  540. * Returns 0 if successful, anything else for an error.
  541. */
  542. int __must_check pci_hp_change_slot_info(struct hotplug_slot *hotplug,
  543. struct hotplug_slot_info *info)
  544. {
  545. struct pci_slot *slot;
  546. if (!hotplug || !info)
  547. return -ENODEV;
  548. slot = hotplug->pci_slot;
  549. memcpy(hotplug->info, info, sizeof(struct hotplug_slot_info));
  550. return 0;
  551. }
  552. static int __init pci_hotplug_init (void)
  553. {
  554. int result;
  555. result = cpci_hotplug_init(debug);
  556. if (result) {
  557. err ("cpci_hotplug_init with error %d\n", result);
  558. goto err_cpci;
  559. }
  560. info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
  561. err_cpci:
  562. return result;
  563. }
  564. static void __exit pci_hotplug_exit (void)
  565. {
  566. cpci_hotplug_exit();
  567. }
  568. module_init(pci_hotplug_init);
  569. module_exit(pci_hotplug_exit);
  570. MODULE_AUTHOR(DRIVER_AUTHOR);
  571. MODULE_DESCRIPTION(DRIVER_DESC);
  572. MODULE_LICENSE("GPL");
  573. module_param(debug, bool, 0644);
  574. MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
  575. EXPORT_SYMBOL_GPL(pci_hp_register);
  576. EXPORT_SYMBOL_GPL(pci_hp_deregister);
  577. EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);