linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crane Cai <crane.cai-5C7GfCeVMHo@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] I2C: add driver for SMBus Control Method Interface
Date: Thu, 17 Sep 2009 12:46:47 +0800	[thread overview]
Message-ID: <20090917044647.GB13319@crane-desktop> (raw)
In-Reply-To: <20090916154846.70413d42-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

Hi Jean,

On Wed, Sep 16, 2009 at 03:48:46PM +0200, Jean Delvare wrote:
> If you are fine with my latest proposals, I'll implement them myself,
> no need to resend a patch. Thanks a lot for writing the driver!
OK, I'm fine. Now it is the time in v2.6.32 merge window. I wish we can submit
it in time.

Considering my time zone 6 hours ahead of you. I modify the source as you said.
The discouraged print message I simple removed. For your reference.

---
 drivers/i2c/busses/i2c-cmi.c |   43 ++++++++++++++---------------------------
 1 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cmi.c b/drivers/i2c/busses/i2c-cmi.c
index 555b482..e6cdefc 100644
--- a/drivers/i2c/busses/i2c-cmi.c
+++ b/drivers/i2c/busses/i2c-cmi.c
@@ -16,16 +16,15 @@
 #include <linux/i2c.h>
 #include <linux/acpi.h>
 
-#define ACPI_SMBUS_HC_COMPONENT		0x00080000
 #define ACPI_SMBUS_HC_CLASS		"smbus"
 #define ACPI_SMBUS_HC_DEVICE_NAME	"cmi"
 
 ACPI_MODULE_NAME("smbus_cmi");
 
 struct smbus_methods_t {
-	const char *mt_info;
-	const char *mt_sbr;
-	const char *mt_sbw;
+	char *mt_info;
+	char *mt_sbr;
+	char *mt_sbw;
 };
 
 struct acpi_smbus_cmi {
@@ -56,8 +55,8 @@ static const struct acpi_device_id acpi_smbus_cmi_ids[] = {
 #define ACPI_SMBUS_STATUS_ACC_DENY		0x17
 #define ACPI_SMBUS_STATUS_TIMEOUT		0x18
 #define ACPI_SMBUS_STATUS_NOTSUP		0x19
-#define ACPI_SMBUS_STATUS_BUSY			0x1A
-#define ACPI_SMBUS_STATUS_PEC			0x1F
+#define ACPI_SMBUS_STATUS_BUSY			0x1a
+#define ACPI_SMBUS_STATUS_PEC			0x1f
 
 #define ACPI_SMBUS_PRTCL_WRITE			0x00
 #define ACPI_SMBUS_PRTCL_READ			0x01
@@ -151,11 +150,11 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
 
 	if (read_write == I2C_SMBUS_READ) {
 		protocol |= ACPI_SMBUS_PRTCL_READ;
-		method = (char *)smbus_methods.mt_sbr;
+		method = smbus_methods.mt_sbr;
 		input.count = 3;
 	} else {
 		protocol |= ACPI_SMBUS_PRTCL_WRITE;
-		method = (char *)smbus_methods.mt_sbw;
+		method = smbus_methods.mt_sbw;
 		input.count = 5;
 	}
 
@@ -282,17 +281,17 @@ static const struct i2c_algorithm acpi_smbus_cmi_algorithm = {
 	.functionality = acpi_smbus_cmi_func,
 };
 
+
 static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
 				  const char *name)
 {
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object *obj;
-	int i;
 	acpi_status status;
 
 	if (!strcmp(name, smbus_methods.mt_info)) {
 		status = acpi_evaluate_object(smbus_cmi->handle,
-					(char *)smbus_methods.mt_info,
+					smbus_methods.mt_info,
 					NULL, &buffer);
 		if (ACPI_FAILURE(status)) {
 			ACPI_ERROR((AE_INFO, "Evaluating %s: %i",
@@ -311,21 +310,12 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
 
 		if (obj->type != ACPI_TYPE_INTEGER) {
 			ACPI_ERROR((AE_INFO, "Invalid argument type"));
+			kfree(buffer.pointer);
 			return -EIO;
 		} else
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SMBus CMI Version %x"
 					  "\n", (int)obj->integer.value));
 
-		obj = obj->package.elements + 1;
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SMB_INFO:\n"));
-		for (i = 0; i < obj->buffer.length; i++) {
-			ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%02x ",
-						*(obj->buffer.pointer + i)));
-			if (i > 0 && (i % 16) == 0 && i != obj->buffer.length-1)
-				ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\n"));
-		}
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\n"));
-
 		kfree(buffer.pointer);
 		smbus_cmi->cap_info = 1;
 	} else if (!strcmp(name, smbus_methods.mt_sbr))
@@ -333,7 +323,8 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
 	else if (!strcmp(name, smbus_methods.mt_sbw))
 		smbus_cmi->cap_write = 1;
 	else
-		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "CMI Methods: %s\n", name));
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported CMI Method: %s\n",
+				  name));
 
 	return 0;
 }
@@ -377,7 +368,7 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
 		goto err;
 
 	snprintf(smbus_cmi->adapter.name, sizeof(smbus_cmi->adapter.name),
-		"SMBus CMI adapter at %s-%s",
+		"SMBus CMI adapter %s (%s)",
 		acpi_device_name(device),
 		acpi_device_uid(device));
 	smbus_cmi->adapter.owner = THIS_MODULE;
@@ -405,7 +396,7 @@ static int acpi_smbus_cmi_remove(struct acpi_device *device, int type)
 
 	i2c_del_adapter(&smbus_cmi->adapter);
 	kfree(smbus_cmi);
-	smbus_cmi = NULL;
+	device->driver_data = NULL;
 
 	return 0;
 }
@@ -422,11 +413,7 @@ static struct acpi_driver acpi_smbus_cmi_driver = {
 
 static int __init acpi_smbus_cmi_init(void)
 {
-	int result;
-
-	result = acpi_bus_register_driver(&acpi_smbus_cmi_driver);
-
-	return result;
+	return acpi_bus_register_driver(&acpi_smbus_cmi_driver);
 }
 
 static void __exit acpi_smbus_cmi_exit(void)
-- 
1.6.0.4

-- 
Best Regards,
- Crane

  parent reply	other threads:[~2009-09-17  4:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16  9:18 [PATCH v2] I2C: add driver for SMBus Control Method Interface Crane Cai
2009-09-16 13:48 ` Jean Delvare
     [not found]   ` <20090916154846.70413d42-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-17  4:46     ` Crane Cai [this message]
2009-09-17  9:45       ` Jean Delvare
     [not found]         ` <20090917114553.7abddd1e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-18  0:59           ` Crane Cai

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=20090917044647.GB13319@crane-desktop \
    --to=crane.cai-5c7gfcevmho@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@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;
as well as URLs for NNTP newsgroup(s).