public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] ACPI: create ACPI notifier chain
@ 2008-01-25  6:48 Zhang Rui
  2008-02-02  4:02 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Rui @ 2008-01-25  6:48 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, linux-gfx

From: Zhang Rui <rui.zhang@intel.com>

This patch is needed by the kernel mode graphics drivers.
Create an ACPI notifier chain so that they can get
notified upon hotkey events.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/event.c    |   28 ++++++++++++++++++++++++++++
 include/acpi/acpi_bus.h |    3 +++
 2 files changed, 31 insertions(+)

Index: linux-2.6/drivers/acpi/event.c
===================================================================
--- linux-2.6.orig/drivers/acpi/event.c
+++ linux-2.6/drivers/acpi/event.c
@@ -109,6 +109,34 @@ static const struct file_operations acpi
 };
 #endif	/* CONFIG_ACPI_PROC_EVENT */
 
+/* ACPI notifier chain */
+BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
+
+int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
+{
+	struct acpi_bus_event event;
+
+	strcpy(event.device_class, dev->pnp.device_class);
+	strcpy(event.bus_id, dev->pnp.bus_id);
+	event.type = type;
+	event.data = data;
+	return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)
+                        == NOTIFY_BAD) ? -EINVAL : 0;
+}
+EXPORT_SYMBOL(acpi_notifier_call_chain);
+
+int register_acpi_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&acpi_chain_head, nb);
+}
+EXPORT_SYMBOL(register_acpi_notifier);
+
+int unregister_acpi_notifier(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&acpi_chain_head, nb);
+}
+EXPORT_SYMBOL(unregister_acpi_notifier);
+
 #ifdef CONFIG_NET
 static unsigned int acpi_event_seqnum;
 struct acpi_genl_event {
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h
+++ linux-2.6/include/acpi/acpi_bus.h
@@ -320,6 +320,9 @@ struct acpi_bus_event {
 
 extern struct kset acpi_subsys;
 extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
+extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
+extern int register_acpi_notifier(struct notifier_block *);
+extern int unregister_acpi_notifier(struct notifier_block *);
 /*
  * External Functions
  */



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/4] ACPI: create ACPI notifier chain
  2008-01-25  6:48 [PATCH 3/4] ACPI: create ACPI notifier chain Zhang Rui
@ 2008-02-02  4:02 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2008-02-02  4:02 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, linux-gfx

Applied.

thanks,
-Len

On Friday 25 January 2008 01:48, Zhang Rui wrote:
> From: Zhang Rui <rui.zhang@intel.com>
> 
> This patch is needed by the kernel mode graphics drivers.
> Create an ACPI notifier chain so that they can get
> notified upon hotkey events.
> 
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/acpi/event.c    |   28 ++++++++++++++++++++++++++++
>  include/acpi/acpi_bus.h |    3 +++
>  2 files changed, 31 insertions(+)
> 
> Index: linux-2.6/drivers/acpi/event.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/event.c
> +++ linux-2.6/drivers/acpi/event.c
> @@ -109,6 +109,34 @@ static const struct file_operations acpi
>  };
>  #endif	/* CONFIG_ACPI_PROC_EVENT */
>  
> +/* ACPI notifier chain */
> +BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
> +
> +int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
> +{
> +	struct acpi_bus_event event;
> +
> +	strcpy(event.device_class, dev->pnp.device_class);
> +	strcpy(event.bus_id, dev->pnp.bus_id);
> +	event.type = type;
> +	event.data = data;
> +	return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)
> +                        == NOTIFY_BAD) ? -EINVAL : 0;
> +}
> +EXPORT_SYMBOL(acpi_notifier_call_chain);
> +
> +int register_acpi_notifier(struct notifier_block *nb)
> +{
> +	return blocking_notifier_chain_register(&acpi_chain_head, nb);
> +}
> +EXPORT_SYMBOL(register_acpi_notifier);
> +
> +int unregister_acpi_notifier(struct notifier_block *nb)
> +{
> +	return blocking_notifier_chain_unregister(&acpi_chain_head, nb);
> +}
> +EXPORT_SYMBOL(unregister_acpi_notifier);
> +
>  #ifdef CONFIG_NET
>  static unsigned int acpi_event_seqnum;
>  struct acpi_genl_event {
> Index: linux-2.6/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-2.6.orig/include/acpi/acpi_bus.h
> +++ linux-2.6/include/acpi/acpi_bus.h
> @@ -320,6 +320,9 @@ struct acpi_bus_event {
>  
>  extern struct kset acpi_subsys;
>  extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
> +extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
> +extern int register_acpi_notifier(struct notifier_block *);
> +extern int unregister_acpi_notifier(struct notifier_block *);
>  /*
>   * External Functions
>   */
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-02  4:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-25  6:48 [PATCH 3/4] ACPI: create ACPI notifier chain Zhang Rui
2008-02-02  4:02 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox