linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Rob Clark <robdclark@gmail.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Saravana Kannan <saravanak@google.com>
Subject: [PATCH 5/7] component: Use dev.parent instead of adev->parent
Date: Wed, 19 May 2021 17:25:17 -0700	[thread overview]
Message-ID: <20210520002519.3538432-6-swboyd@chromium.org> (raw)
In-Reply-To: <20210520002519.3538432-1-swboyd@chromium.org>

We left this in place to ease the code diff, but now we can remove it
because the aggregate device parent pointer is the same.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/base/component.c | 37 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index a6c0bb7ccdbc..155aab7eefa6 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -64,7 +64,6 @@ struct component_match {
 
 struct aggregate_device {
 	const struct component_master_ops *ops;
-	struct device *parent;
 	struct device dev;
 	struct component_match *match;
 
@@ -105,7 +104,7 @@ static int component_devices_show(struct seq_file *s, void *data)
 	seq_printf(s, "%-40s %20s\n", "aggregate_device name", "status");
 	seq_puts(s, "-------------------------------------------------------------\n");
 	seq_printf(s, "%-40s %20s\n\n",
-		   dev_name(m->parent), m->dev.driver ? "bound" : "not bound");
+		   dev_name(m->dev.parent), m->dev.driver ? "bound" : "not bound");
 
 	seq_printf(s, "%-40s %20s\n", "device name", "status");
 	seq_puts(s, "-------------------------------------------------------------\n");
@@ -134,13 +133,13 @@ core_initcall(component_debug_init);
 
 static void component_master_debugfs_add(struct aggregate_device *m)
 {
-	debugfs_create_file(dev_name(m->parent), 0444, component_debugfs_dir, m,
+	debugfs_create_file(dev_name(m->dev.parent), 0444, component_debugfs_dir, m,
 			    &component_devices_fops);
 }
 
 static void component_master_debugfs_del(struct aggregate_device *m)
 {
-	debugfs_remove(debugfs_lookup(dev_name(m->parent), component_debugfs_dir));
+	debugfs_remove(debugfs_lookup(dev_name(m->dev.parent), component_debugfs_dir));
 }
 
 #else
@@ -203,7 +202,7 @@ static int find_components(struct aggregate_device *adev)
 		struct component_match_array *mc = &match->compare[i];
 		struct component *c;
 
-		dev_dbg(adev->parent, "Looking for component %zu\n", i);
+		dev_dbg(adev->dev.parent, "Looking for component %zu\n", i);
 
 		if (match->compare[i].component)
 			continue;
@@ -212,7 +211,7 @@ static int find_components(struct aggregate_device *adev)
 		if (!c)
 			return 0;
 
-		dev_dbg(adev->parent, "found component %s, duplicate %u\n",
+		dev_dbg(adev->dev.parent, "found component %s, duplicate %u\n",
 			dev_name(c->dev), !!c->adev);
 
 		/* Attach this component to the adev */
@@ -420,12 +419,12 @@ static int aggregate_device_match(struct device *dev, struct device_driver *drv)
 /* TODO: Remove once all aggregate drivers use component_aggregate_register() */
 static int component_probe_bind(struct aggregate_device *adev)
 {
-	return adev->ops->bind(adev->parent);
+	return adev->ops->bind(adev->dev.parent);
 }
 
 static void component_remove_unbind(struct aggregate_device *adev)
 {
-	adev->ops->unbind(adev->parent);
+	adev->ops->unbind(adev->dev.parent);
 }
 
 static int aggregate_driver_probe(struct device *dev)
@@ -443,7 +442,7 @@ static int aggregate_driver_probe(struct device *dev)
 	}
 
 	mutex_lock(&component_mutex);
-	if (devres_open_group(adev->parent, NULL, GFP_KERNEL)) {
+	if (devres_open_group(adev->dev.parent, NULL, GFP_KERNEL)) {
 		ret = adrv->probe(adev);
 		if (ret)
 			devres_release_group(dev->parent, NULL);
@@ -549,8 +548,6 @@ static struct aggregate_device *aggregate_device_add(struct device *parent,
 	}
 
 	adev->id = id;
-	adev->parent = parent;
-
 	adev->dev.parent = parent;
 	adev->dev.bus = &aggregate_bus_type;
 	adev->dev.release = aggregate_device_release;
@@ -709,7 +706,7 @@ static void component_unbind(struct component *component,
 	WARN_ON(!component->bound);
 
 	if (component->ops && component->ops->unbind)
-		component->ops->unbind(component->dev, adev->parent, data);
+		component->ops->unbind(component->dev, adev->dev.parent, data);
 	component->bound = false;
 
 	/* Release all resources claimed in the binding of this component */
@@ -758,7 +755,7 @@ static int component_bind(struct component *component, struct aggregate_device *
 	 * This allows us to roll-back a failed component without
 	 * affecting anything else.
 	 */
-	if (!devres_open_group(adev->parent, NULL, GFP_KERNEL))
+	if (!devres_open_group(adev->dev.parent, NULL, GFP_KERNEL))
 		return -ENOMEM;
 
 	/*
@@ -767,14 +764,14 @@ static int component_bind(struct component *component, struct aggregate_device *
 	 * at the appropriate moment.
 	 */
 	if (!devres_open_group(component->dev, component, GFP_KERNEL)) {
-		devres_release_group(adev->parent, NULL);
+		devres_release_group(adev->dev.parent, NULL);
 		return -ENOMEM;
 	}
 
-	dev_dbg(adev->parent, "binding %s (ops %ps)\n",
+	dev_dbg(adev->dev.parent, "binding %s (ops %ps)\n",
 		dev_name(component->dev), component->ops);
 
-	ret = component->ops->bind(component->dev, adev->parent, data);
+	ret = component->ops->bind(component->dev, adev->dev.parent, data);
 	if (!ret) {
 		component->bound = true;
 
@@ -785,16 +782,16 @@ static int component_bind(struct component *component, struct aggregate_device *
 		 * can clean those resources up independently.
 		 */
 		devres_close_group(component->dev, NULL);
-		devres_remove_group(adev->parent, NULL);
+		devres_remove_group(adev->dev.parent, NULL);
 
-		dev_info(adev->parent, "bound %s (ops %ps)\n",
+		dev_info(adev->dev.parent, "bound %s (ops %ps)\n",
 			 dev_name(component->dev), component->ops);
 	} else {
 		devres_release_group(component->dev, NULL);
-		devres_release_group(adev->parent, NULL);
+		devres_release_group(adev->dev.parent, NULL);
 
 		if (ret != -EPROBE_DEFER)
-			dev_err(adev->parent, "failed to bind %s (ops %ps): %d\n",
+			dev_err(adev->dev.parent, "failed to bind %s (ops %ps): %d\n",
 				dev_name(component->dev), component->ops, ret);
 	}
 
-- 
https://chromeos.dev


  parent reply	other threads:[~2021-05-20  0:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20  0:25 [PATCH 0/7] component: Make into an aggregate bus Stephen Boyd
2021-05-20  0:25 ` [PATCH 1/7] component: Drop 'dev' argument to component_match_realloc() Stephen Boyd
2021-05-20  0:25 ` [PATCH 2/7] component: Rename 'dev' to 'parent' Stephen Boyd
2021-05-20  0:25 ` [PATCH 3/7] component: Introduce struct aggregate_device Stephen Boyd
2021-05-20 20:20   ` Saravana Kannan
2021-05-24  6:01     ` Stephen Boyd
2021-05-20  0:25 ` [PATCH 4/7] component: Introduce the aggregate bus_type Stephen Boyd
2021-05-20  0:25 ` Stephen Boyd [this message]
2021-05-20  0:25 ` [PATCH 6/7] component: Move struct aggregate_device out to header file Stephen Boyd
2021-05-20  0:25 ` [PATCH 7/7] drm/msm: Migrate to aggregate driver Stephen Boyd
2021-05-20 19:58   ` Daniel Vetter
2021-05-20 20:22     ` Saravana Kannan
2021-05-24  6:45     ` Stephen Boyd
2021-05-20  1:27 ` [PATCH 0/7] component: Make into an aggregate bus Saravana Kannan
2021-05-20  1:41   ` Stephen Boyd
2021-05-20 19:30     ` Saravana Kannan
2021-05-20 20:03     ` Daniel Vetter

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=20210520002519.3538432-6-swboyd@chromium.org \
    --to=swboyd@chromium.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=robdclark@gmail.com \
    --cc=saravanak@google.com \
    --subject='Re: [PATCH 5/7] component: Use dev.parent instead of adev->parent' \
    /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

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).