From: Steve Longerbeam <slongerbeam@gmail.com>
To: Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org,
Russell King <rmk+kernel@armlinux.org.uk>,
Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: [PATCH 5/9] media: staging/imx: pass fwnode handle to find/add async subdev
Date: Sat, 28 Oct 2017 13:36:45 -0700 [thread overview]
Message-ID: <1509223009-6392-6-git-send-email-steve_longerbeam@mentor.com> (raw)
In-Reply-To: <1509223009-6392-1-git-send-email-steve_longerbeam@mentor.com>
Pass the subdev's fwnode_handle to imx_media_find_async_subdev() and
imx_media_add_async_subdev(), instead of a device_node.
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
drivers/staging/media/imx/imx-media-dev.c | 20 ++++++++++----------
drivers/staging/media/imx/imx-media-of.c | 7 +++----
drivers/staging/media/imx/imx-media.h | 4 ++--
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c
index b948ce8..eba8560 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -33,15 +33,14 @@ static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n)
}
/*
- * Find a subdev by device node or device name. This is called during
+ * Find a subdev by fwnode or device name. This is called during
* driver load to form the async subdev list and bind them.
*/
struct imx_media_subdev *
imx_media_find_async_subdev(struct imx_media_dev *imxmd,
- struct device_node *np,
+ struct fwnode_handle *fwnode,
const char *devname)
{
- struct fwnode_handle *fwnode = np ? of_fwnode_handle(np) : NULL;
struct imx_media_subdev *imxsd;
int i;
@@ -67,7 +66,7 @@ imx_media_find_async_subdev(struct imx_media_dev *imxmd,
/*
- * Adds a subdev to the async subdev list. If np is non-NULL, adds
+ * Adds a subdev to the async subdev list. If fwnode is non-NULL, adds
* the async as a V4L2_ASYNC_MATCH_FWNODE match type, otherwise as
* a V4L2_ASYNC_MATCH_DEVNAME match type using the dev_name of the
* given platform_device. This is called during driver load when
@@ -75,9 +74,10 @@ imx_media_find_async_subdev(struct imx_media_dev *imxmd,
*/
struct imx_media_subdev *
imx_media_add_async_subdev(struct imx_media_dev *imxmd,
- struct device_node *np,
+ struct fwnode_handle *fwnode,
struct platform_device *pdev)
{
+ struct device_node *np = to_of_node(fwnode);
struct imx_media_subdev *imxsd;
struct v4l2_async_subdev *asd;
const char *devname = NULL;
@@ -89,7 +89,7 @@ imx_media_add_async_subdev(struct imx_media_dev *imxmd,
devname = dev_name(&pdev->dev);
/* return -EEXIST if this subdev already added */
- if (imx_media_find_async_subdev(imxmd, np, devname)) {
+ if (imx_media_find_async_subdev(imxmd, fwnode, devname)) {
dev_dbg(imxmd->md.dev, "%s: already added %s\n",
__func__, np ? np->name : devname);
imxsd = ERR_PTR(-EEXIST);
@@ -107,9 +107,9 @@ imx_media_add_async_subdev(struct imx_media_dev *imxmd,
imxsd = &imxmd->subdev[sd_idx];
asd = &imxsd->asd;
- if (np) {
+ if (fwnode) {
asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
- asd->match.fwnode.fwnode = of_fwnode_handle(np);
+ asd->match.fwnode.fwnode = fwnode;
} else {
asd->match_type = V4L2_ASYNC_MATCH_DEVNAME;
asd->match.device_name.name = devname;
@@ -162,13 +162,13 @@ static int imx_media_subdev_bound(struct v4l2_async_notifier *notifier,
struct v4l2_async_subdev *asd)
{
struct imx_media_dev *imxmd = notifier2dev(notifier);
- struct device_node *np = to_of_node(sd->fwnode);
struct imx_media_subdev *imxsd;
int ret = 0;
mutex_lock(&imxmd->mutex);
- imxsd = imx_media_find_async_subdev(imxmd, np, dev_name(sd->dev));
+ imxsd = imx_media_find_async_subdev(imxmd, sd->fwnode,
+ dev_name(sd->dev));
if (!imxsd) {
ret = -EINVAL;
goto out;
diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c
index a085e52..eb7a7f2 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -87,7 +87,8 @@ of_parse_subdev(struct imx_media_dev *imxmd, struct device_node *sd_np,
}
/* register this subdev with async notifier */
- imxsd = imx_media_add_async_subdev(imxmd, sd_np, NULL);
+ imxsd = imx_media_add_async_subdev(imxmd, of_fwnode_handle(sd_np),
+ NULL);
ret = PTR_ERR_OR_ZERO(imxsd);
if (ret) {
if (ret == -EEXIST) {
@@ -176,9 +177,7 @@ static int create_of_link(struct imx_media_dev *imxmd,
if (link->local_port >= sd->entity.num_pads)
return -EINVAL;
- remote = imx_media_find_async_subdev(imxmd,
- to_of_node(link->remote_node),
- NULL);
+ remote = imx_media_find_async_subdev(imxmd, link->remote_node, NULL);
if (!remote)
return 0;
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 299d4df..b208af41 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -189,11 +189,11 @@ int imx_media_ipu_image_to_mbus_fmt(struct v4l2_mbus_framefmt *mbus,
struct imx_media_subdev *
imx_media_find_async_subdev(struct imx_media_dev *imxmd,
- struct device_node *np,
+ struct fwnode_handle *fwnode,
const char *devname);
struct imx_media_subdev *
imx_media_add_async_subdev(struct imx_media_dev *imxmd,
- struct device_node *np,
+ struct fwnode_handle *fwnode,
struct platform_device *pdev);
void imx_media_grp_id_to_sd_name(char *sd_name, int sz,
--
2.7.4
next prev parent reply other threads:[~2017-10-28 20:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-28 20:36 [PATCH 0/9] media: imx: Add better OF graph support Steve Longerbeam
2017-10-28 20:36 ` [PATCH 1/9] media: staging/imx: get CSI bus type from nearest upstream entity Steve Longerbeam
2017-10-28 20:36 ` [PATCH 2/9] media: staging/imx: remove static media link arrays Steve Longerbeam
2017-10-28 20:36 ` [PATCH 3/9] media: staging/imx: of: allow for recursing downstream Steve Longerbeam
2017-10-28 20:36 ` [PATCH 4/9] media: staging/imx: remove devname string from imx_media_subdev Steve Longerbeam
2017-10-28 20:36 ` Steve Longerbeam [this message]
2017-10-28 20:36 ` [PATCH 6/9] media: staging/imx: remove static subdev arrays Steve Longerbeam
2017-10-28 20:36 ` [PATCH 7/9] media: staging/imx: convert static vdev lists to list_head Steve Longerbeam
2017-10-28 20:36 ` [PATCH 8/9] media: staging/imx: reorder function prototypes Steve Longerbeam
2017-10-28 20:36 ` [PATCH 9/9] media: staging/imx: update TODO Steve Longerbeam
2017-12-04 13:44 ` [PATCH 0/9] media: imx: Add better OF graph support Hans Verkuil
2017-12-07 23:23 ` Steve Longerbeam
2017-12-08 1:05 ` Steve Longerbeam
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=1509223009-6392-6-git-send-email-steve_longerbeam@mentor.com \
--to=slongerbeam@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=rmk+kernel@armlinux.org.uk \
--cc=steve_longerbeam@mentor.com \
/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
all inboxes | Powered by JetHome®