devices.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301, USA.
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/slab.h>
  20. #include <linux/init.h>
  21. #include <linux/err.h>
  22. #include <linux/platform_device.h>
  23. #include <mach/common.h>
  24. int __init mxc_register_device(struct platform_device *pdev, void *data)
  25. {
  26. int ret;
  27. pdev->dev.platform_data = data;
  28. ret = platform_device_register(pdev);
  29. if (ret)
  30. pr_debug("Unable to register platform device '%s': %d\n",
  31. pdev->name, ret);
  32. return ret;
  33. }
  34. struct device mxc_aips_bus = {
  35. .init_name = "mxc_aips",
  36. .parent = &platform_bus,
  37. };
  38. struct device mxc_ahb_bus = {
  39. .init_name = "mxc_ahb",
  40. .parent = &platform_bus,
  41. };
  42. static int __init mxc_device_init(void)
  43. {
  44. int ret;
  45. ret = device_register(&mxc_aips_bus);
  46. if (IS_ERR_VALUE(ret))
  47. goto done;
  48. ret = device_register(&mxc_ahb_bus);
  49. done:
  50. return ret;
  51. }
  52. core_initcall(mxc_device_init);