Hi Andy, On Tue, Aug 25, 2026 at 11:35:52AM +0200, Andy Shevchenko wrote: > Instead of harder to read min_array() and prone to mistakes min_t() > use min3() and min(). No functional changes intended. The types of > the values are unsigned, no side-effects are expected. > > Signed-off-by: Andy Shevchenko <[email protected]> > --- > drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c > b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c > index ef9440166295..bf9e7480f0f5 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c > @@ -153,11 +153,8 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, > struct sg_table *st, > } > } while (1); > > - nr_pages = min_array(((unsigned long[]) { > - folio_nr_pages(folio), > - page_count - i, > - max_segment / PAGE_SIZE, > - }), 3); > + nr_pages = min3(folio_nr_pages(folio), > + page_count - i, max_segment / PAGE_SIZE);
thanks for your patch, but there is another patch involving (and fixing) this line of code[*]. You are welcome to join the review. Thanks, Andi [*] https://patchwork.freedesktop.org/patch/746877/?series=172332&rev=1 > > if (!i || > sg->length >= max_segment || > @@ -168,8 +165,7 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, > struct sg_table *st, > st->nents++; > sg_set_folio(sg, folio, nr_pages * PAGE_SIZE, 0); > } else { > - nr_pages = min_t(unsigned long, nr_pages, > - (max_segment - sg->length) / > PAGE_SIZE); > + nr_pages = min(nr_pages, (max_segment - sg->length) / > PAGE_SIZE); > > sg->length += nr_pages * PAGE_SIZE; > } > -- > 2.50.1 >
