Skip to contentSkip to conversation

S3C2410 I2C driver

DISCUSSION Ben Dooks 3 participants 15 messages May 19, 2005

Subsystems (2)
lore
Share & tools
lore
author
#1 lore raw
Quoted 7 lines · Ben Dooks

I have the first version of my Samsung S3C2410 I2C bus driver available at http://www.fluff.org/ben/linux-26/i2c-s3cdrv1.patch

Tested against 2.6.9-rc3.

I would be grateful of any comment, as I would like to get this support into the 2.6 kernel soon.

Is the correct approach to getting this patch applied to email [email protected] and cc [email protected] and [email protected]

I also need an allocation for I2C_ALGO_S3C2410

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#2 lore raw
In reply to Ben Dooks
Quoted 11 lines · Ben Dooks
Quoted 7 lines · Ben Dooks

I have the first version of my Samsung S3C2410 I2C bus driver available at http://www.fluff.org/ben/linux-26/i2c-s3cdrv1.patch

Tested against 2.6.9-rc3.

I would be grateful of any comment, as I would like to get this support into the 2.6 kernel soon.

Is the correct approach to getting this patch applied to email [email protected] and cc [email protected] and

Yes.

Quoted 1 line

I also need an allocation for I2C_ALGO_S3C2410

Hm, I thought we didn't need ids allocated anymore. Doesn't your driver work just fine without it?

Care to send the patch so we can comment on it?

thanks,

greg k-h

author
#3 lore raw
In reply to Ben Dooks
Quoted 13 lines · Greg KH
Quoted 11 lines · Ben Dooks
Quoted 7 lines · Ben Dooks

I have the first version of my Samsung S3C2410 I2C bus driver available at http://www.fluff.org/ben/linux-26/i2c-s3cdrv1.patch

Tested against 2.6.9-rc3.

I would be grateful of any comment, as I would like to get this support into the 2.6 kernel soon.

Is the correct approach to getting this patch applied to email [email protected] and cc [email protected] and

Quoted 6 lines

Yes.

Quoted 1 line

I also need an allocation for I2C_ALGO_S3C2410

Hm, I thought we didn't need ids allocated anymore. Doesn't your driver work just fine without it?

Ok, I've not seen that information before... what is the correct value to set this to? I assume that the identity of the controller can be ascertained from it's parent device?

Quoted 1 line

Care to send the patch so we can comment on it?

The last version was put on my website for download, as I didn't know wether people would get irritated at having a large-ish patch sent to the list... I can repost the patch inline if people would like to see it in the message.

the url is http://www.fluff.org/ben/linux-26/i2c-s3cdrv1.patch

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#4 lore raw
In reply to Ben Dooks
Quoted 16 lines · Ben Dooks
Quoted 15 lines · Greg KH
Quoted 11 lines · Ben Dooks
Quoted 7 lines · Ben Dooks

I have the first version of my Samsung S3C2410 I2C bus driver available at http://www.fluff.org/ben/linux-26/i2c-s3cdrv1.patch

Tested against 2.6.9-rc3.

I would be grateful of any comment, as I would like to get this support into the 2.6 kernel soon.

Is the correct approach to getting this patch applied to email [email protected] and cc [email protected] and

Yes.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I also need an allocation for I2C_ALGO_S3C2410

Hm, I thought we didn't need ids allocated anymore. Doesn't your driver work just fine without it?

Ok, I've not seen that information before... what is the correct value to set this to? I assume that the identity of the controller can be ascertained from it's parent device?

Hm, this is for a bus driver? I need to see the patch to give you a better answer.

Quoted 6 lines
Quoted 1 line

Care to send the patch so we can comment on it?

The last version was put on my website for download, as I didn't know wether people would get irritated at having a large-ish patch sent to the list... I can repost the patch inline if people would like to see it in the message.

Inline lets us comment on it properly.

thanks,

greg k-h

author
#5 lore raw
In reply to Ben Dooks
Quoted 29 lines · Greg KH
Quoted 16 lines · Ben Dooks
Quoted 15 lines · Greg KH
Quoted 11 lines · Ben Dooks
Quoted 7 lines · Ben Dooks

I have the first version of my Samsung S3C2410 I2C bus driver available at http://www.fluff.org/ben/linux-26/i2c-s3cdrv1.patch

Tested against 2.6.9-rc3.

I would be grateful of any comment, as I would like to get this support into the 2.6 kernel soon.

Is the correct approach to getting this patch applied to email [email protected] and cc [email protected] and

Yes.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I also need an allocation for I2C_ALGO_S3C2410

Hm, I thought we didn't need ids allocated anymore. Doesn't your driver work just fine without it?

Ok, I've not seen that information before... what is the correct value to set this to? I assume that the identity of the controller can be ascertained from it's parent device?

Hm, this is for a bus driver? I need to see the patch to give you a better answer.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Care to send the patch so we can comment on it?

The last version was put on my website for download, as I didn't know wether people would get irritated at having a large-ish patch sent to the list... I can repost the patch inline if people would like to see it in the message.

Inline lets us comment on it properly.

| i2c-s3cdrv1.patch
|
| Files affected:
|   drivers/i2c/busses/Kconfig       |    7 	7 +	0 -	0 !
|   drivers/i2c/busses/Makefile      |    1 	1 +	0 -	0 !
|   drivers/i2c/busses/i2c-s3c2410.c |  922 	922 +	0 -	0 !
|   3 files changed, 930 insertions(+)
|
| Ben Dooks, Fri, 08 Oct 2004 14:04:49 +0100
drivers/i2c/busses/Kconfig +7 -0
diff -urN -X ../dontdiff linux-2.6.9-rc3/drivers/i2c/busses/Kconfig linux-2.6.9-rc3-work2/drivers/i2c/busses/Kconfig
@@ -289,6 +289,13 @@
 	depends on (RPXLITE || RPXCLASSIC) && I2C
 	select I2C_ALGO8XX
 
+config I2C_S3C2410
+	tristate "S3C2410 I2C Driver"
+	depends on I2C && ARCH_S3C2410
+	help
+	  Say Y to this to enable the I2C controller inbuilt into the
+	  Samsung S3C2410 based System-on-Chip devices
+
 config I2C_SAVAGE4
 	tristate "S3 Savage 4"
 	depends on I2C && PCI && EXPERIMENTAL
drivers/i2c/busses/Makefile +1 -0
diff -urN -X ../dontdiff linux-2.6.9-rc3/drivers/i2c/busses/Makefile linux-2.6.9-rc3-work2/drivers/i2c/busses/Makefile
@@ -26,6 +26,7 @@
 obj-$(CONFIG_I2C_PIIX4)		+= i2c-piix4.o
 obj-$(CONFIG_I2C_PROSAVAGE)	+= i2c-prosavage.o
 obj-$(CONFIG_I2C_RPXLITE)	+= i2c-rpx.o
+obj-$(CONFIG_I2C_S3C2410)	+= i2c-s3c2410.o
 obj-$(CONFIG_I2C_SAVAGE4)	+= i2c-savage4.o
 obj-$(CONFIG_I2C_SIS5595)	+= i2c-sis5595.o
 obj-$(CONFIG_I2C_SIS630)	+= i2c-sis630.o
drivers/i2c/busses/i2c-s3c2410.c +922 -0

922 lines not on this page · raw message

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#6 lore raw
In reply to Ben Dooks
Quoted 24 lines · Jean Delvare

Hi Ben, hi Greg,

This is my quick review of Ben's code. Please note that my knowledge about I2C adapters and embedded systems is limited, so you should not consider it as absolute as you could do when I comment on I2C chip drivers. I would like another person to review the code as well (Greg?) since I am likely to miss important points.

Review

Quoted 2 lines
(quoted diff) +2 -0
+config I2C_S3C2410
+	tristate "S3C2410 I2C Driver"

"I2C" and "Driver" are redundant here. You are in the I2C menu, and each time is a driver.

Review

Quoted 4 lines
(quoted diff) +4 -0
+	depends on I2C && ARCH_S3C2410
+	help
+	  Say Y to this to enable the I2C controller inbuilt into the
+	  Samsung S3C2410 based System-on-Chip devices

s/to this// or s/to this/here/
I also doubt that "inbuilt into" is correct. "embedded into" or "built into" sounds better.

Quoted 6 lines

I'd suggest that you depend on EXPERIMENTAL in a first time.

Quoted 2 lines

+ * Copyright (c) 2004 Simtec Electronics
+ * Ben Dooks <[email protected]>

(C), not (c).

ok, will add to list of things to change

Quoted 10 lines

(BTW, Greg, did you verify this? I remember of a confusion last time we talked about this.)

Quoted 4 lines

+ * Changelog
+ * 29-Sep-2004 BJD Initial version
+ * 04-Oct-2004 BJD Fixed ignore ACK on last read
+ * 08-Oct-2004 BJD Fixed stop if zero length message

Changelogs don't belong to the driver code. Bug fixes are documented in BK, functionality changes would better belong to Documentation/i2c/*.

I find at least summary changelogs in the driver very useful, as they can't get seperated from the code, and this is pretty much the style i've used everywhere ese.

Quoted 7 lines
Quoted 1 line

+#define PFX "s3c-i2c: "

Shoudln't it be i2c-s3c (so as to match the driver file name)?

Quoted 1 line

+#define XFER_RETRY (-2000)

couldn't it be -EAGAIN?

ok, good point.

Quoted 44 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+enum s3c24xx_i2c_state {
+	STATE_IDLE,
+	STATE_START,
+	STATE_READ,
+	STATE_WRITE,
+	STATE_STOP
+};

Additional comma after last item. Sane is true for all enums and struct instances.

Review

Quoted 2 lines
(quoted diff) +2 -0
+/* */
+static inline struct s3c2410_platform_i2c 

That was an interesting comment ;)

Quoted 4 lines
(quoted diff) +4 -0
+static void s3c24xx_i2c_showmsg(struct i2c_msg *parent, struct i2c_msg *msg)
+{
+	DBG(0, PFX "%p [%2d: A %04x F 0x%04x L 0x%04x %p ]\n",
+	    parent, parent-msg, msg->addr, msg->flags, msg->len, msg->buf);

Review

Quoted 10 lines
(quoted diff) +10 -0
+}
+
+static void s3c24xx_i2c_showmsgs(struct i2c_msg *msgs, int num)
+{
+	struct i2c_msg *msgp = msgs;
+	int msg;
+
+	for (msg = 0; msg < num; msg++, msgp++)
+		s3c24xx_i2c_showmsg(msgs, msgp);
+}

BTW, shouldn't all this debug stuff be conditioned by DEBUG being defined? Including code that doesn't have a chance to ever get called is not great.

Review

Quoted 5 lines
(quoted diff) +5 -0
+	ret = i2c_add_adapter(&i2c->adap);
+	if (ret < 0) {
+		printk(KERN_INFO "I2C: Failed to add bus\n");
+		goto out;
+	}

Should be KERN_ERR, methinks.

Quoted 3 lines

Remember... I couldn't possibly comment on the technical side, so someone else will have to do it. I hope my comments did help a bit though.

thanks for looking.

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#7 lore raw
In reply to Ben Dooks
Quoted 4 lines · Ben Dooks

+ * Changelog
+ * 29-Sep-2004 BJD Initial version
+ * 04-Oct-2004 BJD Fixed ignore ACK on last read
+ * 08-Oct-2004 BJD Fixed stop if zero length message

Changelogs for kernel files are in the bk tree, not in the individual files. Otherwise, after a number of years, we end up with a huge mess (look at drivers/usb/serial/usb-serial.c for an example of that...)

Please remove them from the file.

Quoted 1 line

+#define PFX "s3c-i2c: "

Not needed

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define XFER_RETRY (-2000)
+#define XFER_NAKED (-ECONNREFUSED)

Don't make up new error codes, just use the exiting ones please.

Quoted 1 line

+static int debug_info = 0;

Don't pre-initialize variables to 0. It wastes space and is unnecessary.

Review

Quoted 8 lines
(quoted diff) +8 -0
+/* Debug */
+
+#define DBG(lev, msg...) do {\
+	if (lev < debug_info) \
+		printk(KERN_INFO msg); \
+	if (lev < debug_norm ) \
+		printk(KERN_DEBUG msg); \
+	} while(0)

Please just use the dev_dbg(), dev_err() and friends macros instead of rolling your own. Also use them instead of printk() to make it more consistant, and easier to determine the exact device spitting out the error/message.

Hm, I don't see a MODULE_LICENSE() marking in the file. How have you been able to load it without tainting the kernel?

Quoted 11 lines
(quoted diff) +11 -0
+/* IO read/write functions */
+
+static inline void wr_regb(struct s3c24xx_i2c *i2c, int reg, unsigned int val)
+{
+	writeb(val, i2c->regs + reg);
+}
+
+static inline void wr_regl(struct s3c24xx_i2c *i2c, int reg, unsigned long val)
+{
+	writel(val, i2c->regs + reg);
+}

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+static inline unsigned long rd_regb(struct s3c24xx_i2c *i2c, int reg)
+{
+	return (unsigned long)readb(i2c->regs + reg);
+}
+
+static inline unsigned long rd_regl(struct s3c24xx_i2c *i2c, int reg)
+{
+	return readl(i2c->regs + reg);
+}

Just use the real write* and read* functions in your code, don't wrap them up into something else. Also try building this with the 2.6.9-rc4 kernel, odds are you will get a bunch of warnings about stuff that needs to be fixed here... (hint void *regs needs to be void __iomem *regs in the s3c24xx_i2c structure.)

Review

Quoted 3 lines
(quoted diff) +3 -0
+#if 1
+	s3c24xx_i2c_showmsgs(msgs, num);
+#endif

Heh, is this needed?

thanks,

greg k-h

author
#8 lore raw
In reply to Ben Dooks
Quoted 12 lines · Greg KH
Quoted 4 lines · Ben Dooks

+ * Changelog
+ * 29-Sep-2004 BJD Initial version
+ * 04-Oct-2004 BJD Fixed ignore ACK on last read
+ * 08-Oct-2004 BJD Fixed stop if zero length message

Changelogs for kernel files are in the bk tree, not in the individual files. Otherwise, after a number of years, we end up with a huge mess (look at drivers/usb/serial/usb-serial.c for an example of that...)

Please remove them from the file.

Quoted 8 lines
Quoted 1 line

+#define PFX "s3c-i2c: "

Not needed

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define XFER_RETRY (-2000)
+#define XFER_NAKED (-ECONNREFUSED)

Don't make up new error codes, just use the exiting ones please.

will remove

Quoted 5 lines
Quoted 1 line

+static int debug_info = 0;

Don't pre-initialize variables to 0. It wastes space and is unnecessary.

Quoted 13 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+/* Debug */
+
+#define DBG(lev, msg...) do {\
+	if (lev < debug_info) \
+		printk(KERN_INFO msg); \
+	if (lev < debug_norm ) \
+		printk(KERN_DEBUG msg); \
+	} while(0)

Please just use the dev_dbg(), dev_err() and friends macros instead of rolling your own. Also use them instead of printk() to make it more consistant, and easier to determine the exact device spitting out the error/message.

ok, will make the changes for dev_err(), the debugging stuff i annoying as there is no way to control how much is included if any is.

Quoted 2 lines

Hm, I don't see a MODULE_LICENSE() marking in the file. How have you been able to load it without tainting the kernel?

no-one ever bothered to check if the code was built into the kernel without a valid MODULE_LICENSE.

Quoted 19 lines
Quoted 19 lines
(quoted diff) +19 -0
+/* IO read/write functions */
+
+static inline void wr_regb(struct s3c24xx_i2c *i2c, int reg, unsigned int val)
+{
+	writeb(val, i2c->regs + reg);
+}
+
+static inline void wr_regl(struct s3c24xx_i2c *i2c, int reg, unsigned long val)
+{
+	writel(val, i2c->regs + reg);
+}
+
+static inline unsigned long rd_regb(struct s3c24xx_i2c *i2c, int reg)
+{
+	return (unsigned long)readb(i2c->regs + reg);
+}
+
+static inline unsigned long rd_regl(struct s3c24xx_i2c *i2c, int reg)
+{
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	return readl(i2c->regs + reg);
+}

Just use the real write* and read* functions in your code, don't wrap them up into something else. Also try building this with the 2.6.9-rc4 kernel, odds are you will get a bunch of warnings about stuff that needs to be fixed here... (hint void *regs needs to be void __iomem *regs in the s3c24xx_i2c structure.)

ok, sorted.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+#if 1
+	s3c24xx_i2c_showmsgs(msgs, num);
+#endif

Heh, is this needed?

it was very useful for debugging, suppose it can go now

i'll post a new patch when i've finished checking through the rest of the changes

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#9 lore raw
In reply to Ben Dooks

On Tue, Oct 12, 2004 at 12:16:27PM -0700, Greg KH wrote:

ok, the new version of the patch:

| i2c-s3cdrv2.patch
|
| Files affected:
|   drivers/i2c/busses/Kconfig       |    7 	7 +	0 -	0 !
|   drivers/i2c/busses/Makefile      |    1 	1 +	0 -	0 !
|   drivers/i2c/busses/i2c-s3c2410.c |  875 	875 +	0 -	0 !
|   3 files changed, 883 insertions(+)
|
| Ben Dooks, Tue, 12 Oct 2004 23:17:05 +0100
drivers/i2c/busses/Kconfig +7 -0
diff -urN -X ../dontdiff linux-2.6.9-rc3/drivers/i2c/busses/Kconfig linux-2.6.9-rc3-work2/drivers/i2c/busses/Kconfig
@@ -289,6 +289,13 @@
 	depends on (RPXLITE || RPXCLASSIC) && I2C
 	select I2C_ALGO8XX
 
+config I2C_S3C2410
+	tristate "S3C2410 I2C Driver"
+	depends on I2C && ARCH_S3C2410
+	help
+	  Say Y here to include support for I2C controller in the
+	  Samsung S3C2410 based System-on-Chip devices.
+
 config I2C_SAVAGE4
 	tristate "S3 Savage 4"
 	depends on I2C && PCI && EXPERIMENTAL
drivers/i2c/busses/Makefile +1 -0
diff -urN -X ../dontdiff linux-2.6.9-rc3/drivers/i2c/busses/Makefile linux-2.6.9-rc3-work2/drivers/i2c/busses/Makefile
@@ -26,6 +26,7 @@
 obj-$(CONFIG_I2C_PIIX4)		+= i2c-piix4.o
 obj-$(CONFIG_I2C_PROSAVAGE)	+= i2c-prosavage.o
 obj-$(CONFIG_I2C_RPXLITE)	+= i2c-rpx.o
+obj-$(CONFIG_I2C_S3C2410)	+= i2c-s3c2410.o
 obj-$(CONFIG_I2C_SAVAGE4)	+= i2c-savage4.o
 obj-$(CONFIG_I2C_SIS5595)	+= i2c-sis5595.o
 obj-$(CONFIG_I2C_SIS630)	+= i2c-sis630.o
drivers/i2c/busses/i2c-s3c2410.c +875 -0

875 lines not on this page · raw message

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#10 lore raw
In reply to Ben Dooks

Review

Quoted 3 lines · Ben Dooks
(quoted diff) +3 -0
+
+static int debug_info;
+static int debug_norm = 1;

Why not make these module_param()? That way they could be changed at module load time, or at run time (module paramaters are also boot line options if they are built into the kernel.)

Or, most likely, these can just be deleted all together as you aren't developing the driver anymore, right?

Review

Quoted 8 lines
(quoted diff) +8 -0
+/* Debug */
+
+#define DBG(lev, msg...) do {\
+	if (lev < debug_info) \
+		dev_info(i2c->dev, msg); \
+	if (lev < debug_norm ) \
+		dev_dbg(i2c->dev, msg); \
+	} while(0)

And if they go away, this odd DBG() macro can also go away, right?

Other than that minor stuff, it looks good to me.

thanks,

greg k-h

#11 lore raw
In reply to Ben Dooks

Hi Ben, hi Greg,

This is my quick review of Ben's code. Please note that my knowledge about I2C adapters and embedded systems is limited, so you should not consider it as absolute as you could do when I comment on I2C chip drivers. I would like another person to review the code as well (Greg?) since I am likely to miss important points.

Review

Quoted 2 lines
(quoted diff) +2 -0
+config I2C_S3C2410
+	tristate "S3C2410 I2C Driver"

"I2C" and "Driver" are redundant here. You are in the I2C menu, and each time is a driver.

Review

Quoted 4 lines
(quoted diff) +4 -0
+	depends on I2C && ARCH_S3C2410
+	help
+	  Say Y to this to enable the I2C controller inbuilt into the
+	  Samsung S3C2410 based System-on-Chip devices

s/to this// or s/to this/here/
I also doubt that "inbuilt into" is correct. "embedded into" or "built into" sounds better.

I'd suggest that you depend on EXPERIMENTAL in a first time.

Quoted 2 lines

+ * Copyright (c) 2004 Simtec Electronics
+ * Ben Dooks <[email protected]>

(C), not (c).

(BTW, Greg, did you verify this? I remember of a confusion last time we talked about this.)

Quoted 4 lines

+ * Changelog
+ * 29-Sep-2004 BJD Initial version
+ * 04-Oct-2004 BJD Fixed ignore ACK on last read
+ * 08-Oct-2004 BJD Fixed stop if zero length message

Changelogs don't belong to the driver code. Bug fixes are documented in BK, functionality changes would better belong to Documentation/i2c/*.

Quoted 1 line

+#define PFX "s3c-i2c: "

Shoudln't it be i2c-s3c (so as to match the driver file name)?

Quoted 1 line

+#define XFER_RETRY (-2000)

couldn't it be -EAGAIN?

Review

Quoted 7 lines
(quoted diff) +7 -0
+enum s3c24xx_i2c_state {
+	STATE_IDLE,
+	STATE_START,
+	STATE_READ,
+	STATE_WRITE,
+	STATE_STOP
+};

Additional comma after last item. Sane is true for all enums and struct instances.

Review

Quoted 2 lines
(quoted diff) +2 -0
+/* */
+static inline struct s3c2410_platform_i2c 

That was an interesting comment ;)

Quoted 4 lines
(quoted diff) +4 -0
+static void s3c24xx_i2c_showmsg(struct i2c_msg *parent, struct i2c_msg *msg)
+{
+	DBG(0, PFX "%p [%2d: A %04x F 0x%04x L 0x%04x %p ]\n",
+	    parent, parent-msg, msg->addr, msg->flags, msg->len, msg->buf);

Review

Quoted 10 lines
(quoted diff) +10 -0
+}
+
+static void s3c24xx_i2c_showmsgs(struct i2c_msg *msgs, int num)
+{
+	struct i2c_msg *msgp = msgs;
+	int msg;
+
+	for (msg = 0; msg < num; msg++, msgp++)
+		s3c24xx_i2c_showmsg(msgs, msgp);
+}

BTW, shouldn't all this debug stuff be conditioned by DEBUG being defined? Including code that doesn't have a chance to ever get called is not great.

Review

Quoted 5 lines
(quoted diff) +5 -0
+	ret = i2c_add_adapter(&i2c->adap);
+	if (ret < 0) {
+		printk(KERN_INFO "I2C: Failed to add bus\n");
+		goto out;
+	}

Should be KERN_ERR, methinks.

Oh and BTW, expect Greg to ask you to make use of dev_err, dev_dbg etc... instead of printks.

Review

Quoted 7 lines
(quoted diff) +7 -0
+static struct device_driver s3c24xx_i2c_driver = {
+	.name		= "s3c2410-i2c",
+	.bus		= &platform_bus_type,
+	.probe		= s3c24xx_i2c_probe,
+	.remove		= s3c24xx_i2c_remove,
+	.resume		= s3c24xx_i2c_resume
+};

Additional comma wanted.

Remember... I couldn't possibly comment on the technical side, so someone else will have to do it. I hope my comments did help a bit though.

Jean

#12 lore raw
In reply to Ben Dooks
Quoted 1 line · Ben Dooks

I also need an allocation for I2C_ALGO_S3C2410

Quoted 2 lines · Greg KH

Hm, I thought we didn't need ids allocated anymore. Doesn't your driver work just fine without it?

This is certainly true for i2c chip drivers. I am not certain when it comes to adapters and algorithms though. I remember seeing checks on these in some code (maybe not from the main 2.6 tree though). It is probably worth verifying, especially if we intend to get rid of this struct member at some later time.

Thanks,
Jean

author
#13 lore raw
In reply to Ben Dooks
Quoted 11 lines · Greg KH

Review

Quoted 3 lines · Ben Dooks
(quoted diff) +3 -0
+
+static int debug_info;
+static int debug_norm = 1;

Why not make these module_param()? That way they could be changed at module load time, or at run time (module paramaters are also boot line options if they are built into the kernel.)

Or, most likely, these can just be deleted all together as you aren't developing the driver anymore, right?

Although I am happy with the current stability, there is scope for more development, as we do not currently support the slave mode operation for this driver. Since we do not have (and have not seen) any examples of this on the 2410/2440, we are not in a hurry to support it.

Quoted 10 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+/* Debug */
+
+#define DBG(lev, msg...) do {\
+	if (lev < debug_info) \
+		dev_info(i2c->dev, msg); \
+	if (lev < debug_norm ) \
+		dev_dbg(i2c->dev, msg); \
+	} while(0)

And if they go away, this odd DBG() macro can also go away, right?

would #define DBG(lev, msg..) do {} while(0) be good enough, so that the debugging info is left if it needed to be resurrected later?

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#14 lore raw
In reply to Ben Dooks
Quoted 11 lines · Ben Dooks
Quoted 10 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+/* Debug */
+
+#define DBG(lev, msg...) do {\
+	if (lev < debug_info) \
+		dev_info(i2c->dev, msg); \
+	if (lev < debug_norm ) \
+		dev_dbg(i2c->dev, msg); \
+	} while(0)

And if they go away, this odd DBG() macro can also go away, right?

Quoted 2 lines

would #define DBG(lev, msg..) do {} while(0) be good enough, so that the debugging info is left if it needed to be resurrected later?

Just do what the other i2c drivers do. Have dev_dbg() be enabled if the proper CONFIG option is set. Otherwise dev_dbg() goes away to nothing.

thanks,

greg k-h