Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4953281pxb; Mon, 15 Feb 2021 05:55:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXVwt0F46AOARLUVEaDEGk563D+CmzyX+2vSlbeTpVcvnxn6a96auLZJ88PNEROfeFY6hl X-Received: by 2002:a17:906:a2c9:: with SMTP id by9mr15471081ejb.546.1613397326478; Mon, 15 Feb 2021 05:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613397326; cv=none; d=google.com; s=arc-20160816; b=UCmyH0X3HtPtRENwF+YD+Qv7rb8Jt74oSqLqb3KI/1ojiCMmeX/5IA3b4LFX8qe7Ei 0OYZQnLgOT7Gz+DENQhOQA8+c48hxiJW9b2OEabVt7brso6uLpiGCYyKCtCMgRqS0cNw WhEpO7sI67uKnC4/h6gNZZJ88gp5DuKGm9PePDTOQHguQPHsjNCy597ScZMvvGGezLhV K7x7518iG8FPmiekpPlCg+NCUccZ8F2lMBRlgzK1Au2eYNziDEyUwA7SPCblSM345adE uVLNI1tAorvTjCNyuKdWqzWeMwG9DhycTb5997gFpm4dPuwakctL6IPjpmrb+KmPWOS+ XwIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=KusL0BZYFpOm98TOv9BIF5an2oswc6TO34wgxeuqLT8=; b=ToMMxtf5T1jTMlEjSEEN0NTXAF6ZvPfEVNM4twoZSiwgzYf4NzQZebTYebKGANYaNB uA6PvQiQVnEUSSOSx6VwNUbn/cQl2IqTrxxcwONV7ddAOTnG76FVItVNczIxfTgU3W5J BfpZ14sDUg5YnmdcC2yo9VKSTo0hTyI6VmQh/tOf6mdhjadEKQO0K7KZVqox38Mk/Oqj P1PNkqn1PQ1cIdhQlMugO7HJYHbVIPTrgrIXJIGGlOpRCLv6QWX0AfKwP02IOuQAQMYm qHOWSQZ7YsSegai6931PmaUQRqEsOwnAIRo/TloaSgFv8OYTQzFidFET4wJnfkd2BsQI wu4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf10si6203258ejb.701.2021.02.15.05.55.03; Mon, 15 Feb 2021 05:55:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230268AbhBONvn (ORCPT + 99 others); Mon, 15 Feb 2021 08:51:43 -0500 Received: from mga04.intel.com ([192.55.52.120]:3452 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbhBONui (ORCPT ); Mon, 15 Feb 2021 08:50:38 -0500 IronPort-SDR: BaL9/nUIttOaIv7FOT7OpJSxM2jDEBrk7Qm+TQTycle6UniRyHE5JmPJz9gjEYMKfv0nABD0/Y GiUS+YpbIUpg== X-IronPort-AV: E=McAfee;i="6000,8403,9895"; a="180123256" X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="180123256" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 05:48:37 -0800 IronPort-SDR: R+vTNA8KsI7v/v3QB9ncTDcyBiWLW0KQZIWz8nfziTZynxrchxmy56k75BSox1RrD4HxmfOCSd esSfNbQ2d5sA== X-IronPort-AV: E=Sophos;i="5.81,180,1610438400"; d="scan'208";a="400656303" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 05:48:33 -0800 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id D1CBE20345; Mon, 15 Feb 2021 15:48:30 +0200 (EET) Date: Mon, 15 Feb 2021 15:48:30 +0200 From: Sakari Ailus To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Petr Mladek , Dave Stevenson , dri-devel@lists.freedesktop.org, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, mchehab@kernel.org, Sergey Senozhatsky , Steven Rostedt , Joe Perches , Jani Nikula , Rasmus Villemoes Subject: Re: [PATCH v7 3/3] drm: Switch to %p4cc format modifier Message-ID: <20210215134830.GG3@paasikivi.fi.intel.com> References: <20210215114030.11862-1-sakari.ailus@linux.intel.com> <20210215114030.11862-4-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Mon, Feb 15, 2021 at 03:41:14PM +0200, Andy Shevchenko wrote: > On Mon, Feb 15, 2021 at 01:40:30PM +0200, Sakari Ailus wrote: > > Switch DRM drivers from drm_get_format_name() to %p4cc. This gets rid of a > > large number of temporary variables at the same time. > > What a nice clean up! > Reviewed-by: Andy Shevchenko Thanks! > after addressing nit-picks below. > > Side note (no need to implement esp. right now): it seems often it's coupled > with modifier, would be nice to have them together that %p4ccM or so can do it > in one go. ... > > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c > > index 03262472059c..5cf45aa6eedc 100644 > > --- a/drivers/gpu/drm/drm_fourcc.c > > +++ b/drivers/gpu/drm/drm_fourcc.c > > @@ -30,11 +30,6 @@ > > #include > > #include > > > > -static char printable_char(int c) > > -{ > > - return isascii(c) && isprint(c) ? c : '?'; > > -} > > If it goes as an ABI than your dot is incompatible with this and '?' should be > used instead in the patch 1. And I bend towards suggested '?' rather than '.'. > > Also it means that you probably would need different specifiers for full and > short formats. I thought of that, but then the resulting string would be indeed different and comparing short and long formats would be harder. Remember this is for debug prints. If the format is too long, then it should be made shorter, but during the earlier review rounds people have expressed interest in having this information there. "?" can be expanded by the shell whereas "." is not. If DRM folks think we should go back to "?" I'm fine with that. Also note that there's something wrong with the fourcc code to begin with if it's got either "." or "?". -- Regards, Sakari Ailus