linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool
@ 2019-08-02 13:39 Leonardo Bras
  2019-08-02 13:45 ` David Hildenbrand
  2019-11-14  9:07 ` Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Leonardo Bras @ 2019-08-02 13:39 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel
  Cc: Rob Herring, Pavel Tatashin, David Hildenbrand,
	Greg Kroah-Hartman, YueHaibing, Mahesh Salgaonkar,
	Paul Mackerras, Leonardo Bras, Nathan Fontenot, Oscar Salvador

Changes the return variable to bool (as the return value) and
avoids doing a ternary operation before returning.

Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
---
Changes in v2:
  - Restore previous and-ing logic on rc.

 arch/powerpc/platforms/pseries/hotplug-memory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 8e700390f3d6..c126b94d1943 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -338,7 +338,7 @@ static int pseries_remove_mem_node(struct device_node *np)
 static bool lmb_is_removable(struct drmem_lmb *lmb)
 {
 	int i, scns_per_block;
-	int rc = 1;
+	bool rc = true;
 	unsigned long pfn, block_sz;
 	u64 phys_addr;
 
@@ -363,11 +363,11 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
 		if (!pfn_present(pfn))
 			continue;
 
-		rc &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
+		rc = rc && is_mem_section_removable(pfn, PAGES_PER_SECTION);
 		phys_addr += MIN_MEMORY_BLOCK_SIZE;
 	}
 
-	return rc ? true : false;
+	return rc;
 }
 
 static int dlpar_add_lmb(struct drmem_lmb *);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool
  2019-08-02 13:39 [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool Leonardo Bras
@ 2019-08-02 13:45 ` David Hildenbrand
  2019-09-20  1:57   ` Leonardo Bras
  2019-11-14  9:07 ` Michael Ellerman
  1 sibling, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2019-08-02 13:45 UTC (permalink / raw)
  To: Leonardo Bras, linuxppc-dev, linux-kernel
  Cc: Pavel Tatashin, Rob Herring, YueHaibing, Mahesh Salgaonkar,
	Paul Mackerras, Greg Kroah-Hartman, Nathan Fontenot,
	Oscar Salvador

On 02.08.19 15:39, Leonardo Bras wrote:
> Changes the return variable to bool (as the return value) and
> avoids doing a ternary operation before returning.
> 
> Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
> ---
> Changes in v2:
>   - Restore previous and-ing logic on rc.
> 
>  arch/powerpc/platforms/pseries/hotplug-memory.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index 8e700390f3d6..c126b94d1943 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -338,7 +338,7 @@ static int pseries_remove_mem_node(struct device_node *np)
>  static bool lmb_is_removable(struct drmem_lmb *lmb)
>  {
>  	int i, scns_per_block;
> -	int rc = 1;
> +	bool rc = true;
>  	unsigned long pfn, block_sz;
>  	u64 phys_addr;
>  
> @@ -363,11 +363,11 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
>  		if (!pfn_present(pfn))
>  			continue;
>  
> -		rc &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
> +		rc = rc && is_mem_section_removable(pfn, PAGES_PER_SECTION);
>  		phys_addr += MIN_MEMORY_BLOCK_SIZE;
>  	}
>  
> -	return rc ? true : false;
> +	return rc;
>  }
>  
>  static int dlpar_add_lmb(struct drmem_lmb *);
> 

Yeah, why not

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool
  2019-08-02 13:45 ` David Hildenbrand
@ 2019-09-20  1:57   ` Leonardo Bras
  0 siblings, 0 replies; 5+ messages in thread
From: Leonardo Bras @ 2019-09-20  1:57 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev, linux-kernel
  Cc: Pavel Tatashin, David Hildenbrand, YueHaibing, Mahesh Salgaonkar,
	Paul Mackerras, Greg Kroah-Hartman, Nathan Fontenot, Rob Herring,
	Oscar Salvador

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

Hello Michael,

Any feedback on this patch?

Best regards,


On Fri, 2019-08-02 at 15:45 +0200, David Hildenbrand wrote:
> On 02.08.19 15:39, Leonardo Bras wrote:
> > Changes the return variable to bool (as the return value) and
> > avoids doing a ternary operation before returning.
> > 
> > Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
> > ---
> > Changes in v2:
> >   - Restore previous and-ing logic on rc.
> > 
> >  arch/powerpc/platforms/pseries/hotplug-memory.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> > index 8e700390f3d6..c126b94d1943 100644
> > --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> > +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> > @@ -338,7 +338,7 @@ static int pseries_remove_mem_node(struct device_node *np)
> >  static bool lmb_is_removable(struct drmem_lmb *lmb)
> >  {
> >  	int i, scns_per_block;
> > -	int rc = 1;
> > +	bool rc = true;
> >  	unsigned long pfn, block_sz;
> >  	u64 phys_addr;
> >  
> > @@ -363,11 +363,11 @@ static bool lmb_is_removable(struct drmem_lmb *lmb)
> >  		if (!pfn_present(pfn))
> >  			continue;
> >  
> > -		rc &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
> > +		rc = rc && is_mem_section_removable(pfn, PAGES_PER_SECTION);
> >  		phys_addr += MIN_MEMORY_BLOCK_SIZE;
> >  	}
> >  
> > -	return rc ? true : false;
> > +	return rc;
> >  }
> >  
> >  static int dlpar_add_lmb(struct drmem_lmb *);
> > 
> 
> Yeah, why not
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool
  2019-08-02 13:39 [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool Leonardo Bras
  2019-08-02 13:45 ` David Hildenbrand
@ 2019-11-14  9:07 ` Michael Ellerman
  2019-11-14 18:25   ` Leonardo Bras
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2019-11-14  9:07 UTC (permalink / raw)
  To: Leonardo Bras, linuxppc-dev, linux-kernel
  Cc: Rob Herring, David Hildenbrand, Mahesh Salgaonkar, YueHaibing,
	Pavel Tatashin, Paul Mackerras, Greg Kroah-Hartman,
	Leonardo Bras, Nathan Fontenot, Oscar Salvador

On Fri, 2019-08-02 at 13:39:15 UTC, Leonardo Bras wrote:
> Changes the return variable to bool (as the return value) and
> avoids doing a ternary operation before returning.
> 
> Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/b948aaaf3e39cc475e45fea727638f191a5cb1b4

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool
  2019-11-14  9:07 ` Michael Ellerman
@ 2019-11-14 18:25   ` Leonardo Bras
  0 siblings, 0 replies; 5+ messages in thread
From: Leonardo Bras @ 2019-11-14 18:25 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev, linux-kernel
  Cc: Rob Herring, Pavel Tatashin, Mahesh Salgaonkar,
	David Hildenbrand, YueHaibing, Paul Mackerras,
	Greg Kroah-Hartman, Nathan Fontenot, Oscar Salvador

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

On Thu, 2019-11-14 at 20:07 +1100, Michael Ellerman wrote:
> On Fri, 2019-08-02 at 13:39:15 UTC, Leonardo Bras wrote:
> > Changes the return variable to bool (as the return value) and
> > avoids doing a ternary operation before returning.
> > 
> > Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
> 
> Series applied to powerpc next, thanks.
> 
> https://git.kernel.org/powerpc/c/b948aaaf3e39cc475e45fea727638f191a5cb1b4
> 
> cheers

Thanks!

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-14 18:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 13:39 [PATCH v2 1/1] powerpc/pseries/hotplug-memory.c: Change rc variable to bool Leonardo Bras
2019-08-02 13:45 ` David Hildenbrand
2019-09-20  1:57   ` Leonardo Bras
2019-11-14  9:07 ` Michael Ellerman
2019-11-14 18:25   ` Leonardo Bras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).