[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71d9aa58-e166-419b-9d32-839f5c4ad62c@redhat.com>
Date: Mon, 14 Jul 2025 16:36:42 +0200
From: Hans de Goede <hdegoede@...hat.com>
To: Ricardo Ribalda <ribalda@...omium.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>, Hans Verkuil
<hverkuil@...all.nl>, Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Linus Walleij
<linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
"Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, devicetree@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v2 08/12] media: uvcvideo: Add support for
V4L2_CID_CAMERA_ORIENTATION
Hi,
On 5-Jun-25 19:53, Ricardo Ribalda wrote:
> Fetch the orientation from the fwnode and map it into a control.
>
> The uvc driver does not use the media controller, so we need to create a
> virtual entity, like we previously did with the external gpio.
>
> We do not re-purpose the external gpio entity because its is planned to
> remove it.
>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
...
Taking a second look at this I noticed the following:
> @@ -1869,11 +1869,15 @@ static int uvc_scan_device(struct uvc_device *dev)
> return -1;
> }
>
> - /* Add GPIO entity to the first chain. */
> - if (dev->gpio_unit) {
> + /* Add virtual entities to the first chain. */
> + if (dev->gpio_unit || dev->swentity_unit) {
> chain = list_first_entry(&dev->chains,
> struct uvc_video_chain, list);
> - list_add_tail(&dev->gpio_unit->chain, &chain->entities);
> + if (dev->gpio_unit)
> + list_add_tail(&dev->gpio_unit->chain, &chain->entities);
> + if (dev->swentity_unit)
> + list_add_tail(&dev->swentity_unit->chain,
> + &chain->entities);
> }
>
> return 0;
The double checking of if (dev->gpio_unit) / if (dev->swentity_unit) looks
unnecessary here list_first_entry() is pretty cheap and this only runs
once at probe() time. So maybe:
/* Add virtual entities to the first chain. */
chain = list_first_entry(&dev->chains, struct uvc_video_chain, list);
if (dev->gpio_unit)
list_add_tail(&dev->gpio_unit->chain, &chain->entities);
if (dev->swentity_unit)
list_add_tail(&dev->swentity_unit->chain, &chain->entities);
?
...
Regards,
Hans
Powered by blists - more mailing lists