[v11,2/5] staging: vc04_services: vchiq_arm: Register vchiq_bus_type
Commit Message
Register the vchiq_bus_type bus with the vchiq interface.
The bcm2835-camera and bcm2835_audio will be registered to this bus type
going ahead.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
.../vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 ++++++++++++-
.../interface/vchiq_arm/vchiq_device.c | 7 -------
2 files changed, 12 insertions(+), 8 deletions(-)
Comments
Hi Stefan
On 9/14/23 2:31 AM, Stefan Wahren wrote:
> Hi Umang,
>
> Am 13.09.23 um 21:53 schrieb Umang Jain:
>> Register the vchiq_bus_type bus with the vchiq interface.
>> The bcm2835-camera and bcm2835_audio will be registered to this bus type
>> going ahead.
>>
>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> ---
>> .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 ++++++++++++-
>> .../interface/vchiq_arm/vchiq_device.c | 7 -------
>> 2 files changed, 12 insertions(+), 8 deletions(-)
>>
>> 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..d993a91de237 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,9 +1872,17 @@ 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)
>> + if (ret) {
>> pr_err("Failed to register vchiq driver\n");
>> + bus_unregister(&vchiq_bus_type);
>> + }
>>
>> return ret;
>> }
>> @@ -1880,6 +1890,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);
>> diff --git
>> a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
>> b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
>> index aad55c461905..b8c46f39e74a 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
>> @@ -74,13 +74,6 @@ vchiq_device_register(struct device *parent, const
>> char *name)
>> device->dev.bus = &vchiq_bus_type;
>> device->dev.release = vchiq_device_release;
>>
>> - of_dma_configure(&device->dev, parent->of_node, true);
>> - ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32));
>> - if (ret) {
>> - dev_err(&device->dev, "32-bit DMA enable failed\n");
>> - return NULL;
>> - }
>> -
>
> this code was added in the patch before and now it's removed again.
> Please avoid this.
Ouch, fixup! got incorrectly squashed in this patch, should have been
squashed in earlier patch, apologies.
>
>> ret = device_register(&device->dev);
>> if (ret) {
>> dev_err(parent, "Cannot register %s: %d\n", name, ret);
>
@@ -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,9 +1872,17 @@ 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)
+ if (ret) {
pr_err("Failed to register vchiq driver\n");
+ bus_unregister(&vchiq_bus_type);
+ }
return ret;
}
@@ -1880,6 +1890,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);
@@ -74,13 +74,6 @@ vchiq_device_register(struct device *parent, const char *name)
device->dev.bus = &vchiq_bus_type;
device->dev.release = vchiq_device_release;
- of_dma_configure(&device->dev, parent->of_node, true);
- ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32));
- if (ret) {
- dev_err(&device->dev, "32-bit DMA enable failed\n");
- return NULL;
- }
-
ret = device_register(&device->dev);
if (ret) {
dev_err(parent, "Cannot register %s: %d\n", name, ret);