Skip to contentSkip to conversation

pwm: twl: Use to_twl() instead of container_of()

PATCH In review Johannes Thumshirn 2 participants 8 messages Feb 16, 2013 – Feb 17, 2013 PWM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: twl: Use to_twl() instead of container_of()

In twl6030_pwm_disable() use to_twl() instead of container_of() like in the rest of the driver.

---
 drivers/pwm/pwm-twl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pwm/pwm-twl.c +1 -2
index f783efc..a34c235 100644
@@ -255,8 +255,7 @@ out:
 
 static void twl6030_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
-	struct twl_pwm_chip *twl = container_of(chip, struct twl_pwm_chip,
-						chip);
+	struct twl_pwm_chip *twl = to_twl(chip);
 	int ret;
 	u8 val;
 
Signature · 1 line
1.8.1.3
#1 lore raw
Quoted 7 lines · Johannes Thumshirn

In twl6030_pwm_disable() use to_twl() instead of container_of() like in the rest of the driver.

---
 drivers/pwm/pwm-twl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Hi Johannes,

I see that container_of() is also still used in twl4030_pwm_free() and twl6030_pwm_enable(). Would you mind fixing those up as well?

Thierry

#2 lore raw
Quoted 9 lines · Thierry Reding
Quoted 7 lines · Johannes Thumshirn

In twl6030_pwm_disable() use to_twl() instead of container_of() like in the rest of the driver.

---
 drivers/pwm/pwm-twl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 6 lines

Hi Johannes,

I see that container_of() is also still used in twl4030_pwm_free() and twl6030_pwm_enable(). Would you mind fixing those up as well?

Thierry

Oh sorry haven't seen them, I'll take care of it.

Johannes

#3 lore raw

PATCH 1/1 pwm: twl: Use to_twl() instead of container_of()

In reply to Johannes Thumshirn

Always use to_twl() for converting into private data instead of container_of()

---
 drivers/pwm/pwm-twl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pwm/pwm-twl.c +2 -4
index a34c235..9cd2c9a 100644
@@ -200,8 +200,7 @@ out:
 
 static void twl4030_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
 {
-	struct twl_pwm_chip *twl = container_of(chip, struct twl_pwm_chip,
-						chip);
+	struct twl_pwm_chip *twl = to_twl(chip);
 	int ret;
 	u8 val, mask;
 
@@ -231,8 +230,7 @@ out:
 
 static int twl6030_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
-	struct twl_pwm_chip *twl = container_of(chip, struct twl_pwm_chip,
-						chip);
+	struct twm_pwm_chip *twl = to_twl(chip);
 	int ret;
 	u8 val;
 
Signature · 1 line
1.8.1.3
#4 lore raw
Quoted 6 lines · Johannes Thumshirn

Always use to_twl() for converting into private data instead of container_of()

---
 drivers/pwm/pwm-twl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

I've squashed this patch into the previous one and applied to the for-next branch. Thanks,

Thierry

#5 lore raw

PATCH 1/1 pwm: twl: Fix typo that broke build

Fix a little type that unfortunately broke the build :-(

---
 drivers/pwm/pwm-twl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-twl.c +1 -1
index 9cd2c9a..bf3fda2 100644
@@ -230,7 +230,7 @@ out:
 
 static int twl6030_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
-	struct twm_pwm_chip *twl = to_twl(chip);
+	struct twl_pwm_chip *twl = to_twl(chip);
 	int ret;
 	u8 val;
 
Signature · 1 line
1.8.1.3
#6 lore raw

Re: [PATCH] pwm: twl: Fix typo that broke build

Quoted 5 lines · Johannes Thumshirn

Fix a little type that unfortunately broke the build :-(

---
 drivers/pwm/pwm-twl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Uh... I hadn't noticed and deemed the patch trivial enough so I didn't even build test. That'll teach me. =\

Thierry

#7 lore raw

Re: [PATCH] pwm: twl: Fix typo that broke build

Quoted 11 lines · Thierry Reding
Quoted 5 lines · Johannes Thumshirn

Fix a little type that unfortunately broke the build :-(

---
 drivers/pwm/pwm-twl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Uh... I hadn't noticed and deemed the patch trivial enough so I didn't even build test. That'll teach me. =\

Thierry

Me too.