Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: staging/imx: pass fwnode handle to find/add async subdev

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>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Steve Longerbeam and committed by
Mauro Carvalho Chehab
4eef678d 4dadf056

+15 -16
+10 -10
drivers/staging/media/imx/imx-media-dev.c
··· 33 33 } 34 34 35 35 /* 36 - * Find a subdev by device node or device name. This is called during 36 + * Find a subdev by fwnode or device name. This is called during 37 37 * driver load to form the async subdev list and bind them. 38 38 */ 39 39 struct imx_media_subdev * 40 40 imx_media_find_async_subdev(struct imx_media_dev *imxmd, 41 - struct device_node *np, 41 + struct fwnode_handle *fwnode, 42 42 const char *devname) 43 43 { 44 - struct fwnode_handle *fwnode = np ? of_fwnode_handle(np) : NULL; 45 44 struct imx_media_subdev *imxsd; 46 45 int i; 47 46 ··· 66 67 67 68 68 69 /* 69 - * Adds a subdev to the async subdev list. If np is non-NULL, adds 70 + * Adds a subdev to the async subdev list. If fwnode is non-NULL, adds 70 71 * the async as a V4L2_ASYNC_MATCH_FWNODE match type, otherwise as 71 72 * a V4L2_ASYNC_MATCH_DEVNAME match type using the dev_name of the 72 73 * given platform_device. This is called during driver load when ··· 74 75 */ 75 76 struct imx_media_subdev * 76 77 imx_media_add_async_subdev(struct imx_media_dev *imxmd, 77 - struct device_node *np, 78 + struct fwnode_handle *fwnode, 78 79 struct platform_device *pdev) 79 80 { 81 + struct device_node *np = to_of_node(fwnode); 80 82 struct imx_media_subdev *imxsd; 81 83 struct v4l2_async_subdev *asd; 82 84 const char *devname = NULL; ··· 89 89 devname = dev_name(&pdev->dev); 90 90 91 91 /* return -EEXIST if this subdev already added */ 92 - if (imx_media_find_async_subdev(imxmd, np, devname)) { 92 + if (imx_media_find_async_subdev(imxmd, fwnode, devname)) { 93 93 dev_dbg(imxmd->md.dev, "%s: already added %s\n", 94 94 __func__, np ? np->name : devname); 95 95 imxsd = ERR_PTR(-EEXIST); ··· 107 107 imxsd = &imxmd->subdev[sd_idx]; 108 108 109 109 asd = &imxsd->asd; 110 - if (np) { 110 + if (fwnode) { 111 111 asd->match_type = V4L2_ASYNC_MATCH_FWNODE; 112 - asd->match.fwnode.fwnode = of_fwnode_handle(np); 112 + asd->match.fwnode.fwnode = fwnode; 113 113 } else { 114 114 asd->match_type = V4L2_ASYNC_MATCH_DEVNAME; 115 115 asd->match.device_name.name = devname; ··· 162 162 struct v4l2_async_subdev *asd) 163 163 { 164 164 struct imx_media_dev *imxmd = notifier2dev(notifier); 165 - struct device_node *np = to_of_node(sd->fwnode); 166 165 struct imx_media_subdev *imxsd; 167 166 int ret = 0; 168 167 169 168 mutex_lock(&imxmd->mutex); 170 169 171 - imxsd = imx_media_find_async_subdev(imxmd, np, dev_name(sd->dev)); 170 + imxsd = imx_media_find_async_subdev(imxmd, sd->fwnode, 171 + dev_name(sd->dev)); 172 172 if (!imxsd) { 173 173 ret = -EINVAL; 174 174 goto out;
+3 -4
drivers/staging/media/imx/imx-media-of.c
··· 87 87 } 88 88 89 89 /* register this subdev with async notifier */ 90 - imxsd = imx_media_add_async_subdev(imxmd, sd_np, NULL); 90 + imxsd = imx_media_add_async_subdev(imxmd, of_fwnode_handle(sd_np), 91 + NULL); 91 92 ret = PTR_ERR_OR_ZERO(imxsd); 92 93 if (ret) { 93 94 if (ret == -EEXIST) { ··· 177 176 if (link->local_port >= sd->entity.num_pads) 178 177 return -EINVAL; 179 178 180 - remote = imx_media_find_async_subdev(imxmd, 181 - to_of_node(link->remote_node), 182 - NULL); 179 + remote = imx_media_find_async_subdev(imxmd, link->remote_node, NULL); 183 180 if (!remote) 184 181 return 0; 185 182
+2 -2
drivers/staging/media/imx/imx-media.h
··· 189 189 190 190 struct imx_media_subdev * 191 191 imx_media_find_async_subdev(struct imx_media_dev *imxmd, 192 - struct device_node *np, 192 + struct fwnode_handle *fwnode, 193 193 const char *devname); 194 194 struct imx_media_subdev * 195 195 imx_media_add_async_subdev(struct imx_media_dev *imxmd, 196 - struct device_node *np, 196 + struct fwnode_handle *fwnode, 197 197 struct platform_device *pdev); 198 198 199 199 void imx_media_grp_id_to_sd_name(char *sd_name, int sz,