linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] firmware: edd: Remove redundant condition
       [not found] <tjhedku0cwqypq8pujvusn6i.1647642604045@email.android.com>
@ 2022-04-20 17:31 ` Greg KH
  2022-04-21  1:40   ` [PATCH V2] " Haowen Bai
  2022-04-21  1:43   ` Haowen Bai
  0 siblings, 2 replies; 5+ messages in thread
From: Greg KH @ 2022-04-20 17:31 UTC (permalink / raw)
  To: 白浩文
  Cc: sudeep.holla, cristian.marussi, ardb, bjorn.andersson, linux-kernel

On Fri, Mar 18, 2022 at 10:33:12PM +0000, 白浩文 wrote:
> Dear Greg KH
> 
> But the logic here is:
>         (!A || (A && B))
> not:
>         (!A || A && B)
> 
> as you write
> 
> No, what I wrote is
> 
> the logic here is:
>         (!A || (A && B))
> Is the same:
>         (!A || B)

That is not what your changelog text says, and I quote:

> > The logic !A || A && B is equivalent to !A || B. so we have
> > to make code clear.

(note, top-posting is horrid and is why we do not do this, please fix
this in the future.)

So can you please fix up your changelog text to be correct and resend
it?

thanks,

greg k-h

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

* [PATCH V2] firmware: edd: Remove redundant condition
  2022-04-20 17:31 ` [PATCH] firmware: edd: Remove redundant condition Greg KH
@ 2022-04-21  1:40   ` Haowen Bai
  2022-04-21  1:43   ` Haowen Bai
  1 sibling, 0 replies; 5+ messages in thread
From: Haowen Bai @ 2022-04-21  1:40 UTC (permalink / raw)
  Cc: Haowen Bai, linux-kernel

The logic (!A || (A && B)) is equivalent to (!A || B). so we have
to make code clear.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
V1->V2: 
change changelog text
1. !A || A && B -> (!A || (A && B))
2. !A || B -> (!A || B)

 drivers/firmware/edd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 69353dd0ea22..5cc238916551 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -685,8 +685,7 @@ static void edd_populate_dir(struct edd_device * edev)
 	int i;
 
 	for (i = 0; (attr = edd_attrs[i]) && !error; i++) {
-		if (!attr->test ||
-		    (attr->test && attr->test(edev)))
+		if (!attr->test || attr->test(edev))
 			error = sysfs_create_file(&edev->kobj,&attr->attr);
 	}
 
-- 
2.7.4


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

* [PATCH V2] firmware: edd: Remove redundant condition
  2022-04-20 17:31 ` [PATCH] firmware: edd: Remove redundant condition Greg KH
  2022-04-21  1:40   ` [PATCH V2] " Haowen Bai
@ 2022-04-21  1:43   ` Haowen Bai
  1 sibling, 0 replies; 5+ messages in thread
From: Haowen Bai @ 2022-04-21  1:43 UTC (permalink / raw)
  To: gregkh
  Cc: ardb, baihaowen, bjorn.andersson, cristian.marussi, linux-kernel,
	sudeep.holla

The logic (!A || (A && B)) is equivalent to (!A || B). so we have
to make code clear.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
V1->V2: 
change changelog text
1. !A || A && B -> (!A || (A && B))
2. !A || B -> (!A || B)

 drivers/firmware/edd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 69353dd0ea22..5cc238916551 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -685,8 +685,7 @@ static void edd_populate_dir(struct edd_device * edev)
 	int i;
 
 	for (i = 0; (attr = edd_attrs[i]) && !error; i++) {
-		if (!attr->test ||
-		    (attr->test && attr->test(edev)))
+		if (!attr->test || attr->test(edev))
 			error = sysfs_create_file(&edev->kobj,&attr->attr);
 	}
 
-- 
2.7.4


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

* Re: [PATCH] firmware: edd: Remove redundant condition
  2022-03-17 10:05 [PATCH] " Haowen Bai
@ 2022-03-18 13:15 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2022-03-18 13:15 UTC (permalink / raw)
  To: Haowen Bai
  Cc: sudeep.holla, cristian.marussi, ardb, bjorn.andersson, linux-kernel

On Thu, Mar 17, 2022 at 06:05:20PM +0800, Haowen Bai wrote:
> The logic !A || A && B is equivalent to !A || B. so we have
> to make code clear.

But the logic here is:
	(!A || (A && B))
not:
	(!A || A && B)

as you write.

Is that the same?  I don't want to have to dig up my son's logic
textbook...

How did you test this?

thanks,

greg k-h

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

* [PATCH] firmware: edd: Remove redundant condition
@ 2022-03-17 10:05 Haowen Bai
  2022-03-18 13:15 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Haowen Bai @ 2022-03-17 10:05 UTC (permalink / raw)
  To: sudeep.holla, cristian.marussi, ardb, gregkh
  Cc: bjorn.andersson, linux-kernel, Haowen Bai

The logic !A || A && B is equivalent to !A || B. so we have
to make code clear.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/firmware/edd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 69353dd..5cc2389 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -685,8 +685,7 @@ static void edd_populate_dir(struct edd_device * edev)
 	int i;
 
 	for (i = 0; (attr = edd_attrs[i]) && !error; i++) {
-		if (!attr->test ||
-		    (attr->test && attr->test(edev)))
+		if (!attr->test || attr->test(edev))
 			error = sysfs_create_file(&edev->kobj,&attr->attr);
 	}
 
-- 
2.7.4


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

end of thread, other threads:[~2022-04-21  1:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <tjhedku0cwqypq8pujvusn6i.1647642604045@email.android.com>
2022-04-20 17:31 ` [PATCH] firmware: edd: Remove redundant condition Greg KH
2022-04-21  1:40   ` [PATCH V2] " Haowen Bai
2022-04-21  1:43   ` Haowen Bai
2022-03-17 10:05 [PATCH] " Haowen Bai
2022-03-18 13:15 ` Greg KH

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