ccwgroup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. * bus driver for ccwgroup
  3. *
  4. * Copyright IBM Corp. 2002, 2012
  5. *
  6. * Author(s): Arnd Bergmann (arndb@de.ibm.com)
  7. * Cornelia Huck (cornelia.huck@de.ibm.com)
  8. */
  9. #include <linux/module.h>
  10. #include <linux/errno.h>
  11. #include <linux/slab.h>
  12. #include <linux/list.h>
  13. #include <linux/device.h>
  14. #include <linux/init.h>
  15. #include <linux/ctype.h>
  16. #include <linux/dcache.h>
  17. #include <asm/cio.h>
  18. #include <asm/ccwdev.h>
  19. #include <asm/ccwgroup.h>
  20. #include "device.h"
  21. #define CCW_BUS_ID_SIZE 10
  22. /* In Linux 2.4, we had a channel device layer called "chandev"
  23. * that did all sorts of obscure stuff for networking devices.
  24. * This is another driver that serves as a replacement for just
  25. * one of its functions, namely the translation of single subchannels
  26. * to devices that use multiple subchannels.
  27. */
  28. static struct bus_type ccwgroup_bus_type;
  29. static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
  30. {
  31. int i;
  32. char str[8];
  33. for (i = 0; i < gdev->count; i++) {
  34. sprintf(str, "cdev%d", i);
  35. sysfs_remove_link(&gdev->dev.kobj, str);
  36. sysfs_remove_link(&gdev->cdev[i]->dev.kobj, "group_device");
  37. }
  38. }
  39. /*
  40. * Remove references from ccw devices to ccw group device and from
  41. * ccw group device to ccw devices.
  42. */
  43. static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev)
  44. {
  45. struct ccw_device *cdev;
  46. int i;
  47. for (i = 0; i < gdev->count; i++) {
  48. cdev = gdev->cdev[i];
  49. if (!cdev)
  50. continue;
  51. spin_lock_irq(cdev->ccwlock);
  52. dev_set_drvdata(&cdev->dev, NULL);
  53. spin_unlock_irq(cdev->ccwlock);
  54. gdev->cdev[i] = NULL;
  55. put_device(&cdev->dev);
  56. }
  57. }
  58. /**
  59. * ccwgroup_set_online() - enable a ccwgroup device
  60. * @gdev: target ccwgroup device
  61. *
  62. * This function attempts to put the ccwgroup device into the online state.
  63. * Returns:
  64. * %0 on success and a negative error value on failure.
  65. */
  66. int ccwgroup_set_online(struct ccwgroup_device *gdev)
  67. {
  68. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
  69. int ret = -EINVAL;
  70. if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
  71. return -EAGAIN;
  72. if (gdev->state == CCWGROUP_ONLINE)
  73. goto out;
  74. if (gdrv->set_online)
  75. ret = gdrv->set_online(gdev);
  76. if (ret)
  77. goto out;
  78. gdev->state = CCWGROUP_ONLINE;
  79. out:
  80. atomic_set(&gdev->onoff, 0);
  81. return ret;
  82. }
  83. EXPORT_SYMBOL(ccwgroup_set_online);
  84. /**
  85. * ccwgroup_set_offline() - disable a ccwgroup device
  86. * @gdev: target ccwgroup device
  87. *
  88. * This function attempts to put the ccwgroup device into the offline state.
  89. * Returns:
  90. * %0 on success and a negative error value on failure.
  91. */
  92. int ccwgroup_set_offline(struct ccwgroup_device *gdev)
  93. {
  94. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
  95. int ret = -EINVAL;
  96. if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
  97. return -EAGAIN;
  98. if (gdev->state == CCWGROUP_OFFLINE)
  99. goto out;
  100. if (gdrv->set_offline)
  101. ret = gdrv->set_offline(gdev);
  102. if (ret)
  103. goto out;
  104. gdev->state = CCWGROUP_OFFLINE;
  105. out:
  106. atomic_set(&gdev->onoff, 0);
  107. return ret;
  108. }
  109. EXPORT_SYMBOL(ccwgroup_set_offline);
  110. static ssize_t ccwgroup_online_store(struct device *dev,
  111. struct device_attribute *attr,
  112. const char *buf, size_t count)
  113. {
  114. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  115. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
  116. unsigned long value;
  117. int ret;
  118. if (!dev->driver)
  119. return -EINVAL;
  120. if (!try_module_get(gdrv->driver.owner))
  121. return -EINVAL;
  122. ret = strict_strtoul(buf, 0, &value);
  123. if (ret)
  124. goto out;
  125. if (value == 1)
  126. ret = ccwgroup_set_online(gdev);
  127. else if (value == 0)
  128. ret = ccwgroup_set_offline(gdev);
  129. else
  130. ret = -EINVAL;
  131. out:
  132. module_put(gdrv->driver.owner);
  133. return (ret == 0) ? count : ret;
  134. }
  135. static ssize_t ccwgroup_online_show(struct device *dev,
  136. struct device_attribute *attr,
  137. char *buf)
  138. {
  139. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  140. int online;
  141. online = (gdev->state == CCWGROUP_ONLINE) ? 1 : 0;
  142. return scnprintf(buf, PAGE_SIZE, "%d\n", online);
  143. }
  144. /*
  145. * Provide an 'ungroup' attribute so the user can remove group devices no
  146. * longer needed or accidentially created. Saves memory :)
  147. */
  148. static void ccwgroup_ungroup_callback(struct device *dev)
  149. {
  150. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  151. mutex_lock(&gdev->reg_mutex);
  152. if (device_is_registered(&gdev->dev)) {
  153. __ccwgroup_remove_symlinks(gdev);
  154. device_unregister(dev);
  155. __ccwgroup_remove_cdev_refs(gdev);
  156. }
  157. mutex_unlock(&gdev->reg_mutex);
  158. }
  159. static ssize_t ccwgroup_ungroup_store(struct device *dev,
  160. struct device_attribute *attr,
  161. const char *buf, size_t count)
  162. {
  163. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  164. int rc;
  165. /* Prevent concurrent online/offline processing and ungrouping. */
  166. if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
  167. return -EAGAIN;
  168. if (gdev->state != CCWGROUP_OFFLINE) {
  169. rc = -EINVAL;
  170. goto out;
  171. }
  172. /* Note that we cannot unregister the device from one of its
  173. * attribute methods, so we have to use this roundabout approach.
  174. */
  175. rc = device_schedule_callback(dev, ccwgroup_ungroup_callback);
  176. out:
  177. if (rc) {
  178. if (rc != -EAGAIN)
  179. /* Release onoff "lock" when ungrouping failed. */
  180. atomic_set(&gdev->onoff, 0);
  181. return rc;
  182. }
  183. return count;
  184. }
  185. static DEVICE_ATTR(ungroup, 0200, NULL, ccwgroup_ungroup_store);
  186. static DEVICE_ATTR(online, 0644, ccwgroup_online_show, ccwgroup_online_store);
  187. static struct attribute *ccwgroup_attrs[] = {
  188. &dev_attr_online.attr,
  189. &dev_attr_ungroup.attr,
  190. NULL,
  191. };
  192. static struct attribute_group ccwgroup_attr_group = {
  193. .attrs = ccwgroup_attrs,
  194. };
  195. static const struct attribute_group *ccwgroup_attr_groups[] = {
  196. &ccwgroup_attr_group,
  197. NULL,
  198. };
  199. static void ccwgroup_release(struct device *dev)
  200. {
  201. kfree(to_ccwgroupdev(dev));
  202. }
  203. static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev)
  204. {
  205. char str[8];
  206. int i, rc;
  207. for (i = 0; i < gdev->count; i++) {
  208. rc = sysfs_create_link(&gdev->cdev[i]->dev.kobj,
  209. &gdev->dev.kobj, "group_device");
  210. if (rc) {
  211. for (--i; i >= 0; i--)
  212. sysfs_remove_link(&gdev->cdev[i]->dev.kobj,
  213. "group_device");
  214. return rc;
  215. }
  216. }
  217. for (i = 0; i < gdev->count; i++) {
  218. sprintf(str, "cdev%d", i);
  219. rc = sysfs_create_link(&gdev->dev.kobj,
  220. &gdev->cdev[i]->dev.kobj, str);
  221. if (rc) {
  222. for (--i; i >= 0; i--) {
  223. sprintf(str, "cdev%d", i);
  224. sysfs_remove_link(&gdev->dev.kobj, str);
  225. }
  226. for (i = 0; i < gdev->count; i++)
  227. sysfs_remove_link(&gdev->cdev[i]->dev.kobj,
  228. "group_device");
  229. return rc;
  230. }
  231. }
  232. return 0;
  233. }
  234. static int __get_next_id(const char **buf, struct ccw_dev_id *id)
  235. {
  236. unsigned int cssid, ssid, devno;
  237. int ret = 0, len;
  238. char *start, *end;
  239. start = (char *)*buf;
  240. end = strchr(start, ',');
  241. if (!end) {
  242. /* Last entry. Strip trailing newline, if applicable. */
  243. end = strchr(start, '\n');
  244. if (end)
  245. *end = '\0';
  246. len = strlen(start) + 1;
  247. } else {
  248. len = end - start + 1;
  249. end++;
  250. }
  251. if (len <= CCW_BUS_ID_SIZE) {
  252. if (sscanf(start, "%2x.%1x.%04x", &cssid, &ssid, &devno) != 3)
  253. ret = -EINVAL;
  254. } else
  255. ret = -EINVAL;
  256. if (!ret) {
  257. id->ssid = ssid;
  258. id->devno = devno;
  259. }
  260. *buf = end;
  261. return ret;
  262. }
  263. /**
  264. * ccwgroup_create_dev() - create and register a ccw group device
  265. * @parent: parent device for the new device
  266. * @gdrv: driver for the new group device
  267. * @num_devices: number of slave devices
  268. * @buf: buffer containing comma separated bus ids of slave devices
  269. *
  270. * Create and register a new ccw group device as a child of @parent. Slave
  271. * devices are obtained from the list of bus ids given in @buf.
  272. * Returns:
  273. * %0 on success and an error code on failure.
  274. * Context:
  275. * non-atomic
  276. */
  277. int ccwgroup_create_dev(struct device *parent, struct ccwgroup_driver *gdrv,
  278. int num_devices, const char *buf)
  279. {
  280. struct ccwgroup_device *gdev;
  281. struct ccw_dev_id dev_id;
  282. int rc, i;
  283. gdev = kzalloc(sizeof(*gdev) + num_devices * sizeof(gdev->cdev[0]),
  284. GFP_KERNEL);
  285. if (!gdev)
  286. return -ENOMEM;
  287. atomic_set(&gdev->onoff, 0);
  288. mutex_init(&gdev->reg_mutex);
  289. mutex_lock(&gdev->reg_mutex);
  290. gdev->count = num_devices;
  291. gdev->dev.bus = &ccwgroup_bus_type;
  292. gdev->dev.parent = parent;
  293. gdev->dev.release = ccwgroup_release;
  294. device_initialize(&gdev->dev);
  295. for (i = 0; i < num_devices && buf; i++) {
  296. rc = __get_next_id(&buf, &dev_id);
  297. if (rc != 0)
  298. goto error;
  299. gdev->cdev[i] = get_ccwdev_by_dev_id(&dev_id);
  300. /*
  301. * All devices have to be of the same type in
  302. * order to be grouped.
  303. */
  304. if (!gdev->cdev[i] || !gdev->cdev[i]->drv ||
  305. gdev->cdev[i]->drv != gdev->cdev[0]->drv ||
  306. gdev->cdev[i]->id.driver_info !=
  307. gdev->cdev[0]->id.driver_info) {
  308. rc = -EINVAL;
  309. goto error;
  310. }
  311. /* Don't allow a device to belong to more than one group. */
  312. spin_lock_irq(gdev->cdev[i]->ccwlock);
  313. if (dev_get_drvdata(&gdev->cdev[i]->dev)) {
  314. spin_unlock_irq(gdev->cdev[i]->ccwlock);
  315. rc = -EINVAL;
  316. goto error;
  317. }
  318. dev_set_drvdata(&gdev->cdev[i]->dev, gdev);
  319. spin_unlock_irq(gdev->cdev[i]->ccwlock);
  320. }
  321. /* Check for sufficient number of bus ids. */
  322. if (i < num_devices) {
  323. rc = -EINVAL;
  324. goto error;
  325. }
  326. /* Check for trailing stuff. */
  327. if (i == num_devices && strlen(buf) > 0) {
  328. rc = -EINVAL;
  329. goto error;
  330. }
  331. dev_set_name(&gdev->dev, "%s", dev_name(&gdev->cdev[0]->dev));
  332. gdev->dev.groups = ccwgroup_attr_groups;
  333. if (gdrv) {
  334. gdev->dev.driver = &gdrv->driver;
  335. rc = gdrv->setup ? gdrv->setup(gdev) : 0;
  336. if (rc)
  337. goto error;
  338. }
  339. rc = device_add(&gdev->dev);
  340. if (rc)
  341. goto error;
  342. rc = __ccwgroup_create_symlinks(gdev);
  343. if (rc) {
  344. device_del(&gdev->dev);
  345. goto error;
  346. }
  347. mutex_unlock(&gdev->reg_mutex);
  348. return 0;
  349. error:
  350. for (i = 0; i < num_devices; i++)
  351. if (gdev->cdev[i]) {
  352. spin_lock_irq(gdev->cdev[i]->ccwlock);
  353. if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
  354. dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
  355. spin_unlock_irq(gdev->cdev[i]->ccwlock);
  356. put_device(&gdev->cdev[i]->dev);
  357. gdev->cdev[i] = NULL;
  358. }
  359. mutex_unlock(&gdev->reg_mutex);
  360. put_device(&gdev->dev);
  361. return rc;
  362. }
  363. EXPORT_SYMBOL(ccwgroup_create_dev);
  364. static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action,
  365. void *data)
  366. {
  367. struct device *dev = data;
  368. if (action == BUS_NOTIFY_UNBIND_DRIVER)
  369. device_schedule_callback(dev, ccwgroup_ungroup_callback);
  370. return NOTIFY_OK;
  371. }
  372. static struct notifier_block ccwgroup_nb = {
  373. .notifier_call = ccwgroup_notifier
  374. };
  375. static int __init init_ccwgroup(void)
  376. {
  377. int ret;
  378. ret = bus_register(&ccwgroup_bus_type);
  379. if (ret)
  380. return ret;
  381. ret = bus_register_notifier(&ccwgroup_bus_type, &ccwgroup_nb);
  382. if (ret)
  383. bus_unregister(&ccwgroup_bus_type);
  384. return ret;
  385. }
  386. static void __exit cleanup_ccwgroup(void)
  387. {
  388. bus_unregister_notifier(&ccwgroup_bus_type, &ccwgroup_nb);
  389. bus_unregister(&ccwgroup_bus_type);
  390. }
  391. module_init(init_ccwgroup);
  392. module_exit(cleanup_ccwgroup);
  393. /************************** driver stuff ******************************/
  394. static int ccwgroup_remove(struct device *dev)
  395. {
  396. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  397. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
  398. if (!dev->driver)
  399. return 0;
  400. if (gdrv->remove)
  401. gdrv->remove(gdev);
  402. return 0;
  403. }
  404. static void ccwgroup_shutdown(struct device *dev)
  405. {
  406. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  407. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
  408. if (!dev->driver)
  409. return;
  410. if (gdrv->shutdown)
  411. gdrv->shutdown(gdev);
  412. }
  413. static int ccwgroup_pm_prepare(struct device *dev)
  414. {
  415. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  416. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
  417. /* Fail while device is being set online/offline. */
  418. if (atomic_read(&gdev->onoff))
  419. return -EAGAIN;
  420. if (!gdev->dev.driver || gdev->state != CCWGROUP_ONLINE)
  421. return 0;
  422. return gdrv->prepare ? gdrv->prepare(gdev) : 0;
  423. }
  424. static void ccwgroup_pm_complete(struct device *dev)
  425. {
  426. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  427. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
  428. if (!gdev->dev.driver || gdev->state != CCWGROUP_ONLINE)
  429. return;
  430. if (gdrv->complete)
  431. gdrv->complete(gdev);
  432. }
  433. static int ccwgroup_pm_freeze(struct device *dev)
  434. {
  435. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  436. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
  437. if (!gdev->dev.driver || gdev->state != CCWGROUP_ONLINE)
  438. return 0;
  439. return gdrv->freeze ? gdrv->freeze(gdev) : 0;
  440. }
  441. static int ccwgroup_pm_thaw(struct device *dev)
  442. {
  443. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  444. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
  445. if (!gdev->dev.driver || gdev->state != CCWGROUP_ONLINE)
  446. return 0;
  447. return gdrv->thaw ? gdrv->thaw(gdev) : 0;
  448. }
  449. static int ccwgroup_pm_restore(struct device *dev)
  450. {
  451. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  452. struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
  453. if (!gdev->dev.driver || gdev->state != CCWGROUP_ONLINE)
  454. return 0;
  455. return gdrv->restore ? gdrv->restore(gdev) : 0;
  456. }
  457. static const struct dev_pm_ops ccwgroup_pm_ops = {
  458. .prepare = ccwgroup_pm_prepare,
  459. .complete = ccwgroup_pm_complete,
  460. .freeze = ccwgroup_pm_freeze,
  461. .thaw = ccwgroup_pm_thaw,
  462. .restore = ccwgroup_pm_restore,
  463. };
  464. static struct bus_type ccwgroup_bus_type = {
  465. .name = "ccwgroup",
  466. .remove = ccwgroup_remove,
  467. .shutdown = ccwgroup_shutdown,
  468. .pm = &ccwgroup_pm_ops,
  469. };
  470. /**
  471. * ccwgroup_driver_register() - register a ccw group driver
  472. * @cdriver: driver to be registered
  473. *
  474. * This function is mainly a wrapper around driver_register().
  475. */
  476. int ccwgroup_driver_register(struct ccwgroup_driver *cdriver)
  477. {
  478. /* register our new driver with the core */
  479. cdriver->driver.bus = &ccwgroup_bus_type;
  480. return driver_register(&cdriver->driver);
  481. }
  482. EXPORT_SYMBOL(ccwgroup_driver_register);
  483. static int __ccwgroup_match_all(struct device *dev, void *data)
  484. {
  485. return 1;
  486. }
  487. /**
  488. * ccwgroup_driver_unregister() - deregister a ccw group driver
  489. * @cdriver: driver to be deregistered
  490. *
  491. * This function is mainly a wrapper around driver_unregister().
  492. */
  493. void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver)
  494. {
  495. struct device *dev;
  496. /* We don't want ccwgroup devices to live longer than their driver. */
  497. while ((dev = driver_find_device(&cdriver->driver, NULL, NULL,
  498. __ccwgroup_match_all))) {
  499. struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
  500. mutex_lock(&gdev->reg_mutex);
  501. __ccwgroup_remove_symlinks(gdev);
  502. device_unregister(dev);
  503. __ccwgroup_remove_cdev_refs(gdev);
  504. mutex_unlock(&gdev->reg_mutex);
  505. put_device(dev);
  506. }
  507. driver_unregister(&cdriver->driver);
  508. }
  509. EXPORT_SYMBOL(ccwgroup_driver_unregister);
  510. /**
  511. * ccwgroup_probe_ccwdev() - probe function for slave devices
  512. * @cdev: ccw device to be probed
  513. *
  514. * This is a dummy probe function for ccw devices that are slave devices in
  515. * a ccw group device.
  516. * Returns:
  517. * always %0
  518. */
  519. int ccwgroup_probe_ccwdev(struct ccw_device *cdev)
  520. {
  521. return 0;
  522. }
  523. EXPORT_SYMBOL(ccwgroup_probe_ccwdev);
  524. /**
  525. * ccwgroup_remove_ccwdev() - remove function for slave devices
  526. * @cdev: ccw device to be removed
  527. *
  528. * This is a remove function for ccw devices that are slave devices in a ccw
  529. * group device. It sets the ccw device offline and also deregisters the
  530. * embedding ccw group device.
  531. */
  532. void ccwgroup_remove_ccwdev(struct ccw_device *cdev)
  533. {
  534. struct ccwgroup_device *gdev;
  535. /* Ignore offlining errors, device is gone anyway. */
  536. ccw_device_set_offline(cdev);
  537. /* If one of its devices is gone, the whole group is done for. */
  538. spin_lock_irq(cdev->ccwlock);
  539. gdev = dev_get_drvdata(&cdev->dev);
  540. if (!gdev) {
  541. spin_unlock_irq(cdev->ccwlock);
  542. return;
  543. }
  544. /* Get ccwgroup device reference for local processing. */
  545. get_device(&gdev->dev);
  546. spin_unlock_irq(cdev->ccwlock);
  547. /* Unregister group device. */
  548. mutex_lock(&gdev->reg_mutex);
  549. if (device_is_registered(&gdev->dev)) {
  550. __ccwgroup_remove_symlinks(gdev);
  551. device_unregister(&gdev->dev);
  552. __ccwgroup_remove_cdev_refs(gdev);
  553. }
  554. mutex_unlock(&gdev->reg_mutex);
  555. /* Release ccwgroup device reference for local processing. */
  556. put_device(&gdev->dev);
  557. }
  558. EXPORT_SYMBOL(ccwgroup_remove_ccwdev);
  559. MODULE_LICENSE("GPL");