Skip to contentSkip to conversation

Add mising static's to button.c

PATCH Pavel Machek 2 participants 2 messages Dec 18, 2002 – Dec 19, 2002 ACPI

lore
Share & tools
lore
#0 lore raw

Hi!

Should be obvious, please apply,
Pavel

drivers/acpi/button.c +4 -4
@@ -68,8 +68,8 @@
 MODULE_LICENSE("GPL");
 
 
-int acpi_button_add (struct acpi_device *device);
-int acpi_button_remove (struct acpi_device *device, int type);
+static int acpi_button_add (struct acpi_device *device);
+static int acpi_button_remove (struct acpi_device *device, int type);
 static int acpi_button_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_button_driver = {
@@ -234,7 +234,7 @@
 }
 
 
-int
+static int
 acpi_button_add (
 	struct acpi_device	*device)
 {
@@ -384,7 +384,7 @@
 }
 
 
-int
+static int
 acpi_button_remove (struct acpi_device *device, int type)
 {
 	acpi_status		status = 0;
Signature · 9 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?


-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/
#1 lore raw

LID state

Hi,

should you try this patch? It's simple (& maybe stupid), but it adds
/proc/acpi/button/lid/*/state, which is the actual state of the lid. So you no longer have to count events for lid :-) When the event lid happens, just ask the state ....

It's done by acpi_evaluate_integer( "_LID" ).

This patch is for acpi-20021205 for 2.4.20. It should be applied in
drivers/acpi dir.
It modifies only acpi_drivers.h & button.c.

Don't know, if it is linux-like coded, so somebody should take a look at.

By
Zdenek OGAR Skalak

Signature · 5 lines
Ing. Zdeněk OGAR Skalák
Monet+ a.s.
Zámecká 365
763 14 Zlín - Štípa, CZ
Tel: +420 / 577 110 411,  Fax: +420 / 577 914 557

diff -r -c original/acpi_drivers.h new/acpi_drivers.h
*** original/acpi_drivers.h Mon Dec 9 15:01:10 2002
--- new/acpi_drivers.h Wed Dec 18 14:12:46 2002
***************
*** 86,91 ****
--- 86,92 ----
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_CLASS "button"
#define ACPI_BUTTON_FILE_INFO "info"
+ #define ACPI_BUTTON_FILE_STATE "state"
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
#define ACPI_BUTTON_NOTIFY_STATUS 0x80

diff -r -c original/button.c new/button.c
*** original/button.c Mon Dec 9 11:13:45 2002
--- new/button.c Thu Dec 19 08:17:35 2002
***************
*** 102,107 ****
--- 102,145 ----
return_VALUE(len);
}

+ static int
+ acpi_button_lid_read_state(
+ char *page,
+ char **start,
+ off_t off,
+ int count,
+ int *eof,
+ void *data)
+ {
+ struct acpi_button *button = (struct acpi_button *) data;
+ char *p = page;
+ int len = 0;
+ acpi_status status=AE_OK;
+ unsigned long state;
+
+ ACPI_FUNCTION_TRACE("acpi_button_lid_read_state");
+
+ if (!button || !button->device)
+ goto end;
+
+ status=acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
+ if (ACPI_FAILURE(status)){
+ p += sprintf(p, "state: unsupported\n");
+ }
+ else{
+ p += sprintf(p, "state: %lu\n",state);
+ }
+
+ end:
+ len = (p - page);
+ if (len <= off+count) *eof = 1;
+ *start = page + off;
+ len -= off;
+ if (len>count) len = count;
+ if (len<0) len = 0;
+
+ return_VALUE(len);
+ }

static int
acpi_button_add_fs (
***************
*** 148,153 ****
--- 186,205 ----
else {
entry->read_proc = acpi_button_read_info; entry->data = acpi_driver_data(device);
+ }
+
+ if (button->type==ACPI_BUTTON_TYPE_LID){
+ /* 'state' [R] */
+ entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
+ S_IRUGO, acpi_device_dir(device));
+ if (!entry)
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Unable to create '%s' fs entry\n",
+ ACPI_BUTTON_FILE_STATE));
+ else {
+ entry->read_proc = acpi_button_lid_read_state;
+ entry->data = acpi_driver_data(device);
+ }
}

  	return_VALUE(0);