Re: [PATCH] mm/damon/vaddr: use swap() to make code cleaner

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 10 Nov 2021 12:15:57 +0800 Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:

> On Wed, Nov 10, 2021 at 11:32 AM Yihao Han <hanyihao@xxxxxxxx> wrote:
> >
> > Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> > opencoding it.
> >
> > Signed-off-by: Yihao Han <hanyihao@xxxxxxxx>
> > ---
> >  mm/damon/vaddr.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> > index 35fe49080ee9..414d9fb9c827 100644
> > --- a/mm/damon/vaddr.c
> > +++ b/mm/damon/vaddr.c
> > @@ -100,11 +100,7 @@ static unsigned long sz_range(struct damon_addr_range *r)
> >  static void swap_ranges(struct damon_addr_range *r1,
> >                         struct damon_addr_range *r2)
> >  {
> > -       struct damon_addr_range tmp;
> > -
> > -       tmp = *r1;
> > -       *r1 = *r2;
> > -       *r2 = tmp;
> > +       swap(*r1, *r2);
> 
> IMHO, I suggest removing swap_ranges() completely
> since it's only a wrapper of swap() after your changes.
> The caller can invoke swap() directly.

I also agree to Muchun.


Thanks,
SJ

> 
> Thanks.
> 
> >  }
> >
> >  /*
> > --
> > 2.17.1
> >




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux