ibmebus.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. /*
  2. * IBM PowerPC IBM eBus Infrastructure Support.
  3. *
  4. * Copyright (c) 2005 IBM Corporation
  5. * Joachim Fenkes <fenkes@de.ibm.com>
  6. * Heiko J Schick <schickhj@de.ibm.com>
  7. *
  8. * All rights reserved.
  9. *
  10. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  11. * BSD.
  12. *
  13. * OpenIB BSD License
  14. *
  15. * Redistribution and use in source and binary forms, with or without
  16. * modification, are permitted provided that the following conditions are met:
  17. *
  18. * Redistributions of source code must retain the above copyright notice, this
  19. * list of conditions and the following disclaimer.
  20. *
  21. * Redistributions in binary form must reproduce the above copyright notice,
  22. * this list of conditions and the following disclaimer in the documentation
  23. * and/or other materials
  24. * provided with the distribution.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  33. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  34. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. */
  38. #include <linux/init.h>
  39. #include <linux/export.h>
  40. #include <linux/console.h>
  41. #include <linux/kobject.h>
  42. #include <linux/dma-mapping.h>
  43. #include <linux/interrupt.h>
  44. #include <linux/of.h>
  45. #include <linux/slab.h>
  46. #include <linux/stat.h>
  47. #include <linux/of_platform.h>
  48. #include <asm/ibmebus.h>
  49. #include <asm/abs_addr.h>
  50. static struct device ibmebus_bus_device = { /* fake "parent" device */
  51. .init_name = "ibmebus",
  52. };
  53. struct bus_type ibmebus_bus_type;
  54. /* These devices will automatically be added to the bus during init */
  55. static struct of_device_id __initdata ibmebus_matches[] = {
  56. { .compatible = "IBM,lhca" },
  57. { .compatible = "IBM,lhea" },
  58. {},
  59. };
  60. static void *ibmebus_alloc_coherent(struct device *dev,
  61. size_t size,
  62. dma_addr_t *dma_handle,
  63. gfp_t flag)
  64. {
  65. void *mem;
  66. mem = kmalloc(size, flag);
  67. *dma_handle = (dma_addr_t)mem;
  68. return mem;
  69. }
  70. static void ibmebus_free_coherent(struct device *dev,
  71. size_t size, void *vaddr,
  72. dma_addr_t dma_handle)
  73. {
  74. kfree(vaddr);
  75. }
  76. static dma_addr_t ibmebus_map_page(struct device *dev,
  77. struct page *page,
  78. unsigned long offset,
  79. size_t size,
  80. enum dma_data_direction direction,
  81. struct dma_attrs *attrs)
  82. {
  83. return (dma_addr_t)(page_address(page) + offset);
  84. }
  85. static void ibmebus_unmap_page(struct device *dev,
  86. dma_addr_t dma_addr,
  87. size_t size,
  88. enum dma_data_direction direction,
  89. struct dma_attrs *attrs)
  90. {
  91. return;
  92. }
  93. static int ibmebus_map_sg(struct device *dev,
  94. struct scatterlist *sgl,
  95. int nents, enum dma_data_direction direction,
  96. struct dma_attrs *attrs)
  97. {
  98. struct scatterlist *sg;
  99. int i;
  100. for_each_sg(sgl, sg, nents, i) {
  101. sg->dma_address = (dma_addr_t) sg_virt(sg);
  102. sg->dma_length = sg->length;
  103. }
  104. return nents;
  105. }
  106. static void ibmebus_unmap_sg(struct device *dev,
  107. struct scatterlist *sg,
  108. int nents, enum dma_data_direction direction,
  109. struct dma_attrs *attrs)
  110. {
  111. return;
  112. }
  113. static int ibmebus_dma_supported(struct device *dev, u64 mask)
  114. {
  115. return 1;
  116. }
  117. static struct dma_map_ops ibmebus_dma_ops = {
  118. .alloc_coherent = ibmebus_alloc_coherent,
  119. .free_coherent = ibmebus_free_coherent,
  120. .map_sg = ibmebus_map_sg,
  121. .unmap_sg = ibmebus_unmap_sg,
  122. .dma_supported = ibmebus_dma_supported,
  123. .map_page = ibmebus_map_page,
  124. .unmap_page = ibmebus_unmap_page,
  125. };
  126. static int ibmebus_match_path(struct device *dev, void *data)
  127. {
  128. struct device_node *dn = to_platform_device(dev)->dev.of_node;
  129. return (dn->full_name &&
  130. (strcasecmp((char *)data, dn->full_name) == 0));
  131. }
  132. static int ibmebus_match_node(struct device *dev, void *data)
  133. {
  134. return to_platform_device(dev)->dev.of_node == data;
  135. }
  136. static int ibmebus_create_device(struct device_node *dn)
  137. {
  138. struct platform_device *dev;
  139. int ret;
  140. dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
  141. if (!dev)
  142. return -ENOMEM;
  143. dev->dev.bus = &ibmebus_bus_type;
  144. dev->dev.archdata.dma_ops = &ibmebus_dma_ops;
  145. ret = of_device_add(dev);
  146. if (ret)
  147. platform_device_put(dev);
  148. return ret;
  149. }
  150. static int ibmebus_create_devices(const struct of_device_id *matches)
  151. {
  152. struct device_node *root, *child;
  153. int ret = 0;
  154. root = of_find_node_by_path("/");
  155. for_each_child_of_node(root, child) {
  156. if (!of_match_node(matches, child))
  157. continue;
  158. if (bus_find_device(&ibmebus_bus_type, NULL, child,
  159. ibmebus_match_node))
  160. continue;
  161. ret = ibmebus_create_device(child);
  162. if (ret) {
  163. printk(KERN_ERR "%s: failed to create device (%i)",
  164. __func__, ret);
  165. of_node_put(child);
  166. break;
  167. }
  168. }
  169. of_node_put(root);
  170. return ret;
  171. }
  172. int ibmebus_register_driver(struct of_platform_driver *drv)
  173. {
  174. /* If the driver uses devices that ibmebus doesn't know, add them */
  175. ibmebus_create_devices(drv->driver.of_match_table);
  176. drv->driver.bus = &ibmebus_bus_type;
  177. return driver_register(&drv->driver);
  178. }
  179. EXPORT_SYMBOL(ibmebus_register_driver);
  180. void ibmebus_unregister_driver(struct of_platform_driver *drv)
  181. {
  182. driver_unregister(&drv->driver);
  183. }
  184. EXPORT_SYMBOL(ibmebus_unregister_driver);
  185. int ibmebus_request_irq(u32 ist, irq_handler_t handler,
  186. unsigned long irq_flags, const char *devname,
  187. void *dev_id)
  188. {
  189. unsigned int irq = irq_create_mapping(NULL, ist);
  190. if (irq == NO_IRQ)
  191. return -EINVAL;
  192. return request_irq(irq, handler, irq_flags, devname, dev_id);
  193. }
  194. EXPORT_SYMBOL(ibmebus_request_irq);
  195. void ibmebus_free_irq(u32 ist, void *dev_id)
  196. {
  197. unsigned int irq = irq_find_mapping(NULL, ist);
  198. free_irq(irq, dev_id);
  199. irq_dispose_mapping(irq);
  200. }
  201. EXPORT_SYMBOL(ibmebus_free_irq);
  202. static char *ibmebus_chomp(const char *in, size_t count)
  203. {
  204. char *out = kmalloc(count + 1, GFP_KERNEL);
  205. if (!out)
  206. return NULL;
  207. memcpy(out, in, count);
  208. out[count] = '\0';
  209. if (out[count - 1] == '\n')
  210. out[count - 1] = '\0';
  211. return out;
  212. }
  213. static ssize_t ibmebus_store_probe(struct bus_type *bus,
  214. const char *buf, size_t count)
  215. {
  216. struct device_node *dn = NULL;
  217. char *path;
  218. ssize_t rc = 0;
  219. path = ibmebus_chomp(buf, count);
  220. if (!path)
  221. return -ENOMEM;
  222. if (bus_find_device(&ibmebus_bus_type, NULL, path,
  223. ibmebus_match_path)) {
  224. printk(KERN_WARNING "%s: %s has already been probed\n",
  225. __func__, path);
  226. rc = -EEXIST;
  227. goto out;
  228. }
  229. if ((dn = of_find_node_by_path(path))) {
  230. rc = ibmebus_create_device(dn);
  231. of_node_put(dn);
  232. } else {
  233. printk(KERN_WARNING "%s: no such device node: %s\n",
  234. __func__, path);
  235. rc = -ENODEV;
  236. }
  237. out:
  238. kfree(path);
  239. if (rc)
  240. return rc;
  241. return count;
  242. }
  243. static ssize_t ibmebus_store_remove(struct bus_type *bus,
  244. const char *buf, size_t count)
  245. {
  246. struct device *dev;
  247. char *path;
  248. path = ibmebus_chomp(buf, count);
  249. if (!path)
  250. return -ENOMEM;
  251. if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
  252. ibmebus_match_path))) {
  253. of_device_unregister(to_platform_device(dev));
  254. kfree(path);
  255. return count;
  256. } else {
  257. printk(KERN_WARNING "%s: %s not on the bus\n",
  258. __func__, path);
  259. kfree(path);
  260. return -ENODEV;
  261. }
  262. }
  263. static struct bus_attribute ibmebus_bus_attrs[] = {
  264. __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
  265. __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
  266. __ATTR_NULL
  267. };
  268. static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
  269. {
  270. const struct of_device_id *matches = drv->of_match_table;
  271. if (!matches)
  272. return 0;
  273. return of_match_device(matches, dev) != NULL;
  274. }
  275. static int ibmebus_bus_device_probe(struct device *dev)
  276. {
  277. int error = -ENODEV;
  278. struct of_platform_driver *drv;
  279. struct platform_device *of_dev;
  280. const struct of_device_id *match;
  281. drv = to_of_platform_driver(dev->driver);
  282. of_dev = to_platform_device(dev);
  283. if (!drv->probe)
  284. return error;
  285. of_dev_get(of_dev);
  286. match = of_match_device(drv->driver.of_match_table, dev);
  287. if (match)
  288. error = drv->probe(of_dev, match);
  289. if (error)
  290. of_dev_put(of_dev);
  291. return error;
  292. }
  293. static int ibmebus_bus_device_remove(struct device *dev)
  294. {
  295. struct platform_device *of_dev = to_platform_device(dev);
  296. struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
  297. if (dev->driver && drv->remove)
  298. drv->remove(of_dev);
  299. return 0;
  300. }
  301. static void ibmebus_bus_device_shutdown(struct device *dev)
  302. {
  303. struct platform_device *of_dev = to_platform_device(dev);
  304. struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
  305. if (dev->driver && drv->shutdown)
  306. drv->shutdown(of_dev);
  307. }
  308. /*
  309. * ibmebus_bus_device_attrs
  310. */
  311. static ssize_t devspec_show(struct device *dev,
  312. struct device_attribute *attr, char *buf)
  313. {
  314. struct platform_device *ofdev;
  315. ofdev = to_platform_device(dev);
  316. return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
  317. }
  318. static ssize_t name_show(struct device *dev,
  319. struct device_attribute *attr, char *buf)
  320. {
  321. struct platform_device *ofdev;
  322. ofdev = to_platform_device(dev);
  323. return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
  324. }
  325. static ssize_t modalias_show(struct device *dev,
  326. struct device_attribute *attr, char *buf)
  327. {
  328. ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2);
  329. buf[len] = '\n';
  330. buf[len+1] = 0;
  331. return len+1;
  332. }
  333. struct device_attribute ibmebus_bus_device_attrs[] = {
  334. __ATTR_RO(devspec),
  335. __ATTR_RO(name),
  336. __ATTR_RO(modalias),
  337. __ATTR_NULL
  338. };
  339. #ifdef CONFIG_PM_SLEEP
  340. static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
  341. {
  342. struct platform_device *of_dev = to_platform_device(dev);
  343. struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
  344. int ret = 0;
  345. if (dev->driver && drv->suspend)
  346. ret = drv->suspend(of_dev, mesg);
  347. return ret;
  348. }
  349. static int ibmebus_bus_legacy_resume(struct device *dev)
  350. {
  351. struct platform_device *of_dev = to_platform_device(dev);
  352. struct of_platform_driver *drv = to_of_platform_driver(dev->driver);
  353. int ret = 0;
  354. if (dev->driver && drv->resume)
  355. ret = drv->resume(of_dev);
  356. return ret;
  357. }
  358. static int ibmebus_bus_pm_prepare(struct device *dev)
  359. {
  360. struct device_driver *drv = dev->driver;
  361. int ret = 0;
  362. if (drv && drv->pm && drv->pm->prepare)
  363. ret = drv->pm->prepare(dev);
  364. return ret;
  365. }
  366. static void ibmebus_bus_pm_complete(struct device *dev)
  367. {
  368. struct device_driver *drv = dev->driver;
  369. if (drv && drv->pm && drv->pm->complete)
  370. drv->pm->complete(dev);
  371. }
  372. #ifdef CONFIG_SUSPEND
  373. static int ibmebus_bus_pm_suspend(struct device *dev)
  374. {
  375. struct device_driver *drv = dev->driver;
  376. int ret = 0;
  377. if (!drv)
  378. return 0;
  379. if (drv->pm) {
  380. if (drv->pm->suspend)
  381. ret = drv->pm->suspend(dev);
  382. } else {
  383. ret = ibmebus_bus_legacy_suspend(dev, PMSG_SUSPEND);
  384. }
  385. return ret;
  386. }
  387. static int ibmebus_bus_pm_suspend_noirq(struct device *dev)
  388. {
  389. struct device_driver *drv = dev->driver;
  390. int ret = 0;
  391. if (!drv)
  392. return 0;
  393. if (drv->pm) {
  394. if (drv->pm->suspend_noirq)
  395. ret = drv->pm->suspend_noirq(dev);
  396. }
  397. return ret;
  398. }
  399. static int ibmebus_bus_pm_resume(struct device *dev)
  400. {
  401. struct device_driver *drv = dev->driver;
  402. int ret = 0;
  403. if (!drv)
  404. return 0;
  405. if (drv->pm) {
  406. if (drv->pm->resume)
  407. ret = drv->pm->resume(dev);
  408. } else {
  409. ret = ibmebus_bus_legacy_resume(dev);
  410. }
  411. return ret;
  412. }
  413. static int ibmebus_bus_pm_resume_noirq(struct device *dev)
  414. {
  415. struct device_driver *drv = dev->driver;
  416. int ret = 0;
  417. if (!drv)
  418. return 0;
  419. if (drv->pm) {
  420. if (drv->pm->resume_noirq)
  421. ret = drv->pm->resume_noirq(dev);
  422. }
  423. return ret;
  424. }
  425. #else /* !CONFIG_SUSPEND */
  426. #define ibmebus_bus_pm_suspend NULL
  427. #define ibmebus_bus_pm_resume NULL
  428. #define ibmebus_bus_pm_suspend_noirq NULL
  429. #define ibmebus_bus_pm_resume_noirq NULL
  430. #endif /* !CONFIG_SUSPEND */
  431. #ifdef CONFIG_HIBERNATE_CALLBACKS
  432. static int ibmebus_bus_pm_freeze(struct device *dev)
  433. {
  434. struct device_driver *drv = dev->driver;
  435. int ret = 0;
  436. if (!drv)
  437. return 0;
  438. if (drv->pm) {
  439. if (drv->pm->freeze)
  440. ret = drv->pm->freeze(dev);
  441. } else {
  442. ret = ibmebus_bus_legacy_suspend(dev, PMSG_FREEZE);
  443. }
  444. return ret;
  445. }
  446. static int ibmebus_bus_pm_freeze_noirq(struct device *dev)
  447. {
  448. struct device_driver *drv = dev->driver;
  449. int ret = 0;
  450. if (!drv)
  451. return 0;
  452. if (drv->pm) {
  453. if (drv->pm->freeze_noirq)
  454. ret = drv->pm->freeze_noirq(dev);
  455. }
  456. return ret;
  457. }
  458. static int ibmebus_bus_pm_thaw(struct device *dev)
  459. {
  460. struct device_driver *drv = dev->driver;
  461. int ret = 0;
  462. if (!drv)
  463. return 0;
  464. if (drv->pm) {
  465. if (drv->pm->thaw)
  466. ret = drv->pm->thaw(dev);
  467. } else {
  468. ret = ibmebus_bus_legacy_resume(dev);
  469. }
  470. return ret;
  471. }
  472. static int ibmebus_bus_pm_thaw_noirq(struct device *dev)
  473. {
  474. struct device_driver *drv = dev->driver;
  475. int ret = 0;
  476. if (!drv)
  477. return 0;
  478. if (drv->pm) {
  479. if (drv->pm->thaw_noirq)
  480. ret = drv->pm->thaw_noirq(dev);
  481. }
  482. return ret;
  483. }
  484. static int ibmebus_bus_pm_poweroff(struct device *dev)
  485. {
  486. struct device_driver *drv = dev->driver;
  487. int ret = 0;
  488. if (!drv)
  489. return 0;
  490. if (drv->pm) {
  491. if (drv->pm->poweroff)
  492. ret = drv->pm->poweroff(dev);
  493. } else {
  494. ret = ibmebus_bus_legacy_suspend(dev, PMSG_HIBERNATE);
  495. }
  496. return ret;
  497. }
  498. static int ibmebus_bus_pm_poweroff_noirq(struct device *dev)
  499. {
  500. struct device_driver *drv = dev->driver;
  501. int ret = 0;
  502. if (!drv)
  503. return 0;
  504. if (drv->pm) {
  505. if (drv->pm->poweroff_noirq)
  506. ret = drv->pm->poweroff_noirq(dev);
  507. }
  508. return ret;
  509. }
  510. static int ibmebus_bus_pm_restore(struct device *dev)
  511. {
  512. struct device_driver *drv = dev->driver;
  513. int ret = 0;
  514. if (!drv)
  515. return 0;
  516. if (drv->pm) {
  517. if (drv->pm->restore)
  518. ret = drv->pm->restore(dev);
  519. } else {
  520. ret = ibmebus_bus_legacy_resume(dev);
  521. }
  522. return ret;
  523. }
  524. static int ibmebus_bus_pm_restore_noirq(struct device *dev)
  525. {
  526. struct device_driver *drv = dev->driver;
  527. int ret = 0;
  528. if (!drv)
  529. return 0;
  530. if (drv->pm) {
  531. if (drv->pm->restore_noirq)
  532. ret = drv->pm->restore_noirq(dev);
  533. }
  534. return ret;
  535. }
  536. #else /* !CONFIG_HIBERNATE_CALLBACKS */
  537. #define ibmebus_bus_pm_freeze NULL
  538. #define ibmebus_bus_pm_thaw NULL
  539. #define ibmebus_bus_pm_poweroff NULL
  540. #define ibmebus_bus_pm_restore NULL
  541. #define ibmebus_bus_pm_freeze_noirq NULL
  542. #define ibmebus_bus_pm_thaw_noirq NULL
  543. #define ibmebus_bus_pm_poweroff_noirq NULL
  544. #define ibmebus_bus_pm_restore_noirq NULL
  545. #endif /* !CONFIG_HIBERNATE_CALLBACKS */
  546. static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
  547. .prepare = ibmebus_bus_pm_prepare,
  548. .complete = ibmebus_bus_pm_complete,
  549. .suspend = ibmebus_bus_pm_suspend,
  550. .resume = ibmebus_bus_pm_resume,
  551. .freeze = ibmebus_bus_pm_freeze,
  552. .thaw = ibmebus_bus_pm_thaw,
  553. .poweroff = ibmebus_bus_pm_poweroff,
  554. .restore = ibmebus_bus_pm_restore,
  555. .suspend_noirq = ibmebus_bus_pm_suspend_noirq,
  556. .resume_noirq = ibmebus_bus_pm_resume_noirq,
  557. .freeze_noirq = ibmebus_bus_pm_freeze_noirq,
  558. .thaw_noirq = ibmebus_bus_pm_thaw_noirq,
  559. .poweroff_noirq = ibmebus_bus_pm_poweroff_noirq,
  560. .restore_noirq = ibmebus_bus_pm_restore_noirq,
  561. };
  562. #define IBMEBUS_BUS_PM_OPS_PTR (&ibmebus_bus_dev_pm_ops)
  563. #else /* !CONFIG_PM_SLEEP */
  564. #define IBMEBUS_BUS_PM_OPS_PTR NULL
  565. #endif /* !CONFIG_PM_SLEEP */
  566. struct bus_type ibmebus_bus_type = {
  567. .name = "ibmebus",
  568. .uevent = of_device_uevent,
  569. .bus_attrs = ibmebus_bus_attrs,
  570. .match = ibmebus_bus_bus_match,
  571. .probe = ibmebus_bus_device_probe,
  572. .remove = ibmebus_bus_device_remove,
  573. .shutdown = ibmebus_bus_device_shutdown,
  574. .dev_attrs = ibmebus_bus_device_attrs,
  575. .pm = IBMEBUS_BUS_PM_OPS_PTR,
  576. };
  577. EXPORT_SYMBOL(ibmebus_bus_type);
  578. static int __init ibmebus_bus_init(void)
  579. {
  580. int err;
  581. printk(KERN_INFO "IBM eBus Device Driver\n");
  582. err = bus_register(&ibmebus_bus_type);
  583. if (err) {
  584. printk(KERN_ERR "%s: failed to register IBM eBus.\n",
  585. __func__);
  586. return err;
  587. }
  588. err = device_register(&ibmebus_bus_device);
  589. if (err) {
  590. printk(KERN_WARNING "%s: device_register returned %i\n",
  591. __func__, err);
  592. bus_unregister(&ibmebus_bus_type);
  593. return err;
  594. }
  595. err = ibmebus_create_devices(ibmebus_matches);
  596. if (err) {
  597. device_unregister(&ibmebus_bus_device);
  598. bus_unregister(&ibmebus_bus_type);
  599. return err;
  600. }
  601. return 0;
  602. }
  603. postcore_initcall(ibmebus_bus_init);