All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: eric.auger@st.com, eric.auger@linaro.org,
	christoffer.dall@linaro.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	alex.williamson@redhat.com, b.reynal@virtualopensystems.com
Cc: linux-kernel@vger.kernel.org, patches@linaro.org, agraf@suse.de,
	Bharat.Bhushan@freescale.com
Subject: [PATCH 2/5] VFIO: platform: add get_device callback
Date: Thu,  7 May 2015 16:27:20 +0200	[thread overview]
Message-ID: <1431008843-28411-3-git-send-email-eric.auger@linaro.org> (raw)
In-Reply-To: <1431008843-28411-1-git-send-email-eric.auger@linaro.org>

It is needed to introduce a new callback enabling to retrieve the
struct device* from the vfio_platform_device. Implementation depends
on the underlying device, platform or amba. This will be used to retrieve
the compatibility string of the device.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 drivers/vfio/platform/vfio_amba.c             |  9 +++++++++
 drivers/vfio/platform/vfio_platform.c         | 10 ++++++++++
 drivers/vfio/platform/vfio_platform_private.h |  1 +
 3 files changed, 20 insertions(+)

diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
index ff0331f..fd68115 100644
--- a/drivers/vfio/platform/vfio_amba.c
+++ b/drivers/vfio/platform/vfio_amba.c
@@ -48,6 +48,14 @@ static int get_amba_irq(struct vfio_platform_device *vdev, int i)
 	return ret ? ret : -ENXIO;
 }
 
+static struct device *vfio_amba_get_device(struct vfio_platform_device *vdev)
+{
+	struct amba_device *pdev = (struct amba_device *) vdev->opaque;
+	struct device *dev = &pdev->dev;
+
+	return dev;
+}
+
 static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
 {
 	struct vfio_platform_device *vdev;
@@ -67,6 +75,7 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
 	vdev->flags = VFIO_DEVICE_FLAGS_AMBA;
 	vdev->get_resource = get_amba_resource;
 	vdev->get_irq = get_amba_irq;
+	vdev->get_device = vfio_amba_get_device;
 
 	ret = vfio_platform_probe_common(vdev, &adev->dev);
 	if (ret) {
diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c
index cef645c..c025d76 100644
--- a/drivers/vfio/platform/vfio_platform.c
+++ b/drivers/vfio/platform/vfio_platform.c
@@ -51,6 +51,15 @@ static int get_platform_irq(struct vfio_platform_device *vdev, int i)
 	return platform_get_irq(pdev, i);
 }
 
+static struct device *vfio_platform_get_device(
+				struct vfio_platform_device *vdev)
+{
+	struct platform_device *pdev = (struct platform_device *) vdev->opaque;
+	struct device *dev = &pdev->dev;
+
+	return dev;
+}
+
 static int vfio_platform_probe(struct platform_device *pdev)
 {
 	struct vfio_platform_device *vdev;
@@ -65,6 +74,7 @@ static int vfio_platform_probe(struct platform_device *pdev)
 	vdev->flags = VFIO_DEVICE_FLAGS_PLATFORM;
 	vdev->get_resource = get_platform_resource;
 	vdev->get_irq = get_platform_irq;
+	vdev->get_device = vfio_platform_get_device;
 
 	ret = vfio_platform_probe_common(vdev, &pdev->dev);
 	if (ret)
diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h
index da2d60b..68909a4 100644
--- a/drivers/vfio/platform/vfio_platform_private.h
+++ b/drivers/vfio/platform/vfio_platform_private.h
@@ -67,6 +67,7 @@ struct vfio_platform_device {
 	struct resource*
 		(*get_resource)(struct vfio_platform_device *vdev, int i);
 	int	(*get_irq)(struct vfio_platform_device *vdev, int i);
+	struct device *(*get_device)(struct vfio_platform_device *vdev);
 };
 
 typedef int (*vfio_platform_reset_fn_t)(struct vfio_platform_device *vdev);
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: eric.auger@linaro.org (Eric Auger)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] VFIO: platform: add get_device callback
Date: Thu,  7 May 2015 16:27:20 +0200	[thread overview]
Message-ID: <1431008843-28411-3-git-send-email-eric.auger@linaro.org> (raw)
In-Reply-To: <1431008843-28411-1-git-send-email-eric.auger@linaro.org>

It is needed to introduce a new callback enabling to retrieve the
struct device* from the vfio_platform_device. Implementation depends
on the underlying device, platform or amba. This will be used to retrieve
the compatibility string of the device.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 drivers/vfio/platform/vfio_amba.c             |  9 +++++++++
 drivers/vfio/platform/vfio_platform.c         | 10 ++++++++++
 drivers/vfio/platform/vfio_platform_private.h |  1 +
 3 files changed, 20 insertions(+)

diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
index ff0331f..fd68115 100644
--- a/drivers/vfio/platform/vfio_amba.c
+++ b/drivers/vfio/platform/vfio_amba.c
@@ -48,6 +48,14 @@ static int get_amba_irq(struct vfio_platform_device *vdev, int i)
 	return ret ? ret : -ENXIO;
 }
 
+static struct device *vfio_amba_get_device(struct vfio_platform_device *vdev)
+{
+	struct amba_device *pdev = (struct amba_device *) vdev->opaque;
+	struct device *dev = &pdev->dev;
+
+	return dev;
+}
+
 static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
 {
 	struct vfio_platform_device *vdev;
@@ -67,6 +75,7 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
 	vdev->flags = VFIO_DEVICE_FLAGS_AMBA;
 	vdev->get_resource = get_amba_resource;
 	vdev->get_irq = get_amba_irq;
+	vdev->get_device = vfio_amba_get_device;
 
 	ret = vfio_platform_probe_common(vdev, &adev->dev);
 	if (ret) {
diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c
index cef645c..c025d76 100644
--- a/drivers/vfio/platform/vfio_platform.c
+++ b/drivers/vfio/platform/vfio_platform.c
@@ -51,6 +51,15 @@ static int get_platform_irq(struct vfio_platform_device *vdev, int i)
 	return platform_get_irq(pdev, i);
 }
 
+static struct device *vfio_platform_get_device(
+				struct vfio_platform_device *vdev)
+{
+	struct platform_device *pdev = (struct platform_device *) vdev->opaque;
+	struct device *dev = &pdev->dev;
+
+	return dev;
+}
+
 static int vfio_platform_probe(struct platform_device *pdev)
 {
 	struct vfio_platform_device *vdev;
@@ -65,6 +74,7 @@ static int vfio_platform_probe(struct platform_device *pdev)
 	vdev->flags = VFIO_DEVICE_FLAGS_PLATFORM;
 	vdev->get_resource = get_platform_resource;
 	vdev->get_irq = get_platform_irq;
+	vdev->get_device = vfio_platform_get_device;
 
 	ret = vfio_platform_probe_common(vdev, &pdev->dev);
 	if (ret)
diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h
index da2d60b..68909a4 100644
--- a/drivers/vfio/platform/vfio_platform_private.h
+++ b/drivers/vfio/platform/vfio_platform_private.h
@@ -67,6 +67,7 @@ struct vfio_platform_device {
 	struct resource*
 		(*get_resource)(struct vfio_platform_device *vdev, int i);
 	int	(*get_irq)(struct vfio_platform_device *vdev, int i);
+	struct device *(*get_device)(struct vfio_platform_device *vdev);
 };
 
 typedef int (*vfio_platform_reset_fn_t)(struct vfio_platform_device *vdev);
-- 
1.9.1

  parent reply	other threads:[~2015-05-07 14:30 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07 14:27 [PATCH 0/5] VFIO platform reset Eric Auger
2015-05-07 14:27 ` Eric Auger
2015-05-07 14:27 ` [PATCH 1/5] VFIO: platform: add reset_list and register/unregister functions Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-13 18:32   ` Alex Williamson
2015-05-13 18:32     ` Alex Williamson
2015-05-13 18:32     ` Alex Williamson
2015-05-14  8:25     ` Eric Auger
2015-05-14  8:25       ` Eric Auger
2015-05-14  8:25       ` Eric Auger
2015-05-14 15:42       ` Alex Williamson
2015-05-14 15:42         ` Alex Williamson
2015-05-07 14:27 ` Eric Auger [this message]
2015-05-07 14:27   ` [PATCH 2/5] VFIO: platform: add get_device callback Eric Auger
2015-05-13 18:32   ` Alex Williamson
2015-05-13 18:32     ` Alex Williamson
2015-05-14  8:28     ` Eric Auger
2015-05-14  8:28       ` Eric Auger
2015-05-14  8:28       ` Eric Auger
2015-05-07 14:27 ` [PATCH 3/5] VFIO: platform: add reset callback Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-13 18:32   ` Alex Williamson
2015-05-13 18:32     ` Alex Williamson
2015-05-13 18:32     ` Alex Williamson
2015-05-14  8:39     ` Eric Auger
2015-05-14  8:39       ` Eric Auger
2015-05-14  8:39       ` Eric Auger
2015-05-07 14:27 ` [PATCH 4/5] VFIO: platform: populate reset function according to compat Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-13 18:33   ` Alex Williamson
2015-05-13 18:33     ` Alex Williamson
2015-05-13 18:33     ` Alex Williamson
2015-05-14  8:57     ` Eric Auger
2015-05-14  8:57       ` Eric Auger
2015-05-14  8:57       ` Eric Auger
2015-05-14 15:30       ` Alex Williamson
2015-05-14 15:30         ` Alex Williamson
2015-05-07 14:27 ` [PATCH 5/5] VFIO: platform: VFIO platform Calxeda xgmac reset module Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-07 14:27   ` Eric Auger
2015-05-13 18:33   ` Alex Williamson
2015-05-13 18:33     ` Alex Williamson
2015-05-13 18:33     ` Alex Williamson
2015-05-14  9:06     ` Eric Auger
2015-05-14  9:06       ` Eric Auger
2015-05-14  9:06       ` Eric Auger
2015-05-14 15:14       ` Alex Williamson
2015-05-14 15:14         ` Alex Williamson
2015-05-15 13:35         ` Eric Auger
2015-05-15 13:35           ` Eric Auger
2015-05-15 13:35           ` Eric Auger

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=1431008843-28411-3-git-send-email-eric.auger@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=b.reynal@virtualopensystems.com \
    --cc=christoffer.dall@linaro.org \
    --cc=eric.auger@st.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@linaro.org \
    /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.