lcd.c 864 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Registration of Cobalt LCD platform device.
  4. *
  5. * Copyright (C) 2008 Yoichi Yuasa <[email protected]>
  6. */
  7. #include <linux/errno.h>
  8. #include <linux/init.h>
  9. #include <linux/ioport.h>
  10. #include <linux/platform_device.h>
  11. static struct resource cobalt_lcd_resource __initdata = {
  12. .start = 0x1f000000,
  13. .end = 0x1f00001f,
  14. .flags = IORESOURCE_MEM,
  15. };
  16. static __init int cobalt_lcd_add(void)
  17. {
  18. struct platform_device *pdev;
  19. int retval;
  20. pdev = platform_device_alloc("cobalt-lcd", -1);
  21. if (!pdev)
  22. return -ENOMEM;
  23. retval = platform_device_add_resources(pdev, &cobalt_lcd_resource, 1);
  24. if (retval)
  25. goto err_free_device;
  26. retval = platform_device_add(pdev);
  27. if (retval)
  28. goto err_free_device;
  29. return 0;
  30. err_free_device:
  31. platform_device_put(pdev);
  32. return retval;
  33. }
  34. device_initcall(cobalt_lcd_add);