Message ID | 20200117175626.56358-7-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | None | expand |
On 1/17/20 11:56 AM, Andy Shevchenko wrote: > Since we have a common x86 quirk that provides an exported variable, > use it instead of local DMI table match. > > Cc: Cezary Rojewski <cezary.rojewski@intel.com> > Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com> > Cc: Jie Yang <yang.jie@linux.intel.com> > Cc: Mark Brown <broonie@kernel.org> > Cc: alsa-devel@alsa-project.org > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thanks Andy. Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > --- > .../intel/common/soc-acpi-intel-cht-match.c | 28 ++----------------- > 1 file changed, 3 insertions(+), 25 deletions(-) > > diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c > index d0fb43c2b9f6..833d2e130e6e 100644 > --- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c > +++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c > @@ -5,31 +5,11 @@ > * Copyright (c) 2017, Intel Corporation. > */ > > -#include <linux/dmi.h> > +#include <linux/platform_data/x86/machine.h> > + > #include <sound/soc-acpi.h> > #include <sound/soc-acpi-intel-match.h> > > -static unsigned long cht_machine_id; > - > -#define CHT_SURFACE_MACH 1 > - > -static int cht_surface_quirk_cb(const struct dmi_system_id *id) > -{ > - cht_machine_id = CHT_SURFACE_MACH; > - return 1; > -} > - > -static const struct dmi_system_id cht_table[] = { > - { > - .callback = cht_surface_quirk_cb, > - .matches = { > - DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), > - DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), > - }, > - }, > - { } > -}; > - > static struct snd_soc_acpi_mach cht_surface_mach = { > .id = "10EC5640", > .drv_name = "cht-bsw-rt5645", > @@ -43,9 +23,7 @@ static struct snd_soc_acpi_mach *cht_quirk(void *arg) > { > struct snd_soc_acpi_mach *mach = arg; > > - dmi_check_system(cht_table); > - > - if (cht_machine_id == CHT_SURFACE_MACH) > + if (x86_microsoft_surface_3_machine) > return &cht_surface_mach; > else > return mach; >
On Fri, Jan 17, 2020 at 01:10:55PM -0600, Pierre-Louis Bossart wrote: > On 1/17/20 11:56 AM, Andy Shevchenko wrote: > > Since we have a common x86 quirk that provides an exported variable, > > use it instead of local DMI table match. > > > > Cc: Cezary Rojewski <cezary.rojewski@intel.com> > > Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > > Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com> > > Cc: Jie Yang <yang.jie@linux.intel.com> > > Cc: Mark Brown <broonie@kernel.org> > > Cc: alsa-devel@alsa-project.org > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Thanks Andy. > > Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Thank you. Though I think I'll re-do this a bit, i.e. - convert the cht_quirk() to oneliner that is using ternary operator - convert also codec driver to use variable instead of DMI match > > > --- > > .../intel/common/soc-acpi-intel-cht-match.c | 28 ++----------------- > > 1 file changed, 3 insertions(+), 25 deletions(-) > > > > diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c > > index d0fb43c2b9f6..833d2e130e6e 100644 > > --- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c > > +++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c > > @@ -5,31 +5,11 @@ > > * Copyright (c) 2017, Intel Corporation. > > */ > > -#include <linux/dmi.h> > > +#include <linux/platform_data/x86/machine.h> > > + > > #include <sound/soc-acpi.h> > > #include <sound/soc-acpi-intel-match.h> > > -static unsigned long cht_machine_id; > > - > > -#define CHT_SURFACE_MACH 1 > > - > > -static int cht_surface_quirk_cb(const struct dmi_system_id *id) > > -{ > > - cht_machine_id = CHT_SURFACE_MACH; > > - return 1; > > -} > > - > > -static const struct dmi_system_id cht_table[] = { > > - { > > - .callback = cht_surface_quirk_cb, > > - .matches = { > > - DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), > > - DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), > > - }, > > - }, > > - { } > > -}; > > - > > static struct snd_soc_acpi_mach cht_surface_mach = { > > .id = "10EC5640", > > .drv_name = "cht-bsw-rt5645", > > @@ -43,9 +23,7 @@ static struct snd_soc_acpi_mach *cht_quirk(void *arg) > > { > > struct snd_soc_acpi_mach *mach = arg; > > - dmi_check_system(cht_table); > > - > > - if (cht_machine_id == CHT_SURFACE_MACH) > > + if (x86_microsoft_surface_3_machine) > > return &cht_surface_mach; > > else > > return mach; > >
diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c index d0fb43c2b9f6..833d2e130e6e 100644 --- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c @@ -5,31 +5,11 @@ * Copyright (c) 2017, Intel Corporation. */ -#include <linux/dmi.h> +#include <linux/platform_data/x86/machine.h> + #include <sound/soc-acpi.h> #include <sound/soc-acpi-intel-match.h> -static unsigned long cht_machine_id; - -#define CHT_SURFACE_MACH 1 - -static int cht_surface_quirk_cb(const struct dmi_system_id *id) -{ - cht_machine_id = CHT_SURFACE_MACH; - return 1; -} - -static const struct dmi_system_id cht_table[] = { - { - .callback = cht_surface_quirk_cb, - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), - DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), - }, - }, - { } -}; - static struct snd_soc_acpi_mach cht_surface_mach = { .id = "10EC5640", .drv_name = "cht-bsw-rt5645", @@ -43,9 +23,7 @@ static struct snd_soc_acpi_mach *cht_quirk(void *arg) { struct snd_soc_acpi_mach *mach = arg; - dmi_check_system(cht_table); - - if (cht_machine_id == CHT_SURFACE_MACH) + if (x86_microsoft_surface_3_machine) return &cht_surface_mach; else return mach;
Since we have a common x86 quirk that provides an exported variable, use it instead of local DMI table match. Cc: Cezary Rojewski <cezary.rojewski@intel.com> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com> Cc: Jie Yang <yang.jie@linux.intel.com> Cc: Mark Brown <broonie@kernel.org> Cc: alsa-devel@alsa-project.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- .../intel/common/soc-acpi-intel-cht-match.c | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-)