From patchwork Mon Feb 8 20:09:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 12076467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70A10C433E0 for ; Mon, 8 Feb 2021 20:20:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3579D64E66 for ; Mon, 8 Feb 2021 20:20:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3579D64E66 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7AA1B6E9EB; Mon, 8 Feb 2021 20:20:03 +0000 (UTC) X-Greylist: delayed 655 seconds by postgrey-1.36 at gabe; Mon, 08 Feb 2021 20:20:01 UTC Received: from hillosipuli.retiisi.eu (hillosipuli.retiisi.eu [IPv6:2a01:4f9:c010:4572::81:2]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE6916E9EA for ; Mon, 8 Feb 2021 20:20:01 +0000 (UTC) Received: from lanttu.localdomain (lanttu-e.localdomain [192.168.1.64]) by hillosipuli.retiisi.eu (Postfix) with ESMTP id B3728634C87; Mon, 8 Feb 2021 22:08:33 +0200 (EET) From: Sakari Ailus To: linux-kernel@vger.kernel.org Subject: [PATCH v6 0/3] Add %p4cc printk modifier for V4L2 and DRM fourcc codes Date: Mon, 8 Feb 2021 22:09:00 +0200 Message-Id: <20210208200903.28084-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Petr Mladek , mchehab@kernel.org, Dave Stevenson , Rasmus Villemoes , dri-devel@lists.freedesktop.org, hverkuil@xs4all.nl, Sergey Senozhatsky , Steven Rostedt , laurent.pinchart@ideasonboard.com, Joe Perches , Andy Shevchenko , linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi all, This set adds support for %p4cc printk modifier for printing V4L2 and DRM fourcc codes. The codes are cumbersome to print manually and by adding the modifier, this task is saved from the V4L2 and DRM frameworks as well as related drivers. DRM actually had it handled in a way (see 3rd patch) but the printk modifier makes printing the format easier even there. On V4L2 side it saves quite a few lines of repeating different implementations of printing the 4cc codes. Further work will include converting the V4L2 drivers doing the same, as well as converting DRM drivers from drm_get_format_name() to plain %p4cc. I left these out from this version since individual drivers are easier changed without dealing with multiple trees. If DRM folks would prefer to convert drivers to %p4cc directly instead I have no problem dropping the 3rd patch. Nearly all uses in DRM are in printk family of functions that can readily use %p4cc instead of the current arrangement that relies on caller-allocated temporary buffer. Since v5: - Added V4L2 core conversion to %p4cc, as well as change the DRM fourcc printing function to use %p4cc. - Add missing checkpatch.pl checks for %p4cc modifier. Sakari Ailus (3): lib/vsprintf: Add support for printing V4L2 and DRM fourccs v4l: ioctl: Use %p4cc printk modifier to print FourCC codes drm/fourcc: Switch to %p4cc format modifier Documentation/core-api/printk-formats.rst | 16 +++++ drivers/gpu/drm/drm_fourcc.c | 16 +---- drivers/media/v4l2-core/v4l2-ioctl.c | 85 ++++++----------------- lib/test_printf.c | 17 +++++ lib/vsprintf.c | 51 ++++++++++++++ scripts/checkpatch.pl | 6 +- 6 files changed, 112 insertions(+), 79 deletions(-)