mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH v3] media: intel/ipu6: Improve DWC PHY HSFREQRANGE band selection for overlapping ranges
       [not found] <ac4uvf_a-4-fLBPV@ashevche-desk.local>
@ 2026-04-02  9:35 ` Marco Nenciarini
  0 siblings, 0 replies; only message in thread
From: Marco Nenciarini @ 2026-04-02  9:35 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: sakari.ailus, linux-media, linux-kernel

On 02-Apr-26 11:54, Andy Shevchenko wrote:
> Below just a couple of remarks, no need to be addressed, JFYI.

Thanks for the review.

> > +		if (mbps > freqranges[i].max)
> > +			continue;
> > +
> > +		if (mbps < freqranges[i].min)
> > +			break;
> 
> Wondering if this can use bsearch() algo or any linear ranges.

The overlapping ranges and the multi-criteria selection (osc_freq_target
first, then closest default_mbps) make it hard to fit into a single
comparator. The forward scan with early break seemed like the most
straightforward approach.

> > +		     abs((int)mbps - (int)freqranges[i].default_mbps) <
> > +		     abs((int)mbps - (int)freqranges[best].default_mbps)))
> 
> Note, abs(INT_MIN) is UB, I hope this won't be the case IRL in this code.

Good point. The values here are well within range, but an unsigned
abs_diff() helper would be cleaner. I will address it if a v4 is needed
for other reasons.

Marco

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-02  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ac4uvf_a-4-fLBPV@ashevche-desk.local>
2026-04-02  9:35 ` [PATCH v3] media: intel/ipu6: Improve DWC PHY HSFREQRANGE band selection for overlapping ranges Marco Nenciarini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome