lkml.org 
[lkml]   [2023]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 7/9] media: i2c: ds90ub953: Restructure clkout management
On Mon, Jul 31, 2023 at 04:24:41PM +0300, Tomi Valkeinen wrote:
> Separate clkout calculations and register writes into two functions:
> ub953_calc_clkout_params and ub953_write_clkout_regs, and add a struct
> ub953_clkout_data that is used to store the clkout parameters.
>
> This simplifies the clkout management.

...

> +#define UB953_DEFAULT_CLKOUT_RATE 25000000UL

HZ_PER_MHZ (from units.h)?

...

> +struct ub953_clkout_data {
> + u32 hs_div;
> + u32 m;
> + u32 n;
> + unsigned long rate;

You may save 4 bytes on some architectures (which do not allow 4-byte alignment
for 64-bit members) by reshuffling the members.

(besides using u32-fract :-)

> +};

...

> + dev_dbg(dev, "%s %llu * %u / (8 * %u) = %lu (requested %lu)",
> + __func__, fc_rate, m, n, clkout_rate, target_rate);

__func__ in dev_dbg() is not needed. It's very rare nowadays to debug a kernel
without Dynamic Debug to be on.

...

> + dev_dbg(dev, "%s %llu / %u * %u / %u = %lu (requested %lu)",
> + __func__, fc_rate, hs_div, m, n, clkout_rate,
> + target_rate);

Ditto.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2023-08-01 15:56    [W:0.121 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site