Skip to contentSkip to conversation

SMBus access

PATCH Johan Vromans 2 participants 5 messages Jul 1, 2006 – Jul 2, 2006 ACPI

lore
Share & tools
lore
#0 lore raw

To get battery readings on some laptops it is necessary to interface with the SMBus that hangs of the EC. However, the current implementation of the EC driver does not permit other modules read/write access.

A trivial solution is to change acpi_ec_read/write from static to nonstatic, and export the symbols so other modules can use them.

Would there be any objections to apply this change?

-- Johan

acpi/ec.c renamed from acpi/ec.c~ +4 -2
@@ -305,20 +305,22 @@
 }
 #endif /* ACPI_FUTURE_USAGE */
 
-static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
+int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
 {
 	if (acpi_ec_poll_mode)
 		return acpi_ec_poll_read(ec, address, data);
 	else
 		return acpi_ec_intr_read(ec, address, data);
 }
-static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
+EXPORT_SYMBOL(acpi_ec_read);
+int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
 {
 	if (acpi_ec_poll_mode)
 		return acpi_ec_poll_write(ec, address, data);
 	else
 		return acpi_ec_intr_write(ec, address, data);
 }
+EXPORT_SYMBOL(acpi_ec_write);
 static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
 {
 	acpi_status status = AE_OK;
#1 lore raw
Quoted 9 lines · On Sat, 01 Jul 2006 22:57:34 +0200 Johan Vromans wrote:

To get battery readings on some laptops it is necessary to interface with the SMBus that hangs of the EC. However, the current implementation of the EC driver does not permit other modules read/write access.

A trivial solution is to change acpi_ec_read/write from static to nonstatic, and export the symbols so other modules can use them.

Would there be any objections to apply this change?

a.  patch should also be sent to [email protected] (cc-ed)
b.  patch does not apply cleanly to latest kernel
c.  missing Signed-off-by: line (see Documentation/SubmittingPatches)
d.  incorrect patch filename directory level (see SubmittingPatches)
Quoted 20 lines

-- Johan

acpi/ec.c renamed from acpi/ec.c~ +3 -2
@@ -305,20 +305,22 @@
 }
 #endif /* ACPI_FUTURE_USAGE */
 
-static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
+int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
 {
 	if (acpi_ec_poll_mode)
 		return acpi_ec_poll_read(ec, address, data);
 	else
 		return acpi_ec_intr_read(ec, address, data);
 }
-static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
+EXPORT_SYMBOL(acpi_ec_read);
+int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
 {

acpi/ec.c

Quoted 10 lines
acpi/ec.c renamed from acpi/ec.c~ +1 -1
 	if (acpi_ec_poll_mode)
 		return acpi_ec_poll_write(ec, address, data);
 	else
 		return acpi_ec_intr_write(ec, address, data);
 }
+EXPORT_SYMBOL(acpi_ec_write);
 static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
 {
 	acpi_status status = AE_OK;
-

---
~Randy

#2 lore raw
Quoted 7 lines · On Sat, 1 Jul 2006 14:10:15 -0700 Randy.Dunlap wrote:
Quoted 5 lines · On Sat, 01 Jul 2006 22:57:34 +0200 Johan Vromans wrote:

To get battery readings on some laptops it is necessary to interface with the SMBus that hangs of the EC. However, the current implementation of the EC driver does not permit other modules read/write access.

Quoted 7 lines
Quoted 4 lines

A trivial solution is to change acpi_ec_read/write from static to nonstatic, and export the symbols so other modules can use them.

Would there be any objections to apply this change?

a. patch should also be sent to [email protected] (cc-ed) b. patch does not apply cleanly to latest kernel

Sorry, my bad. It does apply cleanly (part d. below fooled my scripts...)

Quoted 31 lines

c. missing Signed-off-by: line (see Documentation/SubmittingPatches) d. incorrect patch filename directory level (see SubmittingPatches)

Quoted 26 lines

-- Johan

acpi/ec.c renamed from acpi/ec.c~ +4 -2
@@ -305,20 +305,22 @@
 }
 #endif /* ACPI_FUTURE_USAGE */
 
-static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
+int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
 {
 	if (acpi_ec_poll_mode)
 		return acpi_ec_poll_read(ec, address, data);
 	else
 		return acpi_ec_intr_read(ec, address, data);
 }
-static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
+EXPORT_SYMBOL(acpi_ec_read);
+int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
 {
 	if (acpi_ec_poll_mode)
 		return acpi_ec_poll_write(ec, address, data);
 	else
 		return acpi_ec_intr_write(ec, address, data);
 }
+EXPORT_SYMBOL(acpi_ec_write);
Quoted 8 lines

acpi/ec.c

Quoted 4 lines
acpi/ec.c renamed from acpi/ec.c~ +0 -1
 static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
 {
 	acpi_status status = AE_OK;
-

---
~Randy

---
~Randy

#3 lore raw
In reply to Randy.Dunlap
Quoted 4 lines · Randy.Dunlap
a.  patch should also be sent to [email protected] (cc-ed)
b.  patch does not apply cleanly to latest kernel
c.  missing Signed-off-by: line (see Documentation/SubmittingPatches)
d.  incorrect patch filename directory level (see SubmittingPatches)

All procedural issues, than can easily be solved. So I take it there are no technical/philosophical/emotional/ethical objections against this change?

-- Johan

#4 lore raw
Quoted 8 lines · On Sun, 02 Jul 2006 10:41:56 +0200 Johan Vromans wrote:
Quoted 4 lines · Randy.Dunlap
a.  patch should also be sent to [email protected] (cc-ed)
b.  patch does not apply cleanly to latest kernel
c.  missing Signed-off-by: line (see Documentation/SubmittingPatches)
d.  incorrect patch filename directory level (see SubmittingPatches)

All procedural issues, than can easily be solved.

Agreed.

Quoted 3 lines

So I take it there
are no technical/philosophical/emotional/ethical objections against this change?

We are still waiting for feedback/comments to determine that.

---
~Randy