mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-kernel@vger.kernel.org
Subject: 2.6.24 - self-destructing sysfs attributes
Date: Tue, 30 Oct 2007 22:23:47 +0300	[thread overview]
Message-ID: <200710302223.52508.arvidjaar@mail.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

I realized that in patch for ACPI battery I created perfect example of 
self-destructing sysfs attributes. Basically, on every access to battery 
properties we check battery status. If ACPI reports battery not present, we 
remove sysfs power_supply object. I.e.

-> user space queries e.g. .../PNP0C0A:00/power_supply/BAT1/energy_now
  -> call acpi_battery_update
    -> battery gone
       -> call power_supply_unregister(.../PNP0C0A:00/power_supply)

I remember discussion about this but am not sure what final outcome is. So 
questions

- is it legal in this form?
- what is the proper way to manage such situation?
- if I move (de-)registering of power_supply out of acpi_battery_update, is 
extra locking (refcounting) required to keep attributes alive or sysfs will 
ensure this?

TIA

-andrey

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2007-10-30 19:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200710302223.52508.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome