Skip to content

Commit 90ec010

Browse files
David Hildenbrandtorvalds
authored andcommitted
drivers/base/memory: use "unsigned long" for block ids
Block ids are just shifted section numbers, so let's also use "unsigned long" for them, too. Link: http://lkml.kernel.org/r/20190614100114.311-3-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2491f0a commit 90ec010

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎drivers/base/memory.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ static DEFINE_MUTEX(mem_sysfs_mutex);
3434

3535
static int sections_per_block;
3636

37-
static inline int base_memory_block_id(unsigned long section_nr)
37+
static inline unsigned long base_memory_block_id(unsigned long section_nr)
3838
{
3939
return section_nr / sections_per_block;
4040
}
4141

42-
static inline int pfn_to_block_id(unsigned long pfn)
42+
static inline unsigned long pfn_to_block_id(unsigned long pfn)
4343
{
4444
return base_memory_block_id(pfn_to_section_nr(pfn));
4545
}
@@ -587,7 +587,7 @@ int __weak arch_get_memory_phys_device(unsigned long start_pfn)
587587
* A reference for the returned object is held and the reference for the
588588
* hinted object is released.
589589
*/
590-
static struct memory_block *find_memory_block_by_id(int block_id,
590+
static struct memory_block *find_memory_block_by_id(unsigned long block_id,
591591
struct memory_block *hint)
592592
{
593593
struct device *hintdev = hint ? &hint->dev : NULL;
@@ -604,7 +604,7 @@ static struct memory_block *find_memory_block_by_id(int block_id,
604604
struct memory_block *find_memory_block_hinted(struct mem_section *section,
605605
struct memory_block *hint)
606606
{
607-
int block_id = base_memory_block_id(__section_nr(section));
607+
unsigned long block_id = base_memory_block_id(__section_nr(section));
608608

609609
return find_memory_block_by_id(block_id, hint);
610610
}
@@ -663,8 +663,8 @@ int register_memory(struct memory_block *memory)
663663
return ret;
664664
}
665665

666-
static int init_memory_block(struct memory_block **memory, int block_id,
667-
unsigned long state)
666+
static int init_memory_block(struct memory_block **memory,
667+
unsigned long block_id, unsigned long state)
668668
{
669669
struct memory_block *mem;
670670
unsigned long start_pfn;
@@ -729,8 +729,8 @@ static void unregister_memory(struct memory_block *memory)
729729
*/
730730
int create_memory_block_devices(unsigned long start, unsigned long size)
731731
{
732-
const int start_block_id = pfn_to_block_id(PFN_DOWN(start));
733-
int end_block_id = pfn_to_block_id(PFN_DOWN(start + size));
732+
const unsigned long start_block_id = pfn_to_block_id(PFN_DOWN(start));
733+
unsigned long end_block_id = pfn_to_block_id(PFN_DOWN(start + size));
734734
struct memory_block *mem;
735735
unsigned long block_id;
736736
int ret = 0;
@@ -766,10 +766,10 @@ int create_memory_block_devices(unsigned long start, unsigned long size)
766766
*/
767767
void remove_memory_block_devices(unsigned long start, unsigned long size)
768768
{
769-
const int start_block_id = pfn_to_block_id(PFN_DOWN(start));
770-
const int end_block_id = pfn_to_block_id(PFN_DOWN(start + size));
769+
const unsigned long start_block_id = pfn_to_block_id(PFN_DOWN(start));
770+
const unsigned long end_block_id = pfn_to_block_id(PFN_DOWN(start + size));
771771
struct memory_block *mem;
772-
int block_id;
772+
unsigned long block_id;
773773

774774
if (WARN_ON_ONCE(!IS_ALIGNED(start, memory_block_size_bytes()) ||
775775
!IS_ALIGNED(size, memory_block_size_bytes())))

0 commit comments

Comments
 (0)