OSDN Git Service

media: ov6650: Simplify clock divisor calculation
authorJanusz Krzysztofik <jmkrzyszt@gmail.com>
Sun, 13 Oct 2019 12:50:47 +0000 (09:50 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 24 Oct 2019 21:39:41 +0000 (18:39 -0300)
commitd898692e9ddb223210ab9a6e99d58b1fff9658a0
tree7f485cc855158ef621e0742911f6f5c4efbac20a
parentb1c5794382208c455c4e511c3f0b55565b69dd53
media: ov6650: Simplify clock divisor calculation

As appears from an analysis of to_clkrc() helper code after its
pclk_limit argument has been dropped, its result no longer depends on
another argument - pclk_max.  Moreover, assuming that a constant value
of FRAME_RATE_MAX is always used as a denominator of the only
significant argument left - a struct v4l2_fract, the result in fact
depends only on the numerator value of that argument.  As a further
consequence, it no longer makes sense to recalculate frame intervals by
converting them forth and back with a GET_CLKRC_DIV(to_clkrc(tpf))
construct.

Drop use of GET_CLKRC_DIV() on results of to_clkrc() where possible -
use the frame interval value directly.  Furthermore, replace the
to_clkrc() helper function with a simple macro and update its users to
always use FRAME_RATE_MAX as frame interval denominator and pass only
its numerator as an argument.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/ov6650.c