linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND] scsi: aacraid: aachba: replace if with max()
@ 2021-07-22 17:32 Salah Triki
  2021-07-23 16:56 ` Steffen Maier
  2021-07-24  2:32 ` Martin K. Petersen
  0 siblings, 2 replies; 5+ messages in thread
From: Salah Triki @ 2021-07-22 17:32 UTC (permalink / raw)
  To: aacraid, James E.J. Bottomley, Martin K. Petersen, gregkh
  Cc: linux-scsi, linux-kernel

Replace if with max() in order to make code more clean.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 46b8dffce2dd..330224f08fd3 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -485,8 +485,8 @@ int aac_get_containers(struct aac_dev *dev)
 	if (status != -ERESTARTSYS)
 		aac_fib_free(fibptr);
 
-	if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
-		maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
+	maximum_num_containers = max(maximum_num_containers, MAXIMUM_NUM_CONTAINERS);
+
 	if (dev->fsa_dev == NULL ||
 		dev->maximum_num_containers != maximum_num_containers) {
 
-- 
2.25.1


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

* Re: [RESEND] scsi: aacraid: aachba: replace if with max()
  2021-07-22 17:32 [RESEND] scsi: aacraid: aachba: replace if with max() Salah Triki
@ 2021-07-23 16:56 ` Steffen Maier
  2021-07-23 17:19   ` Steffen Maier
  2021-07-23 17:22   ` Salah Triki
  2021-07-24  2:32 ` Martin K. Petersen
  1 sibling, 2 replies; 5+ messages in thread
From: Steffen Maier @ 2021-07-23 16:56 UTC (permalink / raw)
  To: Salah Triki, aacraid, James E.J. Bottomley, Martin K. Petersen, gregkh
  Cc: linux-scsi, linux-kernel

On 7/22/21 7:32 PM, Salah Triki wrote:
> Replace if with max() in order to make code more clean.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>   drivers/scsi/aacraid/aachba.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index 46b8dffce2dd..330224f08fd3 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -485,8 +485,8 @@ int aac_get_containers(struct aac_dev *dev)
>   	if (status != -ERESTARTSYS)
>   		aac_fib_free(fibptr);
> 
> -	if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
> -		maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
> +	maximum_num_containers = max(maximum_num_containers, MAXIMUM_NUM_CONTAINERS);
> +

Haven't really looked closely, but isn't the old code more like a min() rather 
than a max()? maximum_num_containers being at least MAXIMUM_NUM_CONTAINERS or 
higher?


-- 
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z Development

https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: [RESEND] scsi: aacraid: aachba: replace if with max()
  2021-07-23 16:56 ` Steffen Maier
@ 2021-07-23 17:19   ` Steffen Maier
  2021-07-23 17:22   ` Salah Triki
  1 sibling, 0 replies; 5+ messages in thread
From: Steffen Maier @ 2021-07-23 17:19 UTC (permalink / raw)
  To: Salah Triki, aacraid, James E.J. Bottomley, Martin K. Petersen, gregkh
  Cc: linux-scsi, linux-kernel

On 7/23/21 6:56 PM, Steffen Maier wrote:
> On 7/22/21 7:32 PM, Salah Triki wrote:
>> Replace if with max() in order to make code more clean.
>>
>> Signed-off-by: Salah Triki <salah.triki@gmail.com>
>> ---
>>   drivers/scsi/aacraid/aachba.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
>> index 46b8dffce2dd..330224f08fd3 100644
>> --- a/drivers/scsi/aacraid/aachba.c
>> +++ b/drivers/scsi/aacraid/aachba.c
>> @@ -485,8 +485,8 @@ int aac_get_containers(struct aac_dev *dev)
>>       if (status != -ERESTARTSYS)
>>           aac_fib_free(fibptr);
>>
>> -    if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
>> -        maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
>> +    maximum_num_containers = max(maximum_num_containers, 
>> MAXIMUM_NUM_CONTAINERS);
>> +
> 
> Haven't really looked closely, but isn't the old code more like a min() rather 
> than a max()? maximum_num_containers being at least MAXIMUM_NUM_CONTAINERS or 
> higher?

Sorry, scratch that, it was nonsense.


-- 
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z Development

https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* Re: [RESEND] scsi: aacraid: aachba: replace if with max()
  2021-07-23 16:56 ` Steffen Maier
  2021-07-23 17:19   ` Steffen Maier
@ 2021-07-23 17:22   ` Salah Triki
  1 sibling, 0 replies; 5+ messages in thread
From: Salah Triki @ 2021-07-23 17:22 UTC (permalink / raw)
  To: Steffen Maier
  Cc: aacraid, James E.J. Bottomley, Martin K. Petersen, gregkh,
	linux-scsi, linux-kernel

On Fri, Jul 23, 2021 at 06:56:51PM +0200, Steffen Maier wrote:
> On 7/22/21 7:32 PM, Salah Triki wrote:
> > Replace if with max() in order to make code more clean.
> > 
> > Signed-off-by: Salah Triki <salah.triki@gmail.com>
> > ---
> >   drivers/scsi/aacraid/aachba.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> > index 46b8dffce2dd..330224f08fd3 100644
> > --- a/drivers/scsi/aacraid/aachba.c
> > +++ b/drivers/scsi/aacraid/aachba.c
> > @@ -485,8 +485,8 @@ int aac_get_containers(struct aac_dev *dev)
> >   	if (status != -ERESTARTSYS)
> >   		aac_fib_free(fibptr);
> > 
> > -	if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS)
> > -		maximum_num_containers = MAXIMUM_NUM_CONTAINERS;
> > +	maximum_num_containers = max(maximum_num_containers, MAXIMUM_NUM_CONTAINERS);
> > +
> 
> Haven't really looked closely, but isn't the old code more like a min()
> rather than a max()? maximum_num_containers being at least
> MAXIMUM_NUM_CONTAINERS or higher?
> 

In the old code, maximum_num_containers gets the value MAXIMUM_NUM_CONTAINERS if
it is less than this value.

Thanx

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

* Re: [RESEND] scsi: aacraid: aachba: replace if with max()
  2021-07-22 17:32 [RESEND] scsi: aacraid: aachba: replace if with max() Salah Triki
  2021-07-23 16:56 ` Steffen Maier
@ 2021-07-24  2:32 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-07-24  2:32 UTC (permalink / raw)
  To: Salah Triki
  Cc: aacraid, James E.J. Bottomley, Martin K. Petersen, gregkh,
	linux-scsi, linux-kernel


Salah,

> Replace if with max() in order to make code more clean.

I find the original code much easier to wrap my head around than the
proposed replacement.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-07-24  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 17:32 [RESEND] scsi: aacraid: aachba: replace if with max() Salah Triki
2021-07-23 16:56 ` Steffen Maier
2021-07-23 17:19   ` Steffen Maier
2021-07-23 17:22   ` Salah Triki
2021-07-24  2:32 ` Martin K. Petersen

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).