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

Configure Feed

Select the types of activity you want to include in your feed.

media: qcom: camss: change internals of endpoint parsing to fwnode handling

Since a few called V4L2 functions operate with fwnode arguments the change
from OF device nodes to fwnodes brings a simplification to the code.

The camss_parse_endpoint_node() function is called once by camss_probe(),
and there is no use of knowing a number of asynchronously registered
remote devices, so it makes sense to remove the related computation from
the function.

Tested-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Vladimir Zapolskiy and committed by
Hans Verkuil
eccf5fa8 d965919a

+23 -26
+23 -26
drivers/media/platform/qcom/camss/camss.c
··· 4206 4206 }; 4207 4207 4208 4208 /* 4209 - * camss_of_parse_endpoint_node - Parse port endpoint node 4210 - * @dev: Device 4211 - * @node: Device node to be parsed 4209 + * camss_parse_endpoint_node - Parse port endpoint node 4210 + * @dev: CAMSS device 4211 + * @ep: Device endpoint to be parsed 4212 4212 * @csd: Parsed data from port endpoint node 4213 4213 * 4214 4214 * Return 0 on success or a negative error code on failure 4215 4215 */ 4216 - static int camss_of_parse_endpoint_node(struct device *dev, 4217 - struct device_node *node, 4218 - struct camss_async_subdev *csd) 4216 + static int camss_parse_endpoint_node(struct device *dev, 4217 + struct fwnode_handle *ep, 4218 + struct camss_async_subdev *csd) 4219 4219 { 4220 4220 struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg; 4221 4221 struct v4l2_mbus_config_mipi_csi2 *mipi_csi2; ··· 4223 4223 unsigned int i; 4224 4224 int ret; 4225 4225 4226 - ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep); 4226 + ret = v4l2_fwnode_endpoint_parse(ep, &vep); 4227 4227 if (ret) 4228 4228 return ret; 4229 4229 ··· 4258 4258 } 4259 4259 4260 4260 /* 4261 - * camss_of_parse_ports - Parse ports node 4262 - * @dev: Device 4263 - * @notifier: v4l2_device notifier data 4261 + * camss_parse_ports - Parse ports node 4262 + * @dev: CAMSS device 4264 4263 * 4265 - * Return number of "port" nodes found in "ports" node 4264 + * Return 0 on success or a negative error code on failure 4266 4265 */ 4267 - static int camss_of_parse_ports(struct camss *camss) 4266 + static int camss_parse_ports(struct camss *camss) 4268 4267 { 4269 4268 struct device *dev = camss->dev; 4270 - struct device_node *node = NULL; 4271 - struct device_node *remote = NULL; 4272 - int ret, num_subdevs = 0; 4269 + struct fwnode_handle *fwnode = dev_fwnode(dev), *ep; 4270 + int ret; 4273 4271 4274 - for_each_endpoint_of_node(dev->of_node, node) { 4272 + fwnode_graph_for_each_endpoint(fwnode, ep) { 4275 4273 struct camss_async_subdev *csd; 4274 + struct fwnode_handle *remote; 4276 4275 4277 - remote = of_graph_get_remote_port_parent(node); 4276 + remote = fwnode_graph_get_remote_port_parent(ep); 4278 4277 if (!remote) { 4279 4278 dev_err(dev, "Cannot get remote parent\n"); 4280 4279 ret = -EINVAL; 4281 4280 goto err_cleanup; 4282 4281 } 4283 4282 4284 - csd = v4l2_async_nf_add_fwnode(&camss->notifier, 4285 - of_fwnode_handle(remote), 4283 + csd = v4l2_async_nf_add_fwnode(&camss->notifier, remote, 4286 4284 struct camss_async_subdev); 4287 - of_node_put(remote); 4285 + fwnode_handle_put(remote); 4288 4286 if (IS_ERR(csd)) { 4289 4287 ret = PTR_ERR(csd); 4290 4288 goto err_cleanup; 4291 4289 } 4292 4290 4293 - ret = camss_of_parse_endpoint_node(dev, node, csd); 4291 + ret = camss_parse_endpoint_node(dev, ep, csd); 4294 4292 if (ret < 0) 4295 4293 goto err_cleanup; 4296 - 4297 - num_subdevs++; 4298 4294 } 4299 4295 4300 - return num_subdevs; 4296 + return 0; 4301 4297 4302 4298 err_cleanup: 4303 - of_node_put(node); 4299 + fwnode_handle_put(ep); 4300 + 4304 4301 return ret; 4305 4302 } 4306 4303 ··· 4854 4857 4855 4858 pm_runtime_enable(dev); 4856 4859 4857 - ret = camss_of_parse_ports(camss); 4860 + ret = camss_parse_ports(camss); 4858 4861 if (ret < 0) 4859 4862 goto err_v4l2_device_unregister; 4860 4863