cpci_hotplug_core.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. /*
  2. * CompactPCI Hot Plug Driver
  3. *
  4. * Copyright (C) 2002,2005 SOMA Networks, Inc.
  5. * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
  6. * Copyright (C) 2001 IBM Corp.
  7. *
  8. * All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  18. * NON INFRINGEMENT. See the GNU General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. *
  25. * Send feedback to <scottm@somanetworks.com>
  26. */
  27. #include <linux/module.h>
  28. #include <linux/kernel.h>
  29. #include <linux/slab.h>
  30. #include <linux/pci.h>
  31. #include <linux/pci_hotplug.h>
  32. #include <linux/init.h>
  33. #include <linux/interrupt.h>
  34. #include <linux/atomic.h>
  35. #include <linux/delay.h>
  36. #include <linux/kthread.h>
  37. #include "cpci_hotplug.h"
  38. #define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
  39. #define DRIVER_DESC "CompactPCI Hot Plug Core"
  40. #define MY_NAME "cpci_hotplug"
  41. #define dbg(format, arg...) \
  42. do { \
  43. if (cpci_debug) \
  44. printk (KERN_DEBUG "%s: " format "\n", \
  45. MY_NAME , ## arg); \
  46. } while (0)
  47. #define err(format, arg...) printk(KERN_ERR "%s: " format "\n", MY_NAME , ## arg)
  48. #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
  49. #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
  50. /* local variables */
  51. static DECLARE_RWSEM(list_rwsem);
  52. static LIST_HEAD(slot_list);
  53. static int slots;
  54. static atomic_t extracting;
  55. int cpci_debug;
  56. static struct cpci_hp_controller *controller;
  57. static struct task_struct *cpci_thread;
  58. static int thread_finished;
  59. static int enable_slot(struct hotplug_slot *slot);
  60. static int disable_slot(struct hotplug_slot *slot);
  61. static int set_attention_status(struct hotplug_slot *slot, u8 value);
  62. static int get_power_status(struct hotplug_slot *slot, u8 *value);
  63. static int get_attention_status(struct hotplug_slot *slot, u8 *value);
  64. static int get_adapter_status(struct hotplug_slot *slot, u8 *value);
  65. static int get_latch_status(struct hotplug_slot *slot, u8 *value);
  66. static struct hotplug_slot_ops cpci_hotplug_slot_ops = {
  67. .enable_slot = enable_slot,
  68. .disable_slot = disable_slot,
  69. .set_attention_status = set_attention_status,
  70. .get_power_status = get_power_status,
  71. .get_attention_status = get_attention_status,
  72. .get_adapter_status = get_adapter_status,
  73. .get_latch_status = get_latch_status,
  74. };
  75. static int
  76. update_latch_status(struct hotplug_slot *hotplug_slot, u8 value)
  77. {
  78. struct hotplug_slot_info info;
  79. memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
  80. info.latch_status = value;
  81. return pci_hp_change_slot_info(hotplug_slot, &info);
  82. }
  83. static int
  84. update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value)
  85. {
  86. struct hotplug_slot_info info;
  87. memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
  88. info.adapter_status = value;
  89. return pci_hp_change_slot_info(hotplug_slot, &info);
  90. }
  91. static int
  92. enable_slot(struct hotplug_slot *hotplug_slot)
  93. {
  94. struct slot *slot = hotplug_slot->private;
  95. int retval = 0;
  96. dbg("%s - physical_slot = %s", __func__, slot_name(slot));
  97. if (controller->ops->set_power)
  98. retval = controller->ops->set_power(slot, 1);
  99. return retval;
  100. }
  101. static int
  102. disable_slot(struct hotplug_slot *hotplug_slot)
  103. {
  104. struct slot *slot = hotplug_slot->private;
  105. int retval = 0;
  106. dbg("%s - physical_slot = %s", __func__, slot_name(slot));
  107. down_write(&list_rwsem);
  108. /* Unconfigure device */
  109. dbg("%s - unconfiguring slot %s", __func__, slot_name(slot));
  110. retval = cpci_unconfigure_slot(slot);
  111. if (retval) {
  112. err("%s - could not unconfigure slot %s",
  113. __func__, slot_name(slot));
  114. goto disable_error;
  115. }
  116. dbg("%s - finished unconfiguring slot %s", __func__, slot_name(slot));
  117. /* Clear EXT (by setting it) */
  118. if (cpci_clear_ext(slot)) {
  119. err("%s - could not clear EXT for slot %s",
  120. __func__, slot_name(slot));
  121. retval = -ENODEV;
  122. goto disable_error;
  123. }
  124. cpci_led_on(slot);
  125. if (controller->ops->set_power) {
  126. retval = controller->ops->set_power(slot, 0);
  127. if (retval)
  128. goto disable_error;
  129. }
  130. if (update_adapter_status(slot->hotplug_slot, 0))
  131. warn("failure to update adapter file");
  132. if (slot->extracting) {
  133. slot->extracting = 0;
  134. atomic_dec(&extracting);
  135. }
  136. disable_error:
  137. up_write(&list_rwsem);
  138. return retval;
  139. }
  140. static u8
  141. cpci_get_power_status(struct slot *slot)
  142. {
  143. u8 power = 1;
  144. if (controller->ops->get_power)
  145. power = controller->ops->get_power(slot);
  146. return power;
  147. }
  148. static int
  149. get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
  150. {
  151. struct slot *slot = hotplug_slot->private;
  152. *value = cpci_get_power_status(slot);
  153. return 0;
  154. }
  155. static int
  156. get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
  157. {
  158. struct slot *slot = hotplug_slot->private;
  159. *value = cpci_get_attention_status(slot);
  160. return 0;
  161. }
  162. static int
  163. set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
  164. {
  165. return cpci_set_attention_status(hotplug_slot->private, status);
  166. }
  167. static int
  168. get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
  169. {
  170. *value = hotplug_slot->info->adapter_status;
  171. return 0;
  172. }
  173. static int
  174. get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
  175. {
  176. *value = hotplug_slot->info->latch_status;
  177. return 0;
  178. }
  179. static void release_slot(struct hotplug_slot *hotplug_slot)
  180. {
  181. struct slot *slot = hotplug_slot->private;
  182. kfree(slot->hotplug_slot->info);
  183. kfree(slot->hotplug_slot);
  184. pci_dev_put(slot->dev);
  185. kfree(slot);
  186. }
  187. #define SLOT_NAME_SIZE 6
  188. int
  189. cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
  190. {
  191. struct slot *slot;
  192. struct hotplug_slot *hotplug_slot;
  193. struct hotplug_slot_info *info;
  194. char name[SLOT_NAME_SIZE];
  195. int status;
  196. int i;
  197. if (!(controller && bus))
  198. return -ENODEV;
  199. /*
  200. * Create a structure for each slot, and register that slot
  201. * with the pci_hotplug subsystem.
  202. */
  203. for (i = first; i <= last; ++i) {
  204. slot = kzalloc(sizeof (struct slot), GFP_KERNEL);
  205. if (!slot) {
  206. status = -ENOMEM;
  207. goto error;
  208. }
  209. hotplug_slot =
  210. kzalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
  211. if (!hotplug_slot) {
  212. status = -ENOMEM;
  213. goto error_slot;
  214. }
  215. slot->hotplug_slot = hotplug_slot;
  216. info = kzalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
  217. if (!info) {
  218. status = -ENOMEM;
  219. goto error_hpslot;
  220. }
  221. hotplug_slot->info = info;
  222. slot->bus = bus;
  223. slot->number = i;
  224. slot->devfn = PCI_DEVFN(i, 0);
  225. snprintf(name, SLOT_NAME_SIZE, "%02x:%02x", bus->number, i);
  226. hotplug_slot->private = slot;
  227. hotplug_slot->release = &release_slot;
  228. hotplug_slot->ops = &cpci_hotplug_slot_ops;
  229. /*
  230. * Initialize the slot info structure with some known
  231. * good values.
  232. */
  233. dbg("initializing slot %s", name);
  234. info->power_status = cpci_get_power_status(slot);
  235. info->attention_status = cpci_get_attention_status(slot);
  236. dbg("registering slot %s", name);
  237. status = pci_hp_register(slot->hotplug_slot, bus, i, name);
  238. if (status) {
  239. err("pci_hp_register failed with error %d", status);
  240. goto error_info;
  241. }
  242. dbg("slot registered with name: %s", slot_name(slot));
  243. /* Add slot to our internal list */
  244. down_write(&list_rwsem);
  245. list_add(&slot->slot_list, &slot_list);
  246. slots++;
  247. up_write(&list_rwsem);
  248. }
  249. return 0;
  250. error_info:
  251. kfree(info);
  252. error_hpslot:
  253. kfree(hotplug_slot);
  254. error_slot:
  255. kfree(slot);
  256. error:
  257. return status;
  258. }
  259. EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
  260. int
  261. cpci_hp_unregister_bus(struct pci_bus *bus)
  262. {
  263. struct slot *slot;
  264. struct slot *tmp;
  265. int status = 0;
  266. down_write(&list_rwsem);
  267. if (!slots) {
  268. up_write(&list_rwsem);
  269. return -1;
  270. }
  271. list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
  272. if (slot->bus == bus) {
  273. list_del(&slot->slot_list);
  274. slots--;
  275. dbg("deregistering slot %s", slot_name(slot));
  276. status = pci_hp_deregister(slot->hotplug_slot);
  277. if (status) {
  278. err("pci_hp_deregister failed with error %d",
  279. status);
  280. break;
  281. }
  282. }
  283. }
  284. up_write(&list_rwsem);
  285. return status;
  286. }
  287. EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus);
  288. /* This is the interrupt mode interrupt handler */
  289. static irqreturn_t
  290. cpci_hp_intr(int irq, void *data)
  291. {
  292. dbg("entered cpci_hp_intr");
  293. /* Check to see if it was our interrupt */
  294. if ((controller->irq_flags & IRQF_SHARED) &&
  295. !controller->ops->check_irq(controller->dev_id)) {
  296. dbg("exited cpci_hp_intr, not our interrupt");
  297. return IRQ_NONE;
  298. }
  299. /* Disable ENUM interrupt */
  300. controller->ops->disable_irq();
  301. /* Trigger processing by the event thread */
  302. wake_up_process(cpci_thread);
  303. return IRQ_HANDLED;
  304. }
  305. /*
  306. * According to PICMG 2.1 R2.0, section 6.3.2, upon
  307. * initialization, the system driver shall clear the
  308. * INS bits of the cold-inserted devices.
  309. */
  310. static int
  311. init_slots(int clear_ins)
  312. {
  313. struct slot *slot;
  314. struct pci_dev *dev;
  315. dbg("%s - enter", __func__);
  316. down_read(&list_rwsem);
  317. if (!slots) {
  318. up_read(&list_rwsem);
  319. return -1;
  320. }
  321. list_for_each_entry(slot, &slot_list, slot_list) {
  322. dbg("%s - looking at slot %s", __func__, slot_name(slot));
  323. if (clear_ins && cpci_check_and_clear_ins(slot))
  324. dbg("%s - cleared INS for slot %s",
  325. __func__, slot_name(slot));
  326. dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0));
  327. if (dev) {
  328. if (update_adapter_status(slot->hotplug_slot, 1))
  329. warn("failure to update adapter file");
  330. if (update_latch_status(slot->hotplug_slot, 1))
  331. warn("failure to update latch file");
  332. slot->dev = dev;
  333. }
  334. }
  335. up_read(&list_rwsem);
  336. dbg("%s - exit", __func__);
  337. return 0;
  338. }
  339. static int
  340. check_slots(void)
  341. {
  342. struct slot *slot;
  343. int extracted;
  344. int inserted;
  345. u16 hs_csr;
  346. down_read(&list_rwsem);
  347. if (!slots) {
  348. up_read(&list_rwsem);
  349. err("no slots registered, shutting down");
  350. return -1;
  351. }
  352. extracted = inserted = 0;
  353. list_for_each_entry(slot, &slot_list, slot_list) {
  354. dbg("%s - looking at slot %s", __func__, slot_name(slot));
  355. if (cpci_check_and_clear_ins(slot)) {
  356. /*
  357. * Some broken hardware (e.g. PLX 9054AB) asserts
  358. * ENUM# twice...
  359. */
  360. if (slot->dev) {
  361. warn("slot %s already inserted",
  362. slot_name(slot));
  363. inserted++;
  364. continue;
  365. }
  366. /* Process insertion */
  367. dbg("%s - slot %s inserted", __func__, slot_name(slot));
  368. /* GSM, debug */
  369. hs_csr = cpci_get_hs_csr(slot);
  370. dbg("%s - slot %s HS_CSR (1) = %04x",
  371. __func__, slot_name(slot), hs_csr);
  372. /* Configure device */
  373. dbg("%s - configuring slot %s",
  374. __func__, slot_name(slot));
  375. if (cpci_configure_slot(slot)) {
  376. err("%s - could not configure slot %s",
  377. __func__, slot_name(slot));
  378. continue;
  379. }
  380. dbg("%s - finished configuring slot %s",
  381. __func__, slot_name(slot));
  382. /* GSM, debug */
  383. hs_csr = cpci_get_hs_csr(slot);
  384. dbg("%s - slot %s HS_CSR (2) = %04x",
  385. __func__, slot_name(slot), hs_csr);
  386. if (update_latch_status(slot->hotplug_slot, 1))
  387. warn("failure to update latch file");
  388. if (update_adapter_status(slot->hotplug_slot, 1))
  389. warn("failure to update adapter file");
  390. cpci_led_off(slot);
  391. /* GSM, debug */
  392. hs_csr = cpci_get_hs_csr(slot);
  393. dbg("%s - slot %s HS_CSR (3) = %04x",
  394. __func__, slot_name(slot), hs_csr);
  395. inserted++;
  396. } else if (cpci_check_ext(slot)) {
  397. /* Process extraction request */
  398. dbg("%s - slot %s extracted",
  399. __func__, slot_name(slot));
  400. /* GSM, debug */
  401. hs_csr = cpci_get_hs_csr(slot);
  402. dbg("%s - slot %s HS_CSR = %04x",
  403. __func__, slot_name(slot), hs_csr);
  404. if (!slot->extracting) {
  405. if (update_latch_status(slot->hotplug_slot, 0))
  406. warn("failure to update latch file");
  407. slot->extracting = 1;
  408. atomic_inc(&extracting);
  409. }
  410. extracted++;
  411. } else if (slot->extracting) {
  412. hs_csr = cpci_get_hs_csr(slot);
  413. if (hs_csr == 0xffff) {
  414. /*
  415. * Hmmm, we're likely hosed at this point, should we
  416. * bother trying to tell the driver or not?
  417. */
  418. err("card in slot %s was improperly removed",
  419. slot_name(slot));
  420. if (update_adapter_status(slot->hotplug_slot, 0))
  421. warn("failure to update adapter file");
  422. slot->extracting = 0;
  423. atomic_dec(&extracting);
  424. }
  425. }
  426. }
  427. up_read(&list_rwsem);
  428. dbg("inserted=%d, extracted=%d, extracting=%d",
  429. inserted, extracted, atomic_read(&extracting));
  430. if (inserted || extracted)
  431. return extracted;
  432. else if (!atomic_read(&extracting)) {
  433. err("cannot find ENUM# source, shutting down");
  434. return -1;
  435. }
  436. return 0;
  437. }
  438. /* This is the interrupt mode worker thread body */
  439. static int
  440. event_thread(void *data)
  441. {
  442. int rc;
  443. dbg("%s - event thread started", __func__);
  444. while (1) {
  445. dbg("event thread sleeping");
  446. set_current_state(TASK_INTERRUPTIBLE);
  447. schedule();
  448. if (kthread_should_stop())
  449. break;
  450. do {
  451. rc = check_slots();
  452. if (rc > 0) {
  453. /* Give userspace a chance to handle extraction */
  454. msleep(500);
  455. } else if (rc < 0) {
  456. dbg("%s - error checking slots", __func__);
  457. thread_finished = 1;
  458. goto out;
  459. }
  460. } while (atomic_read(&extracting) && !kthread_should_stop());
  461. if (kthread_should_stop())
  462. break;
  463. /* Re-enable ENUM# interrupt */
  464. dbg("%s - re-enabling irq", __func__);
  465. controller->ops->enable_irq();
  466. }
  467. out:
  468. return 0;
  469. }
  470. /* This is the polling mode worker thread body */
  471. static int
  472. poll_thread(void *data)
  473. {
  474. int rc;
  475. while (1) {
  476. if (kthread_should_stop() || signal_pending(current))
  477. break;
  478. if (controller->ops->query_enum()) {
  479. do {
  480. rc = check_slots();
  481. if (rc > 0) {
  482. /* Give userspace a chance to handle extraction */
  483. msleep(500);
  484. } else if (rc < 0) {
  485. dbg("%s - error checking slots", __func__);
  486. thread_finished = 1;
  487. goto out;
  488. }
  489. } while (atomic_read(&extracting) && !kthread_should_stop());
  490. }
  491. msleep(100);
  492. }
  493. out:
  494. return 0;
  495. }
  496. static int
  497. cpci_start_thread(void)
  498. {
  499. if (controller->irq)
  500. cpci_thread = kthread_run(event_thread, NULL, "cpci_hp_eventd");
  501. else
  502. cpci_thread = kthread_run(poll_thread, NULL, "cpci_hp_polld");
  503. if (IS_ERR(cpci_thread)) {
  504. err("Can't start up our thread");
  505. return PTR_ERR(cpci_thread);
  506. }
  507. thread_finished = 0;
  508. return 0;
  509. }
  510. static void
  511. cpci_stop_thread(void)
  512. {
  513. kthread_stop(cpci_thread);
  514. thread_finished = 1;
  515. }
  516. int
  517. cpci_hp_register_controller(struct cpci_hp_controller *new_controller)
  518. {
  519. int status = 0;
  520. if (controller)
  521. return -1;
  522. if (!(new_controller && new_controller->ops))
  523. return -EINVAL;
  524. if (new_controller->irq) {
  525. if (!(new_controller->ops->enable_irq &&
  526. new_controller->ops->disable_irq))
  527. status = -EINVAL;
  528. if (request_irq(new_controller->irq,
  529. cpci_hp_intr,
  530. new_controller->irq_flags,
  531. MY_NAME,
  532. new_controller->dev_id)) {
  533. err("Can't get irq %d for the hotplug cPCI controller",
  534. new_controller->irq);
  535. status = -ENODEV;
  536. }
  537. dbg("%s - acquired controller irq %d",
  538. __func__, new_controller->irq);
  539. }
  540. if (!status)
  541. controller = new_controller;
  542. return status;
  543. }
  544. EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
  545. static void
  546. cleanup_slots(void)
  547. {
  548. struct slot *slot;
  549. struct slot *tmp;
  550. /*
  551. * Unregister all of our slots with the pci_hotplug subsystem,
  552. * and free up all memory that we had allocated.
  553. */
  554. down_write(&list_rwsem);
  555. if (!slots)
  556. goto cleanup_null;
  557. list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
  558. list_del(&slot->slot_list);
  559. pci_hp_deregister(slot->hotplug_slot);
  560. }
  561. cleanup_null:
  562. up_write(&list_rwsem);
  563. return;
  564. }
  565. int
  566. cpci_hp_unregister_controller(struct cpci_hp_controller *old_controller)
  567. {
  568. int status = 0;
  569. if (controller) {
  570. if (!thread_finished)
  571. cpci_stop_thread();
  572. if (controller->irq)
  573. free_irq(controller->irq, controller->dev_id);
  574. controller = NULL;
  575. cleanup_slots();
  576. } else
  577. status = -ENODEV;
  578. return status;
  579. }
  580. EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
  581. int
  582. cpci_hp_start(void)
  583. {
  584. static int first = 1;
  585. int status;
  586. dbg("%s - enter", __func__);
  587. if (!controller)
  588. return -ENODEV;
  589. down_read(&list_rwsem);
  590. if (list_empty(&slot_list)) {
  591. up_read(&list_rwsem);
  592. return -ENODEV;
  593. }
  594. up_read(&list_rwsem);
  595. status = init_slots(first);
  596. if (first)
  597. first = 0;
  598. if (status)
  599. return status;
  600. status = cpci_start_thread();
  601. if (status)
  602. return status;
  603. dbg("%s - thread started", __func__);
  604. if (controller->irq) {
  605. /* Start enum interrupt processing */
  606. dbg("%s - enabling irq", __func__);
  607. controller->ops->enable_irq();
  608. }
  609. dbg("%s - exit", __func__);
  610. return 0;
  611. }
  612. EXPORT_SYMBOL_GPL(cpci_hp_start);
  613. int
  614. cpci_hp_stop(void)
  615. {
  616. if (!controller)
  617. return -ENODEV;
  618. if (controller->irq) {
  619. /* Stop enum interrupt processing */
  620. dbg("%s - disabling irq", __func__);
  621. controller->ops->disable_irq();
  622. }
  623. cpci_stop_thread();
  624. return 0;
  625. }
  626. EXPORT_SYMBOL_GPL(cpci_hp_stop);
  627. int __init
  628. cpci_hotplug_init(int debug)
  629. {
  630. cpci_debug = debug;
  631. return 0;
  632. }
  633. void __exit
  634. cpci_hotplug_exit(void)
  635. {
  636. /*
  637. * Clean everything up.
  638. */
  639. cpci_hp_stop();
  640. cpci_hp_unregister_controller(controller);
  641. }