[PATCH 2/2] staging: vchiq: Remove global bcm*_drvdata

Marcelo Diop-Gonzalez marcgonzalez at google.com
Mon Nov 11 17:14:24 UTC 2019


Moving the DT node check to vchiq_platform_init()
removes the need for these.

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez at google.com>
---
 .../interface/vchiq_arm/vchiq_2835_arm.c      |  4 ++--
 .../interface/vchiq_arm/vchiq_arm.c           | 20 ++-----------------
 .../interface/vchiq_arm/vchiq_arm.h           |  4 ----
 3 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 5ac88be9496b..b133b25c44af 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -78,7 +78,6 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
 int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
 {
 	struct device *dev = &pdev->dev;
-	struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);
 	struct device_node *fw_node;
 	struct rpi_firmware *fw;
 	struct vchiq_slot_zero *vchiq_slot_zero;
@@ -109,7 +108,8 @@ int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
 	if (err < 0)
 		return err;
 
-	g_cache_line_size = drvdata->cache_line_size;
+	if (of_device_is_compatible(dev->of_node, "brcm,bcm2836-vchiq"))
+		g_cache_line_size = 64;
 	g_fragments_size = 2 * g_cache_line_size;
 
 	/* Allocate space for the channels in coherent memory */
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 c666c8b5eda2..cc753ba9c68c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -140,14 +140,6 @@ static DEFINE_SPINLOCK(msg_queue_spinlock);
 static struct platform_device *bcm2835_camera;
 static struct platform_device *bcm2835_audio;
 
-static struct vchiq_drvdata bcm2835_drvdata = {
-	.cache_line_size = 32,
-};
-
-static struct vchiq_drvdata bcm2836_drvdata = {
-	.cache_line_size = 64,
-};
-
 static const char *const ioctl_names[] = {
 	"CONNECT",
 	"SHUTDOWN",
@@ -3161,8 +3153,8 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
 }
 
 static const struct of_device_id vchiq_of_match[] = {
-	{ .compatible = "brcm,bcm2835-vchiq", .data = &bcm2835_drvdata },
-	{ .compatible = "brcm,bcm2836-vchiq", .data = &bcm2836_drvdata },
+	{ .compatible = "brcm,bcm2835-vchiq"},
+	{ .compatible = "brcm,bcm2836-vchiq"},
 	{},
 };
 MODULE_DEVICE_TABLE(of, vchiq_of_match);
@@ -3191,17 +3183,9 @@ vchiq_register_child(struct platform_device *pdev, const char *name)
 
 static int vchiq_probe(struct platform_device *pdev)
 {
-	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);
-	drvdata = (struct vchiq_drvdata *)of_id->data;
-	if (!drvdata)
-		return -EINVAL;
-	platform_set_drvdata(pdev, drvdata);
-
 	err = vchiq_platform_init(pdev, &g_state);
 	if (err)
 		goto failed_platform_init;
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 e2cdfddaf02a..71b97d8d90bd 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
@@ -95,10 +95,6 @@ struct vchiq_arm_state {
 
 };
 
-struct vchiq_drvdata {
-	const unsigned int cache_line_size;
-};
-
 extern int vchiq_arm_log_level;
 extern int vchiq_susp_log_level;
 
-- 
2.20.1



More information about the devel mailing list