All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [PATCH v2 2/7] drivers/base: Allow driver-data to be attached to a master
Date: Tue, 13 May 2014 17:30:45 +0200	[thread overview]
Message-ID: <1399995050-28435-3-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1399995050-28435-1-git-send-email-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

Similarly to what can be done for device drivers, allow driver-specific
data to be attached to a master. This is necessary for masters whose
device is already bound to by a different driver and therefore cannot be
used to store the driver-specific data.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Note that I'd like to merge this patch through the Tegra DRM tree so
that the Tegra DRM changes later in this patch can be merged at the same
time to avoid them being delayed for another release cycle.

In particular I'm looking for an Acked-by from Greg and Russell.

 drivers/base/component.c  | 13 +++++++++++++
 include/linux/component.h |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index c4778995cd72..fb4510707281 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -25,6 +25,8 @@ struct master {
 
 	const struct component_master_ops *ops;
 	struct device *dev;
+
+	void *drvdata;
 };
 
 struct component {
@@ -53,6 +55,17 @@ static struct master *__master_find(struct device *dev,
 	return NULL;
 }
 
+void master_set_drvdata(struct master *master, void *data)
+{
+	if (master)
+		master->drvdata = data;
+}
+
+void *master_get_drvdata(struct master *master)
+{
+	return master ? master->drvdata : NULL;
+}
+
 /* Attach an unattached component to a master. */
 static void component_attach_master(struct master *master, struct component *c)
 {
diff --git a/include/linux/component.h b/include/linux/component.h
index 68870182ca1e..f130b34b1575 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -26,6 +26,9 @@ int component_master_add(struct device *, const struct component_master_ops *);
 void component_master_del(struct device *,
 	const struct component_master_ops *);
 
+void master_set_drvdata(struct master *, void *);
+void *master_get_drvdata(struct master *);
+
 int component_master_add_child(struct master *master,
 	int (*compare)(struct device *, void *), void *compare_data);
 
-- 
1.9.2

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel@ffwll.ch>, Rob Clark <robdclark@gmail.com>,
	David Herrmann <dh.herrmann@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/7] drivers/base: Allow driver-data to be attached to a master
Date: Tue, 13 May 2014 17:30:45 +0200	[thread overview]
Message-ID: <1399995050-28435-3-git-send-email-thierry.reding@gmail.com> (raw)
In-Reply-To: <1399995050-28435-1-git-send-email-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

Similarly to what can be done for device drivers, allow driver-specific
data to be attached to a master. This is necessary for masters whose
device is already bound to by a different driver and therefore cannot be
used to store the driver-specific data.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Note that I'd like to merge this patch through the Tegra DRM tree so
that the Tegra DRM changes later in this patch can be merged at the same
time to avoid them being delayed for another release cycle.

In particular I'm looking for an Acked-by from Greg and Russell.

 drivers/base/component.c  | 13 +++++++++++++
 include/linux/component.h |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index c4778995cd72..fb4510707281 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -25,6 +25,8 @@ struct master {
 
 	const struct component_master_ops *ops;
 	struct device *dev;
+
+	void *drvdata;
 };
 
 struct component {
@@ -53,6 +55,17 @@ static struct master *__master_find(struct device *dev,
 	return NULL;
 }
 
+void master_set_drvdata(struct master *master, void *data)
+{
+	if (master)
+		master->drvdata = data;
+}
+
+void *master_get_drvdata(struct master *master)
+{
+	return master ? master->drvdata : NULL;
+}
+
 /* Attach an unattached component to a master. */
 static void component_attach_master(struct master *master, struct component *c)
 {
diff --git a/include/linux/component.h b/include/linux/component.h
index 68870182ca1e..f130b34b1575 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -26,6 +26,9 @@ int component_master_add(struct device *, const struct component_master_ops *);
 void component_master_del(struct device *,
 	const struct component_master_ops *);
 
+void master_set_drvdata(struct master *, void *);
+void *master_get_drvdata(struct master *);
+
 int component_master_add_child(struct master *master,
 	int (*compare)(struct device *, void *), void *compare_data);
 
-- 
1.9.2


  parent reply	other threads:[~2014-05-13 15:30 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 15:30 [PATCH v2 0/7] drm/tegra: Convert to master/component framework Thierry Reding
2014-05-13 15:30 ` Thierry Reding
2014-05-13 15:30 ` [PATCH v2 1/7] drm: Introduce drm_set_unique() Thierry Reding
2014-05-13 15:30   ` Thierry Reding
2014-05-13 15:46   ` David Herrmann
2014-05-13 15:46     ` David Herrmann
2014-05-13 15:30 ` Thierry Reding [this message]
2014-05-13 15:30   ` [PATCH v2 2/7] drivers/base: Allow driver-data to be attached to a master Thierry Reding
2014-05-13 15:30 ` [PATCH v2 3/7] drivers/base: Allow multiple masters per device Thierry Reding
2014-05-13 15:30   ` Thierry Reding
2014-05-13 15:30 ` [PATCH v2 4/7] drivers/base: Add interface framework Thierry Reding
2014-05-13 15:30   ` Thierry Reding
2014-05-13 17:57   ` Daniel Vetter
2014-05-13 17:57     ` Daniel Vetter
     [not found]     ` <20140513175713.GS3908-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2014-05-13 21:31       ` Thierry Reding
2014-05-13 21:31         ` Thierry Reding
2014-05-14 14:34         ` Daniel Vetter
2014-05-14 14:34           ` Daniel Vetter
2014-05-14 15:13           ` Thierry Reding
2014-05-14 15:13             ` Thierry Reding
2014-05-14  0:32     ` Greg Kroah-Hartman
2014-05-14 14:37       ` Daniel Vetter
2014-05-14 14:37         ` Daniel Vetter
2014-05-14 17:22         ` Greg Kroah-Hartman
     [not found]       ` <20140514003215.GA21520-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-05-15  8:53         ` Thierry Reding
2014-05-15  8:53           ` Thierry Reding
2014-05-20  9:27           ` Andrzej Hajda
2014-05-13 15:30 ` [PATCH v2 5/7] drm/tegra: Convert to master/component framework Thierry Reding
2014-05-13 15:30   ` Thierry Reding
     [not found]   ` <1399995050-28435-6-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-19  8:56     ` Christian Gmeiner
2014-05-19  8:56       ` Christian Gmeiner
2014-05-19 15:25       ` Thierry Reding
2014-05-19 15:25         ` Thierry Reding
2014-05-13 15:30 ` [PATCH v2 6/7] drm: Add device registration documentation Thierry Reding
2014-05-13 15:30   ` Thierry Reding
2014-05-13 17:59   ` Daniel Vetter
2014-05-13 17:59     ` Daniel Vetter
2014-05-13 15:30 ` [PATCH v2 7/7] drm: Document how to register devices without struct drm_bus Thierry Reding
2014-05-13 15:30   ` Thierry Reding
2014-05-13 15:55   ` David Herrmann
2014-05-13 15:55     ` David Herrmann
2014-05-22  9:56 ` [PATCH v2 0/7] drm/tegra: Convert to master/component framework Thierry Reding
2014-05-22  9:56   ` Thierry Reding
2014-05-23 11:03   ` Greg Kroah-Hartman
2014-05-23 11:03     ` Greg Kroah-Hartman
2014-05-25 11:45     ` Thierry Reding
2014-05-25 11:45       ` Thierry Reding

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=1399995050-28435-3-git-send-email-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.