* [patch 08/13] sony_apci: add resume handling
@ 2007-02-06 0:09 akpm
2007-02-07 21:03 ` Len Brown
0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2007-02-06 0:09 UTC (permalink / raw)
To: lenb; +Cc: linux-acpi, akpm
From: Andrew Morton <akpm@osdl.org>
Avoid dimness on resume.
Cc: Stelian Pop <stelian@popies.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/acpi/sony_acpi.c | 49 +++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 15 deletions(-)
diff -puN drivers/acpi/sony_acpi.c~sony_apci-resume drivers/acpi/sony_acpi.c
--- a/drivers/acpi/sony_acpi.c~sony_apci-resume
+++ a/drivers/acpi/sony_acpi.c
@@ -46,19 +46,6 @@ module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help "
"the development of this driver");
-static int sony_acpi_add (struct acpi_device *device);
-static int sony_acpi_remove (struct acpi_device *device, int type);
-
-static struct acpi_driver sony_acpi_driver = {
- .name = ACPI_SNC_DRIVER_NAME,
- .class = ACPI_SNC_CLASS,
- .ids = ACPI_SNC_HID,
- .ops = {
- .add = sony_acpi_add,
- .remove = sony_acpi_remove,
- },
-};
-
static acpi_handle sony_acpi_handle;
static struct proc_dir_entry *sony_acpi_dir;
@@ -69,6 +56,8 @@ static struct sony_acpi_value {
char *acpiset;/* name of the ACPI get function */
int min; /* minimum allowed value or -1 */
int max; /* maximum allowed value or -1 */
+ int value; /* current setting */
+ int valid; /* Has ever been set */
int debug; /* active only in debug mode ? */
} sony_acpi_values[] = {
{
@@ -239,10 +228,30 @@ static int sony_acpi_write(struct file *
if (acpi_callsetfunc(sony_acpi_handle, item->acpiset, value, NULL) < 0)
return -EIO;
-
+ item->value = value;
+ item->valid = 1;
return count;
}
+static int sony_acpi_resume(struct acpi_device *device)
+{
+ struct sony_acpi_value *item;
+
+ for (item = sony_acpi_values; item->name; item++) {
+ int ret;
+
+ if (!item->valid)
+ continue;
+ ret = acpi_callsetfunc(sony_acpi_handle, item->acpiset,
+ item->value, NULL);
+ if (ret < 0) {
+ printk("%s: %d\n", __FUNCTION__, ret);
+ break;
+ }
+ }
+ return 0;
+}
+
static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
{
printk(LOG_PFX "sony_acpi_notify\n");
@@ -344,7 +353,6 @@ outwalk:
return result;
}
-
static int sony_acpi_remove(struct acpi_device *device, int type)
{
acpi_status status;
@@ -367,6 +375,17 @@ static int sony_acpi_remove(struct acpi_
return 0;
}
+static struct acpi_driver sony_acpi_driver = {
+ .name = ACPI_SNC_DRIVER_NAME,
+ .class = ACPI_SNC_CLASS,
+ .ids = ACPI_SNC_HID,
+ .ops = {
+ .add = sony_acpi_add,
+ .remove = sony_acpi_remove,
+ .resume = sony_acpi_resume,
+ },
+};
+
static int __init sony_acpi_init(void)
{
int result;
_
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch 08/13] sony_apci: add resume handling
2007-02-06 0:09 [patch 08/13] sony_apci: add resume handling akpm
@ 2007-02-07 21:03 ` Len Brown
0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2007-02-07 21:03 UTC (permalink / raw)
To: akpm; +Cc: linux-acpi, stelian
NAK
Andrew, please remove this patch from -mm, as it has been included
in the acpi-test tree in a different file, sony-laptop.c
thanks,
-Len
On Monday 05 February 2007 19:09, akpm@linux-foundation.org wrote:
> From: Andrew Morton <akpm@osdl.org>
>
> Avoid dimness on resume.
>
> Cc: Stelian Pop <stelian@popies.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> drivers/acpi/sony_acpi.c | 49 +++++++++++++++++++++++++------------
> 1 file changed, 34 insertions(+), 15 deletions(-)
>
> diff -puN drivers/acpi/sony_acpi.c~sony_apci-resume drivers/acpi/sony_acpi.c
> --- a/drivers/acpi/sony_acpi.c~sony_apci-resume
> +++ a/drivers/acpi/sony_acpi.c
> @@ -46,19 +46,6 @@ module_param(debug, int, 0);
> MODULE_PARM_DESC(debug, "set this to 1 (and RTFM) if you want to help "
> "the development of this driver");
>
> -static int sony_acpi_add (struct acpi_device *device);
> -static int sony_acpi_remove (struct acpi_device *device, int type);
> -
> -static struct acpi_driver sony_acpi_driver = {
> - .name = ACPI_SNC_DRIVER_NAME,
> - .class = ACPI_SNC_CLASS,
> - .ids = ACPI_SNC_HID,
> - .ops = {
> - .add = sony_acpi_add,
> - .remove = sony_acpi_remove,
> - },
> -};
> -
> static acpi_handle sony_acpi_handle;
> static struct proc_dir_entry *sony_acpi_dir;
>
> @@ -69,6 +56,8 @@ static struct sony_acpi_value {
> char *acpiset;/* name of the ACPI get function */
> int min; /* minimum allowed value or -1 */
> int max; /* maximum allowed value or -1 */
> + int value; /* current setting */
> + int valid; /* Has ever been set */
> int debug; /* active only in debug mode ? */
> } sony_acpi_values[] = {
> {
> @@ -239,10 +228,30 @@ static int sony_acpi_write(struct file *
>
> if (acpi_callsetfunc(sony_acpi_handle, item->acpiset, value, NULL) < 0)
> return -EIO;
> -
> + item->value = value;
> + item->valid = 1;
> return count;
> }
>
> +static int sony_acpi_resume(struct acpi_device *device)
> +{
> + struct sony_acpi_value *item;
> +
> + for (item = sony_acpi_values; item->name; item++) {
> + int ret;
> +
> + if (!item->valid)
> + continue;
> + ret = acpi_callsetfunc(sony_acpi_handle, item->acpiset,
> + item->value, NULL);
> + if (ret < 0) {
> + printk("%s: %d\n", __FUNCTION__, ret);
> + break;
> + }
> + }
> + return 0;
> +}
> +
> static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
> {
> printk(LOG_PFX "sony_acpi_notify\n");
> @@ -344,7 +353,6 @@ outwalk:
> return result;
> }
>
> -
> static int sony_acpi_remove(struct acpi_device *device, int type)
> {
> acpi_status status;
> @@ -367,6 +375,17 @@ static int sony_acpi_remove(struct acpi_
> return 0;
> }
>
> +static struct acpi_driver sony_acpi_driver = {
> + .name = ACPI_SNC_DRIVER_NAME,
> + .class = ACPI_SNC_CLASS,
> + .ids = ACPI_SNC_HID,
> + .ops = {
> + .add = sony_acpi_add,
> + .remove = sony_acpi_remove,
> + .resume = sony_acpi_resume,
> + },
> +};
> +
> static int __init sony_acpi_init(void)
> {
> int result;
> _
> -
> 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:[~2007-02-07 21:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-06 0:09 [patch 08/13] sony_apci: add resume handling akpm
2007-02-07 21:03 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox