From: greg@kroah.com (Greg KH)
To: lm-sensors@vger.kernel.org
Subject: S3C2410 I2C driver
Date: Thu, 19 May 2005 06:25:18 +0000 [thread overview]
Message-ID: <20041012191627.GC31353@kroah.com> (raw)
In-Reply-To: <20041008130842.GK12218@home.fluff.org>
On Tue, Oct 12, 2004 at 10:00:50AM +0100, Ben Dooks wrote:
> + * 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.
> +#define PFX "s3c-i2c: "
Not needed
> +#define XFER_RETRY (-2000)
> +#define XFER_NAKED (-ECONNREFUSED)
Don't make up new error codes, just use the exiting ones please.
> +static int debug_info = 0;
Don't pre-initialize variables to 0. It wastes space and is
unnecessary.
> +/* 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?
> +/* 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)
> +{
> + 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.)
> +#if 1
> + s3c24xx_i2c_showmsgs(msgs, num);
> +#endif
Heh, is this needed?
thanks,
greg k-h
next prev parent reply other threads:[~2005-05-19 6:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-19 6:25 S3C2410 I2C driver Ben Dooks
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Greg KH
2005-05-19 6:25 ` Greg KH [this message]
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Greg KH
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Greg KH
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Ben Dooks
2005-05-19 6:25 ` Greg KH
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=20041012191627.GC31353@kroah.com \
--to=greg@kroah.com \
--cc=lm-sensors@vger.kernel.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 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.