0111-BCM2708_VCIO-Add-automatic-creation-of-device-node.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From 7fa07e9f8c88a5a628b9ca8a843d3490a59fb9cb Mon Sep 17 00:00:00 2001
  2. From: android <trevd1234@gmail.com>
  3. Date: Mon, 25 Aug 2014 13:18:21 +0100
  4. Subject: [PATCH 111/114] BCM2708_VCIO : Add automatic creation of device node
  5. ---
  6. arch/arm/mach-bcm2708/vcio.c | 12 +++++++++++-
  7. arch/arm/mach-bcm2709/vcio.c | 12 +++++++++++-
  8. 2 files changed, 22 insertions(+), 2 deletions(-)
  9. --- a/arch/arm/mach-bcm2708/vcio.c
  10. +++ b/arch/arm/mach-bcm2708/vcio.c
  11. @@ -61,7 +61,7 @@
  12. #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
  13. #define MBOX_MAGIC 0xd0d0c0de
  14. -
  15. +static struct class *vcio_class = NULL;
  16. struct vc_mailbox {
  17. struct device *dev; /* parent device */
  18. void __iomem *status;
  19. @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platfor
  20. "Failed registering the character device %d\n", ret);
  21. return ret;
  22. }
  23. + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
  24. + if (IS_ERR(vcio_class)) {
  25. + ret = PTR_ERR(vcio_class);
  26. + return ret ;
  27. + }
  28. + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
  29. + "vcio");
  30. }
  31. return ret;
  32. }
  33. @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
  34. static void __exit bcm_mbox_exit(void)
  35. {
  36. + device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
  37. + class_destroy(vcio_class);
  38. + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
  39. platform_driver_unregister(&bcm_mbox_driver);
  40. }
  41. --- a/arch/arm/mach-bcm2709/vcio.c
  42. +++ b/arch/arm/mach-bcm2709/vcio.c
  43. @@ -61,7 +61,7 @@
  44. #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
  45. #define MBOX_MAGIC 0xd0d0c0de
  46. -
  47. +static struct class *vcio_class = NULL;
  48. struct vc_mailbox {
  49. struct device *dev; /* parent device */
  50. void __iomem *status;
  51. @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platfor
  52. "Failed registering the character device %d\n", ret);
  53. return ret;
  54. }
  55. + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
  56. + if (IS_ERR(vcio_class)) {
  57. + ret = PTR_ERR(vcio_class);
  58. + return ret ;
  59. + }
  60. + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
  61. + "vcio");
  62. }
  63. return ret;
  64. }
  65. @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
  66. static void __exit bcm_mbox_exit(void)
  67. {
  68. + device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
  69. + class_destroy(vcio_class);
  70. + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
  71. platform_driver_unregister(&bcm_mbox_driver);
  72. }