From: Andreas Schwab <schwab@linux-m68k.org>
To: tom.leiming@gmail.com
Cc: kay.sievers@vrfy.org, greg@kroah.com, cornelia.huck@de.ibm.com,
linux-kernel@vger.kernel.org, arjan@linux.intel.com
Subject: Re: [PATCH] driver core: check bus->match without holding device lock(v2)
Date: Fri, 10 Apr 2009 17:31:24 +0200 [thread overview]
Message-ID: <m2fxggle43.fsf@igel.home> (raw)
In-Reply-To: <1232551667-4829-1-git-send-email-tom.leiming@gmail.com> (tom leiming's message of "Wed, 21 Jan 2009 23:27:47 +0800")
tom.leiming@gmail.com writes:
> +static inline int driver_match_device(struct device_driver *drv,
> + struct device *dev)
> +{
> + return drv->bus->match && drv->bus->match(dev, drv);
> +}
This logic is wrong. !(a && !b) <=> !a || b, not a && b
A bus that does not have a match function now never matches, whereas
previously it would always match. This breaks aoa-soundbus.
Andreas.
---
driver core: Fix logic in driver_match_device
A bus that does not have a match function always matches. This fixes
49b420a13ff9 ("driver core: check bus->match without holding device
lock").
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
drivers/base/base.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/base.h b/drivers/base/base.h
index ddc9749..087e911 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -115,7 +115,7 @@ extern int driver_probe_device(struct device_driver *drv, struct device *dev);
static inline int driver_match_device(struct device_driver *drv,
struct device *dev)
{
- return drv->bus->match && drv->bus->match(dev, drv);
+ return !drv->bus->match || drv->bus->match(dev, drv);
}
extern void sysdev_shutdown(void);
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2009-04-10 15:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 15:27 [PATCH] driver core: check bus->match without holding device lock(v2) tom.leiming
2009-01-21 15:59 ` Cornelia Huck
2009-04-10 15:31 ` Andreas Schwab [this message]
2009-04-11 1:52 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2fxggle43.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=arjan@linux.intel.com \
--cc=cornelia.huck@de.ibm.com \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.leiming@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox