ASoC: Move quirk to identify correct machine driver
authorNaveen M <naveen.m@intel.com>
Mon, 15 May 2017 08:12:14 +0000 (13:42 +0530)
committerMark Brown <broonie@kernel.org>
Wed, 24 May 2017 17:27:43 +0000 (18:27 +0100)
sst_acpi_mach has a quirk field to handle board specific quirks.
Patch moves quirk call to sst_acpi_find_machine() instead of calling
it in respective driver

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/atom/sst/sst_acpi.c
sound/soc/intel/common/sst-match-acpi.c

index 193c4d7b35f5456fac544c328b64d55670459772..592f6afaf2a5f74d40d1609a3b4b9b5fa2f5e125 100644 (file)
@@ -303,8 +303,6 @@ static int sst_acpi_probe(struct platform_device *pdev)
                dev_err(dev, "No matching machine driver found\n");
                return -ENODEV;
        }
-       if (mach->machine_quirk)
-               mach = mach->machine_quirk(mach);
 
        pdata = mach->pdata;
 
index f4af3d144b822c7a3810dfdaaa03245b4b0f0a5f..88e4977578b53a05dd62001c392c3aaae27a768a 100644 (file)
@@ -81,9 +81,15 @@ struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
        struct sst_acpi_mach *mach;
 
-       for (mach = machines; mach->id[0]; mach++)
-               if (sst_acpi_check_hid(mach->id) == true)
-                       return mach;
+       for (mach = machines; mach->id[0]; mach++) {
+               if (sst_acpi_check_hid(mach->id) == true) {
+                       if (mach->machine_quirk == NULL)
+                               return mach;
+
+                       if (mach->machine_quirk(mach) != NULL)
+                               return mach;
+               }
+       }
        return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);