Skip to content

Commit c551bd8

Browse files
andy-shevlag-linaro
authored andcommitted
pinctrl: intel: Check against matching data instead of ACPI companion
In some cases we may get a platform device that has ACPI companion which is different to the pin control described in the ACPI tables. This is primarily happens when device is instantiated by board file. In order to allow this device being enumerated, refactor intel_pinctrl_get_soc_data() to check the matching data instead of ACPI companion. Reported-by: Henning Schild <henning.schild@siemens.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Henning Schild <henning.schild@siemens.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 9745fb0 commit c551bd8

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,16 +1641,14 @@ EXPORT_SYMBOL_GPL(intel_pinctrl_probe_by_uid);
16411641

16421642
const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_device *pdev)
16431643
{
1644+
const struct intel_pinctrl_soc_data * const *table;
16441645
const struct intel_pinctrl_soc_data *data = NULL;
1645-
const struct intel_pinctrl_soc_data **table;
1646-
struct acpi_device *adev;
1647-
unsigned int i;
16481646

1649-
adev = ACPI_COMPANION(&pdev->dev);
1650-
if (adev) {
1651-
const void *match = device_get_match_data(&pdev->dev);
1647+
table = device_get_match_data(&pdev->dev);
1648+
if (table) {
1649+
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
1650+
unsigned int i;
16521651

1653-
table = (const struct intel_pinctrl_soc_data **)match;
16541652
for (i = 0; table[i]; i++) {
16551653
if (!strcmp(adev->pnp.unique_id, table[i]->uid)) {
16561654
data = table[i];
@@ -1664,7 +1662,7 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
16641662
if (!id)
16651663
return ERR_PTR(-ENODEV);
16661664

1667-
table = (const struct intel_pinctrl_soc_data **)id->driver_data;
1665+
table = (const struct intel_pinctrl_soc_data * const *)id->driver_data;
16681666
data = table[pdev->id];
16691667
}
16701668

0 commit comments

Comments
 (0)