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 D58EAC4332F for ; Mon, 14 Nov 2022 16:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YzsLRHNyjS/8JyxMmxWcH4QxHxAi7iZiANpF4gfXmz8=; b=pGkimq70cNcdFN H54nZAVw+V8KaMPYshG0E2MCFEu691bBOQ+Va/QN+APWaexXZTPQiybMcPnCz9YUWXPeNDyZFl2xA F25L0AE82EH3gP2X3s//sHhqvjf9pqu7p0fVJ1f8lhrnPiBjWVSo4uZqFLu0G7WmChIOpWiAFKHcw b2VCahLd7+AXDQNdXDv+S2Di0dEK6xXknfRswuchaqXMiPtLu9d+3SA5CgpR44BrFQab87FV9jVK8 J69wZcZjjozkQ58Mj6WWFbcFGNJfTGk1TGvUAPSyZH07r/u/ZDYJZgK5Zo3S8r0MEdIdFJbd5vENp I7gopBEc4gZFywF1T36g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oucAL-002e8j-ER; Mon, 14 Nov 2022 16:18:33 +0000 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oucAH-002e5A-8J for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2022 16:18:30 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B4DAC22C5F; Mon, 14 Nov 2022 16:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1668442707; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0tL7xPSD03f3HZ+4HQQQ7sQ5enemmDpf5Sp5cZ89xFw=; b=oWvuMqKJhtkNpedSgvnQGk4xFBCkRyJ7Ke9fIutR/Lc7G/sifitPB/TZk+jWmaLllrk9R4 OKXNLgokyF/Vky+YYw3QVk2SaFT+t0DtJgztAH1VgUhEphielJwf/CWWY2zmJwUoGy6lOR /Rr4Dzm154RIXwpqI13iQCAKf+QwqWo= Received: from suse.cz (unknown [10.100.201.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 559E52C142; Mon, 14 Nov 2022 16:18:27 +0000 (UTC) Date: Mon, 14 Nov 2022 17:18:26 +0100 From: Petr Mladek To: Andy Shevchenko Cc: Russell King , Linus Walleij , Bartosz Golaszewski , Rob Herring , Lee Jones , Alyssa Rosenzweig , asahi@lists.linux.dev, devicetree@vger.kernel.org, Hector Martin , Jonathan Corbet , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-gpio@vger.kernel.org, Rasmus Villemoes , Sergey Senozhatsky , Steven Rostedt , Sven Peter Subject: Re: [PATCH v3 2/7] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221114_081829_503315_9E3D095D X-CRM114-Status: GOOD ( 22.94 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon 2022-11-14 17:46:28, Andy Shevchenko wrote: > On Mon, Nov 14, 2022 at 04:34:07PM +0100, Petr Mladek wrote: > > On Tue 2022-11-08 16:33:22, Russell King wrote: > > ... > > > > orig = get_unaligned(fourcc); > > > - val = orig & ~BIT(31); > > > + switch (fmt[2]) { > > > + case 'h': > > > + val = orig; > > > + break; > > > + case 'r': > > > + val = orig = swab32(orig); > > > > I do not like much these multi assignments. I think that the result > > was not even defined in some older C standards. Though, I can't find > > it now. And even make W=3 does not warn about it. > > > > > + break; > > > + case 'l': > > > + val = orig = le32_to_cpu(orig); > > > + break; > > > + case 'b': > > > + val = orig = be32_to_cpu(orig); > > > + break; > > Isn't easy to fix? Something like below? > > switch (fmt[2]) { > case 'h': > break; > case 'r': > orig = swab32(orig); > break; > case 'l': > orig = le32_to_cpu(orig); > break; > case 'b': > orig = be32_to_cpu(orig); > break; > > ... > } > val = orig; I though the same. Unfortunately, this is not valid for the "case c:" path where "orig" stays untouched: case 'c': /* Pixel formats are printed LSB-first */ val = swab32(orig & ~BIT(31)); pixel_fmt = true; break; It is pity that "orig" is handled differently for the pixel and the generic formats. But I am afraid that there is no good solution. The code will always be a mess when it tries to implement a messy definition. It would be nice if the the FourCC format was used consistently in all subsystems in the first place. IMPORTANT: This brings the questions. Is there actually a standard how to print the original number in FourCC? Do we really want to modify "orig" in the generic implementation? Best Regards, Petr _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel