From: Uwe Kleine-König Date: Wed, 14 Feb 2024 09:31:13 +0000 (+0100) Subject: pwm: crc: Simplify code to determine the pwmchip's parent device X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4709f383083ae927f0e1a5e282ee9ace3ffb5f19;p=linux.git pwm: crc: Simplify code to determine the pwmchip's parent device There is already a pointer to the pwmchip, make use of it directly instead of using the struct crystalcove_pwm *crc_pwm just obtained from it. This also has the advantage of not using struct crystalcove_pwm::chip any more which will be dropped soon. Link: https://lore.kernel.org/r/66d55649e13526bbd95d7bfd1cacfa0beb9efd43.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- diff --git a/drivers/pwm/pwm-crc.c b/drivers/pwm/pwm-crc.c index e09358901ab50..d985a9d3336d3 100644 --- a/drivers/pwm/pwm-crc.c +++ b/drivers/pwm/pwm-crc.c @@ -55,7 +55,7 @@ static int crc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, const struct pwm_state *state) { struct crystalcove_pwm *crc_pwm = to_crc_pwm(chip); - struct device *dev = crc_pwm->chip.dev; + struct device *dev = chip->dev; int err; if (state->period > PWM_MAX_PERIOD_NS) { @@ -125,7 +125,7 @@ static int crc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *state) { struct crystalcove_pwm *crc_pwm = to_crc_pwm(chip); - struct device *dev = crc_pwm->chip.dev; + struct device *dev = chip->dev; unsigned int clk_div, clk_div_reg, duty_cycle_reg; int error;