All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH] sbs: Use i2c_smbus_xfer
       [not found] <20070215215215.ccb9c132.khali@linux-fr.org>
@ 2007-02-16  5:54 ` Lebedev, Vladimir P
  2007-02-16  6:25   ` Jean Delvare
  0 siblings, 1 reply; 3+ messages in thread
From: Lebedev, Vladimir P @ 2007-02-16  5:54 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-acpi

Yes, you are right, but we are going to remove i2c objects from sbs
driver in near future.

Thanks.
Vladimir.

-----Original Message-----
From: Jean Delvare [mailto:khali@linux-fr.org] 
Sent: Thursday, February 15, 2007 11:52 PM
To: Lebedev, Vladimir P
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH] sbs: Use i2c_smbus_xfer

Use i2c_smbus_xfer() in the ACPI SBS driver, instead of explicitely
calling the i2c bus driver's smbus_xfer() function. This is the right
thing to do for two reasons:
* i2c-core takes care of concurrent accesses to the bus.
* i2c-core can emulate SMBus transactions over an I2C bus. This will
make
  it possible to use the sbs driver on top of other i2c bus drivers than
  i2c_ec.

As a side effect, I fixed a bug in acpi_battery_smbus_err_handler(),
which was starting an SMBus block read transaction instead of an SMBus
word read.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/acpi/sbs.c |   37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

--- linux-2.6.21-pre.orig/drivers/acpi/sbs.c	2007-02-15
20:38:33.000000000 +0100
+++ linux-2.6.21-pre/drivers/acpi/sbs.c	2007-02-15 20:46:03.000000000
+0100
@@ -189,10 +189,9 @@ static void acpi_battery_smbus_err_handl
 
 	data.word = 0;
 
-	result = smbus->adapter.algo->
-	    smbus_xfer(&smbus->adapter,
-		       ACPI_SB_SMBUS_ADDR,
-		       0, I2C_SMBUS_READ, 0x16, I2C_SMBUS_BLOCK_DATA,
&data);
+	result = i2c_smbus_xfer(&smbus->adapter, ACPI_SB_SMBUS_ADDR, 0,
+				I2C_SMBUS_READ, 0x16,
I2C_SMBUS_WORD_DATA,
+				&data);
 
 	err_number = (data.word & 0x000f);
 
@@ -242,13 +241,12 @@ acpi_sbs_smbus_read_word(struct acpi_ec_
 	}
 
 	for (i = 0; i < MAX_SMBUS_ERR; i++) {
-		result =
-		    smbus->adapter.algo->smbus_xfer(&smbus->adapter,
addr, 0,
-						    I2C_SMBUS_READ,
func,
-						    I2C_SMBUS_WORD_DATA,
&data);
+		result = i2c_smbus_xfer(&smbus->adapter, addr, 0,
+					I2C_SMBUS_READ, func,
+					I2C_SMBUS_WORD_DATA, &data);
 		if (result) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					  "try %i:
smbus->adapter.algo->smbus_xfer() failed\n",
+					  "try %i: i2c_smbus_xfer()
failed\n",
 					  i));
 			if (err_handler) {
 				err_handler(smbus);
@@ -276,14 +274,12 @@ acpi_sbs_smbus_read_str(struct acpi_ec_s
 	}
 
 	for (i = 0; i < MAX_SMBUS_ERR; i++) {
-		result =
-		    smbus->adapter.algo->smbus_xfer(&smbus->adapter,
addr, 0,
-						    I2C_SMBUS_READ,
func,
-
I2C_SMBUS_BLOCK_DATA,
-						    &data);
+		result = i2c_smbus_xfer(&smbus->adapter, addr, 0,
+					I2C_SMBUS_READ, func,
+					I2C_SMBUS_BLOCK_DATA, &data);
 		if (result) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					  "try %i:
smbus->adapter.algo->smbus_xfer() failed\n",
+					  "try %i: i2c_smbus_xfer()
failed\n",
 					  i));
 			if (err_handler) {
 				err_handler(smbus);
@@ -315,14 +311,13 @@ acpi_sbs_smbus_write_word(struct acpi_ec
 	data.word = word;
 
 	for (i = 0; i < MAX_SMBUS_ERR; i++) {
-		result =
-		    smbus->adapter.algo->smbus_xfer(&smbus->adapter,
addr, 0,
-						    I2C_SMBUS_WRITE,
func,
-						    I2C_SMBUS_WORD_DATA,
&data);
+		result = i2c_smbus_xfer(&smbus->adapter, addr, 0,
+					I2C_SMBUS_WRITE, func,
+					I2C_SMBUS_WORD_DATA, &data);
 		if (result) {
 			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					  "try %i: smbus->adapter.algo"
-					  "->smbus_xfer() failed\n",
i));
+					  "try %i: i2c_smbus_xfer()
failed\n",
+					  i));
 			if (err_handler) {
 				err_handler(smbus);
 			}


-- 
Jean Delvare

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

* Re: [PATCH] sbs: Use i2c_smbus_xfer
  2007-02-16  5:54 ` [PATCH] sbs: Use i2c_smbus_xfer Lebedev, Vladimir P
@ 2007-02-16  6:25   ` Jean Delvare
  2007-02-16 12:02     ` Lebedev, Vladimir P
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2007-02-16  6:25 UTC (permalink / raw)
  To: Lebedev, Vladimir P; +Cc: linux-acpi

Vladimir,

On Fri, 16 Feb 2007 08:54:25 +0300, Lebedev, Vladimir P wrote:
> Yes, you are right, but we are going to remove i2c objects from sbs
> driver in near future.

How that? How do you plan to access SMBus devices without using i2c
functions?

Thanks,
-- 
Jean Delvare

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

* RE: [PATCH] sbs: Use i2c_smbus_xfer
  2007-02-16  6:25   ` Jean Delvare
@ 2007-02-16 12:02     ` Lebedev, Vladimir P
  0 siblings, 0 replies; 3+ messages in thread
From: Lebedev, Vladimir P @ 2007-02-16 12:02 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-acpi


Right now sbs driver has access to SBS via 'ec' (read/write) functions,
but it uses the i2c functions/structures - this is historical situation,
so; there are no problems (some time is needed only) to remove i2c using
from sbs driver. We are planning to do it to next release.

Thanks.
Vladimir.

-----Original Message-----
From: Jean Delvare [mailto:khali@linux-fr.org] 
Sent: Friday, February 16, 2007 9:25 AM
To: Lebedev, Vladimir P
Cc: linux-acpi@vger.kernel.org
Subject: Re: [PATCH] sbs: Use i2c_smbus_xfer

Vladimir,

On Fri, 16 Feb 2007 08:54:25 +0300, Lebedev, Vladimir P wrote:
> Yes, you are right, but we are going to remove i2c objects from sbs
> driver in near future.

How that? How do you plan to access SMBus devices without using i2c
functions?

Thanks,
-- 
Jean Delvare

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

end of thread, other threads:[~2007-02-16 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20070215215215.ccb9c132.khali@linux-fr.org>
2007-02-16  5:54 ` [PATCH] sbs: Use i2c_smbus_xfer Lebedev, Vladimir P
2007-02-16  6:25   ` Jean Delvare
2007-02-16 12:02     ` Lebedev, Vladimir P

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.