pciehp_ctrl.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /*
  2. * PCI Express Hot Plug Controller Driver
  3. *
  4. * Copyright (C) 1995,2001 Compaq Computer Corporation
  5. * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
  6. * Copyright (C) 2001 IBM Corp.
  7. * Copyright (C) 2003-2004 Intel Corporation
  8. *
  9. * All rights reserved.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or (at
  14. * your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  19. * NON INFRINGEMENT. See the GNU General Public License for more
  20. * details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25. *
  26. * Send feedback to <greg@kroah.com>, <kristen.c.accardi@intel.com>
  27. *
  28. */
  29. #include <linux/module.h>
  30. #include <linux/kernel.h>
  31. #include <linux/types.h>
  32. #include <linux/smp_lock.h>
  33. #include <linux/pci.h>
  34. #include <linux/workqueue.h>
  35. #include "../pci.h"
  36. #include "pciehp.h"
  37. static void interrupt_event_handler(struct work_struct *work);
  38. static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
  39. {
  40. struct event_info *info;
  41. info = kmalloc(sizeof(*info), GFP_ATOMIC);
  42. if (!info)
  43. return -ENOMEM;
  44. info->event_type = event_type;
  45. info->p_slot = p_slot;
  46. INIT_WORK(&info->work, interrupt_event_handler);
  47. schedule_work(&info->work);
  48. return 0;
  49. }
  50. u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
  51. {
  52. struct slot *p_slot;
  53. u32 event_type;
  54. /* Attention Button Change */
  55. dbg("pciehp: Attention button interrupt received.\n");
  56. p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
  57. /*
  58. * Button pressed - See if need to TAKE ACTION!!!
  59. */
  60. info("Button pressed on Slot(%s)\n", p_slot->name);
  61. event_type = INT_BUTTON_PRESS;
  62. queue_interrupt_event(p_slot, event_type);
  63. return 0;
  64. }
  65. u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
  66. {
  67. struct slot *p_slot;
  68. u8 getstatus;
  69. u32 event_type;
  70. /* Switch Change */
  71. dbg("pciehp: Switch interrupt received.\n");
  72. p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
  73. p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
  74. if (getstatus) {
  75. /*
  76. * Switch opened
  77. */
  78. info("Latch open on Slot(%s)\n", p_slot->name);
  79. event_type = INT_SWITCH_OPEN;
  80. } else {
  81. /*
  82. * Switch closed
  83. */
  84. info("Latch close on Slot(%s)\n", p_slot->name);
  85. event_type = INT_SWITCH_CLOSE;
  86. }
  87. queue_interrupt_event(p_slot, event_type);
  88. return 1;
  89. }
  90. u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
  91. {
  92. struct slot *p_slot;
  93. u32 event_type;
  94. u8 presence_save;
  95. /* Presence Change */
  96. dbg("pciehp: Presence/Notify input change.\n");
  97. p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
  98. /* Switch is open, assume a presence change
  99. * Save the presence state
  100. */
  101. p_slot->hpc_ops->get_adapter_status(p_slot, &presence_save);
  102. if (presence_save) {
  103. /*
  104. * Card Present
  105. */
  106. info("Card present on Slot(%s)\n", p_slot->name);
  107. event_type = INT_PRESENCE_ON;
  108. } else {
  109. /*
  110. * Not Present
  111. */
  112. info("Card not present on Slot(%s)\n", p_slot->name);
  113. event_type = INT_PRESENCE_OFF;
  114. }
  115. queue_interrupt_event(p_slot, event_type);
  116. return 1;
  117. }
  118. u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
  119. {
  120. struct slot *p_slot;
  121. u32 event_type;
  122. /* power fault */
  123. dbg("pciehp: Power fault interrupt received.\n");
  124. p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
  125. if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) {
  126. /*
  127. * power fault Cleared
  128. */
  129. info("Power fault cleared on Slot(%s)\n", p_slot->name);
  130. event_type = INT_POWER_FAULT_CLEAR;
  131. } else {
  132. /*
  133. * power fault
  134. */
  135. info("Power fault on Slot(%s)\n", p_slot->name);
  136. event_type = INT_POWER_FAULT;
  137. info("power fault bit %x set\n", hp_slot);
  138. }
  139. queue_interrupt_event(p_slot, event_type);
  140. return 1;
  141. }
  142. /* The following routines constitute the bulk of the
  143. hotplug controller logic
  144. */
  145. static void set_slot_off(struct controller *ctrl, struct slot * pslot)
  146. {
  147. /* turn off slot, turn on Amber LED, turn off Green LED if supported*/
  148. if (POWER_CTRL(ctrl->ctrlcap)) {
  149. if (pslot->hpc_ops->power_off_slot(pslot)) {
  150. err("%s: Issue of Slot Power Off command failed\n",
  151. __func__);
  152. return;
  153. }
  154. }
  155. if (PWR_LED(ctrl->ctrlcap))
  156. pslot->hpc_ops->green_led_off(pslot);
  157. if (ATTN_LED(ctrl->ctrlcap)) {
  158. if (pslot->hpc_ops->set_attention_status(pslot, 1)) {
  159. err("%s: Issue of Set Attention Led command failed\n",
  160. __func__);
  161. return;
  162. }
  163. }
  164. }
  165. /**
  166. * board_added - Called after a board has been added to the system.
  167. * @p_slot: &slot where board is added
  168. *
  169. * Turns power on for the board.
  170. * Configures board.
  171. */
  172. static int board_added(struct slot *p_slot)
  173. {
  174. int retval = 0;
  175. struct controller *ctrl = p_slot->ctrl;
  176. dbg("%s: slot device, slot offset, hp slot = %d, %d ,%d\n",
  177. __func__, p_slot->device,
  178. ctrl->slot_device_offset, p_slot->hp_slot);
  179. if (POWER_CTRL(ctrl->ctrlcap)) {
  180. /* Power on slot */
  181. retval = p_slot->hpc_ops->power_on_slot(p_slot);
  182. if (retval)
  183. return retval;
  184. }
  185. if (PWR_LED(ctrl->ctrlcap))
  186. p_slot->hpc_ops->green_led_blink(p_slot);
  187. /* Wait for ~1 second */
  188. msleep(1000);
  189. /* Check link training status */
  190. retval = p_slot->hpc_ops->check_lnk_status(ctrl);
  191. if (retval) {
  192. err("%s: Failed to check link status\n", __func__);
  193. set_slot_off(ctrl, p_slot);
  194. return retval;
  195. }
  196. /* Check for a power fault */
  197. if (p_slot->hpc_ops->query_power_fault(p_slot)) {
  198. dbg("%s: power fault detected\n", __func__);
  199. retval = POWER_FAILURE;
  200. goto err_exit;
  201. }
  202. retval = pciehp_configure_device(p_slot);
  203. if (retval) {
  204. err("Cannot add device 0x%x:%x\n", p_slot->bus,
  205. p_slot->device);
  206. goto err_exit;
  207. }
  208. /*
  209. * Some PCI Express root ports require fixup after hot-plug operation.
  210. */
  211. if (pcie_mch_quirk)
  212. pci_fixup_device(pci_fixup_final, ctrl->pci_dev);
  213. if (PWR_LED(ctrl->ctrlcap))
  214. p_slot->hpc_ops->green_led_on(p_slot);
  215. return 0;
  216. err_exit:
  217. set_slot_off(ctrl, p_slot);
  218. return retval;
  219. }
  220. /**
  221. * remove_board - Turns off slot and LEDs
  222. * @p_slot: slot where board is being removed
  223. */
  224. static int remove_board(struct slot *p_slot)
  225. {
  226. int retval = 0;
  227. struct controller *ctrl = p_slot->ctrl;
  228. retval = pciehp_unconfigure_device(p_slot);
  229. if (retval)
  230. return retval;
  231. dbg("In %s, hp_slot = %d\n", __func__, p_slot->hp_slot);
  232. if (POWER_CTRL(ctrl->ctrlcap)) {
  233. /* power off slot */
  234. retval = p_slot->hpc_ops->power_off_slot(p_slot);
  235. if (retval) {
  236. err("%s: Issue of Slot Disable command failed\n",
  237. __func__);
  238. return retval;
  239. }
  240. }
  241. if (PWR_LED(ctrl->ctrlcap))
  242. /* turn off Green LED */
  243. p_slot->hpc_ops->green_led_off(p_slot);
  244. return 0;
  245. }
  246. struct power_work_info {
  247. struct slot *p_slot;
  248. struct work_struct work;
  249. };
  250. /**
  251. * pciehp_power_thread - handle pushbutton events
  252. * @work: &struct work_struct describing work to be done
  253. *
  254. * Scheduled procedure to handle blocking stuff for the pushbuttons.
  255. * Handles all pending events and exits.
  256. */
  257. static void pciehp_power_thread(struct work_struct *work)
  258. {
  259. struct power_work_info *info =
  260. container_of(work, struct power_work_info, work);
  261. struct slot *p_slot = info->p_slot;
  262. mutex_lock(&p_slot->lock);
  263. switch (p_slot->state) {
  264. case POWEROFF_STATE:
  265. mutex_unlock(&p_slot->lock);
  266. dbg("%s: disabling bus:device(%x:%x)\n",
  267. __func__, p_slot->bus, p_slot->device);
  268. pciehp_disable_slot(p_slot);
  269. mutex_lock(&p_slot->lock);
  270. p_slot->state = STATIC_STATE;
  271. break;
  272. case POWERON_STATE:
  273. mutex_unlock(&p_slot->lock);
  274. if (pciehp_enable_slot(p_slot) &&
  275. PWR_LED(p_slot->ctrl->ctrlcap))
  276. p_slot->hpc_ops->green_led_off(p_slot);
  277. mutex_lock(&p_slot->lock);
  278. p_slot->state = STATIC_STATE;
  279. break;
  280. default:
  281. break;
  282. }
  283. mutex_unlock(&p_slot->lock);
  284. kfree(info);
  285. }
  286. void pciehp_queue_pushbutton_work(struct work_struct *work)
  287. {
  288. struct slot *p_slot = container_of(work, struct slot, work.work);
  289. struct power_work_info *info;
  290. info = kmalloc(sizeof(*info), GFP_KERNEL);
  291. if (!info) {
  292. err("%s: Cannot allocate memory\n", __func__);
  293. return;
  294. }
  295. info->p_slot = p_slot;
  296. INIT_WORK(&info->work, pciehp_power_thread);
  297. mutex_lock(&p_slot->lock);
  298. switch (p_slot->state) {
  299. case BLINKINGOFF_STATE:
  300. p_slot->state = POWEROFF_STATE;
  301. break;
  302. case BLINKINGON_STATE:
  303. p_slot->state = POWERON_STATE;
  304. break;
  305. default:
  306. goto out;
  307. }
  308. queue_work(pciehp_wq, &info->work);
  309. out:
  310. mutex_unlock(&p_slot->lock);
  311. }
  312. static int update_slot_info(struct slot *slot)
  313. {
  314. struct hotplug_slot_info *info;
  315. int result;
  316. info = kmalloc(sizeof(*info), GFP_KERNEL);
  317. if (!info)
  318. return -ENOMEM;
  319. slot->hpc_ops->get_power_status(slot, &(info->power_status));
  320. slot->hpc_ops->get_attention_status(slot, &(info->attention_status));
  321. slot->hpc_ops->get_latch_status(slot, &(info->latch_status));
  322. slot->hpc_ops->get_adapter_status(slot, &(info->adapter_status));
  323. result = pci_hp_change_slot_info(slot->hotplug_slot, info);
  324. kfree (info);
  325. return result;
  326. }
  327. /*
  328. * Note: This function must be called with slot->lock held
  329. */
  330. static void handle_button_press_event(struct slot *p_slot)
  331. {
  332. struct controller *ctrl = p_slot->ctrl;
  333. u8 getstatus;
  334. switch (p_slot->state) {
  335. case STATIC_STATE:
  336. p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
  337. if (getstatus) {
  338. p_slot->state = BLINKINGOFF_STATE;
  339. info("PCI slot #%s - powering off due to button "
  340. "press.\n", p_slot->name);
  341. } else {
  342. p_slot->state = BLINKINGON_STATE;
  343. info("PCI slot #%s - powering on due to button "
  344. "press.\n", p_slot->name);
  345. }
  346. /* blink green LED and turn off amber */
  347. if (PWR_LED(ctrl->ctrlcap))
  348. p_slot->hpc_ops->green_led_blink(p_slot);
  349. if (ATTN_LED(ctrl->ctrlcap))
  350. p_slot->hpc_ops->set_attention_status(p_slot, 0);
  351. schedule_delayed_work(&p_slot->work, 5*HZ);
  352. break;
  353. case BLINKINGOFF_STATE:
  354. case BLINKINGON_STATE:
  355. /*
  356. * Cancel if we are still blinking; this means that we
  357. * press the attention again before the 5 sec. limit
  358. * expires to cancel hot-add or hot-remove
  359. */
  360. info("Button cancel on Slot(%s)\n", p_slot->name);
  361. dbg("%s: button cancel\n", __func__);
  362. cancel_delayed_work(&p_slot->work);
  363. if (p_slot->state == BLINKINGOFF_STATE) {
  364. if (PWR_LED(ctrl->ctrlcap))
  365. p_slot->hpc_ops->green_led_on(p_slot);
  366. } else {
  367. if (PWR_LED(ctrl->ctrlcap))
  368. p_slot->hpc_ops->green_led_off(p_slot);
  369. }
  370. if (ATTN_LED(ctrl->ctrlcap))
  371. p_slot->hpc_ops->set_attention_status(p_slot, 0);
  372. info("PCI slot #%s - action canceled due to button press\n",
  373. p_slot->name);
  374. p_slot->state = STATIC_STATE;
  375. break;
  376. case POWEROFF_STATE:
  377. case POWERON_STATE:
  378. /*
  379. * Ignore if the slot is on power-on or power-off state;
  380. * this means that the previous attention button action
  381. * to hot-add or hot-remove is undergoing
  382. */
  383. info("Button ignore on Slot(%s)\n", p_slot->name);
  384. update_slot_info(p_slot);
  385. break;
  386. default:
  387. warn("Not a valid state\n");
  388. break;
  389. }
  390. }
  391. /*
  392. * Note: This function must be called with slot->lock held
  393. */
  394. static void handle_surprise_event(struct slot *p_slot)
  395. {
  396. u8 getstatus;
  397. struct power_work_info *info;
  398. info = kmalloc(sizeof(*info), GFP_KERNEL);
  399. if (!info) {
  400. err("%s: Cannot allocate memory\n", __func__);
  401. return;
  402. }
  403. info->p_slot = p_slot;
  404. INIT_WORK(&info->work, pciehp_power_thread);
  405. p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
  406. if (!getstatus)
  407. p_slot->state = POWEROFF_STATE;
  408. else
  409. p_slot->state = POWERON_STATE;
  410. queue_work(pciehp_wq, &info->work);
  411. }
  412. static void interrupt_event_handler(struct work_struct *work)
  413. {
  414. struct event_info *info = container_of(work, struct event_info, work);
  415. struct slot *p_slot = info->p_slot;
  416. struct controller *ctrl = p_slot->ctrl;
  417. mutex_lock(&p_slot->lock);
  418. switch (info->event_type) {
  419. case INT_BUTTON_PRESS:
  420. handle_button_press_event(p_slot);
  421. break;
  422. case INT_POWER_FAULT:
  423. if (!POWER_CTRL(ctrl->ctrlcap))
  424. break;
  425. if (ATTN_LED(ctrl->ctrlcap))
  426. p_slot->hpc_ops->set_attention_status(p_slot, 1);
  427. if (PWR_LED(ctrl->ctrlcap))
  428. p_slot->hpc_ops->green_led_off(p_slot);
  429. break;
  430. case INT_PRESENCE_ON:
  431. case INT_PRESENCE_OFF:
  432. if (!HP_SUPR_RM(ctrl->ctrlcap))
  433. break;
  434. dbg("Surprise Removal\n");
  435. update_slot_info(p_slot);
  436. handle_surprise_event(p_slot);
  437. break;
  438. default:
  439. update_slot_info(p_slot);
  440. break;
  441. }
  442. mutex_unlock(&p_slot->lock);
  443. kfree(info);
  444. }
  445. int pciehp_enable_slot(struct slot *p_slot)
  446. {
  447. u8 getstatus = 0;
  448. int rc;
  449. /* Check to see if (latch closed, card present, power off) */
  450. mutex_lock(&p_slot->ctrl->crit_sect);
  451. rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
  452. if (rc || !getstatus) {
  453. info("%s: no adapter on slot(%s)\n", __func__,
  454. p_slot->name);
  455. mutex_unlock(&p_slot->ctrl->crit_sect);
  456. return -ENODEV;
  457. }
  458. if (MRL_SENS(p_slot->ctrl->ctrlcap)) {
  459. rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
  460. if (rc || getstatus) {
  461. info("%s: latch open on slot(%s)\n", __func__,
  462. p_slot->name);
  463. mutex_unlock(&p_slot->ctrl->crit_sect);
  464. return -ENODEV;
  465. }
  466. }
  467. if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {
  468. rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
  469. if (rc || getstatus) {
  470. info("%s: already enabled on slot(%s)\n", __func__,
  471. p_slot->name);
  472. mutex_unlock(&p_slot->ctrl->crit_sect);
  473. return -EINVAL;
  474. }
  475. }
  476. p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
  477. rc = board_added(p_slot);
  478. if (rc) {
  479. p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
  480. }
  481. update_slot_info(p_slot);
  482. mutex_unlock(&p_slot->ctrl->crit_sect);
  483. return rc;
  484. }
  485. int pciehp_disable_slot(struct slot *p_slot)
  486. {
  487. u8 getstatus = 0;
  488. int ret = 0;
  489. if (!p_slot->ctrl)
  490. return 1;
  491. /* Check to see if (latch closed, card present, power on) */
  492. mutex_lock(&p_slot->ctrl->crit_sect);
  493. if (!HP_SUPR_RM(p_slot->ctrl->ctrlcap)) {
  494. ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
  495. if (ret || !getstatus) {
  496. info("%s: no adapter on slot(%s)\n", __func__,
  497. p_slot->name);
  498. mutex_unlock(&p_slot->ctrl->crit_sect);
  499. return -ENODEV;
  500. }
  501. }
  502. if (MRL_SENS(p_slot->ctrl->ctrlcap)) {
  503. ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
  504. if (ret || getstatus) {
  505. info("%s: latch open on slot(%s)\n", __func__,
  506. p_slot->name);
  507. mutex_unlock(&p_slot->ctrl->crit_sect);
  508. return -ENODEV;
  509. }
  510. }
  511. if (POWER_CTRL(p_slot->ctrl->ctrlcap)) {
  512. ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
  513. if (ret || !getstatus) {
  514. info("%s: already disabled slot(%s)\n", __func__,
  515. p_slot->name);
  516. mutex_unlock(&p_slot->ctrl->crit_sect);
  517. return -EINVAL;
  518. }
  519. }
  520. ret = remove_board(p_slot);
  521. update_slot_info(p_slot);
  522. mutex_unlock(&p_slot->ctrl->crit_sect);
  523. return ret;
  524. }
  525. int pciehp_sysfs_enable_slot(struct slot *p_slot)
  526. {
  527. int retval = -ENODEV;
  528. mutex_lock(&p_slot->lock);
  529. switch (p_slot->state) {
  530. case BLINKINGON_STATE:
  531. cancel_delayed_work(&p_slot->work);
  532. case STATIC_STATE:
  533. p_slot->state = POWERON_STATE;
  534. mutex_unlock(&p_slot->lock);
  535. retval = pciehp_enable_slot(p_slot);
  536. mutex_lock(&p_slot->lock);
  537. p_slot->state = STATIC_STATE;
  538. break;
  539. case POWERON_STATE:
  540. info("Slot %s is already in powering on state\n",
  541. p_slot->name);
  542. break;
  543. case BLINKINGOFF_STATE:
  544. case POWEROFF_STATE:
  545. info("Already enabled on slot %s\n", p_slot->name);
  546. break;
  547. default:
  548. err("Not a valid state on slot %s\n", p_slot->name);
  549. break;
  550. }
  551. mutex_unlock(&p_slot->lock);
  552. return retval;
  553. }
  554. int pciehp_sysfs_disable_slot(struct slot *p_slot)
  555. {
  556. int retval = -ENODEV;
  557. mutex_lock(&p_slot->lock);
  558. switch (p_slot->state) {
  559. case BLINKINGOFF_STATE:
  560. cancel_delayed_work(&p_slot->work);
  561. case STATIC_STATE:
  562. p_slot->state = POWEROFF_STATE;
  563. mutex_unlock(&p_slot->lock);
  564. retval = pciehp_disable_slot(p_slot);
  565. mutex_lock(&p_slot->lock);
  566. p_slot->state = STATIC_STATE;
  567. break;
  568. case POWEROFF_STATE:
  569. info("Slot %s is already in powering off state\n",
  570. p_slot->name);
  571. break;
  572. case BLINKINGON_STATE:
  573. case POWERON_STATE:
  574. info("Already disabled on slot %s\n", p_slot->name);
  575. break;
  576. default:
  577. err("Not a valid state on slot %s\n", p_slot->name);
  578. break;
  579. }
  580. mutex_unlock(&p_slot->lock);
  581. return retval;
  582. }