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

staging: media: atmel: use for_each_endpoint_of_node()

We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Kuninori Morimoto and committed by
Hans Verkuil
d2f035ef 18f9ca7e

+6 -14
+3 -7
drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
··· 333 333 static int isc_parse_dt(struct device *dev, struct isc_device *isc) 334 334 { 335 335 struct device_node *np = dev->of_node; 336 - struct device_node *epn = NULL; 336 + struct device_node *epn; 337 337 struct isc_subdev_entity *subdev_entity; 338 338 unsigned int flags; 339 - int ret; 339 + int ret = -EINVAL; 340 340 341 341 INIT_LIST_HEAD(&isc->subdev_entities); 342 342 343 - while (1) { 343 + for_each_endpoint_of_node(np, epn) { 344 344 struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 }; 345 - 346 - epn = of_graph_get_next_endpoint(np, epn); 347 - if (!epn) 348 - return 0; 349 345 350 346 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn), 351 347 &v4l2_epn);
+3 -7
drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
··· 316 316 static int xisc_parse_dt(struct device *dev, struct isc_device *isc) 317 317 { 318 318 struct device_node *np = dev->of_node; 319 - struct device_node *epn = NULL; 319 + struct device_node *epn; 320 320 struct isc_subdev_entity *subdev_entity; 321 321 unsigned int flags; 322 - int ret; 322 + int ret = -EINVAL; 323 323 bool mipi_mode; 324 324 325 325 INIT_LIST_HEAD(&isc->subdev_entities); 326 326 327 327 mipi_mode = of_property_read_bool(np, "microchip,mipi-mode"); 328 328 329 - while (1) { 329 + for_each_endpoint_of_node(np, epn) { 330 330 struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 }; 331 - 332 - epn = of_graph_get_next_endpoint(np, epn); 333 - if (!epn) 334 - return 0; 335 331 336 332 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn), 337 333 &v4l2_epn);