Skip to contentSkip to conversation

i2c-s3c2410: move resume state flag to end of resume

PATCH In review Huisung Kang 3 participants 4 messages Feb 11, 2012 – Feb 13, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-s3c2410: move resume state flag to end of resume

From: Kisoo Yu <[email protected]>

need to set flag after finishing its work

---
 drivers/i2c/busses/i2c-s3c2410.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +1 -1
index 4c17180..7d6d2b7 100644
@@ -1082,10 +1082,10 @@ static int s3c24xx_i2c_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
 
-	i2c->suspended = 0;
 	clk_enable(i2c->clk);
 	s3c24xx_i2c_init(i2c);
 	clk_disable(i2c->clk);
+	i2c->suspended = 0;
 
 	return 0;
 }
Signature · 1 line
1.7.1
#1 lore raw

drivers/i2c/busses/i2c-s3c2410.c static int s3c24xx_i2c_resume(struct device *dev) · line 1088

Quoted 9 lines · Huisung Kang

From: Kisoo Yu <[email protected]>

need to set flag after finishing its work

drivers/i2c/busses/i2c-s3c2410.c +1 -1
-	i2c->suspended = 0;
 	clk_enable(i2c->clk);
 	s3c24xx_i2c_init(i2c);
 	clk_disable(i2c->clk);
+	i2c->suspended = 0;

Why is this needed - given that there's no locking involved anywhere here does this mean that we've got a race somewhere?

A message that is not in the archive (sent off-list or not yet received): 20120212131230.GB3395-yzvPICuk2AATkU/[email protected]

#3 lore raw
Quoted 5 lines · Mark Brown
Quoted 3 lines · Huisung Kang

From: Kisoo Yu <[email protected]>

need to set flag after finishing its work

Quoted 8 lines

drivers/i2c/busses/i2c-s3c2410.c static int s3c24xx_i2c_resume(struct device *dev) · line 1088

Quoted 5 lines
drivers/i2c/busses/i2c-s3c2410.c +1 -1
-	i2c->suspended = 0;
 	clk_enable(i2c->clk);
 	s3c24xx_i2c_init(i2c);
 	clk_disable(i2c->clk);
+	i2c->suspended = 0;

Why is this needed - given that there's no locking involved anywhere here does this mean that we've got a race somewhere?

It is in the wrong order, the lack of locking is a bit of a problem but then again so is the whole suspend/resume framework at the moment. I'm inclined to apply this to the fixes branch.

Signature · 1 line
Ben
#4 lore raw
In reply to Huisung Kang
Quoted 15 lines · Huisung Kang

From: Kisoo Yu <[email protected]>

need to set flag after finishing its work

---
 drivers/i2c/busses/i2c-s3c2410.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +0 -0
index 4c17180..7d6d2b7 100644

drivers/i2c/busses/i2c-s3c2410.c static int s3c24xx_i2c_resume(struct device *dev) · line 1088

Quoted 8 lines
drivers/i2c/busses/i2c-s3c2410.c +1 -1
@@ -1082,10 +1082,10 @@ static int s3c24xx_i2c_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
 
-	i2c->suspended = 0;
 	clk_enable(i2c->clk);
 	s3c24xx_i2c_init(i2c);
 	clk_disable(i2c->clk);
+	i2c->suspended = 0;

Yes, technically we should not mark ourselves as un-suspended until the peripheral has been properly restarted. I will have a look at Mark's comments before this is applied.

Signature · 1 line
Ben