pwm: omap-dmtimer: Make use of pwmchip_parent() accessor
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 14 Feb 2024 09:32:05 +0000 (10:32 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 19 Feb 2024 10:04:12 +0000 (11:04 +0100)
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

Link: https://lore.kernel.org/r/6681ebd024c2b8b2315ca3da5cac612e5f433d63.1707900770.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
drivers/pwm/pwm-omap-dmtimer.c

index 496bd73d29fe1dc154a4d3c401e3a059eae33ec9..527a7aa0ce613c7ce0fcc7fecf1345e49b64207b 100644 (file)
@@ -155,7 +155,7 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
        unsigned long clk_rate;
        struct clk *fclk;
 
-       dev_dbg(chip->dev, "requested duty cycle: %d ns, period: %d ns\n",
+       dev_dbg(pwmchip_parent(chip), "requested duty cycle: %d ns, period: %d ns\n",
                duty_ns, period_ns);
 
        if (duty_ns == pwm_get_duty_cycle(pwm) &&
@@ -164,17 +164,17 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
 
        fclk = omap->pdata->get_fclk(omap->dm_timer);
        if (!fclk) {
-               dev_err(chip->dev, "invalid pmtimer fclk\n");
+               dev_err(pwmchip_parent(chip), "invalid pmtimer fclk\n");
                return -EINVAL;
        }
 
        clk_rate = clk_get_rate(fclk);
        if (!clk_rate) {
-               dev_err(chip->dev, "invalid pmtimer fclk rate\n");
+               dev_err(pwmchip_parent(chip), "invalid pmtimer fclk rate\n");
                return -EINVAL;
        }
 
-       dev_dbg(chip->dev, "clk rate: %luHz\n", clk_rate);
+       dev_dbg(pwmchip_parent(chip), "clk rate: %luHz\n", clk_rate);
 
        /*
         * Calculate the appropriate load and match values based on the
@@ -196,27 +196,27 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
        duty_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, duty_ns);
 
        if (period_cycles < 2) {
-               dev_info(chip->dev,
+               dev_info(pwmchip_parent(chip),
                         "period %d ns too short for clock rate %lu Hz\n",
                         period_ns, clk_rate);
                return -EINVAL;
        }
 
        if (duty_cycles < 1) {
-               dev_dbg(chip->dev,
+               dev_dbg(pwmchip_parent(chip),
                        "duty cycle %d ns is too short for clock rate %lu Hz\n",
                        duty_ns, clk_rate);
-               dev_dbg(chip->dev, "using minimum of 1 clock cycle\n");
+               dev_dbg(pwmchip_parent(chip), "using minimum of 1 clock cycle\n");
                duty_cycles = 1;
        } else if (duty_cycles >= period_cycles) {
-               dev_dbg(chip->dev,
+               dev_dbg(pwmchip_parent(chip),
                        "duty cycle %d ns is too long for period %d ns at clock rate %lu Hz\n",
                        duty_ns, period_ns, clk_rate);
-               dev_dbg(chip->dev, "using maximum of 1 clock cycle less than period\n");
+               dev_dbg(pwmchip_parent(chip), "using maximum of 1 clock cycle less than period\n");
                duty_cycles = period_cycles - 1;
        }
 
-       dev_dbg(chip->dev, "effective duty cycle: %lld ns, period: %lld ns\n",
+       dev_dbg(pwmchip_parent(chip), "effective duty cycle: %lld ns, period: %lld ns\n",
                DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * duty_cycles,
                                      clk_rate),
                DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * period_cycles,
@@ -228,7 +228,7 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
        omap->pdata->set_load(omap->dm_timer, load_value);
        omap->pdata->set_match(omap->dm_timer, true, match_value);
 
-       dev_dbg(chip->dev, "load value: %#08x (%d), match value: %#08x (%d)\n",
+       dev_dbg(pwmchip_parent(chip), "load value: %#08x (%d), match value: %#08x (%d)\n",
                load_value, load_value, match_value, match_value);
 
        return 0;