linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Michael Grzeschik <m.grzeschik@pengutronix.de>,
	Sasha Levin <sashal@kernel.org>,
	mchehab@kernel.org, linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 6.1 04/60] media: uvcvideo: Remove format descriptions
Date: Fri,  3 Mar 2023 16:42:18 -0500	[thread overview]
Message-ID: <20230303214315.1447666-4-sashal@kernel.org> (raw)
In-Reply-To: <20230303214315.1447666-1-sashal@kernel.org>

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

[ Upstream commit 50459f103edfe47c9a599d766a850ef6014936c5 ]

The V4L2 core overwrites format descriptions in v4l_fill_fmtdesc(),
there's no need to manually set the descriptions in the driver. This
prepares for removal of the format descriptions from the uvc_fmts table.

Unlike V4L2, UVC makes a distinction between the SD-DV, SDL-DV and HD-DV
formats. It also indicates whether the DV format uses 50Hz or 60Hz. This
information is parsed by the driver to construct a format name string
that is printed in a debug message, but serves no other purpose as V4L2
has a single V4L2_PIX_FMT_DV pixel format that covers all those cases.

As the information is available in the UVC descriptors, and thus
accessible to users with lsusb if they really care, don't log it in a
debug message and drop the format name string to simplify the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/media/usb/uvc/uvc_driver.c | 24 ++----------------------
 drivers/media/usb/uvc/uvc_v4l2.c   |  2 --
 drivers/media/usb/uvc/uvcvideo.h   |  2 --
 3 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 215fb483efb00..cfc18fbeaf6b6 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -251,14 +251,10 @@ static int uvc_parse_format(struct uvc_device *dev,
 		fmtdesc = uvc_format_by_guid(&buffer[5]);
 
 		if (fmtdesc != NULL) {
-			strscpy(format->name, fmtdesc->name,
-				sizeof(format->name));
 			format->fcc = fmtdesc->fcc;
 		} else {
 			dev_info(&streaming->intf->dev,
 				 "Unknown video format %pUl\n", &buffer[5]);
-			snprintf(format->name, sizeof(format->name), "%pUl\n",
-				&buffer[5]);
 			format->fcc = 0;
 		}
 
@@ -270,8 +266,6 @@ static int uvc_parse_format(struct uvc_device *dev,
 		 */
 		if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
 			if (format->fcc == V4L2_PIX_FMT_YUYV) {
-				strscpy(format->name, "Greyscale 8-bit (Y8  )",
-					sizeof(format->name));
 				format->fcc = V4L2_PIX_FMT_GREY;
 				format->bpp = 8;
 				width_multiplier = 2;
@@ -312,7 +306,6 @@ static int uvc_parse_format(struct uvc_device *dev,
 			return -EINVAL;
 		}
 
-		strscpy(format->name, "MJPEG", sizeof(format->name));
 		format->fcc = V4L2_PIX_FMT_MJPEG;
 		format->flags = UVC_FMT_FLAG_COMPRESSED;
 		format->bpp = 0;
@@ -328,17 +321,7 @@ static int uvc_parse_format(struct uvc_device *dev,
 			return -EINVAL;
 		}
 
-		switch (buffer[8] & 0x7f) {
-		case 0:
-			strscpy(format->name, "SD-DV", sizeof(format->name));
-			break;
-		case 1:
-			strscpy(format->name, "SDL-DV", sizeof(format->name));
-			break;
-		case 2:
-			strscpy(format->name, "HD-DV", sizeof(format->name));
-			break;
-		default:
+		if ((buffer[8] & 0x7f) > 2) {
 			uvc_dbg(dev, DESCR,
 				"device %d videostreaming interface %d: unknown DV format %u\n",
 				dev->udev->devnum,
@@ -346,9 +329,6 @@ static int uvc_parse_format(struct uvc_device *dev,
 			return -EINVAL;
 		}
 
-		strlcat(format->name, buffer[8] & (1 << 7) ? " 60Hz" : " 50Hz",
-			sizeof(format->name));
-
 		format->fcc = V4L2_PIX_FMT_DV;
 		format->flags = UVC_FMT_FLAG_COMPRESSED | UVC_FMT_FLAG_STREAM;
 		format->bpp = 0;
@@ -375,7 +355,7 @@ static int uvc_parse_format(struct uvc_device *dev,
 		return -EINVAL;
 	}
 
-	uvc_dbg(dev, DESCR, "Found format %s\n", format->name);
+	uvc_dbg(dev, DESCR, "Found format %p4cc", &format->fcc);
 
 	buflen -= buffer[0];
 	buffer += buffer[0];
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index f4d4c33b6dfbd..dcd178d249b6b 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -660,8 +660,6 @@ static int uvc_ioctl_enum_fmt(struct uvc_streaming *stream,
 	fmt->flags = 0;
 	if (format->flags & UVC_FMT_FLAG_COMPRESSED)
 		fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
-	strscpy(fmt->description, format->name, sizeof(fmt->description));
-	fmt->description[sizeof(fmt->description) - 1] = 0;
 	fmt->pixelformat = format->fcc;
 	return 0;
 }
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index df93db259312e..b60e4ae95e815 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -264,8 +264,6 @@ struct uvc_format {
 	u32 fcc;
 	u32 flags;
 
-	char name[32];
-
 	unsigned int nframes;
 	struct uvc_frame *frame;
 };
-- 
2.39.2


  parent reply	other threads:[~2023-03-03 21:49 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 21:42 [PATCH AUTOSEL 6.1 01/60] IB/hfi1: Update RMT size calculation Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 02/60] iommu/amd: Fix error handling for pdev_pri_ats_enable() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 03/60] PCI/ACPI: Account for _S0W of the target bridge in acpi_pci_bridge_d3() Sasha Levin
2023-03-03 21:42 ` Sasha Levin [this message]
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 05/60] media: uvcvideo: Handle cameras with invalid descriptors Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 06/60] media: uvcvideo: Handle errors from calls to usb_string Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 07/60] media: uvcvideo: Quirk for autosuspend in Logitech B910 and C910 Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 08/60] media: uvcvideo: Silence memcpy() run-time false positive warnings Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 09/60] USB: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 10/60] cacheinfo: Fix shared_cpu_map to handle shared caches at different levels Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 11/60] staging: emxx_udc: Add checks for dma_alloc_coherent() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 12/60] tty: fix out-of-bounds access in tty_driver_lookup_tty() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 13/60] tty: serial: fsl_lpuart: disable the CTS when send break signal Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 14/60] serial: sc16is7xx: setup GPIO controller later in probe Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 15/60] mei: bus-fixup:upon error print return values of send and receive Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 16/60] parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 17/60] tools/iio/iio_utils:fix memory leak Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 18/60] bus: mhi: ep: Fix the debug message for MHI_PKT_TYPE_RESET_CHAN_CMD cmd Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 19/60] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_status_word() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 20/60] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_config_word() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 21/60] media: uvcvideo: Add GUID for BGRA/X 8:8:8:8 Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 22/60] firmware: coreboot: framebuffer: Ignore reserved pixel color bits Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 23/60] soundwire: bus_type: Avoid lockdep assert in sdw_drv_probe() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 24/60] PCI: loongson: Prevent LS7A MRRS increases Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 25/60] staging: pi433: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 26/60] USB: dwc3: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 27/60] USB: chipidea: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 28/60] USB: ULPI: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 29/60] USB: uhci: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 30/60] USB: sl811: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 31/60] USB: fotg210: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 32/60] USB: isp116x: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 33/60] USB: isp1362: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 34/60] USB: gadget: gr_udc: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 35/60] USB: gadget: bcm63xx_udc: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 36/60] USB: gadget: lpc32xx_udc: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 37/60] USB: gadget: pxa25x_udc: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 38/60] USB: gadget: pxa27x_udc: " Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 39/60] usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 40/60] USB: ene_usb6250: Allocate enough memory for full object Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 41/60] usb: uvc: Enumerate valid values for color matching Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 42/60] usb: gadget: uvc: Make bSourceID read/write Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 43/60] PCI: Align extra resources for hotplug bridges properly Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 44/60] PCI: Take other bus devices into account when distributing resources Sasha Levin
2023-03-03 21:42 ` [PATCH AUTOSEL 6.1 45/60] PCI: Distribute available resources for root buses, too Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 46/60] tty: pcn_uart: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 47/60] misc: vmw_balloon: " Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 48/60] drivers: base: component: " Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 49/60] drivers: base: dd: " Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 50/60] kernel/time/test_udelay.c: " Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 51/60] kernel/power/energy_model.c: " Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 52/60] kernel/fail_function: " Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 53/60] PCI: loongson: Add more devices that need MRRS quirk Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 54/60] PCI: Add ACS quirk for Wangxun NICs Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 55/60] PCI: pciehp: Add Qualcomm quirk for Command Completed erratum Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 56/60] phy: rockchip-typec: Fix unsigned comparison with less than zero Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 57/60] RDMA/cma: Distinguish between sockaddr_in and sockaddr_in6 by size Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 58/60] iommu: Attach device group to old domain in error path Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 59/60] soundwire: cadence: Remove wasted space in response_buf Sasha Levin
2023-03-03 21:43 ` [PATCH AUTOSEL 6.1 60/60] soundwire: cadence: Drain the RX FIFO after an IO timeout Sasha Levin

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=20230303214315.1447666-4-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).