diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2008-12-10 14:07:21 +0100 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-12-29 13:39:34 +0100 |
commit | d61c72e52b98411d1cfef1fdb3f5a8bb070f8966 (patch) | |
tree | a32263f85d0b518cac00cf0758e738eee52a7f73 /drivers/firmware/dmi_scan.c | |
parent | libata: blacklist NCQ on OCZ CORE 2 SSD (resend) (diff) | |
download | linux-d61c72e52b98411d1cfef1fdb3f5a8bb070f8966.tar.xz linux-d61c72e52b98411d1cfef1fdb3f5a8bb070f8966.zip |
DMI: add dmi_match
Add a wrapper for testing system_info which will handle also NULL
system infos.
This will be used by the ata PIIX driver.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alexandru Romanescu <a_romanescu@yahoo.co.uk>
Cc: Tejun Heo <tj@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/firmware/dmi_scan.c')
-rw-r--r-- | drivers/firmware/dmi_scan.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 4a597d8c2f70..78b989d202a3 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -582,3 +582,19 @@ int dmi_walk(void (*decode)(const struct dmi_header *)) return 0; } EXPORT_SYMBOL_GPL(dmi_walk); + +/** + * dmi_match - compare a string to the dmi field (if exists) + * + * Returns true if the requested field equals to the str (including NULL). + */ +bool dmi_match(enum dmi_field f, const char *str) +{ + const char *info = dmi_get_system_info(f); + + if (info == NULL || str == NULL) + return info == str; + + return !strcmp(info, str); +} +EXPORT_SYMBOL_GPL(dmi_match); |