driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
To: gregkh@linuxfoundation.org, eric@anholt.net, wahrenst@gmx.net
Cc: devel@driverdev.osuosl.org, linux-rpi-kernel@lists.infradead.org
Subject: [PATCH 2/2] staging: vchiq: Remove global bcm*_drvdata
Date: Mon, 11 Nov 2019 12:14:24 -0500	[thread overview]
Message-ID: <bfad5318dbecc1705416a554dc806a99069247b0.1573482698.git.marcgonzalez@google.com> (raw)
In-Reply-To: <cover.1573482698.git.marcgonzalez@google.com>

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

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2019-11-11 17:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 17:14 [PATCH 0/2] Remove global struct vchiq_drvdata variables Marcelo Diop-Gonzalez
2019-11-11 17:14 ` [PATCH 1/2] staging: vchiq: Move retrieval of rpi_firmware to vchiq_platform_init() Marcelo Diop-Gonzalez
2019-11-12 23:09   ` Greg KH
2019-11-12 23:29     ` Marcelo Diop-Gonzalez
2019-11-13  5:32       ` Greg KH
2019-11-13 14:08         ` Marcelo Diop-Gonzalez
2019-11-13 20:29     ` Marcelo Diop-Gonzalez
2019-11-13 18:17   ` Dan Carpenter
2019-11-13 19:58     ` Marcelo Diop-Gonzalez
2019-11-11 17:14 ` Marcelo Diop-Gonzalez [this message]
2019-11-13 18:18   ` [PATCH 2/2] staging: vchiq: Remove global bcm*_drvdata Dan Carpenter
2019-11-13 18:40   ` Stefan Wahren
2019-11-13 19:56     ` Marcelo Diop-Gonzalez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfad5318dbecc1705416a554dc806a99069247b0.1573482698.git.marcgonzalez@google.com \
    --to=marcgonzalez@google.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=eric@anholt.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=wahrenst@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).