diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2010-02-26 09:04:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-28 03:43:33 -0500 |
commit | 4067a8541d397e9d6b443dd2ce0ecb78bfd991db (patch) | |
tree | 49690419b218020b8a0e9381db2f9cc90b658cd0 /drivers/pci/vpd.c | |
parent | e1d5bdabb94da89bdb3c3f2ee105cf61fca88ec8 (diff) |
pci: Add helper to search for VPD keywords
This patch adds the pci_vpd_find_info_keyword() helper function to
find information field keywords within read-only and read-write large
resource data type sections.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/pci/vpd.c')
-rw-r--r-- | drivers/pci/vpd.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c index 6bc554576f8d..a5a5ca17cfe6 100644 --- a/drivers/pci/vpd.c +++ b/drivers/pci/vpd.c | |||
@@ -41,3 +41,21 @@ int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt) | |||
41 | return -ENOENT; | 41 | return -ENOENT; |
42 | } | 42 | } |
43 | EXPORT_SYMBOL_GPL(pci_vpd_find_tag); | 43 | EXPORT_SYMBOL_GPL(pci_vpd_find_tag); |
44 | |||
45 | int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, | ||
46 | unsigned int len, const char *kw) | ||
47 | { | ||
48 | int i; | ||
49 | |||
50 | for (i = off; i + PCI_VPD_INFO_FLD_HDR_SIZE <= off + len;) { | ||
51 | if (buf[i + 0] == kw[0] && | ||
52 | buf[i + 1] == kw[1]) | ||
53 | return i; | ||
54 | |||
55 | i += PCI_VPD_INFO_FLD_HDR_SIZE + | ||
56 | pci_vpd_info_field_size(&buf[i]); | ||
57 | } | ||
58 | |||
59 | return -ENOENT; | ||
60 | } | ||
61 | EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword); | ||