Skip to contentSkip to conversation

vchiq: Patch to separate platform and cdev code

PATCH In review Ojaswin Mujoo 3 participants 13 messages Jul 21, 2021 – Jul 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover vchiq: Patch to separate platform and cdev code

Hello,

This patchset adderesses the TODO item number 10 specified at:

drivers/staging/vc04-services/interface/TODO

For reference, the task is:

10) Reorganize file structure: Move char driver to it's own file and join both platform files

The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.

A summary of the patches is as follows:

- Patch 1: Move cdev init code into a function
- Patch 2: Shift some devlarations from vchiq_arm.c to vchiq_arm.h for sharing
- Patch 3: Move vchiq cdev init code from vchiq_arm.c into vchiq_dev.c
- Patch 4: Decouple cdev code by defining a Kconfig entry to allow optional compilation of it.
- Patch 5: Merge code in vchiq_2835_arm.c to vchiq_arm.c

Changes since v3 [2]:

* In Patch 5, replace forward declarations of some of the functions with function definition

Changes since v2 [1]:

* In Patch 1, as suggested, I have added error handling code back to ensure the driver exits when there is an error in creating vchiq cdev

* I have built this patch against the right kernel (gregkh/staging, staging-next branch) to avoid introducing any unwanted inconsistencies like whitespace changes

I have tested the patch using vchiq_test utility on RPi 3B+.

Regards,
Ojaswin

[1] v2: https://lore.kernel.org/patchwork/cover/1449117/
[2] v3: https://lore.kernel.org/patchwork/cover/1453915/

Ojaswin Mujoo (5):
staging: vchiq: Refactor vchiq cdev code
staging: vchiq: Move certain declarations to vchiq_arm.h
staging: vchiq: Move vchiq char driver to its own file
staging: vchiq: Make creation of vchiq cdev optional
staging: vchiq: Combine vchiq platform code into single file

 drivers/staging/vc04_services/Kconfig         |   10 +
 drivers/staging/vc04_services/Makefile        |    5 +-
 .../interface/vchiq_arm/vchiq_2835_arm.c      |  564 ----
 .../interface/vchiq_arm/vchiq_arm.c           | 2330 +++++------------
 .../interface/vchiq_arm/vchiq_arm.h           |   82 +
 .../interface/vchiq_arm/vchiq_dev.c           | 1440 ++++++++++
 6 files changed, 2251 insertions(+), 2180 deletions(-)
 delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
 create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/5 staging: vchiq: Refactor vchiq cdev code

Move the vchiq cdev initialization code to its own function for better code organization. Call the initialization function during probe, thus shifting the whole cdev creation logic (which was earlier split in vchiq_probe() and vchiq_driver_init()) to vchiq_probe().

---
 .../interface/vchiq_arm/vchiq_arm.c           | 142 ++++++++++++------
 1 file changed, 92 insertions(+), 50 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +92 -50
index b5aac862a298..3a0724fe25ea 100644
@@ -2134,6 +2134,81 @@ vchiq_fops = {
 	.read = vchiq_read
 };
 
+/**
+ *	vchiq_register_chrdev - Register the char driver for vchiq
+ *				and create the necessary class and
+ *				device files in userspace.
+ *	@parent		The parent of the char device.
+ *
+ *	Returns 0 on success else returns the error code.
+ */
+static int vchiq_register_chrdev(struct device *parent)
+{
+	struct device *vchiq_dev;
+	int ret;
+
+	vchiq_class = class_create(THIS_MODULE, DEVICE_NAME);
+	if (IS_ERR(vchiq_class)) {
+		pr_err("Failed to create vchiq class\n");
+		ret = PTR_ERR(vchiq_class);
+		goto error_exit;
+	}
+
+	ret = alloc_chrdev_region(&vchiq_devid, 0, 1, DEVICE_NAME);
+	if (ret) {
+		pr_err("vchiq: Failed to allocate vchiq's chrdev region\n");
+		goto alloc_region_error;
+	}
+
+	cdev_init(&vchiq_cdev, &vchiq_fops);
+	vchiq_cdev.owner = THIS_MODULE;
+	ret = cdev_add(&vchiq_cdev, vchiq_devid, 1);
+	if (ret) {
+		vchiq_log_error(vchiq_arm_log_level,
+				"Unable to register vchiq char device");
+		goto cdev_add_error;
+	}
+
+	vchiq_dev = device_create(vchiq_class, parent, vchiq_devid, NULL,
+				  DEVICE_NAME);
+	if (IS_ERR(vchiq_dev)) {
+		vchiq_log_error(vchiq_arm_log_level,
+				"Failed to create vchiq char device node");
+		ret = PTR_ERR(vchiq_dev);
+		goto device_create_error;
+	}
+
+	vchiq_log_info(vchiq_arm_log_level,
+		       "vchiq char dev initialised successfully - device %d.%d",
+			MAJOR(vchiq_devid), MINOR(vchiq_devid));
+
+	return 0;
+
+device_create_error:
+	cdev_del(&vchiq_cdev);
+
+cdev_add_error:
+	unregister_chrdev_region(vchiq_devid, 1);
+
+alloc_region_error:
+	class_destroy(vchiq_class);
+
+error_exit:
+	return ret;
+}
+
+/**
+ *	vchiq_deregister_chrdev	- Deregister and cleanup the vchiq char
+ *				  driver and device files
+ */
+static void vchiq_deregister_chrdev(void)
+{
+	device_destroy(vchiq_class, vchiq_devid);
+	cdev_del(&vchiq_cdev);
+	unregister_chrdev_region(vchiq_devid, 1);
+	class_destroy(vchiq_class);
+}
+
 /*
  * Autosuspend related functionality
  */
@@ -2644,7 +2719,6 @@ static int vchiq_probe(struct platform_device *pdev)
 	struct device_node *fw_node;
 	const struct of_device_id *of_id;
 	struct vchiq_drvdata *drvdata;
-	struct device *vchiq_dev;
 	int err;
 
 	of_id = of_match_node(vchiq_of_match, pdev->dev.of_node);
@@ -2670,38 +2744,31 @@ static int vchiq_probe(struct platform_device *pdev)
 	if (err)
 		goto failed_platform_init;
 
-	cdev_init(&vchiq_cdev, &vchiq_fops);
-	vchiq_cdev.owner = THIS_MODULE;
-	err = cdev_add(&vchiq_cdev, vchiq_devid, 1);
-	if (err) {
-		vchiq_log_error(vchiq_arm_log_level,
-			"Unable to register device");
-		goto failed_platform_init;
-	}
-
-	vchiq_dev = device_create(vchiq_class, &pdev->dev, vchiq_devid, NULL,
-				  "vchiq");
-	if (IS_ERR(vchiq_dev)) {
-		err = PTR_ERR(vchiq_dev);
-		goto failed_device_create;
-	}
-
 	vchiq_debugfs_init();
 
 	vchiq_log_info(vchiq_arm_log_level,
-		"vchiq: initialised - version %d (min %d), device %d.%d",
-		VCHIQ_VERSION, VCHIQ_VERSION_MIN,
-		MAJOR(vchiq_devid), MINOR(vchiq_devid));
+		       "vchiq: platform initialised - version %d (min %d)",
+		       VCHIQ_VERSION, VCHIQ_VERSION_MIN);
+
+	/*
+	 * Simply exit on error since the function handles cleanup in
+	 * cases of failure.
+	 */
+	err = vchiq_register_chrdev(&pdev->dev);
+	if (err) {
+		vchiq_log_warning(vchiq_arm_log_level,
+				  "Failed to initialize vchiq cdev");
+		goto error_exit;
+	}
 
 	bcm2835_camera = vchiq_register_child(pdev, "bcm2835-camera");
 	bcm2835_audio = vchiq_register_child(pdev, "bcm2835_audio");
 
 	return 0;
 
-failed_device_create:
-	cdev_del(&vchiq_cdev);
 failed_platform_init:
-	vchiq_log_warning(vchiq_arm_log_level, "could not load vchiq");
+	vchiq_log_warning(vchiq_arm_log_level, "could not initialize vchiq platform");
+error_exit:
 	return err;
 }
 
@@ -2710,8 +2777,7 @@ static int vchiq_remove(struct platform_device *pdev)
 	platform_device_unregister(bcm2835_audio);
 	platform_device_unregister(bcm2835_camera);
 	vchiq_debugfs_deinit();
-	device_destroy(vchiq_class, vchiq_devid);
-	cdev_del(&vchiq_cdev);
+	vchiq_deregister_chrdev();
 
 	return 0;
 }
@@ -2729,31 +2795,9 @@ static int __init vchiq_driver_init(void)
 {
 	int ret;
 
-	vchiq_class = class_create(THIS_MODULE, DEVICE_NAME);
-	if (IS_ERR(vchiq_class)) {
-		pr_err("Failed to create vchiq class\n");
-		return PTR_ERR(vchiq_class);
-	}
-
-	ret = alloc_chrdev_region(&vchiq_devid, 0, 1, DEVICE_NAME);
-	if (ret) {
-		pr_err("Failed to allocate vchiq's chrdev region\n");
-		goto class_destroy;
-	}
-
 	ret = platform_driver_register(&vchiq_driver);
-	if (ret) {
+	if (ret)
 		pr_err("Failed to register vchiq driver\n");
-		goto region_unregister;
-	}
-
-	return 0;
-
-region_unregister:
-	unregister_chrdev_region(vchiq_devid, 1);
-
-class_destroy:
-	class_destroy(vchiq_class);
 
 	return ret;
 }
@@ -2762,8 +2806,6 @@ module_init(vchiq_driver_init);
 static void __exit vchiq_driver_exit(void)
 {
 	platform_driver_unregister(&vchiq_driver);
-	unregister_chrdev_region(vchiq_devid, 1);
-	class_destroy(vchiq_class);
 }
 module_exit(vchiq_driver_exit);
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 2/5 staging: vchiq: Move certain declarations to vchiq_arm.h

In reply to Ojaswin Mujoo

Move certain declarations from vchiq_arm.c to vchiq_arm.h to allow code sharing. This will be useful when we eventually separate the vchiq char driver code from platform code, into its own file.

---
 .../interface/vchiq_arm/vchiq_arm.c           | 68 ++---------------
 .../interface/vchiq_arm/vchiq_arm.h           | 73 +++++++++++++++++++
 2 files changed, 79 insertions(+), 62 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +6 -62
index 3a0724fe25ea..3152466086f3 100644
@@ -38,12 +38,6 @@
 #undef MODULE_PARAM_PREFIX
 #define MODULE_PARAM_PREFIX DEVICE_NAME "."
 
-/* Some per-instance constants */
-#define MAX_COMPLETIONS 128
-#define MAX_SERVICES 64
-#define MAX_ELEMENTS 8
-#define MSG_QUEUE_SIZE 128
-
 #define KEEPALIVE_VER 1
 #define KEEPALIVE_VER_MIN KEEPALIVE_VER
 
@@ -51,62 +45,12 @@
 int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT;
 int vchiq_susp_log_level = VCHIQ_LOG_ERROR;
 
-struct user_service {
-	struct vchiq_service *service;
-	void __user *userdata;
-	struct vchiq_instance *instance;
-	char is_vchi;
-	char dequeue_pending;
-	char close_pending;
-	int message_available_pos;
-	int msg_insert;
-	int msg_remove;
-	struct completion insert_event;
-	struct completion remove_event;
-	struct completion close_event;
-	struct vchiq_header *msg_queue[MSG_QUEUE_SIZE];
-};
-
-struct bulk_waiter_node {
-	struct bulk_waiter bulk_waiter;
-	int pid;
-	struct list_head list;
-};
-
-struct vchiq_instance {
-	struct vchiq_state *state;
-	struct vchiq_completion_data_kernel completions[MAX_COMPLETIONS];
-	int completion_insert;
-	int completion_remove;
-	struct completion insert_event;
-	struct completion remove_event;
-	struct mutex completion_mutex;
-
-	int connected;
-	int closing;
-	int pid;
-	int mark;
-	int use_close_delivered;
-	int trace;
-
-	struct list_head bulk_waiter_list;
-	struct mutex bulk_waiter_list_mutex;
-
-	struct vchiq_debugfs_node debugfs_node;
-};
-
-struct dump_context {
-	char __user *buf;
-	size_t actual;
-	size_t space;
-	loff_t offset;
-};
+DEFINE_SPINLOCK(msg_queue_spinlock);
+struct vchiq_state g_state;
 
 static struct cdev    vchiq_cdev;
 static dev_t          vchiq_devid;
-static struct vchiq_state g_state;
 static struct class  *vchiq_class;
-static DEFINE_SPINLOCK(msg_queue_spinlock);
 static struct platform_device *bcm2835_camera;
 static struct platform_device *bcm2835_audio;
 
@@ -199,7 +143,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out)
 }
 EXPORT_SYMBOL(vchiq_initialise);
 
-static void free_bulk_waiter(struct vchiq_instance *instance)
+void free_bulk_waiter(struct vchiq_instance *instance)
 {
 	struct bulk_waiter_node *waiter, *next;
 
@@ -561,7 +505,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
 	return VCHIQ_SUCCESS;
 }
 
-static enum vchiq_status
+enum vchiq_status
 service_callback(enum vchiq_reason reason, struct vchiq_header *header,
 		 unsigned int handle, void *bulk_userdata)
 {
@@ -2142,7 +2086,7 @@ vchiq_fops = {
  *
  *	Returns 0 on success else returns the error code.
  */
-static int vchiq_register_chrdev(struct device *parent)
+int vchiq_register_chrdev(struct device *parent)
 {
 	struct device *vchiq_dev;
 	int ret;
@@ -2201,7 +2145,7 @@ static int vchiq_register_chrdev(struct device *parent)
  *	vchiq_deregister_chrdev	- Deregister and cleanup the vchiq char
  *				  driver and device files
  */
-static void vchiq_deregister_chrdev(void)
+void vchiq_deregister_chrdev(void)
 {
 	device_destroy(vchiq_class, vchiq_devid);
 	cdev_del(&vchiq_cdev);
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +73 -0

92 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH v4 3/5 staging: vchiq: Move vchiq char driver to its own file

In reply to Ojaswin Mujoo

Split the initialization code of vchiq char driver and device files from that of vchiq platform. The char driver code now resides in vchiq_dev.c and the platform code resides in the original vchiq_arm.c file.

This commit focuses on separating the code into different files while maintaining the same functionality. It does not completely decouple them as the cdev init code is still called from the platform's vchiq_probe() function.

---
 drivers/staging/vc04_services/Makefile        |    1 +
 .../interface/vchiq_arm/vchiq_arm.c           | 1619 +----------------
 .../interface/vchiq_arm/vchiq_dev.c           | 1440 +++++++++++++++
 3 files changed, 1540 insertions(+), 1520 deletions(-)
 create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
drivers/staging/vc04_services/Makefile +1 -0
index e21e73ae3cc6..db28be341239 100644
@@ -7,6 +7,7 @@ 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 \
 
 obj-$(CONFIG_SND_BCM2835)		+= bcm2835-audio/
 obj-$(CONFIG_VIDEO_BCM2835)		+= bcm2835-camera/
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +99 -1520

1,680 lines not on this page · raw message

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c new file +1440 -0

1,313 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.25.1

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH v4 4/5 staging: vchiq: Make creation of vchiq cdev optional

In reply to Ojaswin Mujoo

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.

---
 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(-)
drivers/staging/vc04_services/Kconfig +10 -0
index 4b886293f198..63caa6818d37 100644
@@ -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"
drivers/staging/vc04_services/Makefile +4 -1
index db28be341239..0a04338fc962 100644
@@ -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/
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +9 -0
index 2453971b6b78..e8e39a154c74 100644
@@ -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);
Signature · 1 line
2.25.1
maintainer
#5 lore raw

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

Quoted 16 lines · Ojaswin Mujoo

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.

---
 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(-)
drivers/staging/vc04_services/Kconfig +0 -0
index 4b886293f198..63caa6818d37 100644

drivers/staging/vc04_services/Kconfig config BCM2835_VCHIQ · line 28

Quoted 10 lines
drivers/staging/vc04_services/Kconfig +7 -0
@@ -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

#6 lore raw

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

Quoted 32 lines · Greg KH
Quoted 16 lines · Ojaswin Mujoo

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.

---
 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(-)
drivers/staging/vc04_services/Kconfig +0 -0
index 4b886293f198..63caa6818d37 100644

drivers/staging/vc04_services/Kconfig config BCM2835_VCHIQ · line 28

Quoted 10 lines
drivers/staging/vc04_services/Kconfig +7 -0
@@ -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?

Quoted 3 lines

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

Quoted 4 lines

thanks,

greg k-h

#7 lore raw

PATCH v4 5/5 staging: vchiq: Combine vchiq platform code into single file

In reply to Ojaswin Mujoo

Combine the vchiq platform initialization code into a single file by merging vchiq_2835_arm.c into vchiq_arm.c

---
 drivers/staging/vc04_services/Makefile        |   1 -
 .../interface/vchiq_arm/vchiq_2835_arm.c      | 564 ------------------
 .../interface/vchiq_arm/vchiq_arm.c           | 535 +++++++++++++++++
 3 files changed, 535 insertions(+), 565 deletions(-)
 delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
drivers/staging/vc04_services/Makefile +0 -1
index 0a04338fc962..1fd191e2e2a5 100644
@@ -4,7 +4,6 @@ obj-$(CONFIG_BCM2835_VCHIQ)	+= vchiq.o
 vchiq-objs := \
    interface/vchiq_arm/vchiq_core.o  \
    interface/vchiq_arm/vchiq_arm.o \
-   interface/vchiq_arm/vchiq_2835_arm.o \
    interface/vchiq_arm/vchiq_debugfs.o \
    interface/vchiq_arm/vchiq_connected.o \
 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c deleted +0 -564

564 lines not on this page · raw message

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +535 -0

560 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#8 lore raw
In reply to Ojaswin Mujoo
Quoted 29 lines · Ojaswin Mujoo

Hello,

This patchset adderesses the TODO item number 10 specified at:

drivers/staging/vc04-services/interface/TODO

For reference, the task is:

10) Reorganize file structure: Move char driver to it's own file and join both platform files

The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.

A summary of the patches is as follows:

- Patch 1: Move cdev init code into a function
- Patch 2: Shift some devlarations from vchiq_arm.c to vchiq_arm.h for sharing
- Patch 3: Move vchiq cdev init code from vchiq_arm.c into vchiq_dev.c
- Patch 4: Decouple cdev code by defining a Kconfig entry to allow optional compilation of it.
- Patch 5: Merge code in vchiq_2835_arm.c to vchiq_arm.c

Quoted 4 lines

Changes since v3 [2]:

* In Patch 5, replace forward declarations of some of the functions with function definition

You dropped the reviews of others, so now I need to wait for them again :(

#9 lore raw
Quoted 30 lines · Greg KH
Quoted 29 lines · Ojaswin Mujoo

Hello,

This patchset adderesses the TODO item number 10 specified at:

drivers/staging/vc04-services/interface/TODO

For reference, the task is:

10) Reorganize file structure: Move char driver to it's own file and join both platform files

The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.

A summary of the patches is as follows:

- Patch 1: Move cdev init code into a function
- Patch 2: Shift some devlarations from vchiq_arm.c to vchiq_arm.h for sharing
- Patch 3: Move vchiq cdev init code from vchiq_arm.c into vchiq_dev.c
- Patch 4: Decouple cdev code by defining a Kconfig entry to allow optional compilation of it.
- Patch 5: Merge code in vchiq_2835_arm.c to vchiq_arm.c

Quoted 8 lines
Quoted 4 lines

Changes since v3 [2]:

* In Patch 5, replace forward declarations of some of the functions with function definition

You dropped the reviews of others, so now I need to wait for them again :(

Hello Greg,

Apologies for that, I was under the impression that a new version needed a separate review :(

If its okay, I can alternately resubmit this (as v5?) with Stefan's Reviewed-By tags on unchanged commits intact. Let me know if that's okay or if its better to wait out.

Thank you!
Ojaswin

#10 lore raw

Am 23.07.21 um 14:59 schrieb Ojaswin Mujoo:

Quoted 35 lines · Greg KH
Quoted 34 lines · Ojaswin Mujoo
Quoted 33 lines

Hello,

This patchset adderesses the TODO item number 10 specified at:

drivers/staging/vc04-services/interface/TODO

For reference, the task is:

10) Reorganize file structure: Move char driver to it's own file and join both platform files

The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.

A summary of the patches is as follows:

- Patch 1: Move cdev init code into a function
- Patch 2: Shift some devlarations from vchiq_arm.c to vchiq_arm.h for sharing
- Patch 3: Move vchiq cdev init code from vchiq_arm.c into vchiq_dev.c
- Patch 4: Decouple cdev code by defining a Kconfig entry to allow optional compilation of it.
- Patch 5: Merge code in vchiq_2835_arm.c to vchiq_arm.c

Changes since v3 [2]:

* In Patch 5, replace forward declarations of some of the functions with function definition

Quoted 7 lines
Quoted 3 lines

You dropped the reviews of others, so now I need to wait for them again :(

Hello Greg,

Apologies for that, I was under the impression that a new version needed a separate review :(

No, just the patches which had functional changes.

Quoted 3 lines

If its okay, I can alternately resubmit this (as v5?) with Stefan's Reviewed-By tags on unchanged commits intact. Let me know if that's okay or if its better to wait out.

No, please don't resubmit. I will do the review soon.

Regards
Stefan

Quoted 8 lines

Thank you!
Ojaswin

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#11 lore raw
Quoted 36 lines · Stefan Wahren

Am 23.07.21 um 14:59 schrieb Ojaswin Mujoo:

Quoted 35 lines · Greg KH
Quoted 34 lines · Ojaswin Mujoo
Quoted 33 lines

Hello,

This patchset adderesses the TODO item number 10 specified at:

drivers/staging/vc04-services/interface/TODO

For reference, the task is:

10) Reorganize file structure: Move char driver to it's own file and join both platform files

The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.

A summary of the patches is as follows:

- Patch 1: Move cdev init code into a function
- Patch 2: Shift some devlarations from vchiq_arm.c to vchiq_arm.h for sharing
- Patch 3: Move vchiq cdev init code from vchiq_arm.c into vchiq_dev.c
- Patch 4: Decouple cdev code by defining a Kconfig entry to allow optional compilation of it.
- Patch 5: Merge code in vchiq_2835_arm.c to vchiq_arm.c

Changes since v3 [2]:

* In Patch 5, replace forward declarations of some of the functions with function definition

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

You dropped the reviews of others, so now I need to wait for them again :(

Hello Greg,

Apologies for that, I was under the impression that a new version needed a separate review :(

No, just the patches which had functional changes.

Ohh, noted.

Quoted 5 lines
Quoted 3 lines

If its okay, I can alternately resubmit this (as v5?) with Stefan's Reviewed-By tags on unchanged commits intact. Let me know if that's okay or if its better to wait out.

No, please don't resubmit. I will do the review soon.

Thanks for the review and all the help, Stefan. It is much appreciated :)

Regards,
Ojaswin

Reviewed-by on the v4 series
#12 lore raw
In reply to Ojaswin Mujoo

Am 21.07.21 um 18:20 schrieb Ojaswin Mujoo:

Quoted 29 lines

Hello,

This patchset adderesses the TODO item number 10 specified at:

drivers/staging/vc04-services/interface/TODO

For reference, the task is:

10) Reorganize file structure: Move char driver to it's own file and join both platform files

The cdev is defined alongside with the platform code in vchiq_arm.c. It would be nice to completely decouple it from the actual core code. For instance to be able to use bcm2835-audio without having /dev/vchiq created. One could argue it's better for security reasons or general cleanliness. It could even be interesting to create two different kernel modules, something the likes of vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.

A summary of the patches is as follows:

- Patch 1: Move cdev init code into a function
- Patch 2: Shift some devlarations from vchiq_arm.c to vchiq_arm.h for sharing
- Patch 3: Move vchiq cdev init code from vchiq_arm.c into vchiq_dev.c
- Patch 4: Decouple cdev code by defining a Kconfig entry to allow optional compilation of it.
- Patch 5: Merge code in vchiq_2835_arm.c to vchiq_arm.c

Quoted 5 lines

Changes since v3 [2]:

* In Patch 5, replace forward declarations of some of the functions with function definition

The whole series is:

Thanks