Hi Sakari,

Thanks for the review.
[...]
+static void led_clamp_align(struct led_flash_setting *s)
+{
+       u32 v, offset;
+
+       v = s->val + s->step / 2;
+       v = clamp(v, s->min, s->max);
+       offset = v - s->min;
+       offset = s->step * (offset / s->step);

You could use the rounddown() macro. I.e.

rounddown(v - s->min, s->step) + s->min;

I took this code snippet from v4l2-ctrls.c.
It allows for aligning the control value to the nearest
step - top or bottom, whereas rounddown only to the
bottom one.

Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to