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
7 arch/arm/mach-bcm2708/vcio.c | 12 +++++++++++-
8 arch/arm/mach-bcm2709/vcio.c | 12 +++++++++++-
9 2 files changed, 22 insertions(+), 2 deletions(-)
11 --- a/arch/arm/mach-bcm2708/vcio.c
12 +++ b/arch/arm/mach-bcm2708/vcio.c
14 #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
16 #define MBOX_MAGIC 0xd0d0c0de
18 +static struct class *vcio_class = NULL;
20 struct device *dev; /* parent device */
22 @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platfor
23 "Failed registering the character device %d\n", ret);
26 + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
27 + if (IS_ERR(vcio_class)) {
28 + ret = PTR_ERR(vcio_class);
31 + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
36 @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
38 static void __exit bcm_mbox_exit(void)
40 + device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
41 + class_destroy(vcio_class);
42 + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
43 platform_driver_unregister(&bcm_mbox_driver);
46 --- a/arch/arm/mach-bcm2709/vcio.c
47 +++ b/arch/arm/mach-bcm2709/vcio.c
49 #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
51 #define MBOX_MAGIC 0xd0d0c0de
53 +static struct class *vcio_class = NULL;
55 struct device *dev; /* parent device */
57 @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platfor
58 "Failed registering the character device %d\n", ret);
61 + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
62 + if (IS_ERR(vcio_class)) {
63 + ret = PTR_ERR(vcio_class);
66 + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
71 @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
73 static void __exit bcm_mbox_exit(void)
75 + device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
76 + class_destroy(vcio_class);
77 + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
78 platform_driver_unregister(&bcm_mbox_driver);