diff options
author | Mattia Dongili <malattia@linux.it> | 2007-01-13 17:04:38 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-13 03:06:11 -0500 |
commit | 05e2d8274ef4504db9941f7c515f340ab6c0b2e1 (patch) | |
tree | 7ee3935ed571f0ebdd2854498baf67cd9d12c6df /drivers | |
parent | c561162f10b9f35c9aa5c25eb8dbeb446f0c5201 (diff) |
sony_acpi: Allow easier debugging for the unknown SNC methods.
Allow the existence of a setter method without a getter and viceversa,
additionaly set /proc file permissions reflecting it.
Fix also the error exit path.
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/sony_acpi.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/acpi/sony_acpi.c b/drivers/acpi/sony_acpi.c index 138f2b6184d3..69122ad778f5 100644 --- a/drivers/acpi/sony_acpi.c +++ b/drivers/acpi/sony_acpi.c | |||
@@ -296,6 +296,7 @@ static int sony_acpi_add(struct acpi_device *device) | |||
296 | acpi_status status; | 296 | acpi_status status; |
297 | int result; | 297 | int result; |
298 | acpi_handle handle; | 298 | acpi_handle handle; |
299 | mode_t proc_file_mode; | ||
299 | struct sony_acpi_value *item; | 300 | struct sony_acpi_value *item; |
300 | 301 | ||
301 | sony_acpi_acpi_device = device; | 302 | sony_acpi_acpi_device = device; |
@@ -334,20 +335,31 @@ static int sony_acpi_add(struct acpi_device *device) | |||
334 | } | 335 | } |
335 | 336 | ||
336 | for (item = sony_acpi_values; item->name; ++item) { | 337 | for (item = sony_acpi_values; item->name; ++item) { |
338 | proc_file_mode = 0; | ||
339 | |||
337 | if (!debug && item->debug) | 340 | if (!debug && item->debug) |
338 | continue; | 341 | continue; |
339 | 342 | ||
340 | if (item->acpiget && | 343 | if (item->acpiget && |
341 | ACPI_FAILURE(acpi_get_handle(sony_acpi_handle, | 344 | ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, |
342 | item->acpiget, &handle))) | 345 | item->acpiget, &handle))) |
343 | continue; | 346 | proc_file_mode = S_IRUSR; |
347 | else | ||
348 | printk(LOG_PFX "unable to get ACPI handle for %s (get)\n", | ||
349 | item->name); | ||
344 | 350 | ||
345 | if (item->acpiset && | 351 | if (item->acpiset && |
346 | ACPI_FAILURE(acpi_get_handle(sony_acpi_handle, | 352 | ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, |
347 | item->acpiset, &handle))) | 353 | item->acpiset, &handle))) |
348 | continue; | 354 | proc_file_mode |= S_IWUSR; |
355 | else | ||
356 | printk(LOG_PFX "unable to get ACPI handle for %s (set)\n", | ||
357 | item->name); | ||
358 | |||
359 | if (proc_file_mode == 0) | ||
360 | continue; | ||
349 | 361 | ||
350 | item->proc = create_proc_entry(item->name, 0666, | 362 | item->proc = create_proc_entry(item->name, proc_file_mode, |
351 | acpi_device_dir(device)); | 363 | acpi_device_dir(device)); |
352 | if (!item->proc) { | 364 | if (!item->proc) { |
353 | printk(LOG_PFX "unable to create proc entry\n"); | 365 | printk(LOG_PFX "unable to create proc entry\n"); |
@@ -366,15 +378,15 @@ static int sony_acpi_add(struct acpi_device *device) | |||
366 | return 0; | 378 | return 0; |
367 | 379 | ||
368 | outproc: | 380 | outproc: |
381 | for (item = sony_acpi_values; item->name; ++item) | ||
382 | if (item->proc) | ||
383 | remove_proc_entry(item->name, acpi_device_dir(device)); | ||
384 | outnotify: | ||
369 | status = acpi_remove_notify_handler(sony_acpi_handle, | 385 | status = acpi_remove_notify_handler(sony_acpi_handle, |
370 | ACPI_DEVICE_NOTIFY, | 386 | ACPI_DEVICE_NOTIFY, |
371 | sony_acpi_notify); | 387 | sony_acpi_notify); |
372 | if (ACPI_FAILURE(status)) | 388 | if (ACPI_FAILURE(status)) |
373 | printk(LOG_PFX "unable to remove notify handler\n"); | 389 | printk(LOG_PFX "unable to remove notify handler\n"); |
374 | outnotify: | ||
375 | for (item = sony_acpi_values; item->name; ++item) | ||
376 | if (item->proc) | ||
377 | remove_proc_entry(item->name, acpi_device_dir(device)); | ||
378 | outwalk: | 390 | outwalk: |
379 | return result; | 391 | return result; |
380 | } | 392 | } |