public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 12/13] sony_acpi: allow multiple sony_acpi_values for the same .name
@ 2007-02-06  0:09 akpm
  2007-02-07 21:08 ` 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, malattia

From: Mattia Dongili <malattia@linux.it>

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: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/acpi/sony_acpi.c |   44 +++++++++++++++++++++----------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff -puN drivers/acpi/sony_acpi.c~sony_acpi-allow-multiple-sony_acpi_values-for-the-same-name drivers/acpi/sony_acpi.c
--- a/drivers/acpi/sony_acpi.c~sony_acpi-allow-multiple-sony_acpi_values-for-the-same-name
+++ a/drivers/acpi/sony_acpi.c
@@ -68,7 +68,7 @@ static struct backlight_properties sony_
 
 static struct sony_acpi_value {
 	char			*name;	 /* name of the entry */
-	struct proc_dir_entry 	*proc;	 /* /proc entry */
+	struct proc_dir_entry	*proc;	 /* /proc entry */
 	char			*acpiget;/* name of the ACPI get function */
 	char			*acpiset;/* name of the ACPI get function */
 	int 			min;	 /* minimum allowed value or -1 */
@@ -78,6 +78,7 @@ static struct sony_acpi_value {
 	int			debug;	 /* active only in debug mode ? */
 } sony_acpi_values[] = {
 	{
+		/* for backward compatibility only */
 		.name		= "brightness",
 		.acpiget	= "GBRT",
 		.acpiset	= "SBRT",
@@ -107,6 +108,14 @@ static struct sony_acpi_value {
 		.debug		= 0,
 	},
 	{
+		.name		= "cdpower",
+		.acpiget	= "GCDP",
+		.acpiset	= "CDPW",
+		.min		= 0,
+		.max		= 1,
+		.debug		= 0,
+	},
+	{
 		.name           = "audiopower",
 		.acpiget        = "GAZP",
 		.acpiset        = "AZPW",
@@ -356,27 +365,24 @@ static int sony_acpi_add(struct acpi_dev
 		if (!debug && item->debug)
 			continue;
 
-		if (item->acpiget &&
-		    ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
-		    		 item->acpiget, &handle)))
-			proc_file_mode = S_IRUSR;
-		else
-			printk(LOG_PFX "unable to get ACPI handle for %s (get)\n",
-					item->name);
-
-		if (item->acpiset &&
-		    ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
-		    		 item->acpiset, &handle)))
-			proc_file_mode |= S_IWUSR;
-		else
-			printk(LOG_PFX "unable to get ACPI handle for %s (set)\n",
-					item->name);
+		if (item->acpiget) {
+			if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
+							item->acpiget, &handle)))
+				continue;
 
-		if (proc_file_mode == 0)
-			continue;
+			proc_file_mode |= S_IRUSR;
+		}
+
+		if (item->acpiset) {
+			if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
+							item->acpiset, &handle)))
+				continue;
+
+			proc_file_mode |= S_IWUSR;
+		}
 
 		item->proc = create_proc_entry(item->name, proc_file_mode,
-					       acpi_device_dir(device));
+				acpi_device_dir(device));
 		if (!item->proc) {
 			printk(LOG_PFX "unable to create proc entry\n");
 			result = -EIO;
_

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

* Re: [patch 12/13] sony_acpi: allow multiple sony_acpi_values for the same .name
  2007-02-06  0:09 [patch 12/13] sony_acpi: allow multiple sony_acpi_values for the same .name akpm
@ 2007-02-07 21:08 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2007-02-07 21:08 UTC (permalink / raw)
  To: akpm; +Cc: linux-acpi, malattia

NAK,
included in sony-laptop.c series

thanks,
-Len

On Monday 05 February 2007 19:09, akpm@linux-foundation.org wrote:
> From: Mattia Dongili <malattia@linux.it>
> 
> 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: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/acpi/sony_acpi.c |   44 +++++++++++++++++++++----------------
>  1 file changed, 25 insertions(+), 19 deletions(-)
> 
> diff -puN drivers/acpi/sony_acpi.c~sony_acpi-allow-multiple-sony_acpi_values-for-the-same-name drivers/acpi/sony_acpi.c
> --- a/drivers/acpi/sony_acpi.c~sony_acpi-allow-multiple-sony_acpi_values-for-the-same-name
> +++ a/drivers/acpi/sony_acpi.c
> @@ -68,7 +68,7 @@ static struct backlight_properties sony_
>  
>  static struct sony_acpi_value {
>  	char			*name;	 /* name of the entry */
> -	struct proc_dir_entry 	*proc;	 /* /proc entry */
> +	struct proc_dir_entry	*proc;	 /* /proc entry */
>  	char			*acpiget;/* name of the ACPI get function */
>  	char			*acpiset;/* name of the ACPI get function */
>  	int 			min;	 /* minimum allowed value or -1 */
> @@ -78,6 +78,7 @@ static struct sony_acpi_value {
>  	int			debug;	 /* active only in debug mode ? */
>  } sony_acpi_values[] = {
>  	{
> +		/* for backward compatibility only */
>  		.name		= "brightness",
>  		.acpiget	= "GBRT",
>  		.acpiset	= "SBRT",
> @@ -107,6 +108,14 @@ static struct sony_acpi_value {
>  		.debug		= 0,
>  	},
>  	{
> +		.name		= "cdpower",
> +		.acpiget	= "GCDP",
> +		.acpiset	= "CDPW",
> +		.min		= 0,
> +		.max		= 1,
> +		.debug		= 0,
> +	},
> +	{
>  		.name           = "audiopower",
>  		.acpiget        = "GAZP",
>  		.acpiset        = "AZPW",
> @@ -356,27 +365,24 @@ static int sony_acpi_add(struct acpi_dev
>  		if (!debug && item->debug)
>  			continue;
>  
> -		if (item->acpiget &&
> -		    ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
> -		    		 item->acpiget, &handle)))
> -			proc_file_mode = S_IRUSR;
> -		else
> -			printk(LOG_PFX "unable to get ACPI handle for %s (get)\n",
> -					item->name);
> -
> -		if (item->acpiset &&
> -		    ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
> -		    		 item->acpiset, &handle)))
> -			proc_file_mode |= S_IWUSR;
> -		else
> -			printk(LOG_PFX "unable to get ACPI handle for %s (set)\n",
> -					item->name);
> +		if (item->acpiget) {
> +			if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
> +							item->acpiget, &handle)))
> +				continue;
>  
> -		if (proc_file_mode == 0)
> -			continue;
> +			proc_file_mode |= S_IRUSR;
> +		}
> +
> +		if (item->acpiset) {
> +			if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
> +							item->acpiset, &handle)))
> +				continue;
> +
> +			proc_file_mode |= S_IWUSR;
> +		}
>  
>  		item->proc = create_proc_entry(item->name, proc_file_mode,
> -					       acpi_device_dir(device));
> +				acpi_device_dir(device));
>  		if (!item->proc) {
>  			printk(LOG_PFX "unable to create proc entry\n");
>  			result = -EIO;
> _
> -
> 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:09 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 12/13] sony_acpi: allow multiple sony_acpi_values for the same .name akpm
2007-02-07 21:08 ` Len Brown

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