diff mbox

ASoC: rt5640: add an of_match table

Message ID 1396285517-17892-1-git-send-email-swarren@wwwdotorg.org (mailing list archive)
State Accepted
Commit 03a620d8fa5f5423b87aa93e49bfa79b731c5790
Headers show

Commit Message

Stephen Warren March 31, 2014, 5:05 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Add a device tree match table. This serves to make the driver's support
of device tree more explicit. Perhaps the fallback for DT matching to
using the i2c_device_id table will go away one day, since it fails in
face of devices from different vendors with the same name.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 sound/soc/codecs/rt5640.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Michael Nazzareno Trimarchi March 31, 2014, 5:14 p.m. UTC | #1
Hi

Il 31/mar/2014 19:05 "Stephen Warren" <swarren@wwwdotorg.org> ha scritto:
>
> From: Stephen Warren <swarren@nvidia.com>
>
> Add a device tree match table. This serves to make the driver's support
> of device tree more explicit. Perhaps the fallback for DT matching to
> using the i2c_device_id table will go away one day, since it fails in
> face of devices from different vendors with the same name.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  sound/soc/codecs/rt5640.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
> index b5014a2024e2..b6a02c16f100 100644
> --- a/sound/soc/codecs/rt5640.c
> +++ b/sound/soc/codecs/rt5640.c
> @@ -2018,6 +2018,14 @@ static const struct i2c_device_id rt5640_i2c_id[]
= {
>  };
>  MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
>
> +#if defined(CONFIG_OF)
> +static const struct of_device_id rt5640_of_match[] = {
> +       { .compatible = "realtek,rt5640", },
> +       {},
> +};
> +MODULE_DEVICE_TABLE(of, rt5640_of_match);
> +#endif

Are you sure that you need #if defined?

Michael

> +
>  #ifdef CONFIG_ACPI
>  static struct acpi_device_id rt5640_acpi_match[] = {
>         { "INT33CA", 0 },
> @@ -2166,6 +2174,7 @@ static struct i2c_driver rt5640_i2c_driver = {
>                 .name = "rt5640",
>                 .owner = THIS_MODULE,
>                 .acpi_match_table = ACPI_PTR(rt5640_acpi_match),
> +               .of_match_table = of_match_ptr(rt5640_of_match),
>         },
>         .probe = rt5640_i2c_probe,
>         .remove   = rt5640_i2c_remove,
> --
> 1.8.1.5
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Stephen Warren March 31, 2014, 5:27 p.m. UTC | #2
On 03/31/2014 11:14 AM, Michael Trimarchi wrote:
> Hi
> 
> Il 31/mar/2014 19:05 "Stephen Warren" <swarren@wwwdotorg.org
> <mailto:swarren@wwwdotorg.org>> ha scritto:
>>
>> From: Stephen Warren <swarren@nvidia.com <mailto:swarren@nvidia.com>>
>>
>> Add a device tree match table. This serves to make the driver's support
>> of device tree more explicit. Perhaps the fallback for DT matching to
>> using the i2c_device_id table will go away one day, since it fails in
>> face of devices from different vendors with the same name.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com
> <mailto:swarren@nvidia.com>>
>> ---
>>  sound/soc/codecs/rt5640.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
>> index b5014a2024e2..b6a02c16f100 100644
>> --- a/sound/soc/codecs/rt5640.c
>> +++ b/sound/soc/codecs/rt5640.c
>> @@ -2018,6 +2018,14 @@ static const struct i2c_device_id
> rt5640_i2c_id[] = {
>>  };
>>  MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
>>
>> +#if defined(CONFIG_OF)
>> +static const struct of_device_id rt5640_of_match[] = {
>> +       { .compatible = "realtek,rt5640", },
>> +       {},
>> +};
>> +MODULE_DEVICE_TABLE(of, rt5640_of_match);
>> +#endif
> 
> Are you sure that you need #if defined?

It may not be necessary, but it's for consistency with the ACPI table
which is also #defined.
Mark Brown March 31, 2014, 5:28 p.m. UTC | #3
On Mon, Mar 31, 2014 at 11:05:17AM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Add a device tree match table. This serves to make the driver's support
> of device tree more explicit. Perhaps the fallback for DT matching to
> using the i2c_device_id table will go away one day, since it fails in
> face of devices from different vendors with the same name.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index b5014a2024e2..b6a02c16f100 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2018,6 +2018,14 @@  static const struct i2c_device_id rt5640_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id rt5640_of_match[] = {
+	{ .compatible = "realtek,rt5640", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rt5640_of_match);
+#endif
+
 #ifdef CONFIG_ACPI
 static struct acpi_device_id rt5640_acpi_match[] = {
 	{ "INT33CA", 0 },
@@ -2166,6 +2174,7 @@  static struct i2c_driver rt5640_i2c_driver = {
 		.name = "rt5640",
 		.owner = THIS_MODULE,
 		.acpi_match_table = ACPI_PTR(rt5640_acpi_match),
+		.of_match_table = of_match_ptr(rt5640_of_match),
 	},
 	.probe = rt5640_i2c_probe,
 	.remove   = rt5640_i2c_remove,