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 X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 73FA0C433E3 for ; Mon, 29 Mar 2021 13:02:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 501BD61969 for ; Mon, 29 Mar 2021 13:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231743AbhC2NBo (ORCPT ); Mon, 29 Mar 2021 09:01:44 -0400 Received: from mga11.intel.com ([192.55.52.93]:38158 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbhC2NB2 (ORCPT ); Mon, 29 Mar 2021 09:01:28 -0400 IronPort-SDR: IZ4WvCnN/rFWLCZ0t0+yM4JxD1/NxasVKi+gGIt1PZUnpLUmsYZ2Qw7THHjt/dMBuW9D74aErp Zh39Sg16Y6sQ== X-IronPort-AV: E=McAfee;i="6000,8403,9937"; a="188275054" X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="188275054" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 06:01:26 -0700 IronPort-SDR: r29PVR40HJDKTPxnh2BdepZ2i6qkER5CYOGByOT3/Lm06gJBDSe6vdRkyLv4TeOa0FYGKNR1VK Nq8h5aza3AAQ== X-IronPort-AV: E=Sophos;i="5.81,287,1610438400"; d="scan'208";a="376417615" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 06:01:23 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lQrWA-00H1cf-Md; Mon, 29 Mar 2021 16:01:18 +0300 Date: Mon, 29 Mar 2021 16:01:18 +0300 From: Andy Shevchenko To: Greg Kroah-Hartman Cc: Daniel Scally , Linux Kernel Mailing List , Linux Media Mailing List , ACPI Devel Maling List , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: Re: [PATCH v1 3/8] software node: Show properties and their values in sysfs Message-ID: References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> <20210327222012.54103-3-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Sun, Mar 28, 2021 at 03:02:24PM +0200, Greg Kroah-Hartman wrote: > On Sun, Mar 28, 2021 at 03:56:26PM +0300, Andy Shevchenko wrote: > > On Sun, Mar 28, 2021 at 9:47 AM Greg Kroah-Hartman > > wrote: > > > > > > On Sun, Mar 28, 2021 at 12:20:07AM +0200, Andy Shevchenko wrote: > > > > It's very convenient to see what properties and their values > > > > are currently being assigned in the registered software nodes. > > > > > > > > Show properties and their values in sysfs. > > > > ... > > > > > > + for (i = 0; i < prop->length / sizeof(u8); i++) > > > > + len += sysfs_emit_at(buf, len, "%u,", ((u8 *)pointer)[i]); > > > > > > No, sysfs is "one value per file", and that is not what you are showing > > > here at all :( > > > > It is following: it's a "one value" for property in question, > > > > As we may read in [1]: "...so it is socially acceptable to express an > > array of values of the same type." > > > > And here is exactly the case: *values of the same type*. > > So what is it going to look like exactly? Basically we have two approaches (already done in the kernel!) use space or comma for a separator. So: - for boolean it will be an empty string (and it's one value always) - for integers it will be, for example, '0,1,2' (w/o single quotes) for property array with values 0, 1, and 2 - for plain integers or arrays out of 1 element it will be plain integer - for strings it will be, for example, '"str1","str2"' (w/o single quotes) for array of string { "str1", "str2" } - for single string or array out of 1 element, it will be '"str"' (w/o single quotes) This should be a part of documentation. > And what tool is going to be > there to parse this mess? Who is going to to use it? I guess something like hwinfo (needs a patch). The idea behind that this is following what ACPI and DT provides to the users via /sys/firmware/ (however, in binary format). I can re-do to provide a binary, and it will effectively make software nodes in align with the rest. -- With Best Regards, Andy Shevchenko