Message ID | d2aa9fa6-4513-c3e8-493a-3a34d5a1143b@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | pwm: pwm-meson: remove not needed check in meson_pwm_calc | expand |
Hello Heiner, On Thu, May 04, 2023 at 07:35:55AM +0200, Heiner Kallweit wrote: > duty <= period implies that duty_cnt <= cnt. We verified before > that cnt <= 0xffff, therefore we can omit the check here. > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> > --- > Note: Applies only after "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX" Do you know there is git magic to express this that (at least some of) the build bots understand? Look at git format-patch's --base option. Otherwise: Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Thanks Uwe
On Thu, May 04, 2023 at 08:47:30AM +0200, Uwe Kleine-König wrote: > Hello Heiner, > > On Thu, May 04, 2023 at 07:35:55AM +0200, Heiner Kallweit wrote: > > duty <= period implies that duty_cnt <= cnt. We verified before > > that cnt <= 0xffff, therefore we can omit the check here. > > > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> > > --- > > Note: Applies only after "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX" > > Do you know there is git magic to express this that (at least some of) > the build bots understand? Look at git format-patch's --base option. I think --base is really only applicable if the base patch is applied to a well-known tree, otherwise the commit is unknown. For things like this it's easier to just send them out as a series, which implies the dependency. Obviously sometimes you get situations where you send out a patch and only then realize there's cleanup you can do, so mentioning this is usually enough. Most bots will end up building this after I apply as well, so we'll get the coverage either way. Thierry
Hello Thierry, On Thu, May 04, 2023 at 11:11:36AM +0200, Thierry Reding wrote: > On Thu, May 04, 2023 at 08:47:30AM +0200, Uwe Kleine-König wrote: > > On Thu, May 04, 2023 at 07:35:55AM +0200, Heiner Kallweit wrote: > > > duty <= period implies that duty_cnt <= cnt. We verified before > > > that cnt <= 0xffff, therefore we can omit the check here. > > > > > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> > > > --- > > > Note: Applies only after "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX" > > > > Do you know there is git magic to express this that (at least some of) > > the build bots understand? Look at git format-patch's --base option. > > I think --base is really only applicable if the base patch is applied to > a well-known tree, otherwise the commit is unknown. Yes, "base" should be something like v6.3. On a tree that has the patch under discussion applied on top of "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX" on top of v6.3, git format-patch --base v6.3 -1 results in the footers: base-commit: 457391b0380335d5e9a5babdec90ac53928b23b4 prerequisite-patch-id: 76d61171becf4a80716637610b6f33d9617eb9b9 Where 457391b0380335d5e9a5babdec90ac53928b23b4 is v6.3 and 76d61171becf4a80716637610b6f33d9617eb9b9 is the patch-id[1] of the UINT_MAX patch. While this doesn't replace some human readable hints, this is the machine-parsable information that this patch is supposed to be applied on top of that UINT patch. This doesn't help finding that patch, but at least it stops reports about broken stuff in v6.3 + this patch without the prerequisite patch. So if used in the right way, this is helpful also in Heiner's case here. Best regards Uwe [1] git show @^{/"pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX"} | git patch-id
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 33107204a..aad4a0ed3 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -204,12 +204,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm, channel->hi = 0; channel->lo = cnt; } else { - /* Then check is we can have the duty with the same pre_div */ duty_cnt = div64_u64(fin_freq * duty, NSEC_PER_SEC * (pre_div + 1)); - if (duty_cnt > 0xffff) { - dev_err(meson->chip.dev, "unable to get duty cycle\n"); - return -EINVAL; - } dev_dbg(meson->chip.dev, "duty=%llu pre_div=%u duty_cnt=%u\n", duty, pre_div, duty_cnt);
duty <= period implies that duty_cnt <= cnt. We verified before that cnt <= 0xffff, therefore we can omit the check here. Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> --- Note: Applies only after "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX" --- drivers/pwm/pwm-meson.c | 5 ----- 1 file changed, 5 deletions(-)