Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pwm: atmel-tcb: Drop duplicated tracking of per-channel data

Per-channel data is tracked using struct pwm_device::chip_data and
struct atmel_tcb_pwm_chip::pwms[]. Simplify by using the latter
consistently.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Uwe Kleine-König and committed by
Thierry Reding
fdaa6efc 8246b478

+6 -6
+6 -6
drivers/pwm/pwm-atmel-tcb.c
··· 72 72 struct pwm_device *pwm, 73 73 enum pwm_polarity polarity) 74 74 { 75 - struct atmel_tcb_pwm_device *tcbpwm = pwm_get_chip_data(pwm); 75 + struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip); 76 + struct atmel_tcb_pwm_device *tcbpwm = tcbpwmc->pwms[pwm->hwpwm]; 76 77 77 78 tcbpwm->polarity = polarity; 78 79 ··· 98 97 return ret; 99 98 } 100 99 101 - pwm_set_chip_data(pwm, tcbpwm); 102 100 tcbpwm->polarity = PWM_POLARITY_NORMAL; 103 101 tcbpwm->duty = 0; 104 102 tcbpwm->period = 0; ··· 139 139 static void atmel_tcb_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) 140 140 { 141 141 struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip); 142 - struct atmel_tcb_pwm_device *tcbpwm = pwm_get_chip_data(pwm); 142 + struct atmel_tcb_pwm_device *tcbpwm = tcbpwmc->pwms[pwm->hwpwm]; 143 143 144 144 clk_disable_unprepare(tcbpwmc->clk); 145 145 tcbpwmc->pwms[pwm->hwpwm] = NULL; ··· 149 149 static void atmel_tcb_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) 150 150 { 151 151 struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip); 152 - struct atmel_tcb_pwm_device *tcbpwm = pwm_get_chip_data(pwm); 152 + struct atmel_tcb_pwm_device *tcbpwm = tcbpwmc->pwms[pwm->hwpwm]; 153 153 unsigned cmr; 154 154 enum pwm_polarity polarity = tcbpwm->polarity; 155 155 ··· 206 206 static int atmel_tcb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) 207 207 { 208 208 struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip); 209 - struct atmel_tcb_pwm_device *tcbpwm = pwm_get_chip_data(pwm); 209 + struct atmel_tcb_pwm_device *tcbpwm = tcbpwmc->pwms[pwm->hwpwm]; 210 210 u32 cmr; 211 211 enum pwm_polarity polarity = tcbpwm->polarity; 212 212 ··· 291 291 int duty_ns, int period_ns) 292 292 { 293 293 struct atmel_tcb_pwm_chip *tcbpwmc = to_tcb_chip(chip); 294 - struct atmel_tcb_pwm_device *tcbpwm = pwm_get_chip_data(pwm); 294 + struct atmel_tcb_pwm_device *tcbpwm = tcbpwmc->pwms[pwm->hwpwm]; 295 295 struct atmel_tcb_pwm_device *atcbpwm = NULL; 296 296 int i = 0; 297 297 int slowclk = 0;