diff mbox series

[2/2] ASoC: wm8961: add support for devicetree

Message ID 20221001200039.21049-3-doug@schmorgal.com
State New
Headers show
Series ASoC: add devicetree support for WM8961 codec | expand

Commit Message

Doug Brown Oct. 1, 2022, 8 p.m. UTC
This adds support for devicetree to the WM8961 driver so it can be used
with modern DT-based kernels.

Signed-off-by: Doug Brown <doug@schmorgal.com>
---
 sound/soc/codecs/Kconfig  | 2 +-
 sound/soc/codecs/wm8961.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Doug Brown Oct. 2, 2022, 5:04 a.m. UTC | #1
On 10/1/2022 3:23 PM, kernel test robot wrote:

>>> sound/soc/codecs/wm8961.c:974:34: warning: 'wm8961_of_match' defined but not used [-Wunused-const-variable=]
>       974 | static const struct of_device_id wm8961_of_match[] = {
>           |                                  ^~~~~~~~~~~~~~~

Oops, nice catch by the kernel test robot. I will submit a V2 patch that
does this part exactly how the wm8960 driver does it, including
.of_match_table in wm8961_i2c_driver. Waiting to see if I get any other
feedback on V1 first.

Thanks,
Doug
Krzysztof Kozlowski Oct. 2, 2022, 8:08 a.m. UTC | #2
On 01/10/2022 22:00, Doug Brown wrote:
> This adds support for devicetree to the WM8961 driver so it can be used

Do not use "This commit/patch adds ...".
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95

Just "Add support for ..."


> with modern DT-based kernels.
> 
> Signed-off-by: Doug Brown <doug@schmorgal.com>
> ---
>  sound/soc/codecs/Kconfig  | 2 +-
>  sound/soc/codecs/wm8961.c | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index e3b90c425faf..2b5787ee8d31 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -1929,7 +1929,7 @@ config SND_SOC_WM8960
>  	depends on I2C
>  
>  config SND_SOC_WM8961
> -	tristate
> +	tristate "Wolfson Microelectronics WM8961 CODEC"

This is independent change. Please split to separate commit.

>  	depends on I2C
>  
>  config SND_SOC_WM8962
> diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
> index 7dc6aaf65576..539096184eda 100644
> --- a/sound/soc/codecs/wm8961.c
> +++ b/sound/soc/codecs/wm8961.c
> @@ -971,6 +971,12 @@ static const struct i2c_device_id wm8961_i2c_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, wm8961_i2c_id);
>  
> +static const struct of_device_id wm8961_of_match[] = {
> +	{ .compatible = "wlf,wm8961", },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, wm8961_of_match);

Compile-test with W=1 and without CONFIG_OF. Is there a warning here?

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 2, 2022, 8:35 a.m. UTC | #3
On 02/10/2022 07:04, Doug Brown wrote:
> On 10/1/2022 3:23 PM, kernel test robot wrote:
> 
>>>> sound/soc/codecs/wm8961.c:974:34: warning: 'wm8961_of_match' defined but not used [-Wunused-const-variable=]
>>       974 | static const struct of_device_id wm8961_of_match[] = {
>>           |                                  ^~~~~~~~~~~~~~~
> 
> Oops, nice catch by the kernel test robot. I will submit a V2 patch that

Now I see the report about issue I wrote to you. It's not particular
nice catch of robot... it's visible from the code and easily testable by
yourself. Even without compile test... The code was just not tested for
warnings.

> does this part exactly how the wm8960 driver does it, including
> .of_match_table in wm8961_i2c_driver. Waiting to see if I get any other
> feedback on V1 first.

maybe_unused instead of ifdefs.

Best regards,
Krzysztof
Doug Brown Oct. 2, 2022, 5:54 p.m. UTC | #4
Hi Krzysztof,

On 10/2/2022 1:35 AM, Krzysztof Kozlowski wrote:

> Now I see the report about issue I wrote to you. It's not particular
> nice catch of robot... it's visible from the code and easily testable by
> yourself. Even without compile test... The code was just not tested for
> warnings.

Thanks for your thorough and timely review. It is much appreciated. I
will address everything you mentioned in V2, and will do a better job of
checking for warnings with multiple configs going forward.

Doug
diff mbox series

Patch

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e3b90c425faf..2b5787ee8d31 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -1929,7 +1929,7 @@  config SND_SOC_WM8960
 	depends on I2C
 
 config SND_SOC_WM8961
-	tristate
+	tristate "Wolfson Microelectronics WM8961 CODEC"
 	depends on I2C
 
 config SND_SOC_WM8962
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index 7dc6aaf65576..539096184eda 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -971,6 +971,12 @@  static const struct i2c_device_id wm8961_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, wm8961_i2c_id);
 
+static const struct of_device_id wm8961_of_match[] = {
+	{ .compatible = "wlf,wm8961", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wm8961_of_match);
+
 static struct i2c_driver wm8961_i2c_driver = {
 	.driver = {
 		.name = "wm8961",