cpci_hotplug_core.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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. if ((retval = cpci_unconfigure_slot(slot))) {
  111. err("%s - could not unconfigure slot %s",
  112. __func__, slot_name(slot));
  113. goto disable_error;
  114. }
  115. dbg("%s - finished unconfiguring slot %s", __func__, slot_name(slot));
  116. /* Clear EXT (by setting it) */
  117. if (cpci_clear_ext(slot)) {
  118. err("%s - could not clear EXT for slot %s",
  119. __func__, slot_name(slot));
  120. retval = -ENODEV;
  121. goto disable_error;
  122. }
  123. cpci_led_on(slot);
  124. if (controller->ops->set_power)
  125. if ((retval = controller->ops->set_power(slot, 0)))
  126. goto disable_error;
  127. if (update_adapter_status(slot->hotplug_slot, 0))
  128. warn("failure to update adapter file");
  129. if (slot->extracting) {
  130. slot->extracting = 0;
  131. atomic_dec(&extracting);
  132. }
  133. disable_error:
  134. up_write(&list_rwsem);
  135. return retval;
  136. }
  137. static u8
  138. cpci_get_power_status(struct slot *slot)
  139. {
  140. u8 power = 1;
  141. if (controller->ops->get_power)
  142. power = controller->ops->get_power(slot);
  143. return power;
  144. }
  145. static int
  146. get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
  147. {
  148. struct slot *slot = hotplug_slot->private;
  149. *value = cpci_get_power_status(slot);
  150. return 0;
  151. }
  152. static int
  153. get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
  154. {
  155. struct slot *slot = hotplug_slot->private;
  156. *value = cpci_get_attention_status(slot);
  157. return 0;
  158. }
  159. static int
  160. set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
  161. {
  162. return cpci_set_attention_status(hotplug_slot->private, status);
  163. }
  164. static int
  165. get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
  166. {
  167. *value = hotplug_slot->info->adapter_status;
  168. return 0;
  169. }
  170. static int
  171. get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
  172. {
  173. *value = hotplug_slot->info->latch_status;
  174. return 0;
  175. }
  176. static void release_slot(struct hotplug_slot *hotplug_slot)
  177. {
  178. struct slot *slot = hotplug_slot->private;
  179. kfree(slot->hotplug_slot->info);
  180. kfree(slot->hotplug_slot);
  181. if (slot->dev)
  182. pci_dev_put(slot->dev);
  183. kfree(slot);
  184. }
  185. #define SLOT_NAME_SIZE 6
  186. int
  187. cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
  188. {
  189. struct slot *slot;
  190. struct hotplug_slot *hotplug_slot;
  191. struct hotplug_slot_info *info;
  192. char name[SLOT_NAME_SIZE];
  193. int status;
  194. int i;
  195. if (!(controller && bus))
  196. return -ENODEV;
  197. /*
  198. * Create a structure for each slot, and register that slot
  199. * with the pci_hotplug subsystem.
  200. */
  201. for (i = first; i <= last; ++i) {
  202. slot = kzalloc(sizeof (struct slot), GFP_KERNEL);
  203. if (!slot) {
  204. status = -ENOMEM;
  205. goto error;
  206. }
  207. hotplug_slot =
  208. kzalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
  209. if (!hotplug_slot) {
  210. status = -ENOMEM;
  211. goto error_slot;
  212. }
  213. slot->hotplug_slot = hotplug_slot;
  214. info = kzalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
  215. if (!info) {
  216. status = -ENOMEM;
  217. goto error_hpslot;
  218. }
  219. hotplug_slot->info = info;
  220. slot->bus = bus;
  221. slot->number = i;
  222. slot->devfn = PCI_DEVFN(i, 0);
  223. snprintf(name, SLOT_NAME_SIZE, "%02x:%02x", bus->number, i);
  224. hotplug_slot->private = slot;
  225. hotplug_slot->release = &release_slot;
  226. hotplug_slot->ops = &cpci_hotplug_slot_ops;
  227. /*
  228. * Initialize the slot info structure with some known
  229. * good values.
  230. */
  231. dbg("initializing slot %s", name);
  232. info->power_status = cpci_get_power_status(slot);
  233. info->attention_status = cpci_get_attention_status(slot);
  234. dbg("registering slot %s", name);
  235. status = pci_hp_register(slot->hotplug_slot, bus, i, name);
  236. if (status) {
  237. err("pci_hp_register failed with error %d", status);
  238. goto error_info;
  239. }
  240. dbg("slot registered with name: %s", slot_name(slot));
  241. /* Add slot to our internal list */
  242. down_write(&list_rwsem);
  243. list_add(&slot->slot_list, &slot_list);
  244. slots++;
  245. up_write(&list_rwsem);
  246. }
  247. return 0;
  248. error_info:
  249. kfree(info);
  250. error_hpslot:
  251. kfree(hotplug_slot);
  252. error_slot:
  253. kfree(slot);
  254. error:
  255. return status;
  256. }
  257. EXPORT_SYMBOL_GPL(cpci_hp_register_bus);
  258. int
  259. cpci_hp_unregister_bus(struct pci_bus *bus)
  260. {
  261. struct slot *slot;
  262. struct slot *tmp;
  263. int status = 0;
  264. down_write(&list_rwsem);
  265. if (!slots) {
  266. up_write(&list_rwsem);
  267. return -1;
  268. }
  269. list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
  270. if (slot->bus == bus) {
  271. list_del(&slot->slot_list);
  272. slots--;
  273. dbg("deregistering slot %s", slot_name(slot));
  274. status = pci_hp_deregister(slot->hotplug_slot);
  275. if (status) {
  276. err("pci_hp_deregister failed with error %d",
  277. status);
  278. break;
  279. }
  280. }
  281. }
  282. up_write(&list_rwsem);
  283. return status;
  284. }
  285. EXPORT_SYMBOL_GPL(cpci_hp_unregister_bus);
  286. /* This is the interrupt mode interrupt handler */
  287. static irqreturn_t
  288. cpci_hp_intr(int irq, void *data)
  289. {
  290. dbg("entered cpci_hp_intr");
  291. /* Check to see if it was our interrupt */
  292. if ((controller->irq_flags & IRQF_SHARED) &&
  293. !controller->ops->check_irq(controller->dev_id)) {
  294. dbg("exited cpci_hp_intr, not our interrupt");
  295. return IRQ_NONE;
  296. }
  297. /* Disable ENUM interrupt */
  298. controller->ops->disable_irq();
  299. /* Trigger processing by the event thread */
  300. wake_up_process(cpci_thread);
  301. return IRQ_HANDLED;
  302. }
  303. /*
  304. * According to PICMG 2.1 R2.0, section 6.3.2, upon
  305. * initialization, the system driver shall clear the
  306. * INS bits of the cold-inserted devices.
  307. */
  308. static int
  309. init_slots(int clear_ins)
  310. {
  311. struct slot *slot;
  312. struct pci_dev *dev;
  313. dbg("%s - enter", __func__);
  314. down_read(&list_rwsem);
  315. if (!slots) {
  316. up_read(&list_rwsem);
  317. return -1;
  318. }
  319. list_for_each_entry(slot, &slot_list, slot_list) {
  320. dbg("%s - looking at slot %s", __func__, slot_name(slot));
  321. if (clear_ins && cpci_check_and_clear_ins(slot))
  322. dbg("%s - cleared INS for slot %s",
  323. __func__, slot_name(slot));
  324. dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0));
  325. if (dev) {
  326. if (update_adapter_status(slot->hotplug_slot, 1))
  327. warn("failure to update adapter file");
  328. if (update_latch_status(slot->hotplug_slot, 1))
  329. warn("failure to update latch file");
  330. slot->dev = dev;
  331. }
  332. }
  333. up_read(&list_rwsem);
  334. dbg("%s - exit", __func__);
  335. return 0;
  336. }
  337. static int
  338. check_slots(void)
  339. {
  340. struct slot *slot;
  341. int extracted;
  342. int inserted;
  343. u16 hs_csr;
  344. down_read(&list_rwsem);
  345. if (!slots) {
  346. up_read(&list_rwsem);
  347. err("no slots registered, shutting down");
  348. return -1;
  349. }
  350. extracted = inserted = 0;
  351. list_for_each_entry(slot, &slot_list, slot_list) {
  352. dbg("%s - looking at slot %s", __func__, slot_name(slot));
  353. if (cpci_check_and_clear_ins(slot)) {
  354. /*
  355. * Some broken hardware (e.g. PLX 9054AB) asserts
  356. * ENUM# twice...
  357. */
  358. if (slot->dev) {
  359. warn("slot %s already inserted",
  360. slot_name(slot));
  361. inserted++;
  362. continue;
  363. }
  364. /* Process insertion */
  365. dbg("%s - slot %s inserted", __func__, slot_name(slot));
  366. /* GSM, debug */
  367. hs_csr = cpci_get_hs_csr(slot);
  368. dbg("%s - slot %s HS_CSR (1) = %04x",
  369. __func__, slot_name(slot), hs_csr);
  370. /* Configure device */
  371. dbg("%s - configuring slot %s",
  372. __func__, slot_name(slot));
  373. if (cpci_configure_slot(slot)) {
  374. err("%s - could not configure slot %s",
  375. __func__, slot_name(slot));
  376. continue;
  377. }
  378. dbg("%s - finished configuring slot %s",
  379. __func__, slot_name(slot));
  380. /* GSM, debug */
  381. hs_csr = cpci_get_hs_csr(slot);
  382. dbg("%s - slot %s HS_CSR (2) = %04x",
  383. __func__, slot_name(slot), hs_csr);
  384. if (update_latch_status(slot->hotplug_slot, 1))
  385. warn("failure to update latch file");
  386. if (update_adapter_status(slot->hotplug_slot, 1))
  387. warn("failure to update adapter file");
  388. cpci_led_off(slot);
  389. /* GSM, debug */
  390. hs_csr = cpci_get_hs_csr(slot);
  391. dbg("%s - slot %s HS_CSR (3) = %04x",
  392. __func__, slot_name(slot), hs_csr);
  393. inserted++;
  394. } else if (cpci_check_ext(slot)) {
  395. /* Process extraction request */
  396. dbg("%s - slot %s extracted",
  397. __func__, slot_name(slot));
  398. /* GSM, debug */
  399. hs_csr = cpci_get_hs_csr(slot);
  400. dbg("%s - slot %s HS_CSR = %04x",
  401. __func__, slot_name(slot), hs_csr);
  402. if (!slot->extracting) {
  403. if (update_latch_status(slot->hotplug_slot, 0)) {
  404. warn("failure to update latch file");
  405. }
  406. slot->extracting = 1;
  407. atomic_inc(&extracting);
  408. }
  409. extracted++;
  410. } else if (slot->extracting) {
  411. hs_csr = cpci_get_hs_csr(slot);
  412. if (hs_csr == 0xffff) {
  413. /*
  414. * Hmmm, we're likely hosed at this point, should we
  415. * bother trying to tell the driver or not?
  416. */
  417. err("card in slot %s was improperly removed",
  418. slot_name(slot));
  419. if (update_adapter_status(slot->hotplug_slot, 0))
  420. warn("failure to update adapter file");
  421. slot->extracting = 0;
  422. atomic_dec(&extracting);
  423. }
  424. }
  425. }
  426. up_read(&list_rwsem);
  427. dbg("inserted=%d, extracted=%d, extracting=%d",
  428. inserted, extracted, atomic_read(&extracting));
  429. if (inserted || extracted)
  430. return extracted;
  431. else if (!atomic_read(&extracting)) {
  432. err("cannot find ENUM# source, shutting down");
  433. return -1;
  434. }
  435. return 0;
  436. }
  437. /* This is the interrupt mode worker thread body */
  438. static int
  439. event_thread(void *data)
  440. {
  441. int rc;
  442. dbg("%s - event thread started", __func__);
  443. while (1) {
  444. dbg("event thread sleeping");
  445. set_current_state(TASK_INTERRUPTIBLE);
  446. schedule();
  447. if (kthread_should_stop())
  448. break;
  449. do {
  450. rc = check_slots();
  451. if (rc > 0) {
  452. /* Give userspace a chance to handle extraction */
  453. msleep(500);
  454. } else if (rc < 0) {
  455. dbg("%s - error checking slots", __func__);
  456. thread_finished = 1;
  457. goto out;
  458. }
  459. } while (atomic_read(&extracting) && !kthread_should_stop());
  460. if (kthread_should_stop())
  461. break;
  462. /* Re-enable ENUM# interrupt */
  463. dbg("%s - re-enabling irq", __func__);
  464. controller->ops->enable_irq();
  465. }
  466. out:
  467. return 0;
  468. }
  469. /* This is the polling mode worker thread body */
  470. static int
  471. poll_thread(void *data)
  472. {
  473. int rc;
  474. while (1) {
  475. if (kthread_should_stop() || signal_pending(current))
  476. break;
  477. if (controller->ops->query_enum()) {
  478. do {
  479. rc = check_slots();
  480. if (rc > 0) {
  481. /* Give userspace a chance to handle extraction */
  482. msleep(500);
  483. } else if (rc < 0) {
  484. dbg("%s - error checking slots", __func__);
  485. thread_finished = 1;
  486. goto out;
  487. }
  488. } while (atomic_read(&extracting) && !kthread_should_stop());
  489. }
  490. msleep(100);
  491. }
  492. out:
  493. return 0;
  494. }
  495. static int
  496. cpci_start_thread(void)
  497. {
  498. if (controller->irq)
  499. cpci_thread = kthread_run(event_thread, NULL, "cpci_hp_eventd");
  500. else
  501. cpci_thread = kthread_run(poll_thread, NULL, "cpci_hp_polld");
  502. if (IS_ERR(cpci_thread)) {
  503. err("Can't start up our thread");
  504. return PTR_ERR(cpci_thread);
  505. }
  506. thread_finished = 0;
  507. return 0;
  508. }
  509. static void
  510. cpci_stop_thread(void)
  511. {
  512. kthread_stop(cpci_thread);
  513. thread_finished = 1;
  514. }
  515. int
  516. cpci_hp_register_controller(struct cpci_hp_controller *new_controller)
  517. {
  518. int status = 0;
  519. if (controller)
  520. return -1;
  521. if (!(new_controller && new_controller->ops))
  522. return -EINVAL;
  523. if (new_controller->irq) {
  524. if (!(new_controller->ops->enable_irq &&
  525. new_controller->ops->disable_irq))
  526. status = -EINVAL;
  527. if (request_irq(new_controller->irq,
  528. cpci_hp_intr,
  529. new_controller->irq_flags,
  530. MY_NAME,
  531. new_controller->dev_id)) {
  532. err("Can't get irq %d for the hotplug cPCI controller",
  533. new_controller->irq);
  534. status = -ENODEV;
  535. }
  536. dbg("%s - acquired controller irq %d",
  537. __func__, new_controller->irq);
  538. }
  539. if (!status)
  540. controller = new_controller;
  541. return status;
  542. }
  543. EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
  544. static void
  545. cleanup_slots(void)
  546. {
  547. struct slot *slot;
  548. struct slot *tmp;
  549. /*
  550. * Unregister all of our slots with the pci_hotplug subsystem,
  551. * and free up all memory that we had allocated.
  552. */
  553. down_write(&list_rwsem);
  554. if (!slots)
  555. goto cleanup_null;
  556. list_for_each_entry_safe(slot, tmp, &slot_list, slot_list) {
  557. list_del(&slot->slot_list);
  558. pci_hp_deregister(slot->hotplug_slot);
  559. }
  560. cleanup_null:
  561. up_write(&list_rwsem);
  562. return;
  563. }
  564. int
  565. cpci_hp_unregister_controller(struct cpci_hp_controller *old_controller)
  566. {
  567. int status = 0;
  568. if (controller) {
  569. if (!thread_finished)
  570. cpci_stop_thread();
  571. if (controller->irq)
  572. free_irq(controller->irq, controller->dev_id);
  573. controller = NULL;
  574. cleanup_slots();
  575. } else
  576. status = -ENODEV;
  577. return status;
  578. }
  579. EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
  580. int
  581. cpci_hp_start(void)
  582. {
  583. static int first = 1;
  584. int status;
  585. dbg("%s - enter", __func__);
  586. if (!controller)
  587. return -ENODEV;
  588. down_read(&list_rwsem);
  589. if (list_empty(&slot_list)) {
  590. up_read(&list_rwsem);
  591. return -ENODEV;
  592. }
  593. up_read(&list_rwsem);
  594. status = init_slots(first);
  595. if (first)
  596. first = 0;
  597. if (status)
  598. return status;
  599. status = cpci_start_thread();
  600. if (status)
  601. return status;
  602. dbg("%s - thread started", __func__);
  603. if (controller->irq) {
  604. /* Start enum interrupt processing */
  605. dbg("%s - enabling irq", __func__);
  606. controller->ops->enable_irq();
  607. }
  608. dbg("%s - exit", __func__);
  609. return 0;
  610. }
  611. EXPORT_SYMBOL_GPL(cpci_hp_start);
  612. int
  613. cpci_hp_stop(void)
  614. {
  615. if (!controller)
  616. return -ENODEV;
  617. if (controller->irq) {
  618. /* Stop enum interrupt processing */
  619. dbg("%s - disabling irq", __func__);
  620. controller->ops->disable_irq();
  621. }
  622. cpci_stop_thread();
  623. return 0;
  624. }
  625. EXPORT_SYMBOL_GPL(cpci_hp_stop);
  626. int __init
  627. cpci_hotplug_init(int debug)
  628. {
  629. cpci_debug = debug;
  630. return 0;
  631. }
  632. void __exit
  633. cpci_hotplug_exit(void)
  634. {
  635. /*
  636. * Clean everything up.
  637. */
  638. cpci_hp_stop();
  639. cpci_hp_unregister_controller(controller);
  640. }