public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Daniel Scally <djrscally@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Yong Zhi <yong.zhi@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: Re: [PATCH v1 3/8] software node: Show properties and their values in sysfs
Date: Mon, 29 Mar 2021 20:26:43 +0200	[thread overview]
Message-ID: <YGIb4z8oHIV7LlWi@kroah.com> (raw)
In-Reply-To: <CAHp75VfEN4HAX=BUZNp+-kKD1B1WVU2oeG2SXyaw=EWVa-CAhA@mail.gmail.com>

On Mon, Mar 29, 2021 at 05:51:01PM +0300, Andy Shevchenko wrote:
> On Mon, Mar 29, 2021 at 4:46 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Mon, Mar 29, 2021 at 04:01:18PM +0300, Andy Shevchenko wrote:
> > > 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
> > > > > <gregkh@linuxfoundation.org> 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.
> 
> ...
> 
> > > > > > > +             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 I will complain then too, these "lists of values" are not for sysfs,
> > sorry.
> 
> How can you recommend showing an array(s) of values of the same type?

I do not think that is something that should be shown in sysfs if at all
possible.

> > > > 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).
> >
> > If nothing needs this, then why are you adding these?
> 
> OK, I will prepare tools first, but I have no idea for the format. So,
> how can I be sure that tools will accept the patch if there is no
> kernel interface available? Seems like a stale case.

Develop both together.  Do not think that you will get the kernel format
right without actually knowing what userspace needs/wants.  That is
crazy.

thanks,

greg k-h

  reply	other threads:[~2021-03-29 18:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 22:20 [PATCH v1 1/8] software node: Free resources explicitly when swnode_register() fails Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 2/8] software node: Introduce software_node_alloc()/software_node_free() Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 3/8] software node: Show properties and their values in sysfs Andy Shevchenko
2021-03-28  1:14   ` kernel test robot
2021-03-28  6:45   ` Greg Kroah-Hartman
2021-03-28 12:56     ` Andy Shevchenko
2021-03-28 13:02       ` Greg Kroah-Hartman
2021-03-29 13:01         ` Andy Shevchenko
2021-03-29 13:46           ` Greg Kroah-Hartman
2021-03-29 14:51             ` Andy Shevchenko
2021-03-29 18:26               ` Greg Kroah-Hartman [this message]
2021-03-27 22:20 ` [PATCH v1 4/8] software node: Deduplicate code in fwnode_create_software_node() Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 5/8] software node: Imply kobj_to_swnode() to be no-op Andy Shevchenko
2021-03-28  8:43   ` Greg Kroah-Hartman
2021-03-28 12:50     ` Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 6/8] software node: Simplify swnode_register() a bit Andy Shevchenko
2021-03-28  8:44   ` Greg Kroah-Hartman
2021-03-28 12:50     ` Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 7/8] software node: Introduce SOFTWARE_NODE_REFERENCE() helper macro Andy Shevchenko
2021-03-27 22:20 ` [PATCH v1 8/8] media: ipu3-cio2: Switch to use SOFTWARE_NODE_REFERENCE() Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YGIb4z8oHIV7LlWi@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bingbu.cao@intel.com \
    --cc=djrscally@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=yong.zhi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox