Skip to content

Commit ae5e6c6

Browse files
andy-shevrafaeljw
authored andcommitted
iommu/amd: Switch to use acpi_dev_hid_uid_match()
Since we have a generic helper, drop custom implementation in the driver. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4f3cde3 commit ae5e6c6

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -124,30 +124,6 @@ static struct lock_class_key reserved_rbtree_key;
124124
*
125125
****************************************************************************/
126126

127-
static inline int match_hid_uid(struct device *dev,
128-
struct acpihid_map_entry *entry)
129-
{
130-
struct acpi_device *adev = ACPI_COMPANION(dev);
131-
const char *hid, *uid;
132-
133-
if (!adev)
134-
return -ENODEV;
135-
136-
hid = acpi_device_hid(adev);
137-
uid = acpi_device_uid(adev);
138-
139-
if (!hid || !(*hid))
140-
return -ENODEV;
141-
142-
if (!uid || !(*uid))
143-
return strcmp(hid, entry->hid);
144-
145-
if (!(*entry->uid))
146-
return strcmp(hid, entry->hid);
147-
148-
return (strcmp(hid, entry->hid) || strcmp(uid, entry->uid));
149-
}
150-
151127
static inline u16 get_pci_device_id(struct device *dev)
152128
{
153129
struct pci_dev *pdev = to_pci_dev(dev);
@@ -158,10 +134,14 @@ static inline u16 get_pci_device_id(struct device *dev)
158134
static inline int get_acpihid_device_id(struct device *dev,
159135
struct acpihid_map_entry **entry)
160136
{
137+
struct acpi_device *adev = ACPI_COMPANION(dev);
161138
struct acpihid_map_entry *p;
162139

140+
if (!adev)
141+
return -ENODEV;
142+
163143
list_for_each_entry(p, &acpihid_map, list) {
164-
if (!match_hid_uid(dev, p)) {
144+
if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
165145
if (entry)
166146
*entry = p;
167147
return p->devid;

0 commit comments

Comments
 (0)