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 diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c
12 index 5e43e85..700bff4 100644
13 --- a/arch/arm/mach-bcm2708/vcio.c
14 +++ b/arch/arm/mach-bcm2708/vcio.c
16 #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
18 #define MBOX_MAGIC 0xd0d0c0de
20 +static struct class *vcio_class = NULL;
22 struct device *dev; /* parent device */
24 @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platform_device *pdev)
25 "Failed registering the character device %d\n", ret);
28 + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
29 + if (IS_ERR(vcio_class)) {
30 + ret = PTR_ERR(vcio_class);
33 + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
38 @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
40 static void __exit bcm_mbox_exit(void)
42 + device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
43 + class_destroy(vcio_class);
44 + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
45 platform_driver_unregister(&bcm_mbox_driver);
48 diff --git a/arch/arm/mach-bcm2709/vcio.c b/arch/arm/mach-bcm2709/vcio.c
49 index 5e43e85..700bff4 100644
50 --- a/arch/arm/mach-bcm2709/vcio.c
51 +++ b/arch/arm/mach-bcm2709/vcio.c
53 #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4)
55 #define MBOX_MAGIC 0xd0d0c0de
57 +static struct class *vcio_class = NULL;
59 struct device *dev; /* parent device */
61 @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platform_device *pdev)
62 "Failed registering the character device %d\n", ret);
65 + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
66 + if (IS_ERR(vcio_class)) {
67 + ret = PTR_ERR(vcio_class);
70 + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
75 @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
77 static void __exit bcm_mbox_exit(void)
79 + device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0));
80 + class_destroy(vcio_class);
81 + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME);
82 platform_driver_unregister(&bcm_mbox_driver);