aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Dongili <malattia@linux.it>2007-01-13 17:04:40 -0500
committerLen Brown <len.brown@intel.com>2007-02-13 03:06:35 -0500
commit57ede701af3bc0c153070133e7831332ffa1d761 (patch)
treeb4fc837ae7adce11dc8b9681f4a208da55bac740
parent4465857d5f99079bae00621626adf74ed8256296 (diff)
sony_acpi: Allow multiple sony_acpi_values for the same .name
The acpi handles are kept _only_ if both the requested .acpiget and .acpiset are available in the DSDT. Currently only the SCDP/CDPW dualism is known. Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/sony_acpi.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/acpi/sony_acpi.c b/drivers/acpi/sony_acpi.c
index 1f7dca337025..c65f5893e0e2 100644
--- a/drivers/acpi/sony_acpi.c
+++ b/drivers/acpi/sony_acpi.c
@@ -68,7 +68,7 @@ static struct backlight_properties sony_backlight_properties = {
68 68
69static struct sony_acpi_value { 69static struct sony_acpi_value {
70 char *name; /* name of the entry */ 70 char *name; /* name of the entry */
71 struct proc_dir_entry *proc; /* /proc entry */ 71 struct proc_dir_entry *proc; /* /proc entry */
72 char *acpiget;/* name of the ACPI get function */ 72 char *acpiget;/* name of the ACPI get function */
73 char *acpiset;/* name of the ACPI get function */ 73 char *acpiset;/* name of the ACPI get function */
74 int min; /* minimum allowed value or -1 */ 74 int min; /* minimum allowed value or -1 */
@@ -78,6 +78,7 @@ static struct sony_acpi_value {
78 int debug; /* active only in debug mode ? */ 78 int debug; /* active only in debug mode ? */
79} sony_acpi_values[] = { 79} sony_acpi_values[] = {
80 { 80 {
81 /* for backward compatibility only */
81 .name = "brightness", 82 .name = "brightness",
82 .acpiget = "GBRT", 83 .acpiget = "GBRT",
83 .acpiset = "SBRT", 84 .acpiset = "SBRT",
@@ -107,6 +108,14 @@ static struct sony_acpi_value {
107 .debug = 0, 108 .debug = 0,
108 }, 109 },
109 { 110 {
111 .name = "cdpower",
112 .acpiget = "GCDP",
113 .acpiset = "CDPW",
114 .min = 0,
115 .max = 1,
116 .debug = 0,
117 },
118 {
110 .name = "audiopower", 119 .name = "audiopower",
111 .acpiget = "GAZP", 120 .acpiget = "GAZP",
112 .acpiset = "AZPW", 121 .acpiset = "AZPW",
@@ -356,27 +365,24 @@ static int sony_acpi_add(struct acpi_device *device)
356 if (!debug && item->debug) 365 if (!debug && item->debug)
357 continue; 366 continue;
358 367
359 if (item->acpiget && 368 if (item->acpiget) {
360 ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, 369 if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
361 item->acpiget, &handle))) 370 item->acpiget, &handle)))
362 proc_file_mode = S_IRUSR; 371 continue;
363 else
364 printk(LOG_PFX "unable to get ACPI handle for %s (get)\n",
365 item->name);
366
367 if (item->acpiset &&
368 ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
369 item->acpiset, &handle)))
370 proc_file_mode |= S_IWUSR;
371 else
372 printk(LOG_PFX "unable to get ACPI handle for %s (set)\n",
373 item->name);
374 372
375 if (proc_file_mode == 0) 373 proc_file_mode |= S_IRUSR;
376 continue; 374 }
375
376 if (item->acpiset) {
377 if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
378 item->acpiset, &handle)))
379 continue;
380
381 proc_file_mode |= S_IWUSR;
382 }
377 383
378 item->proc = create_proc_entry(item->name, proc_file_mode, 384 item->proc = create_proc_entry(item->name, proc_file_mode,
379 acpi_device_dir(device)); 385 acpi_device_dir(device));
380 if (!item->proc) { 386 if (!item->proc) {
381 printk(LOG_PFX "unable to create proc entry\n"); 387 printk(LOG_PFX "unable to create proc entry\n");
382 result = -EIO; 388 result = -EIO;