From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
julia-dAYI7NvHqcQ@public.gmane.org
Subject: Re: i2c-s3c2410: fix check for being in suspend.
Date: Fri, 31 Oct 2008 13:44:41 +0100 [thread overview]
Message-ID: <20081031134441.0e74bb9b@hyperion.delvare> (raw)
In-Reply-To: <20081031120913.779979727-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
Hi Ben,
Moving to the i2c list...
On Fri, 31 Oct 2008 12:09:14 +0000, Ben Dooks wrote:
> As noted by Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>, we can never
> trigger the check for being in suspend due to the result
> of !readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN
> always being 0.
>
> Add suspend/resume hooks to stop i2c transactions happening
> until the driver has been resumed.
>
> Signed-off-by: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
>
> Index: linux.git/drivers/i2c/busses/i2c-s3c2410.c
> ===================================================================
> --- linux.git.orig/drivers/i2c/busses/i2c-s3c2410.c 2008-10-31 11:51:55.000000000 +0000
> +++ linux.git/drivers/i2c/busses/i2c-s3c2410.c 2008-10-31 12:06:01.000000000 +0000
> @@ -56,6 +56,7 @@ enum s3c24xx_i2c_state {
> struct s3c24xx_i2c {
> spinlock_t lock;
> wait_queue_head_t wait;
> + unsigned int suspended:1;
>
> struct i2c_msg *msg;
> unsigned int msg_num;
> @@ -507,7 +508,7 @@ static int s3c24xx_i2c_doxfer(struct s3c
> unsigned long timeout;
> int ret;
>
> - if (!readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN)
> + if (i2c->suspended)
> return -EIO;
>
> ret = s3c24xx_i2c_set_master(i2c);
This hunk will not apply, ad Julia's fix is already upstream. You'll
have to update your patch a bit.
> @@ -986,17 +987,26 @@ static int s3c24xx_i2c_remove(struct pla
> }
>
> #ifdef CONFIG_PM
> +static int s3c24xx_i2c_suspend_late(struct platform_device *dev,
> + pm_message_t msg)
> +{
> + struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
> + i2c->suspended = 1;
> + return 0;
> +}
> +
> static int s3c24xx_i2c_resume(struct platform_device *dev)
> {
> struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
>
> - if (i2c != NULL)
> - s3c24xx_i2c_init(i2c);
> + i2c->suspended = 0;
> + s3c24xx_i2c_init(i2c);
>
> return 0;
> }
>
> #else
> +#define s3c24xx_i2c_suspend_late NULL
> #define s3c24xx_i2c_resume NULL
> #endif
>
> @@ -1005,6 +1015,7 @@ static int s3c24xx_i2c_resume(struct pla
> static struct platform_driver s3c2410_i2c_driver = {
> .probe = s3c24xx_i2c_probe,
> .remove = s3c24xx_i2c_remove,
> + .suspend_late = s3c24xx_i2c_suspend_late,
> .resume = s3c24xx_i2c_resume,
> .driver = {
> .owner = THIS_MODULE,
> @@ -1015,6 +1026,7 @@ static struct platform_driver s3c2410_i2
> static struct platform_driver s3c2440_i2c_driver = {
> .probe = s3c24xx_i2c_probe,
> .remove = s3c24xx_i2c_remove,
> + .suspend_late = s3c24xx_i2c_suspend_late,
> .resume = s3c24xx_i2c_resume,
> .driver = {
> .owner = THIS_MODULE,
>
Will you take care of pushing this upstream, or should I?
Thanks,
--
Jean Delvare
next parent reply other threads:[~2008-10-31 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081031120913.779979727@fluff.org.uk>
[not found] ` <20081031120913.779979727-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-10-31 12:44 ` Jean Delvare [this message]
2008-10-31 15:42 i2c-s3c2410: fix check for being in suspend Ben Dooks
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=20081031134441.0e74bb9b@hyperion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=julia-dAYI7NvHqcQ@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