public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
To: Joe Perches <joe@perches.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/8] mm/memblock: memblock_is_map/region_memory can be boolean
Date: Tue, 12 Dec 2017 21:32:00 -0500	[thread overview]
Message-ID: <20171213023200.GC28668@byw> (raw)
In-Reply-To: <1513094591.3036.55.camel@perches.com>

On Tue, Dec 12, 2017 at 08:03:11AM -0800, Joe Perches wrote:
> On Mon, 2017-12-11 at 21:55 -0500, Yaowei Bai wrote:
> > This patch makes memblock_is_map/region_memory return bool due to these
> > two functions only using either true or false as its return value.
> []
> > @@ -1690,13 +1690,13 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn,
> >   * RETURNS:
> >   * 0 if false, non-zero if true
> >   */
> > -int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
> > +bool __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
> >  {
> >  	int idx = memblock_search(&memblock.memory, base);
> >  	phys_addr_t end = base + memblock_cap_size(base, &size);
> >  
> >  	if (idx == -1)
> > -		return 0;
> > +		return false;
> >  	return (memblock.memory.regions[idx].base +
> >  		 memblock.memory.regions[idx].size) >= end;
> >  }
> 
> I'd be more inclined to use a temporary for
> memblock.memory.regions[idx] so the function was
> something like:
> 
> int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
> {
> 	phys_addr_t end;
> 	struct memblock_region *region;
> 	int idx = memblock_search(&memblock.memory, base);
> 
> 	if (idx == -1)
> 		return 0;
> 
> 	end = base + memblock_cap_size(base, &size);
> 	region = &memblock.memory.regions[idx];
> 
> 	return (region->base + region->size) >= end;
> }

It' better.

> 
> Maybe change to bool at your option.

Ok. You also can ack this one first. :)

  reply	other threads:[~2017-12-13  2:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12  2:55 [PATCH 0/8] make some functions return bool Yaowei Bai
2017-12-12  2:55 ` [PATCH 1/8] mm/memblock: memblock_is_map/region_memory can be boolean Yaowei Bai
2017-12-12 16:03   ` Joe Perches
2017-12-13  2:32     ` Yaowei Bai [this message]
2017-12-12  2:55 ` [PATCH 2/8] mm/mmzone: mm/lru: is_file/active_lru " Yaowei Bai
2017-12-12  2:55 ` [PATCH 3/8] lib/lockref: __lockref_is_dead " Yaowei Bai
2017-12-12  2:55 ` [PATCH 4/8] kernel/cpuset: current_cpuset_is_being_rebound " Yaowei Bai
2017-12-12  2:55 ` [PATCH 5/8] kernel/resource: iomem_is_exclusive " Yaowei Bai
2017-12-12  2:55 ` [PATCH 6/8] kernel/module: module_is_live " Yaowei Bai
2017-12-12  2:55 ` [PATCH 7/8] kernel/mutex: mutex_is_locked " Yaowei Bai
2017-12-12  2:55 ` [PATCH 8/8] crash_dump: is_kdump_kernel " Yaowei Bai
2017-12-12  5:50 ` [PATCH 0/8] make some functions return bool David Rientjes
2017-12-12  7:21   ` Yaowei Bai
2017-12-12  8:12     ` Nikolay Borisov
2017-12-12 17:20     ` Randy Dunlap
2017-12-13  2:14       ` Yaowei Bai
2017-12-13  2:32         ` Randy Dunlap
2017-12-13  2:58           ` Yaowei Bai
2017-12-13  3:47           ` David Rientjes
2017-12-13  4:16             ` Yaowei Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171213023200.GC28668@byw \
    --to=baiyaowei@cmss.chinamobile.com \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox