brcm2708: refresh patches
[15.05/openwrt.git] / target / linux / brcm2708 / patches-3.18 / 0111-BCM2708_VCIO-Add-automatic-creation-of-device-node.patch
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 ---
7  arch/arm/mach-bcm2708/vcio.c | 12 +++++++++++-
8  arch/arm/mach-bcm2709/vcio.c | 12 +++++++++++-
9  2 files changed, 22 insertions(+), 2 deletions(-)
10
11 --- a/arch/arm/mach-bcm2708/vcio.c
12 +++ b/arch/arm/mach-bcm2708/vcio.c
13 @@ -61,7 +61,7 @@
14  #define MBOX_DATA28_LSB(msg)           (((uint32_t)msg) >> 4)
15  
16  #define MBOX_MAGIC 0xd0d0c0de
17 -
18 +static struct class *vcio_class = NULL;
19  struct vc_mailbox {
20         struct device *dev;     /* parent device */
21         void __iomem *status;
22 @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platfor
23                                "Failed registering the character device %d\n", ret);
24                         return ret;
25                 }
26 +               vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
27 +               if (IS_ERR(vcio_class)) {
28 +                   ret = PTR_ERR(vcio_class);
29 +                  return ret ;
30 +               }
31 +               device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
32 +                      "vcio");
33         }
34         return ret;
35  }
36 @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
37  
38  static void __exit bcm_mbox_exit(void)
39  {
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);
44  }
45  
46 --- a/arch/arm/mach-bcm2709/vcio.c
47 +++ b/arch/arm/mach-bcm2709/vcio.c
48 @@ -61,7 +61,7 @@
49  #define MBOX_DATA28_LSB(msg)           (((uint32_t)msg) >> 4)
50  
51  #define MBOX_MAGIC 0xd0d0c0de
52 -
53 +static struct class *vcio_class = NULL;
54  struct vc_mailbox {
55         struct device *dev;     /* parent device */
56         void __iomem *status;
57 @@ -421,6 +421,13 @@ static int bcm_vcio_probe(struct platfor
58                                "Failed registering the character device %d\n", ret);
59                         return ret;
60                 }
61 +               vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME);
62 +               if (IS_ERR(vcio_class)) {
63 +                   ret = PTR_ERR(vcio_class);
64 +                  return ret ;
65 +               }
66 +               device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL,
67 +                      "vcio");
68         }
69         return ret;
70  }
71 @@ -462,6 +469,9 @@ static int __init bcm_mbox_init(void)
72  
73  static void __exit bcm_mbox_exit(void)
74  {
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);
79  }
80