From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28F6B277004 for ; Fri, 28 Feb 2025 18:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740768483; cv=none; b=KQLO1I83LX41jiUhMzBLl3vuhMfWvQhODaDeknhR3wPm0Ej9hFs7JwVu8ZeBeHp5cXYx+MPC+MNfqz9baP/lDZ7+x1tLDKzhT9Ht/k25WmHwbIu9MCIBV4OghSFGSA5i1pPw7bdfBfxzKJjN5buboseaSmi9rb0iBRPGM7jakWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740768483; c=relaxed/simple; bh=sjccjNRDhW5cSMFd28Q8pm//au0XHsNKas9BxsXZWSk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Nkx0TClRbsKQcqiRxhi/ghScj1dr5wntXhIEZy2icXoYLkiFDdA7ZQgaa908ESCEF2j8vyEF+cjnGYsg50XAfn51NVlQO7I4zzYWGlfZ3AhsdutezmPSYhGc03yz9/a4r5j6OafgL70fkYyJiMZbPaXa+Z4HvNTLI9tY6lWD9mo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AIM4SHUF; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AIM4SHUF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740768480; x=1772304480; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=sjccjNRDhW5cSMFd28Q8pm//au0XHsNKas9BxsXZWSk=; b=AIM4SHUFh3kZciOi4zgsZOu/6B0GkxrtMXiBQRVPM2+lKvFPmzV34Kes LzLJmL/6jIxcOEjV0qIawUyrIqgQ3ag+zFnCIHy4tuVDcTY64J8A+AIKS iRCggY7TLTJPTuYOMmcGyHrlMMbIy0GlMJHpx/sTXtv1ZFJwCdRR80no5 VJw0XjB4ouDA5yO07TlNYbhi/6rTjbuknb078SedWmHckulrRoGenTYZm kMk/azmeMiQUhxUBIftJsX9QNNW6I+peBgSkdYAzwYrmNH9fEIo5HRaGv aWFrnXXIfA7JeN4PeGE7kkAJidClLOR7tE4tOFMogGW+kN+NcqGCwEq6M Q==; X-CSE-ConnectionGUID: f0fb8LDNTHKkh5pLi01NoA== X-CSE-MsgGUID: PEUxH8rPRzuQbqla9Yro8w== X-IronPort-AV: E=McAfee;i="6700,10204,11359"; a="52349876" X-IronPort-AV: E=Sophos;i="6.13,323,1732608000"; d="scan'208";a="52349876" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2025 10:47:59 -0800 X-CSE-ConnectionGUID: jbTsohC5QoqbJW5f0yiN5Q== X-CSE-MsgGUID: Qg72W58CSCq/VdtSuV77hA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="117934373" Received: from smile.fi.intel.com ([10.237.72.58]) by orviesa007.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2025 10:47:54 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.98) (envelope-from ) id 1to5Oo-0000000G3kA-3NNX; Fri, 28 Feb 2025 20:47:50 +0200 Date: Fri, 28 Feb 2025 20:47:50 +0200 From: Andy Shevchenko To: Aditya Garg Cc: Petr Mladek , Steven Rostedt , Rasmus Villemoes , "senozhatsky@chromium.org" , Jonathan Corbet , Andrew Morton , "apw@canonical.com" , "joe@perches.com" , "dwaipayanray1@gmail.com" , "lukas.bulwahn@gmail.com" , "linux-doc@vger.kernel.org" , Linux Kernel Mailing List , Hector Martin , Sven Peter , Janne Grunau , Alyssa Rosenzweig , Asahi Linux Mailing List Subject: Re: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Message-ID: References: <2C9622E6-A2DB-4681-A971-604C79F9955E@live.com> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2C9622E6-A2DB-4681-A971-604C79F9955E@live.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Fri, Feb 28, 2025 at 04:29:12PM +0000, Aditya Garg wrote: > From: Hector Martin > > %p4cc is designed for DRM/V4L2 FourCCs with their specific quirks, but > it's useful to be able to print generic 4-character codes formatted as > an integer. Extend it to add format specifiers for printing generic > 32-bit FourCCs with various endian semantics: > %p4ch Host-endian > %p4cn Reverse-endian Call them Host order, Network order as they are very established endianesses. > %p4cl Little-endian You have extra spaces here > %p4cb Big-endian > > The endianness determines how bytes are interpreted as a u32, and the > FourCC is then always printed MSByte-first (this is the opposite of > V4L/DRM FourCCs). This covers most practical cases, e.g. %p4cn would > allow printing LSByte-first FourCCs stored in host endian order > (other than the hex form being in character order, not the integer > value). ... > +Generic FourCC code > +------------------- > + > +:: > + %p4c[hnlb] gP00 (0x67503030) > + > +Print a generic FourCC code, as both ASCII characters and its numerical > +value as hexadecimal. > + > +The generic FourCC code is always printed in the big-endian format, > +the most significant byte first. This is the opposite of V4L/DRM FourCCs. > + > +The additional ``h``, ``n``, ``l``, and ``b`` specifiers define what > +endianness is used to load the stored bytes. The data might be interpreted > +using the host-endian, reverse-host-endian, little-endian, or big-endian. host order, network order > +Passed by reference. > + > +Examples for a little-endian machine, given &(u32)0x67503030:: > + > + %p4ch gP00 (0x67503030) > + %p4cn 00Pg (0x30305067) > + %p4cl gP00 (0x67503030) > + %p4cb 00Pg (0x30305067) > + > +Examples for a big-endian machine, given &(u32)0x67503030:: > + > + %p4ch gP00 (0x67503030) > + %p4cn 00Pg (0x30305067) > + %p4cl 00Pg (0x30305067) > + %p4cb gP00 (0x67503030) For the reference on the terms: https://www.ibm.com/docs/ja/zvm/7.2?topic=domains-network-byte-order-host-byte-order Otherwise LGTM. With the above addressed, FWIW, Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko