diff mbox

[v1,1/3] ACPI: add callback prepare() into acpi_hotplug_handler

Message ID 1390013297-23462-1-git-send-email-jiang.liu@linux.intel.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Jiang Liu Jan. 18, 2014, 2:48 a.m. UTC
Add callback prepare() into acpi_hotplug_handler, which will get called
at the very beginning of ACPI hotplug event handler. The ACPI core will
ignore the event if prepare() returns NOTIFY_STOP.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 drivers/acpi/scan.c     |    4 ++++
 include/acpi/acpi_bus.h |    1 +
 2 files changed, 5 insertions(+)

Comments

Toshi Kani Jan. 21, 2014, 9:14 p.m. UTC | #1
On Sat, 2014-01-18 at 10:48 +0800, Jiang Liu wrote:
> Add callback prepare() into acpi_hotplug_handler, which will get called
> at the very beginning of ACPI hotplug event handler. The ACPI core will
> ignore the event if prepare() returns NOTIFY_STOP.
> 
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> ---
>  drivers/acpi/scan.c     |    4 ++++
>  include/acpi/acpi_bus.h |    1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index fd39459..6b0f419 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -392,6 +392,10 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
>  	struct acpi_device *adev;
>  	acpi_status status;
>  
> +	if (handler->prepare &&
> +	    handler->prepare(handle, type, data) == NOTIFY_STOP)
> +		return;

The OS is responsible for calling _OST when it is implemented.  So you
cannot just return here.  See acpi_hotplug_unsupported(handle, type)
next line.  Also, please describe why prepare() needs to be added.

Thanks,
-Toshi



> +
>  	if (!handler->hotplug.enabled)
>  		return acpi_hotplug_unsupported(handle, type);
>  
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index ddabed1..09a73bd 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -113,6 +113,7 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
>  struct acpi_scan_handler {
>  	const struct acpi_device_id *ids;
>  	struct list_head list_node;
> +	int (*prepare)(acpi_handle handle, u32 type, void *context);
>  	int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
>  	void (*detach)(struct acpi_device *dev);
>  	struct acpi_hotplug_profile hotplug;


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Toshi Kani Jan. 21, 2014, 11:06 p.m. UTC | #2
On Wed, 2014-01-22 at 00:17 +0100, Rafael J. Wysocki wrote:
> On Tuesday, January 21, 2014 02:14:57 PM Toshi Kani wrote:
> > On Sat, 2014-01-18 at 10:48 +0800, Jiang Liu wrote:
> > > Add callback prepare() into acpi_hotplug_handler, which will get called
> > > at the very beginning of ACPI hotplug event handler. The ACPI core will
> > > ignore the event if prepare() returns NOTIFY_STOP.
> > > 
> > > Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> > > ---
> > >  drivers/acpi/scan.c     |    4 ++++
> > >  include/acpi/acpi_bus.h |    1 +
> > >  2 files changed, 5 insertions(+)
> > > 
> > > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > > index fd39459..6b0f419 100644
> > > --- a/drivers/acpi/scan.c
> > > +++ b/drivers/acpi/scan.c
> > > @@ -392,6 +392,10 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
> > >  	struct acpi_device *adev;
> > >  	acpi_status status;
> > >  
> > > +	if (handler->prepare &&
> > > +	    handler->prepare(handle, type, data) == NOTIFY_STOP)
> > > +		return;
> > 
> > The OS is responsible for calling _OST when it is implemented.  So you
> > cannot just return here.  See acpi_hotplug_unsupported(handle, type)
> > next line.  Also, please describe why prepare() needs to be added.
> 
> I don't think it's needed any more, please see:
> 
> http://marc.info/?l=linux-acpi&m=139001691317575&w=2

Oh, I see.  Thanks!
-Toshi

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki Jan. 21, 2014, 11:17 p.m. UTC | #3
On Tuesday, January 21, 2014 02:14:57 PM Toshi Kani wrote:
> On Sat, 2014-01-18 at 10:48 +0800, Jiang Liu wrote:
> > Add callback prepare() into acpi_hotplug_handler, which will get called
> > at the very beginning of ACPI hotplug event handler. The ACPI core will
> > ignore the event if prepare() returns NOTIFY_STOP.
> > 
> > Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> > ---
> >  drivers/acpi/scan.c     |    4 ++++
> >  include/acpi/acpi_bus.h |    1 +
> >  2 files changed, 5 insertions(+)
> > 
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index fd39459..6b0f419 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -392,6 +392,10 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
> >  	struct acpi_device *adev;
> >  	acpi_status status;
> >  
> > +	if (handler->prepare &&
> > +	    handler->prepare(handle, type, data) == NOTIFY_STOP)
> > +		return;
> 
> The OS is responsible for calling _OST when it is implemented.  So you
> cannot just return here.  See acpi_hotplug_unsupported(handle, type)
> next line.  Also, please describe why prepare() needs to be added.

I don't think it's needed any more, please see:

http://marc.info/?l=linux-acpi&m=139001691317575&w=2

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index fd39459..6b0f419 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -392,6 +392,10 @@  static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
 	struct acpi_device *adev;
 	acpi_status status;
 
+	if (handler->prepare &&
+	    handler->prepare(handle, type, data) == NOTIFY_STOP)
+		return;
+
 	if (!handler->hotplug.enabled)
 		return acpi_hotplug_unsupported(handle, type);
 
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index ddabed1..09a73bd 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -113,6 +113,7 @@  static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
 struct acpi_scan_handler {
 	const struct acpi_device_id *ids;
 	struct list_head list_node;
+	int (*prepare)(acpi_handle handle, u32 type, void *context);
 	int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
 	void (*detach)(struct acpi_device *dev);
 	struct acpi_hotplug_profile hotplug;