linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: malattia@linux.it
To: lenb@kernel.org
Cc: linux-acpi@vger.kernel.org, Stelian Pop <stelian@popies.net>
Subject: [PATCH 7/11] Add acpi_bus_generate event
Date: Sat, 13 Jan 2007 23:04:37 +0100	[thread overview]
Message-ID: <1168725881949-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <11687258813214-git-send-email-malattia@linux.it>

From: Stelian Pop <stelian@popies.net>

Added acpi_bus_generate event for forwarding Fn-keys pressed to acpi subsystem,
and made correspondent necessary changes for this to work.

Signed-off-by: Nilton Volpato <nilton.volpato@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/acpi/sony_acpi.c |   53 ++++++++++++++++++++++++---------------------
 1 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/drivers/acpi/sony_acpi.c b/drivers/acpi/sony_acpi.c
index 195895c..138f2b6 100644
--- a/drivers/acpi/sony_acpi.c
+++ b/drivers/acpi/sony_acpi.c
@@ -54,6 +54,7 @@ MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help "
 
 static acpi_handle sony_acpi_handle;
 static struct proc_dir_entry *sony_acpi_dir;
+static struct acpi_device *sony_acpi_acpi_device = NULL;
 
 static int sony_backlight_update_status(struct backlight_device *bd);
 static int sony_backlight_get_brightness(struct backlight_device *bd);
@@ -270,7 +271,9 @@ static int sony_acpi_resume(struct acpi_device *device)
 
 static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
-	printk(LOG_PFX "sony_acpi_notify\n");
+	if (debug)
+		printk(LOG_PFX "sony_acpi_notify, event: %d\n", event);
+	acpi_bus_generate_event(sony_acpi_acpi_device, 1, event);
 }
 
 static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
@@ -295,6 +298,8 @@ static int sony_acpi_add(struct acpi_device *device)
 	acpi_handle handle;
 	struct sony_acpi_value *item;
 
+	sony_acpi_acpi_device = device;
+
 	sony_acpi_handle = device->handle;
 
 	acpi_driver_data(device) = NULL;
@@ -308,16 +313,16 @@ static int sony_acpi_add(struct acpi_device *device)
 			result = -ENODEV;
 			goto outwalk;
 		}
+	}
 
-		status = acpi_install_notify_handler(sony_acpi_handle,
-						     ACPI_DEVICE_NOTIFY,
-						     sony_acpi_notify,
-						     NULL);
-		if (ACPI_FAILURE(status)) {
-			printk(LOG_PFX "unable to install notify handler\n");
-			result = -ENODEV;
-			goto outnotify;
-		}
+	status = acpi_install_notify_handler(sony_acpi_handle,
+					     ACPI_DEVICE_NOTIFY,
+					     sony_acpi_notify,
+					     NULL);
+	if (ACPI_FAILURE(status)) {
+		printk(LOG_PFX "unable to install notify handler\n");
+		result = -ENODEV;
+		goto outnotify;
 	}
 
 	if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) {
@@ -342,7 +347,7 @@ static int sony_acpi_add(struct acpi_device *device)
 		    		 item->acpiset, &handle)))
 		    	continue;
 
-		item->proc = create_proc_entry(item->name, 0600,
+		item->proc = create_proc_entry(item->name, 0666,
 					       acpi_device_dir(device));
 		if (!item->proc) {
 			printk(LOG_PFX "unable to create proc entry\n");
@@ -361,13 +366,11 @@ static int sony_acpi_add(struct acpi_device *device)
 	return 0;
 
 outproc:
-	if (debug) {
-		status = acpi_remove_notify_handler(sony_acpi_handle,
-						    ACPI_DEVICE_NOTIFY,
-						    sony_acpi_notify);
-		if (ACPI_FAILURE(status))
-			printk(LOG_PFX "unable to remove notify handler\n");
-	}
+	status = acpi_remove_notify_handler(sony_acpi_handle,
+					    ACPI_DEVICE_NOTIFY,
+					    sony_acpi_notify);
+	if (ACPI_FAILURE(status))
+		printk(LOG_PFX "unable to remove notify handler\n");
 outnotify:
 	for (item = sony_acpi_values; item->name; ++item)
 		if (item->proc)
@@ -384,13 +387,13 @@ static int sony_acpi_remove(struct acpi_device *device, int type)
 	if (sony_backlight_device)
 		backlight_device_unregister(sony_backlight_device);
 
-	if (debug) {
-		status = acpi_remove_notify_handler(sony_acpi_handle,
-						    ACPI_DEVICE_NOTIFY,
-						    sony_acpi_notify);
-		if (ACPI_FAILURE(status))
-			printk(LOG_PFX "unable to remove notify handler\n");
-	}
+	sony_acpi_acpi_device = NULL;
+
+	status = acpi_remove_notify_handler(sony_acpi_handle,
+					    ACPI_DEVICE_NOTIFY,
+					    sony_acpi_notify);
+	if (ACPI_FAILURE(status))
+		printk(LOG_PFX "unable to remove notify handler\n");
 
 	for (item = sony_acpi_values; item->name; ++item)
 		if (item->proc)
-- 
1.4.4.2


  reply	other threads:[~2007-01-13 22:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-13 22:04 [PATCH 0/11] sony_acpi: prepare for prime time (resend) malattia
2007-01-13 22:04 ` [PATCH 1/11] SNC device support for Sony Vaios malattia
2007-01-13 22:04   ` [PATCH 2/11] Avoid dimness on resume malattia
2007-01-13 22:04     ` [PATCH 3/11] Fix sony_acpi_resume call malattia
2007-01-13 22:04       ` [PATCH 4/11] Add backlight support to the sony_acpi malattia
2007-01-13 22:04         ` [PATCH 5/11] Add backlight support to the sony_acpi v2 malattia
2007-01-13 22:04           ` [PATCH 6/11] Video sysfs support take 2 malattia
2007-01-13 22:04             ` malattia [this message]
2007-01-13 22:04               ` [PATCH 8/11] Allow easier debugging for the unknown SNC methods malattia
2007-01-13 22:04                 ` [PATCH 9/11] Add lanpower and audiopower controls malattia
2007-01-13 22:04                   ` [PATCH 10/11] Allow multiple sony_acpi_values for the same .name malattia
2007-01-13 22:04                     ` [PATCH 11/11] Fix sony_acpi backlight registration and unregistration malattia
2007-01-15  9:01 ` [PATCH 0/11] sony_acpi: prepare for prime time (resend) Luming Yu
2007-01-15 19:12   ` Mattia Dongili
2007-01-17  5:50     ` Luming Yu
2007-01-17  9:34       ` Mattia Dongili
  -- strict thread matches above, loose matches on Subject: below --
2007-01-07 17:54 [PATCH 0/11] sony_acpi: getting in shape for prime time malattia
2007-01-07 17:54 ` [PATCH 1/11] SNC device support for Sony Vaios malattia
2007-01-07 17:54   ` [PATCH 2/11] Avoid dimness on resume malattia
2007-01-07 17:54     ` [PATCH 3/11] Fix sony_acpi_resume call malattia
2007-01-07 17:54       ` [PATCH 4/11] Add backlight support to the sony_acpi malattia
2007-01-07 17:54         ` [PATCH 5/11] Add backlight support to the sony_acpi v2 malattia
2007-01-07 17:54           ` [PATCH 6/11] Video sysfs support take 2 malattia
2007-01-07 17:54             ` [PATCH 7/11] Add acpi_bus_generate event malattia

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=1168725881949-git-send-email-malattia@linux.it \
    --to=malattia@linux.it \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=stelian@popies.net \
    /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;
as well as URLs for NNTP newsgroup(s).