Linux Kernels

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

This change “pwm: twl: Use to_twl() instead of container_of()” (commit 30f7861) in Linux kernel is authored by Johannes Thumshirn <morbidrsa [at] gmail.com> on Sat Feb 16 19:20:51 2013 +0100.

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

The change “pwm: twl: Use to_twl() instead of container_of()” introduces changes as follows.

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

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

Signed-off-by: Johannes Thumshirn <morbidrsa@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>

Linux kernel releases containing commit 30f7861

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "pwm: twl: Use to_twl() instead of container_of()"

There are 9 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/pwm/pwm-twl.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
 
diff --git a/drivers/pwm/pwm-twl.c b/drivers/pwm/pwm-twl.c
index f783efcd14bb..bf3fda294223 100644
--- a/drivers/pwm/pwm-twl.c
+++ b/drivers/pwm/pwm-twl.c
@@ -200,8 +200,7 @@ static int twl4030_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
 
 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 @@ static void twl4030_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
 
 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 twl_pwm_chip *twl = to_twl(chip);
 	int ret;
 	u8 val;
 
@@ -255,8 +253,7 @@ static int twl6030_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 
 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;
 

The commit for this change in Linux stable tree is 30f7861 (patch).

Last modified: 2020/01/11 09:38