All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: linux-acpi@vger.kernel.org, Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [PATCH 4/5] ACPI: WMI: Add sysfs userspace interface
Date: Wed, 6 Feb 2008 22:49:11 -0500	[thread overview]
Message-ID: <200802062249.11619.lenb@kernel.org> (raw)
In-Reply-To: <200802061136.12426.carlos@strangeworlds.co.uk>

On Wednesday 06 February 2008 06:36, Carlos Corbacho wrote:
> On Tuesday 05 February 2008 22:59:24 Carlos Corbacho wrote:
> > Unfortunately, as you can see this isn't nice, and very racy. To point out
> > the more glaring flaws:
> >
> > 1) instance and method_id can be changed before we start reading and
> > writing in any data.
> >
> > 2) Executing a method involves reading back from the 'data' file (but if we
> > don't care about the output, this makes little sense). If anything changes
> > before this, then either the method will fail, or we may not execute what
> > we intended to.
> 
> On these two points, we could use locking (but this would only be advisory, 
> and rely on other programs not trying to write while we do), but we'd need to 
> rejig how this works a bit (since reading 'data' here triggers execution.
> 
> (So, basically, in future, shoving this all into a C library to abstract the 
> WMI sysfs file access).

In either case, ioctl or sysfs, a library is probably appropriate.
However, with the ioctl, it sounds like the driver is able to enforce
consistency of a transaction, while multiple users of a sysfs I/F
may get confused, or worse.

So the question is if the sysfs I/F is useful for development or not,
since it doesn't look like the right I/F in the long run.

Shall I drop patches #4 and #5, or would you like to send an update?

thanks,
-Len

> > 3) For method execution, this really comes across as rather 'clunky' means
> > to do so
> 
> This point is still valid.
> 
> Maybe changing a method to the following:
> 
> <GUID>/
> |--> instance_count
> |--> instance
> |--> method_id
> |--> in
> |--> out
> |--> execute
> 
> Then to execute a method:
> 
> 1) Write lock instance, method_id, in, out and execute.
> 
> 2) Write the instance and method_id to be executed to their respective files. 
> Write the input data for the method to 'in'.
> 
> 3) Write '1' to execute the method, store the returned data in 'out' 
> (writing '0' to 'execute' would clear everything instead). (We can always 
> return the error code by reading execute).
> 
> 4) Read 'out' to retrieve any data.
> 
> (I don't want to make reading 'out' trigger the execution, since we can't 
> guarantee a read lock between languages).
> 
> For data blocks, we can do something similar.
> 
> Any thoughts? It's still a little clunky, and I'm still not sure whether an 
> ioctl would still be preferable to all this?
> 
> -Carlos

  reply	other threads:[~2008-02-07  3:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05  2:16 [PATCH 0/5] WMI patches for acpi-test (v2) Carlos Corbacho
2008-02-05  2:17 ` [PATCH 1/5] ACPI: WMI: Add ACPI-WMI mapping driver Carlos Corbacho
2008-02-05  2:17 ` [PATCH 2/5] acer-wmi: Add driver for newer Acer laptops Carlos Corbacho
2008-02-05  2:17 ` [PATCH 3/5] [RFC] tc1100-wmi: Add driver for HP Compaq TC1100 Tablets Carlos Corbacho
2008-02-05  2:17 ` [PATCH 4/5] ACPI: WMI: Add sysfs userspace interface Carlos Corbacho
2008-02-05 22:59   ` Carlos Corbacho
2008-02-06 11:36     ` Carlos Corbacho
2008-02-07  3:49       ` Len Brown [this message]
2008-08-27 13:53   ` Matthew Garrett
2008-08-27 20:21     ` Carlos Corbacho
2008-08-27 20:44       ` Matthew Garrett
2008-08-29 15:05         ` [PATCH] Documentation: Provide Documenation/udev.txt Thomas Renninger
2008-08-29 15:30           ` Kay Sievers
2008-08-29 15:35             ` Thomas Renninger
2009-04-29 20:38       ` [PATCH 4/5] ACPI: WMI: Add sysfs userspace interface Matthew Garrett
2009-04-29 21:09         ` Carlos Corbacho
2008-02-05  2:17 ` [PATCH 5/5] ACPI: WMI: Add documentation Carlos Corbacho
2008-02-05  2:25   ` [PATCH 5/5] ACPI: WMI: Add initial documentation Carlos Corbacho
2008-02-06  3:12     ` Randy Dunlap
2008-02-06 10:51       ` Carlos Corbacho
2008-02-05 21:03 ` [PATCH 0/5] WMI patches for acpi-test (v2) Len Brown
2008-02-05 21:03   ` Len Brown
2008-02-05 21:18   ` Carlos Corbacho
2008-02-05 21:18     ` Carlos Corbacho
2008-02-06  0:35     ` Bjorn Helgaas
2008-02-06  0:35       ` Bjorn Helgaas
2008-02-06  2:03       ` Carlos Corbacho
2008-02-06  2:03         ` Carlos Corbacho
2008-02-06  6:30         ` Bjorn Helgaas
2008-02-06  6:30           ` Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2007-12-12  2:01 [PATCH 0/5] WMI Carlos Corbacho
2007-12-12  2:09 ` [PATCH 4/5] ACPI: WMI: Add sysfs userspace interface Carlos Corbacho

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=200802062249.11619.lenb@kernel.org \
    --to=lenb@kernel.org \
    --cc=carlos@strangeworlds.co.uk \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.