[v8,2/5] staging: vc04_services: vchiq_arm: Register vchiq_bus_type

Message ID 20230627201628.207483-3-umang.jain@ideasonboard.com
State New
Headers
Series staging: vc04_services: vchiq: Register devices with a custom bus_type |

Commit Message

Umang Jain June 27, 2023, 8:16 p.m. UTC
  Register the vchiq_bus_type bus with the vchiq interface.
The bcm2835-camera nad bcm2835_audio will be registered to this bus type
going ahead.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c        | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Kieran Bingham June 28, 2023, 11:21 a.m. UTC | #1
Quoting Umang Jain (2023-06-27 21:16:25)
> Register the vchiq_bus_type bus with the vchiq interface.
> The bcm2835-camera nad bcm2835_audio will be registered to this bus type

s/nad/and/

Is it possible to rename bcm2835_audio to bcm2835-audio for consistency?
Or is that baked into existing usage/abi already?

If it can be changed, I think it's probably something to do in an
independent patch at the end of the series anyway.

I suspect this patch could be merged with 1/5 but I think it's ok
separate too.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> going ahead.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  .../vc04_services/interface/vchiq_arm/vchiq_arm.c        | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index aa2313f3bcab..e8d40f891449 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -12,6 +12,7 @@
>  #include <linux/cdev.h>
>  #include <linux/fs.h>
>  #include <linux/device.h>
> +#include <linux/device/bus.h>
>  #include <linux/mm.h>
>  #include <linux/highmem.h>
>  #include <linux/pagemap.h>
> @@ -34,6 +35,7 @@
>  #include "vchiq_ioctl.h"
>  #include "vchiq_arm.h"
>  #include "vchiq_debugfs.h"
> +#include "vchiq_device.h"
>  #include "vchiq_connected.h"
>  #include "vchiq_pagelist.h"
>  
> @@ -1870,6 +1872,12 @@ static int __init vchiq_driver_init(void)
>  {
>         int ret;
>  
> +       ret = bus_register(&vchiq_bus_type);
> +       if (ret) {
> +               pr_err("Failed to register %s\n", vchiq_bus_type.name);
> +               return ret;
> +       }
> +
>         ret = platform_driver_register(&vchiq_driver);
>         if (ret)
>                 pr_err("Failed to register vchiq driver\n");
> @@ -1880,6 +1888,7 @@ module_init(vchiq_driver_init);
>  
>  static void __exit vchiq_driver_exit(void)
>  {
> +       bus_unregister(&vchiq_bus_type);
>         platform_driver_unregister(&vchiq_driver);
>  }
>  module_exit(vchiq_driver_exit);
> -- 
> 2.39.1
>
  
Umang Jain June 28, 2023, 9:08 p.m. UTC | #2
Hi Kieran,

On 6/28/23 1:21 PM, Kieran Bingham wrote:
> Quoting Umang Jain (2023-06-27 21:16:25)
>> Register the vchiq_bus_type bus with the vchiq interface.
>> The bcm2835-camera nad bcm2835_audio will be registered to this bus type
> s/nad/and/

Oops,  v9 probably?
>
> Is it possible to rename bcm2835_audio to bcm2835-audio for consistency?
> Or is that baked into existing usage/abi already?

well, there are more (bcm2835_hdmi, bcm2835_headphones) so, I don't 
think I will address in this series.
>
> If it can be changed, I think it's probably something to do in an
> independent patch at the end of the series anyway.
>
> I suspect this patch could be merged with 1/5 but I think it's ok
> separate too.
>
>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>
>> going ahead.
>>
>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>> ---
>>   .../vc04_services/interface/vchiq_arm/vchiq_arm.c        | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index aa2313f3bcab..e8d40f891449 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -12,6 +12,7 @@
>>   #include <linux/cdev.h>
>>   #include <linux/fs.h>
>>   #include <linux/device.h>
>> +#include <linux/device/bus.h>
>>   #include <linux/mm.h>
>>   #include <linux/highmem.h>
>>   #include <linux/pagemap.h>
>> @@ -34,6 +35,7 @@
>>   #include "vchiq_ioctl.h"
>>   #include "vchiq_arm.h"
>>   #include "vchiq_debugfs.h"
>> +#include "vchiq_device.h"
>>   #include "vchiq_connected.h"
>>   #include "vchiq_pagelist.h"
>>   
>> @@ -1870,6 +1872,12 @@ static int __init vchiq_driver_init(void)
>>   {
>>          int ret;
>>   
>> +       ret = bus_register(&vchiq_bus_type);
>> +       if (ret) {
>> +               pr_err("Failed to register %s\n", vchiq_bus_type.name);
>> +               return ret;
>> +       }
>> +
>>          ret = platform_driver_register(&vchiq_driver);
>>          if (ret)
>>                  pr_err("Failed to register vchiq driver\n");
>> @@ -1880,6 +1888,7 @@ module_init(vchiq_driver_init);
>>   
>>   static void __exit vchiq_driver_exit(void)
>>   {
>> +       bus_unregister(&vchiq_bus_type);
>>          platform_driver_unregister(&vchiq_driver);
>>   }
>>   module_exit(vchiq_driver_exit);
>> -- 
>> 2.39.1
>>
  

Patch

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index aa2313f3bcab..e8d40f891449 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -12,6 +12,7 @@ 
 #include <linux/cdev.h>
 #include <linux/fs.h>
 #include <linux/device.h>
+#include <linux/device/bus.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
@@ -34,6 +35,7 @@ 
 #include "vchiq_ioctl.h"
 #include "vchiq_arm.h"
 #include "vchiq_debugfs.h"
+#include "vchiq_device.h"
 #include "vchiq_connected.h"
 #include "vchiq_pagelist.h"
 
@@ -1870,6 +1872,12 @@  static int __init vchiq_driver_init(void)
 {
 	int ret;
 
+	ret = bus_register(&vchiq_bus_type);
+	if (ret) {
+		pr_err("Failed to register %s\n", vchiq_bus_type.name);
+		return ret;
+	}
+
 	ret = platform_driver_register(&vchiq_driver);
 	if (ret)
 		pr_err("Failed to register vchiq driver\n");
@@ -1880,6 +1888,7 @@  module_init(vchiq_driver_init);
 
 static void __exit vchiq_driver_exit(void)
 {
+	bus_unregister(&vchiq_bus_type);
 	platform_driver_unregister(&vchiq_driver);
 }
 module_exit(vchiq_driver_exit);