pci_hotplug_core.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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 bool has_power_file(struct pci_slot *pci_slot)
  294. {
  295. struct hotplug_slot *slot = pci_slot->hotplug;
  296. if ((!slot) || (!slot->ops))
  297. return false;
  298. if ((slot->ops->enable_slot) ||
  299. (slot->ops->disable_slot) ||
  300. (slot->ops->get_power_status))
  301. return true;
  302. return false;
  303. }
  304. static bool has_attention_file(struct pci_slot *pci_slot)
  305. {
  306. struct hotplug_slot *slot = pci_slot->hotplug;
  307. if ((!slot) || (!slot->ops))
  308. return false;
  309. if ((slot->ops->set_attention_status) ||
  310. (slot->ops->get_attention_status))
  311. return true;
  312. return false;
  313. }
  314. static bool has_latch_file(struct pci_slot *pci_slot)
  315. {
  316. struct hotplug_slot *slot = pci_slot->hotplug;
  317. if ((!slot) || (!slot->ops))
  318. return false;
  319. if (slot->ops->get_latch_status)
  320. return true;
  321. return false;
  322. }
  323. static bool has_adapter_file(struct pci_slot *pci_slot)
  324. {
  325. struct hotplug_slot *slot = pci_slot->hotplug;
  326. if ((!slot) || (!slot->ops))
  327. return false;
  328. if (slot->ops->get_adapter_status)
  329. return true;
  330. return false;
  331. }
  332. static bool 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 false;
  337. if (slot->ops->get_max_bus_speed)
  338. return true;
  339. return false;
  340. }
  341. static bool 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 false;
  346. if (slot->ops->get_cur_bus_speed)
  347. return true;
  348. return false;
  349. }
  350. static bool has_test_file(struct pci_slot *pci_slot)
  351. {
  352. struct hotplug_slot *slot = pci_slot->hotplug;
  353. if ((!slot) || (!slot->ops))
  354. return false;
  355. if (slot->ops->hardware_test)
  356. return true;
  357. return false;
  358. }
  359. static int fs_add_slot(struct pci_slot *slot)
  360. {
  361. int retval = 0;
  362. /* Create symbolic link to the hotplug driver module */
  363. pci_hp_create_module_link(slot);
  364. if (has_power_file(slot)) {
  365. retval = sysfs_create_file(&slot->kobj,
  366. &hotplug_slot_attr_power.attr);
  367. if (retval)
  368. goto exit_power;
  369. }
  370. if (has_attention_file(slot)) {
  371. retval = sysfs_create_file(&slot->kobj,
  372. &hotplug_slot_attr_attention.attr);
  373. if (retval)
  374. goto exit_attention;
  375. }
  376. if (has_latch_file(slot)) {
  377. retval = sysfs_create_file(&slot->kobj,
  378. &hotplug_slot_attr_latch.attr);
  379. if (retval)
  380. goto exit_latch;
  381. }
  382. if (has_adapter_file(slot)) {
  383. retval = sysfs_create_file(&slot->kobj,
  384. &hotplug_slot_attr_presence.attr);
  385. if (retval)
  386. goto exit_adapter;
  387. }
  388. if (has_max_bus_speed_file(slot)) {
  389. retval = sysfs_create_file(&slot->kobj,
  390. &hotplug_slot_attr_max_bus_speed.attr);
  391. if (retval)
  392. goto exit_max_speed;
  393. }
  394. if (has_cur_bus_speed_file(slot)) {
  395. retval = sysfs_create_file(&slot->kobj,
  396. &hotplug_slot_attr_cur_bus_speed.attr);
  397. if (retval)
  398. goto exit_cur_speed;
  399. }
  400. if (has_test_file(slot)) {
  401. retval = sysfs_create_file(&slot->kobj,
  402. &hotplug_slot_attr_test.attr);
  403. if (retval)
  404. goto exit_test;
  405. }
  406. goto exit;
  407. exit_test:
  408. if (has_cur_bus_speed_file(slot))
  409. sysfs_remove_file(&slot->kobj,
  410. &hotplug_slot_attr_cur_bus_speed.attr);
  411. exit_cur_speed:
  412. if (has_max_bus_speed_file(slot))
  413. sysfs_remove_file(&slot->kobj,
  414. &hotplug_slot_attr_max_bus_speed.attr);
  415. exit_max_speed:
  416. if (has_adapter_file(slot))
  417. sysfs_remove_file(&slot->kobj,
  418. &hotplug_slot_attr_presence.attr);
  419. exit_adapter:
  420. if (has_latch_file(slot))
  421. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr);
  422. exit_latch:
  423. if (has_attention_file(slot))
  424. sysfs_remove_file(&slot->kobj,
  425. &hotplug_slot_attr_attention.attr);
  426. exit_attention:
  427. if (has_power_file(slot))
  428. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr);
  429. exit_power:
  430. pci_hp_remove_module_link(slot);
  431. exit:
  432. return retval;
  433. }
  434. static void fs_remove_slot(struct pci_slot *slot)
  435. {
  436. if (has_power_file(slot))
  437. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_power.attr);
  438. if (has_attention_file(slot))
  439. sysfs_remove_file(&slot->kobj,
  440. &hotplug_slot_attr_attention.attr);
  441. if (has_latch_file(slot))
  442. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_latch.attr);
  443. if (has_adapter_file(slot))
  444. sysfs_remove_file(&slot->kobj,
  445. &hotplug_slot_attr_presence.attr);
  446. if (has_max_bus_speed_file(slot))
  447. sysfs_remove_file(&slot->kobj,
  448. &hotplug_slot_attr_max_bus_speed.attr);
  449. if (has_cur_bus_speed_file(slot))
  450. sysfs_remove_file(&slot->kobj,
  451. &hotplug_slot_attr_cur_bus_speed.attr);
  452. if (has_test_file(slot))
  453. sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_test.attr);
  454. pci_hp_remove_module_link(slot);
  455. }
  456. static struct hotplug_slot *get_slot_from_name (const char *name)
  457. {
  458. struct hotplug_slot *slot;
  459. struct list_head *tmp;
  460. list_for_each (tmp, &pci_hotplug_slot_list) {
  461. slot = list_entry (tmp, struct hotplug_slot, slot_list);
  462. if (strcmp(hotplug_slot_name(slot), name) == 0)
  463. return slot;
  464. }
  465. return NULL;
  466. }
  467. /**
  468. * __pci_hp_register - register a hotplug_slot with the PCI hotplug subsystem
  469. * @bus: bus this slot is on
  470. * @slot: pointer to the &struct hotplug_slot to register
  471. * @devnr: device number
  472. * @name: name registered with kobject core
  473. *
  474. * Registers a hotplug slot with the pci hotplug subsystem, which will allow
  475. * userspace interaction to the slot.
  476. *
  477. * Returns 0 if successful, anything else for an error.
  478. */
  479. int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus,
  480. int devnr, const char *name,
  481. struct module *owner, const char *mod_name)
  482. {
  483. int result;
  484. struct pci_slot *pci_slot;
  485. if (slot == NULL)
  486. return -ENODEV;
  487. if ((slot->info == NULL) || (slot->ops == NULL))
  488. return -EINVAL;
  489. if (slot->release == NULL) {
  490. dbg("Why are you trying to register a hotplug slot "
  491. "without a proper release function?\n");
  492. return -EINVAL;
  493. }
  494. slot->ops->owner = owner;
  495. slot->ops->mod_name = mod_name;
  496. mutex_lock(&pci_hp_mutex);
  497. /*
  498. * No problems if we call this interface from both ACPI_PCI_SLOT
  499. * driver and call it here again. If we've already created the
  500. * pci_slot, the interface will simply bump the refcount.
  501. */
  502. pci_slot = pci_create_slot(bus, devnr, name, slot);
  503. if (IS_ERR(pci_slot)) {
  504. result = PTR_ERR(pci_slot);
  505. goto out;
  506. }
  507. slot->pci_slot = pci_slot;
  508. pci_slot->hotplug = slot;
  509. list_add(&slot->slot_list, &pci_hotplug_slot_list);
  510. result = fs_add_slot(pci_slot);
  511. kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
  512. dbg("Added slot %s to the list\n", name);
  513. out:
  514. mutex_unlock(&pci_hp_mutex);
  515. return result;
  516. }
  517. /**
  518. * pci_hp_deregister - deregister a hotplug_slot with the PCI hotplug subsystem
  519. * @hotplug: pointer to the &struct hotplug_slot to deregister
  520. *
  521. * The @slot must have been registered with the pci hotplug subsystem
  522. * previously with a call to pci_hp_register().
  523. *
  524. * Returns 0 if successful, anything else for an error.
  525. */
  526. int pci_hp_deregister(struct hotplug_slot *hotplug)
  527. {
  528. struct hotplug_slot *temp;
  529. struct pci_slot *slot;
  530. if (!hotplug)
  531. return -ENODEV;
  532. mutex_lock(&pci_hp_mutex);
  533. temp = get_slot_from_name(hotplug_slot_name(hotplug));
  534. if (temp != hotplug) {
  535. mutex_unlock(&pci_hp_mutex);
  536. return -ENODEV;
  537. }
  538. list_del(&hotplug->slot_list);
  539. slot = hotplug->pci_slot;
  540. fs_remove_slot(slot);
  541. dbg("Removed slot %s from the list\n", hotplug_slot_name(hotplug));
  542. hotplug->release(hotplug);
  543. slot->hotplug = NULL;
  544. pci_destroy_slot(slot);
  545. mutex_unlock(&pci_hp_mutex);
  546. return 0;
  547. }
  548. /**
  549. * pci_hp_change_slot_info - changes the slot's information structure in the core
  550. * @hotplug: pointer to the slot whose info has changed
  551. * @info: pointer to the info copy into the slot's info structure
  552. *
  553. * @slot must have been registered with the pci
  554. * hotplug subsystem previously with a call to pci_hp_register().
  555. *
  556. * Returns 0 if successful, anything else for an error.
  557. */
  558. int __must_check pci_hp_change_slot_info(struct hotplug_slot *hotplug,
  559. struct hotplug_slot_info *info)
  560. {
  561. struct pci_slot *slot;
  562. if (!hotplug || !info)
  563. return -ENODEV;
  564. slot = hotplug->pci_slot;
  565. memcpy(hotplug->info, info, sizeof(struct hotplug_slot_info));
  566. return 0;
  567. }
  568. static int __init pci_hotplug_init (void)
  569. {
  570. int result;
  571. result = cpci_hotplug_init(debug);
  572. if (result) {
  573. err ("cpci_hotplug_init with error %d\n", result);
  574. goto err_cpci;
  575. }
  576. info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
  577. err_cpci:
  578. return result;
  579. }
  580. static void __exit pci_hotplug_exit (void)
  581. {
  582. cpci_hotplug_exit();
  583. }
  584. module_init(pci_hotplug_init);
  585. module_exit(pci_hotplug_exit);
  586. MODULE_AUTHOR(DRIVER_AUTHOR);
  587. MODULE_DESCRIPTION(DRIVER_DESC);
  588. MODULE_LICENSE("GPL");
  589. module_param(debug, bool, 0644);
  590. MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
  591. EXPORT_SYMBOL_GPL(__pci_hp_register);
  592. EXPORT_SYMBOL_GPL(pci_hp_deregister);
  593. EXPORT_SYMBOL_GPL(pci_hp_change_slot_info);