From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25139C44501 for ; Mon, 6 Jul 2026 13:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FAwLiia2JGi1UR3siRqaZ+/HBhFhRyk9696rUgRA9Ok=; b=tuCH+LiCBpSCLRBnKPZgvXGbt9 2oK8BEzscNZA4ejecXXv9s+H8rK5QetuEy+hWDofe+jKLxuWUHc5+f3pdkVh2wKOzPzaWfCAvH1Wr Lt4KKP6ehTGmpS9fVx0dI82MUZRZjoWEybV3FIJGiZnJgR7gVOvF1tbucae/715KRSi0OhbgLpsdo zhMje4sFYDFMRoNB6Xt9YHBzV6HyKHqtPjNcNFTzZ25EU0SJficOYz0k1rxDtm/rWUfMyGlR6r9qp D8HT0t35N76COyr6m/IUXghiQortq39v7/V1P254yNYC4oCdU+ZGSGtU9IgJvXRdti/fimGa22Ik3 aR4zbKLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wgjak-0000000CdA3-3tb2; Mon, 06 Jul 2026 13:42:34 +0000 Received: from bali.collaboradmins.com ([2a01:4f8:201:9162::2]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wgjai-0000000Cd8O-3Mdv; Mon, 06 Jul 2026 13:42:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1783345349; bh=WOdI6liJJoliaIn+JO2tFPyTbcueg6fnE6bGqwExDF0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=T7/Tab6XtaY2R0En3PJVbZoiPJ6Wb7Z4a/14NF9gxL0PDfxKJdBl+dvVZjTT1yFrp Pkdnxk3V8i+ElVFAKAFe5o5t1juVExh7AJF5k05fjFxXCy3E3sYPUMnJkF7V8Vu+n8 tMtcg2a8T9dV3qMecTiguqwvZK5qVFNq5ygbgaDmW0ypiN2nyA4Odabo+dRggOPO66 o/CYsb/kJViARCstN/upytQUHDvzfLCECQxmPjctmGRWoM227dzZ3RjdxZZVJJURO4 8Ycp121ntL33SMINjQimbiiY2Fz8EtsSC5OPTMn0sWV4h7gjLN8LKmcU3ZAkaER9IS cCDAovKzhfBlw== Received: from [192.168.0.15] (unknown [100.64.0.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: detlev) by bali.collaboradmins.com (Postfix) with ESMTPSA id EBE3417E0D6B; Mon, 06 Jul 2026 15:42:27 +0200 (CEST) From: Detlev Casanova Date: Mon, 06 Jul 2026 09:42:18 -0400 Subject: [PATCH v3 1/5] media: v4l2: Add callback for show_fdinfo MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260706-v4l2-add-fdinfo-v3-1-d556568cf38e@collabora.com> References: <20260706-v4l2-add-fdinfo-v3-0-d556568cf38e@collabora.com> In-Reply-To: <20260706-v4l2-add-fdinfo-v3-0-d556568cf38e@collabora.com> To: Mauro Carvalho Chehab , Nicolas Dufresne , Benjamin Gaignard , Philipp Zabel , Ezequiel Garcia , Heiko Stuebner Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, kernel@collabora.com, Detlev Casanova , linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.15.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260706_064233_004681_AE005FD9 X-CRM114-Status: GOOD ( 12.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow v4l2 drivers to add information in the fdinfo file matching the opened /dev/videoX file. The core prints the standard "v4l2-driver:" key with the driver name and then calls the driver's optional show_fdinfo callback, added to struct v4l2_file_operations, to let drivers append their own key:value pairs. Signed-off-by: Detlev Casanova --- drivers/media/v4l2-core/v4l2-dev.c | 10 ++++++++++ include/media/v4l2-dev.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 5516b2bbb08f..6de85de0fd76 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -481,6 +481,15 @@ static int v4l2_release(struct inode *inode, struct file *filp) return ret; } +/* Override for the show_fdinfo function */ +static void v4l2_show_fdinfo(struct seq_file *m, struct file *filp) +{ + struct video_device *vdev = video_devdata(filp); + + if (vdev->fops->show_fdinfo) + vdev->fops->show_fdinfo(m, filp); +} + static const struct file_operations v4l2_fops = { .owner = THIS_MODULE, .read = v4l2_read, @@ -494,6 +503,7 @@ static const struct file_operations v4l2_fops = { #endif .release = v4l2_release, .poll = v4l2_poll, + .show_fdinfo = v4l2_show_fdinfo, }; /** diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 2e0f6d2e6a78..1635ab186f21 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -212,6 +212,7 @@ struct v4l2_file_operations { int (*mmap) (struct file *, struct vm_area_struct *); int (*open) (struct file *); int (*release) (struct file *); + void (*show_fdinfo)(struct seq_file *, struct file *); }; /* -- 2.54.0