public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: target: Fix the conversion to bool in iblock_execute_pr_out
@ 2023-06-12  8:10 Lu Hongfei
  2023-06-12 10:04 ` Chaitanya Kulkarni
  0 siblings, 1 reply; 3+ messages in thread
From: Lu Hongfei @ 2023-06-12  8:10 UTC (permalink / raw)
  To: Martin K. Petersen, open list:SCSI TARGET SUBSYSTEM,
	open list:SCSI TARGET SUBSYSTEM, open list
  Cc: opensource.kernel, luhongfei

The return value of the '==' or '!=' operator are bool, so there's
no need to convert it to bool again in iblock_execute_pr_out.

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
---
 drivers/target/target_core_iblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 254c33c9788e..ea42cb5d06d4
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -889,7 +889,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
 
 		ret = ops->pr_preempt(bdev, key, sa_key,
 				      scsi_pr_type_to_block(type),
-				      sa == PRO_PREEMPT ? false : true);
+				      sa != PRO_PREEMPT);
 		break;
 	case PRO_RELEASE:
 		if (!ops->pr_clear) {
-- 
2.39.0


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

* Re: [PATCH] drivers: target: Fix the conversion to bool in iblock_execute_pr_out
  2023-06-12  8:10 [PATCH] drivers: target: Fix the conversion to bool in iblock_execute_pr_out Lu Hongfei
@ 2023-06-12 10:04 ` Chaitanya Kulkarni
  2023-06-13  4:01   ` Konstantin Shelekhin
  0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2023-06-12 10:04 UTC (permalink / raw)
  To: Lu Hongfei, Martin K. Petersen, open list:SCSI TARGET SUBSYSTEM,
	open list:SCSI TARGET SUBSYSTEM, open list
  Cc: opensource.kernel@vivo.com

On 6/12/23 01:10, Lu Hongfei wrote:
> The return value of the '==' or '!=' operator are bool, so there's
> no need to convert it to bool again in iblock_execute_pr_out.
>
> Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> ---
>   drivers/target/target_core_iblock.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
> index 254c33c9788e..ea42cb5d06d4
> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
> @@ -889,7 +889,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
>   
>   		ret = ops->pr_preempt(bdev, key, sa_key,
>   				      scsi_pr_type_to_block(type),
> -				      sa == PRO_PREEMPT ? false : true);
> +				      sa != PRO_PREEMPT);
>   		break;
>   	case PRO_RELEASE:
>   		if (!ops->pr_clear) {

this not a fix as current code is not broken ..

-ck



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

* Re: [PATCH] drivers: target: Fix the conversion to bool in iblock_execute_pr_out
  2023-06-12 10:04 ` Chaitanya Kulkarni
@ 2023-06-13  4:01   ` Konstantin Shelekhin
  0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Shelekhin @ 2023-06-13  4:01 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: Lu Hongfei, Martin K. Petersen, open list:SCSI TARGET SUBSYSTEM,
	open list:SCSI TARGET SUBSYSTEM, open list,
	opensource.kernel@vivo.com

On Mon, Jun 12, 2023 at 10:04:28AM +0000, Chaitanya Kulkarni wrote:
> On 6/12/23 01:10, Lu Hongfei wrote:
> > The return value of the '==' or '!=' operator are bool, so there's
> > no need to convert it to bool again in iblock_execute_pr_out.
> >
> > Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
> > ---
> >   drivers/target/target_core_iblock.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
> > index 254c33c9788e..ea42cb5d06d4
> > --- a/drivers/target/target_core_iblock.c
> > +++ b/drivers/target/target_core_iblock.c
> > @@ -889,7 +889,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
> >
> >               ret = ops->pr_preempt(bdev, key, sa_key,
> >                                     scsi_pr_type_to_block(type),
> > -                                   sa == PRO_PREEMPT ? false : true);
> > +                                   sa != PRO_PREEMPT);
> >               break;
> >       case PRO_RELEASE:
> >               if (!ops->pr_clear) {
> 
> this not a fix as current code is not broken ..

It looks much better though. And it's easier to understand.

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

end of thread, other threads:[~2023-06-13  4:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12  8:10 [PATCH] drivers: target: Fix the conversion to bool in iblock_execute_pr_out Lu Hongfei
2023-06-12 10:04 ` Chaitanya Kulkarni
2023-06-13  4:01   ` Konstantin Shelekhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox