Skip to content

Commit 4f3cde3

Browse files
andy-shevrafaeljw
authored andcommitted
mmc: sdhci-acpi: 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]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7e70c8a commit 4f3cde3

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

drivers/mmc/host/sdhci-acpi.c

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct sdhci_acpi_slot {
6161
mmc_pm_flag_t pm_caps;
6262
unsigned int flags;
6363
size_t priv_size;
64-
int (*probe_slot)(struct platform_device *, const char *, const char *);
64+
int (*probe_slot)(struct platform_device *, struct acpi_device *);
6565
int (*remove_slot)(struct platform_device *);
6666
int (*free_slot)(struct platform_device *pdev);
6767
int (*setup_host)(struct platform_device *pdev);
@@ -325,12 +325,10 @@ static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
325325
* wifi card in the expected slot with an ACPI companion node, is used to
326326
* indicate that acpi_device_fix_up_power() should be avoided.
327327
*/
328-
static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
329-
const char *uid)
328+
static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
330329
{
331330
return sdhci_acpi_cht() &&
332-
!strcmp(hid, "80860F14") &&
333-
!strcmp(uid, "2") &&
331+
acpi_dev_hid_uid_match(adev, "80860F14", "2") &&
334332
sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
335333
}
336334

@@ -345,8 +343,7 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev)
345343
return false;
346344
}
347345

348-
static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
349-
const char *uid)
346+
static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
350347
{
351348
return false;
352349
}
@@ -375,19 +372,18 @@ static int bxt_get_cd(struct mmc_host *mmc)
375372
return ret;
376373
}
377374

378-
static int intel_probe_slot(struct platform_device *pdev, const char *hid,
379-
const char *uid)
375+
static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
380376
{
381377
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
382378
struct intel_host *intel_host = sdhci_acpi_priv(c);
383379
struct sdhci_host *host = c->host;
384380

385-
if (hid && uid && !strcmp(hid, "80860F14") && !strcmp(uid, "1") &&
381+
if (acpi_dev_hid_uid_match(adev, "80860F14", "1") &&
386382
sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
387383
sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807)
388384
host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
389385

390-
if (hid && !strcmp(hid, "80865ACA"))
386+
if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL))
391387
host->mmc_host_ops.get_cd = bxt_get_cd;
392388

393389
intel_dsm_init(intel_host, &pdev->dev, host->mmc);
@@ -473,16 +469,15 @@ static irqreturn_t sdhci_acpi_qcom_handler(int irq, void *ptr)
473469
return IRQ_HANDLED;
474470
}
475471

476-
static int qcom_probe_slot(struct platform_device *pdev, const char *hid,
477-
const char *uid)
472+
static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
478473
{
479474
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
480475
struct sdhci_host *host = c->host;
481476
int *irq = sdhci_acpi_priv(c);
482477

483478
*irq = -EINVAL;
484479

485-
if (strcmp(hid, "QCOM8051"))
480+
if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
486481
return 0;
487482

488483
*irq = platform_get_irq(pdev, 1);
@@ -501,14 +496,12 @@ static int qcom_free_slot(struct platform_device *pdev)
501496
struct sdhci_host *host = c->host;
502497
struct acpi_device *adev;
503498
int *irq = sdhci_acpi_priv(c);
504-
const char *hid;
505499

506500
adev = ACPI_COMPANION(dev);
507501
if (!adev)
508502
return -ENODEV;
509503

510-
hid = acpi_device_hid(adev);
511-
if (strcmp(hid, "QCOM8051"))
504+
if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
512505
return 0;
513506

514507
if (*irq < 0)
@@ -583,7 +576,7 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_amd = {
583576
};
584577

585578
static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev,
586-
const char *hid, const char *uid)
579+
struct acpi_device *adev)
587580
{
588581
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
589582
struct sdhci_host *host = c->host;
@@ -654,17 +647,12 @@ static const struct acpi_device_id sdhci_acpi_ids[] = {
654647
};
655648
MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
656649

657-
static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid,
658-
const char *uid)
650+
static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(struct acpi_device *adev)
659651
{
660652
const struct sdhci_acpi_uid_slot *u;
661653

662654
for (u = sdhci_acpi_uids; u->hid; u++) {
663-
if (strcmp(u->hid, hid))
664-
continue;
665-
if (!u->uid)
666-
return u->slot;
667-
if (uid && !strcmp(u->uid, uid))
655+
if (acpi_dev_hid_uid_match(adev, u->hid, u->uid))
668656
return u->slot;
669657
}
670658
return NULL;
@@ -680,22 +668,17 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
680668
struct resource *iomem;
681669
resource_size_t len;
682670
size_t priv_size;
683-
const char *hid;
684-
const char *uid;
685671
int err;
686672

687673
device = ACPI_COMPANION(dev);
688674
if (!device)
689675
return -ENODEV;
690676

691-
hid = acpi_device_hid(device);
692-
uid = acpi_device_uid(device);
693-
694-
slot = sdhci_acpi_get_slot(hid, uid);
677+
slot = sdhci_acpi_get_slot(device);
695678

696679
/* Power on the SDHCI controller and its children */
697680
acpi_device_fix_up_power(device);
698-
if (!sdhci_acpi_no_fixup_child_power(hid, uid)) {
681+
if (!sdhci_acpi_no_fixup_child_power(device)) {
699682
list_for_each_entry(child, &device->children, node)
700683
if (child->status.present && child->status.enabled)
701684
acpi_device_fix_up_power(child);
@@ -745,7 +728,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
745728

746729
if (c->slot) {
747730
if (c->slot->probe_slot) {
748-
err = c->slot->probe_slot(pdev, hid, uid);
731+
err = c->slot->probe_slot(pdev, device);
749732
if (err)
750733
goto err_free;
751734
}

0 commit comments

Comments
 (0)