mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Toshi Kani <toshi.kani@hp.com>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>,
	Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
	Jiang Liu <liuj97@gmail.com>
Subject: Re: [PATCH 5/7] ACPI / hotplug: Introduce user space interface for hotplug profiles
Date: Tue, 26 Feb 2013 00:25:48 +0100	[thread overview]
Message-ID: <19747824.nPmizS2ZIQ@vostro.rjw.lan> (raw)
In-Reply-To: <1361816039.12845.73.camel@misato.fc.hp.com>

On Monday, February 25, 2013 11:13:59 AM Toshi Kani wrote:
> On Sun, 2013-02-17 at 16:24 +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@inel.com>
> > 
> > Introduce user space interface for manipulating hotplug profiles
> > associated with ACPI scan handlers.
> > 
> > The interface consists of sysfs directories under
> > /sys/firmware/acpi/hotplug/, one for each hotplug profile, containing
> > attributes allowing user space to manipulate the enabled, uevents,
> > and autoeject fields of the corresponding profile.  In particular,
> > switching the enabled attribute from 'unset' to 'set' will cause
> > the common hotplug notify handler to be installed for all ACPI
> > namespace objects representing devices matching the scan handler
> > associated with the given hotplug profile (and analogously for the
> > converse switch).
> > 
> > Drivers willing to use the new user space interface should add their
> > ACPI scan handlers with the help of new funtion
> > acpi_scan_add_handler_with_hotplug().
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@inel.com>
> > ---
> >  Documentation/ABI/testing/sysfs-firmware-acpi |   42 +++++++++
> >  drivers/acpi/internal.h                       |    9 +
> >  drivers/acpi/scan.c                           |   73 +++++++++++++++
> >  drivers/acpi/sysfs.c                          |  120 ++++++++++++++++++++++++++
> >  include/acpi/acpi_bus.h                       |    7 +
> >  5 files changed, 251 insertions(+)
>  :
> > Index: test/drivers/acpi/scan.c
> > ===================================================================
> > --- test.orig/drivers/acpi/scan.c
> > +++ test/drivers/acpi/scan.c
> > @@ -63,6 +63,19 @@ int acpi_scan_add_handler(struct acpi_sc
> >  	return 0;
> >  }
> >  
> > +int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler,
> > +				       const char *hotplug_profile_name)
> > +{
> > +	int error;
> > +
> > +	error = acpi_scan_add_handler(handler);
> > +	if (error)
> > +		return error;
> > +
> > +	acpi_sysfs_add_hotplug_profile(&handler->hotplug, hotplug_profile_name);
> > +	return 0;
> > +}
> > +
> >  /*
> >   * Creates hid/cid(s) string needed for modalias and uevent
> >   * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get:
> > @@ -1675,6 +1688,66 @@ static bool acpi_scan_handler_matching(s
> >  	return false;
> >  }
> >  
> > +static acpi_status acpi_scan_hotplug_modify(acpi_handle handle,
> > +					    u32 lvl_not_used, void *data,
> > +					    void **ret_not_used)
> > +{
> > +	struct acpi_scan_handler *handler = data;
> > +	struct acpi_device_info *info;
> > +	bool match = false;
> > +
> > +	if (ACPI_FAILURE(acpi_get_object_info(handle, &info)))
> > +		return AE_OK;
> > +
> > +	if (info->valid & ACPI_VALID_HID) {
> > +		char *idstr = info->hardware_id.string;
> > +		match = acpi_scan_handler_matching(handler, idstr, NULL);
> > +	}
> > +	kfree(info);
> > +	if (!match)
> > +		return AE_OK;
> > +
> > +	if (handler->hotplug.enabled)
> > +		acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
> > +					   acpi_hotplug_notify_cb);
> > +	else
> > +		acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
> > +					    acpi_hotplug_notify_cb, NULL);
> 
> I found that the action for "enabled" attribute is incorrect.  When
> enabled, it should install the notify handler, and remove otherwise.

Well, thanks for spotting this!

Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-02-25 23:19 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-17 15:18 [PATCH 0/7] ACPI / hotplug: Common code for ACPI-based hotplug Rafael J. Wysocki
2013-02-17 15:20 ` [PATCH 1/7] ACPI / scan: Introduce acpi_scan_match_handler() Rafael J. Wysocki
2013-02-19  6:48   ` Yasuaki Ishimatsu
2013-02-17 15:21 ` [PATCH 2/7] ACPI / scan: Introduce common code for ACPI-based device hotplug Rafael J. Wysocki
2013-02-19  6:43   ` Yasuaki Ishimatsu
2013-02-19  7:10     ` Yasuaki Ishimatsu
2013-02-20 13:27       ` Rafael J. Wysocki
2013-02-20 13:23     ` Rafael J. Wysocki
2013-02-20 20:23       ` Toshi Kani
2013-02-20 21:17         ` Rafael J. Wysocki
2013-02-20 22:49   ` [Update][PATCH " Rafael J. Wysocki
2013-02-21  1:17     ` Toshi Kani
2013-02-21 15:44       ` Rafael J. Wysocki
2013-02-21 15:52     ` [Update 2][PATCH " Rafael J. Wysocki
2013-02-21 17:39       ` Toshi Kani
2013-02-21 22:57         ` Rafael J. Wysocki
2013-02-21 23:06       ` [Update 3][PATCH " Rafael J. Wysocki
2013-02-22  1:12         ` Toshi Kani
2013-02-22  1:50           ` Rafael J. Wysocki
2013-02-22  8:51             ` Yasuaki Ishimatsu
2013-02-22 12:37               ` Rafael J. Wysocki
2013-02-22 15:54                 ` Toshi Kani
2013-02-22 20:59                   ` Rafael J. Wysocki
2013-02-23 22:38         ` [Update 4][PATCH " Rafael J. Wysocki
2013-02-25 18:07           ` Toshi Kani
2013-02-25 23:39             ` Rafael J. Wysocki
2013-02-25 23:32               ` Toshi Kani
2013-02-26  0:40               ` Yasuaki Ishimatsu
2013-02-26  1:09                 ` Toshi Kani
2013-02-26  2:02                   ` Yasuaki Ishimatsu
2013-02-26  3:11                     ` Rafael J. Wysocki
2013-02-26  3:40                       ` Yasuaki Ishimatsu
2013-02-26  3:50                         ` Rafael J. Wysocki
2013-03-04 13:10               ` Vasilis Liaskovitis
2013-03-14 17:16                 ` Rafael J. Wysocki
2013-03-15 10:47                   ` Vasilis Liaskovitis
2013-03-25 20:45                     ` Toshi Kani
2013-03-25 22:29                       ` Rafael J. Wysocki
2013-03-25 22:57                         ` Toshi Kani
2013-03-26 12:22                           ` Rafael J. Wysocki
2013-03-26 20:10                             ` Toshi Kani
2013-02-17 15:22 ` [PATCH 3/7] ACPI / container: Use common hotplug code Rafael J. Wysocki
2013-02-17 15:23 ` [PATCH 4/7] ACPI / scan: Introduce acpi_scan_handler_matching() Rafael J. Wysocki
2013-02-19  8:05   ` Yasuaki Ishimatsu
2013-02-17 15:24 ` [PATCH 5/7] ACPI / hotplug: Introduce user space interface for hotplug profiles Rafael J. Wysocki
2013-02-25 18:13   ` Toshi Kani
2013-02-25 23:25     ` Rafael J. Wysocki [this message]
2013-02-17 15:25 ` [PATCH 6/7] ACPI / container: Use hotplug profile user space interface Rafael J. Wysocki
2013-02-17 15:27 ` [PATCH 7/7] ACPI / scan: Make memory hotplug driver use struct acpi_scan_handler Rafael J. Wysocki
2013-02-19 18:11   ` Vasilis Liaskovitis
2013-02-20  3:35     ` Yasuaki Ishimatsu
2013-02-20 10:42       ` Vasilis Liaskovitis
2013-02-20 21:50         ` Toshi Kani
2013-02-20 22:29           ` Rafael J. Wysocki
2013-02-20 22:39             ` Toshi Kani
2013-02-21  6:58         ` Yasuaki Ishimatsu
2013-02-26 22:41 ` [PATCH v2, 0/7] ACPI / hotplug: Common code for ACPI-based hotplug Rafael J. Wysocki
2013-02-26 22:44   ` [PATCH v2, 1/7] ACPI / scan: Introduce acpi_scan_match_handler() Rafael J. Wysocki
2013-02-26 22:46   ` [PATCH v2, 2/7] ACPI / scan: Introduce common code for ACPI-based device hotplug Rafael J. Wysocki
2013-02-26 22:46   ` [PATCH v2, 3/7] ACPI / container: Use common hotplug code Rafael J. Wysocki
2013-02-26 23:13     ` Toshi Kani
2013-02-27  0:06       ` Rafael J. Wysocki
2013-02-27  0:09     ` [Update][PATCH " Rafael J. Wysocki
2013-02-26 22:47   ` [PATCH v2, 4/7] ACPI / scan: Introduce acpi_scan_handler_matching() Rafael J. Wysocki
2013-02-26 22:48   ` [PATCH v2, 5/7] ACPI / hotplug: Introduce user space interface for hotplug profiles Rafael J. Wysocki
2013-02-26 22:49   ` [PATCH v2, 6/7] ACPI / container: Use hotplug profile user space interface Rafael J. Wysocki
2013-02-26 22:50   ` [PATCH v2, 7/7] ACPI / scan: Make memory hotplug driver use struct acpi_scan_handler Rafael J. Wysocki
2013-02-27  0:51   ` [PATCH v2, 0/7] ACPI / hotplug: Common code for ACPI-based hotplug Toshi Kani

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=19747824.nPmizS2ZIQ@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=bhelgaas@google.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@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

all inboxes | Powered by JetHome®