public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hiroshi Miura <miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
To: David Bronaugh <dbronaugh-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	letsnote-tech-eXqGM+LsbTTAqL8d+zIrHngSJqDPrsil@public.gmane.org
Subject: [PATCH]Panasonic Hotkey Driver v0.6.3
Date: Thu, 26 Aug 2004 17:45:40 +0900	[thread overview]
Message-ID: <87pt5e5lu3.wl%miura@da-cha.org> (raw)
In-Reply-To: <41297BA7.3050503-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

Hi,

Bugfix:
v0.6.2 cannot generate hotkey event because pcc_acpi_get_key() does not
return proper value. And it is not handle return value of acpi_bus_register_driver(), too.

Cleanup:
ACPI subsystem has funcion 'acpi_evaluate_integer',
I can replase read_acpi_int by it.

These patchs fix these problems.

# these are generated by bkexport script.


[-- Attachment #2: pcc_acpi_20040826_1.patch --]
[-- Type: application/octet-stream, Size: 3482 bytes --]

#### AUTHOR miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org
#### COMMENT START
### Comments for ChangeSet
[ACPI] pcc_acpi: clean up. replace read_acpi_int to standard acpi_evaluate_interger.
### Comments for drivers/acpi/pcc_acpi.c
replace read_acpi_int to standard acpi_evaluate_interger.
#### COMMENT END

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/25 21:16:52+09:00 miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org 
#   [ACPI] pcc_acpi: clean up. replace read_acpi_int to standard acpi_evaluate_interger.
# 
# drivers/acpi/pcc_acpi.c
#   2004/08/25 21:16:32+09:00 miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org +17 -39
#   replace read_acpi_int to standard acpi_evaluate_interger.
# 
diff -Nru a/drivers/acpi/pcc_acpi.c b/drivers/acpi/pcc_acpi.c
--- a/drivers/acpi/pcc_acpi.c	2004-08-26 17:23:24 +09:00
+++ b/drivers/acpi/pcc_acpi.c	2004-08-26 17:23:24 +09:00
@@ -52,7 +52,7 @@
  *
  */
 
-#define ACPI_PCC_VERSION	"0.6.2"
+#define ACPI_PCC_VERSION	"0.6.3"
 
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -155,32 +155,6 @@
 	return_VALUE(status == AE_OK);
 }
 
-static int read_acpi_int(acpi_handle handle, const char* methodName, int* pVal)
-{
-	struct acpi_buffer results;
-	union acpi_object out_objs[1];
-	acpi_status status;
-
-	results.length = sizeof(out_objs);
-	results.pointer = out_objs;
-
-	status = acpi_evaluate_object(handle, (char*)methodName, 0, &results);
-	if (ACPI_FAILURE(status)) {
-		printk(KERN_INFO LOGPREFIX "acpi evaluate error on %s\n", 
-		       methodName);
-		return -EFAULT;
-	}
-
-	if (out_objs[0].type == ACPI_TYPE_INTEGER) {
-		*pVal = out_objs[0].integer.value;
-	} else {
-		printk(KERN_INFO LOGPREFIX "return value is not int\n");
-		status = AE_ERROR;
-	}
-
-	return (status == AE_OK);
-}
-
 /* register utils for proc handler */
 static int dispatch_read(char* page, char** start, off_t off, int count, 
 			 int* eof, ProcItem* item)
@@ -238,18 +212,20 @@
 	return result;
 }
 
-static inline int acpi_pcc_get_sqty(void) 
+static inline int acpi_pcc_get_sqty(struct acpi_device *device) 
 {
-	int s;
+	unsigned long s;
+	acpi_status status;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_get_sqty");
 
-	if (read_acpi_int(NULL, DEVICE_NAME_HKEY "." METHOD_HKEY_SQTY, &s)) {
-		return s;
+	status = acpi_evaluate_integer(device->handle,METHOD_HKEY_SQTY,NULL,&s);
+	if (ACPI_SUCCESS(status)) {
+		return_VALUE(s);
 	} else {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
 				  "evaluation error HKEY.SQTY\n"));
-		return -EINVAL;
+		return_VALUE(-EINVAL);
 	}
 }
 
@@ -439,17 +415,19 @@
 /* hotkey driver */
 static int acpi_pcc_hotkey_get_key(struct acpi_hotkey *hotkey)
 {
-	int result;
-	int status;
+	unsigned long result;
+	acpi_status status;
 
-	status = read_acpi_int(hotkey->handle, METHOD_HKEY_QUERY, &result);
-	if (status < 0) {
-		printk(KERN_INFO LOGPREFIX "error getting hotkey status\n");
+	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_get_key");
+
+	status = acpi_evaluate_integer(hotkey->handle,METHOD_HKEY_QUERY,NULL,&result);
+	if (ACPI_FAILURE(status)) {
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "error getting hotkey status\n"));
 	} else {
 		hotkey->status = result;
 	}
 
-	return (status);
+	return_VALUE(status);
 }
 
 void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data)
@@ -559,7 +537,7 @@
 		return_VALUE(-EINVAL);
 	}
 
-	num_sifr = acpi_pcc_get_sqty();
+	num_sifr = acpi_pcc_get_sqty(device);
 	
 	if (num_sifr > 255) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "num_sifr too large"));

[-- Attachment #3: pcc_acpi_20040826_2.patch --]
[-- Type: application/octet-stream, Size: 5672 bytes --]

#### AUTHOR miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org
#### COMMENT START
### Comments for ChangeSet
[ACPI] pcc_acpi: fix to enable notifier and clean up.
### Comments for drivers/acpi/pcc_acpi.c
v0.6.3 replace read_acpi_int by standard function acpi_evaluate_integer
       some clean up and make smart copyright notice. 
       fix return value of pcc_acpi_get_key.
       fix checking return value of acpi_bus_register_driver()
#### COMMENT END

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/08/26 12:10:56+09:00 miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org 
#   [ACPI] pcc_acpi: fix to enable notifier and clean up.
# 
# drivers/acpi/pcc_acpi.c
#   2004/08/26 12:10:36+09:00 miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org +31 -18
#   v0.6.3 replace read_acpi_int by standard function acpi_evaluate_integer
#          some clean up and make smart copyright notice. 
#          fix return value of pcc_acpi_get_key.
#          fix checking return value of acpi_bus_register_driver()
# 
diff -Nru a/drivers/acpi/pcc_acpi.c b/drivers/acpi/pcc_acpi.c
--- a/drivers/acpi/pcc_acpi.c	2004-08-26 17:24:08 +09:00
+++ b/drivers/acpi/pcc_acpi.c	2004-08-26 17:24:08 +09:00
@@ -1,8 +1,9 @@
 /*
  *  Panasonic HotKey and lcd brightness control Extra driver
- *  Written by Hiroshi Miura <miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>  2004
+ *  (C) 2004 Hiroshi Miura <miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
+ *  (C) 2004 NTT DATA Intellilink Co. http://www.intellilink.co.jp/
  *
- *  Copyright (C) 2002-2004 John Belmonte
+ *  derived from toshiba_acpi.c, Copyright (C) 2002-2004 John Belmonte
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as 
@@ -20,6 +21,12 @@
  *---------------------------------------------------------------------------
  *
  * ChangeLog:
+ *	Aug.25, 2004	Hiroshi Miura <miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
+ *		-v0.6.3 replace read_acpi_int by standard function acpi_evaluate_integer
+ *			some clean up and make smart copyright notice.
+ *			fix return value of pcc_acpi_get_key()
+ *			fix checking return value of acpi_bus_register_driver() 
+ *
  *      Aug.22, 2004    David Bronaugh <dbronaugh-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
  *              -v0.6.2 Add check on ACPI data (num_sifr)
  *                      Coding style cleanups, better error messages/handling
@@ -92,7 +99,6 @@
  *
  *******************************************************************/
 #define PROC_PCC		"pcc"
-#define PROC_VIDEO "video"
 
 #define ACPI_PCC_DRIVER_NAME "PCC HotKey Driver"
 #define ACPI_HOTKEY_DEVICE_NAME "HotKey"
@@ -275,16 +281,18 @@
 {
 	u32* sinf = kmalloc(sizeof(u32) * (num_sifr + 1), GFP_KERNEL);
 
+	ACPI_FUNCTION_TRACE("acpi_pcc_read_sinf_field");
+
 	if (!sinf) {
-		printk(KERN_INFO LOGPREFIX "Couldn't allocate %i bytes\n", 
-		       sizeof(u32) * num_sifr);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate %i bytes\n", 
+		       sizeof(u32) * num_sifr));
 		return p;
 	}
 
 	if (acpi_pcc_retrieve_biosdata(sinf)) {
 		p += sprintf(p, "%d\n",	sinf[field]);
 	} else {
-		printk(KERN_INFO LOGPREFIX "Couldn't retrieve BIOS data\n");
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n"));
 	}
 
 	kfree(sinf);
@@ -362,19 +370,21 @@
 	u32 bright;
 	u32* sinf = kmalloc(sizeof(u32) * (num_sifr + 1), GFP_KERNEL);
 
+	ACPI_FUNCTION_TRACE("acpi_pcc_write_brightness");
+
 	if (!sinf) {
-		printk(KERN_INFO LOGPREFIX "Couldn't allocate %i bytes\n", 
-		       sizeof(u32) * num_sifr);
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't allocate %i bytes\n", 
+		       sizeof(u32) * num_sifr));
 		return count;
 	}
 
 	if (!acpi_pcc_retrieve_biosdata(sinf)) {
-		printk(KERN_INFO LOGPREFIX "Couldn't retrieve BIOS data\n");
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't retrieve BIOS data\n"));
 		goto end;
 	}
 	
 	if (!sscanf(buffer, "%i", &bright)) {
-		printk(KERN_INFO LOGPREFIX "Invalid DC brightness\n");
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid DC brightness\n"));
 		goto end;
 	}
 
@@ -416,7 +426,7 @@
 static int acpi_pcc_hotkey_get_key(struct acpi_hotkey *hotkey)
 {
 	unsigned long result;
-	acpi_status status;
+	acpi_status status = AE_OK;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_get_key");
 
@@ -427,7 +437,7 @@
 		hotkey->status = result;
 	}
 
-	return_VALUE(status);
+	return_VALUE(status == AE_OK);
 }
 
 void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data)
@@ -498,21 +508,24 @@
 static int __init acpi_pcc_proc_init(void)
 {
 	acpi_status status = AE_OK;
+
+	ACPI_FUNCTION_TRACE("acpi_pcc_proc_init");
+
 	acpi_pcc_dir = proc_mkdir(PROC_PCC, acpi_root_dir);
 
 	if (unlikely(!acpi_pcc_dir)) {
-		printk(KERN_INFO LOGPREFIX "Couldn't create dir in /proc\n");
-		return -ENODEV;
+		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Couldn't create dir in /proc\n"));
+		return_VALUE(-ENODEV);
 	}
 
 	acpi_pcc_dir->owner = THIS_MODULE;
 	status = add_device(pcc_proc_items, acpi_pcc_dir);
 	if (ACPI_FAILURE(status)) {
 		remove_proc_entry(PROC_PCC, acpi_root_dir);
-		return -ENODEV;
+		return_VALUE(-ENODEV);
 	}
 
-	return (status == AE_OK);
+	return_VALUE(status == AE_OK);
 }
 
 static acpi_status __exit remove_device(ProcItem *proc_items, 
@@ -604,7 +617,7 @@
 
 static int __init acpi_pcc_init(void)
 {
-	acpi_status result = AE_OK;
+	int result = 0;
  
 	ACPI_FUNCTION_TRACE("acpi_pcc_init");
 
@@ -613,7 +626,7 @@
 	}
 
 	result = acpi_bus_register_driver(&acpi_hotkey_driver);
-	if (ACPI_FAILURE(result)) {
+	if (result < 0) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error registering hotkey driver\n"));
 		return_VALUE(-ENODEV);
 	}

[-- Attachment #4: Type: text/plain, Size: 376 bytes --]

-- 
Hiroshi Miura  --- http://www.da-cha.org/  --- miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org
NTTDATA Corp. OpenSource Software Center. --- miurahr-3MafRgGXt7BL9jVzuh4AOg@public.gmane.org 
NTTDATA Intellilink Corp. OpenSource Engineering Dev. -- miurahr-w0OK63jvRlAuJ+9fw/WgBHgSJqDPrsil@public.gmane.org
Key fingerprint = 9117 9407 5684 FBF1 4063  15B4 401D D077 04AB 8617

  parent reply	other threads:[~2004-08-26  8:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-19  6:00 [PATCH]Panasonic Hotkey Driver David Bronaugh
     [not found] ` <41244219.1090603-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-20  2:51   ` Hiroshi Miura
     [not found]     ` <871xi2s555.wl%miura@da-cha.org>
     [not found]       ` <871xi2s555.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-20  6:25         ` [PATCH]Panasonic Hotkey Driver v0.5 [1/2] Hiroshi Miura
     [not found]           ` <87vffeqqaq.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-20 17:11             ` Len Brown
2004-08-21  1:30               ` [letsnote-tech:00074] " Hiroshi Miura
     [not found]     ` <87acwqserw.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-20  6:25       ` [PATCH]Panasonic Hotkey Driver v0.5 [2/2] Hiroshi Miura
     [not found]         ` <87u0uyqqa7.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-20  7:44           ` David Bronaugh
     [not found]             ` <4125ABEF.9090106-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-20  8:43               ` Hiroshi Miura
     [not found]                 ` <87pt5mqjxj.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-20 12:46                   ` Stefan Seyfried
2004-08-20 17:14                   ` David Bronaugh
     [not found]                     ` <41263192.7010300-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-20 17:43                       ` Nate Lawson
     [not found]                         ` <41263840.1010003-Y6VGUYTwhu0@public.gmane.org>
2004-08-21  0:46                           ` Hiroshi Miura
2004-08-21  5:39                           ` Hiroshi Miura
2004-08-21  1:30                       ` Hiroshi Miura
2004-08-24 23:00           ` John Belmonte
2004-08-21  1:42   ` [PATCH]Panasonic Hotkey Driver Hiroshi Miura
     [not found]     ` <87zn4pl116.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-21  5:33       ` Hiroshi Miura
     [not found]         ` <87n00pkqc5.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-21  8:44           ` David Bronaugh
     [not found]             ` <41270B53.3060903-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-21 10:34               ` Hiroshi Miura
     [not found]                 ` <87d61klqzh.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-08-21 11:50                   ` vgod spam
2004-08-22  6:45                   ` David Bronaugh
     [not found]                     ` <41284119.1060504-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-22  8:27                       ` David Bronaugh
     [not found]                         ` <412858F0.8050406-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-23  5:07                           ` David Bronaugh
     [not found]                             ` <41297BA7.3050503-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org>
2004-08-26  8:45                               ` Hiroshi Miura [this message]
     [not found]                                 ` <87pt5e5lu3.wl%miura-yiisDzvROlQdnm+yROfE0A@public.gmane.org>
2004-09-15  0:42                                   ` [PATCH]Panasonic Hotkey Driver v0.7 Hiroshi Miura

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=87pt5e5lu3.wl%miura@da-cha.org \
    --to=miura-yiisdzvrolqdnm+yrofe0a@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=dbronaugh-Jp3n8lUXroSX6QiC4yPwbg@public.gmane.org \
    --cc=letsnote-tech-eXqGM+LsbTTAqL8d+zIrHngSJqDPrsil@public.gmane.org \
    /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