2021-07-21 21:05:01

by Ojaswin Mujoo

[permalink] [raw]
Subject: [PATCH v4 4/5] staging: vchiq: Make creation of vchiq cdev optional

Before this commit, vchiq cdev (/dev/vchiq) was always created during
platform initialization. Introduce a new Kconfig option
CONFIG_VCHIQ_CDEV which determines if the cdev will be created or not.

Signed-off-by: Ojaswin Mujoo <[email protected]>
---
drivers/staging/vc04_services/Kconfig | 10 ++++++++++
drivers/staging/vc04_services/Makefile | 5 ++++-
.../vc04_services/interface/vchiq_arm/vchiq_arm.h | 9 +++++++++
3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig
index 4b886293f198..63caa6818d37 100644
--- a/drivers/staging/vc04_services/Kconfig
+++ b/drivers/staging/vc04_services/Kconfig
@@ -19,6 +19,16 @@ config BCM2835_VCHIQ
Defaults to Y when the Broadcom Videocore services
are included in the build, N otherwise.

+if BCM2835_VCHIQ
+
+config VCHIQ_CDEV
+ bool "VCHIQ Character Driver"
+ help
+ Enable the creation of VCHIQ character driver to help
+ communicate with the Videocore platform.
+
+endif
+
source "drivers/staging/vc04_services/bcm2835-audio/Kconfig"

source "drivers/staging/vc04_services/bcm2835-camera/Kconfig"
diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile
index db28be341239..0a04338fc962 100644
--- a/drivers/staging/vc04_services/Makefile
+++ b/drivers/staging/vc04_services/Makefile
@@ -7,7 +7,10 @@ vchiq-objs := \
interface/vchiq_arm/vchiq_2835_arm.o \
interface/vchiq_arm/vchiq_debugfs.o \
interface/vchiq_arm/vchiq_connected.o \
- interface/vchiq_arm/vchiq_dev.o \
+
+ifdef CONFIG_VCHIQ_CDEV
+vchiq-objs += interface/vchiq_arm/vchiq_dev.o
+endif

obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/
obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
index 2453971b6b78..e8e39a154c74 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
@@ -174,12 +174,21 @@ vchiq_instance_get_trace(struct vchiq_instance *instance);
extern void
vchiq_instance_set_trace(struct vchiq_instance *instance, int trace);

+#if IS_ENABLED(CONFIG_VCHIQ_CDEV)
+
extern void
vchiq_deregister_chrdev(void);

extern int
vchiq_register_chrdev(struct device *parent);

+#else
+
+static inline void vchiq_deregister_chrdev(void) { }
+static inline int vchiq_register_chrdev(struct device *parent) { return 0; }
+
+#endif /* IS_ENABLED(CONFIG_VCHIQ_CDEV) */
+
extern enum vchiq_status
service_callback(enum vchiq_reason reason, struct vchiq_header *header,
unsigned int handle, void *bulk_userdata);
--
2.25.1


2021-07-27 13:27:56

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v4 4/5] staging: vchiq: Make creation of vchiq cdev optional

On Wed, Jul 21, 2021 at 09:50:52PM +0530, Ojaswin Mujoo wrote:
> Before this commit, vchiq cdev (/dev/vchiq) was always created during
> platform initialization. Introduce a new Kconfig option
> CONFIG_VCHIQ_CDEV which determines if the cdev will be created or not.
>
> Signed-off-by: Ojaswin Mujoo <[email protected]>
> ---
> drivers/staging/vc04_services/Kconfig | 10 ++++++++++
> drivers/staging/vc04_services/Makefile | 5 ++++-
> .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 9 +++++++++
> 3 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig
> index 4b886293f198..63caa6818d37 100644
> --- a/drivers/staging/vc04_services/Kconfig
> +++ b/drivers/staging/vc04_services/Kconfig
> @@ -19,6 +19,16 @@ config BCM2835_VCHIQ
> Defaults to Y when the Broadcom Videocore services
> are included in the build, N otherwise.
>
> +if BCM2835_VCHIQ
> +
> +config VCHIQ_CDEV
> + bool "VCHIQ Character Driver"
> + help
> + Enable the creation of VCHIQ character driver to help
> + communicate with the Videocore platform.

I'll take this, but this really should say more about what this really
is for. Who needs this? Why will I know if I want a character driver
interface? What tools talk to this?

Or conversely, why would I want to turn this off?

Can you send a follow-on patch that makes this more descriptive?

thanks,

greg k-h

2021-07-27 16:56:35

by Ojaswin Mujoo

[permalink] [raw]
Subject: Re: [PATCH v4 4/5] staging: vchiq: Make creation of vchiq cdev optional

On Tue, Jul 27, 2021 at 03:25:01PM +0200, Greg KH wrote:
> On Wed, Jul 21, 2021 at 09:50:52PM +0530, Ojaswin Mujoo wrote:
> > Before this commit, vchiq cdev (/dev/vchiq) was always created during
> > platform initialization. Introduce a new Kconfig option
> > CONFIG_VCHIQ_CDEV which determines if the cdev will be created or not.
> >
> > Signed-off-by: Ojaswin Mujoo <[email protected]>
> > ---
> > drivers/staging/vc04_services/Kconfig | 10 ++++++++++
> > drivers/staging/vc04_services/Makefile | 5 ++++-
> > .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 9 +++++++++
> > 3 files changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig
> > index 4b886293f198..63caa6818d37 100644
> > --- a/drivers/staging/vc04_services/Kconfig
> > +++ b/drivers/staging/vc04_services/Kconfig
> > @@ -19,6 +19,16 @@ config BCM2835_VCHIQ
> > Defaults to Y when the Broadcom Videocore services
> > are included in the build, N otherwise.
> >
> > +if BCM2835_VCHIQ
> > +
> > +config VCHIQ_CDEV
> > + bool "VCHIQ Character Driver"
> > + help
> > + Enable the creation of VCHIQ character driver to help
> > + communicate with the Videocore platform.
>
> I'll take this, but this really should say more about what this really
> is for. Who needs this? Why will I know if I want a character driver
> interface? What tools talk to this?
>
> Or conversely, why would I want to turn this off?
>
> Can you send a follow-on patch that makes this more descriptive?
Hello Greg,

Sure, I can send in a follow up patch explaining this in more detail.

Thank you,
Ojaswin
>
> thanks,
>
> greg k-h