diff mbox series

[v2,3/3] regulator: mt6323: Add OF match table

Message ID 20210109112612.1221-3-matthias.bgg@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] regulator: mt6360: Add OF match table | expand

Commit Message

Matthias Brugger Jan. 9, 2021, 11:26 a.m. UTC
From: Matthias Brugger <mbrugger@suse.com>

The binding documentation mentions that a compatible is required for the
MT6323 device node. But the driver does not provide a OF match table.
This way auto-loading is broken as the MFD driver that registers the
device has a .of_compatible set which makes the platform .uevent
callback report a OF modalias, but that's not in the module.

Fixes: 2fdf82923618 ("regulator: mt6323: Add support for MT6323 regulator")
Signed-off-by: Matthias Brugger <mbrugger@suse.com>

---

Changes in v2:
- check for CONFIG_OF
- add Fixes tag

 drivers/regulator/mt6323-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Frank Wunderlich Jan. 9, 2021, 4:44 p.m. UTC | #1
Hi

> Gesendet: Samstag, 09. Januar 2021 um 12:26 Uhr
> Von: matthias.bgg@kernel.org

> Changes in v2:
> - check for CONFIG_OF
> - add Fixes tag

> --- a/drivers/regulator/mt6323-regulator.c
> +++ b/drivers/regulator/mt6323-regulator.c
> @@ -406,9 +406,18 @@ static const struct platform_device_id mt6323_platform_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(platform, mt6323_platform_ids);
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id mt6323_of_match[] = {
> +	{ .compatible = "mediatek,mt6323-regulator", },
> +	{ /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, mt6323_of_match);
> +#endif
> +
>  static struct platform_driver mt6323_regulator_driver = {
>  	.driver = {
>  		.name = "mt6323-regulator",
> +		.of_match_table = of_match_ptr(mt6323_of_match),

imho check for CONFIG_OF is here needed too, else mt6323_of_match is referenced but undefined

>  	},
>  	.probe = mt6323_regulator_probe,
>  	.id_table = mt6323_platform_ids,

regards Frank
Matthias Brugger Jan. 10, 2021, 6:48 p.m. UTC | #2
On 09/01/2021 17:44, Frank Wunderlich wrote:
> Hi
> 
>> Gesendet: Samstag, 09. Januar 2021 um 12:26 Uhr
>> Von: matthias.bgg@kernel.org
> 
>> Changes in v2:
>> - check for CONFIG_OF
>> - add Fixes tag
> 
>> --- a/drivers/regulator/mt6323-regulator.c
>> +++ b/drivers/regulator/mt6323-regulator.c
>> @@ -406,9 +406,18 @@ static const struct platform_device_id mt6323_platform_ids[] = {
>>  };
>>  MODULE_DEVICE_TABLE(platform, mt6323_platform_ids);
>>
>> +#ifdef CONFIG_OF
>> +static const struct of_device_id mt6323_of_match[] = {
>> +	{ .compatible = "mediatek,mt6323-regulator", },
>> +	{ /* sentinel */ },
>> +};
>> +MODULE_DEVICE_TABLE(of, mt6323_of_match);
>> +#endif
>> +
>>  static struct platform_driver mt6323_regulator_driver = {
>>  	.driver = {
>>  		.name = "mt6323-regulator",
>> +		.of_match_table = of_match_ptr(mt6323_of_match),
> 
> imho check for CONFIG_OF is here needed too, else mt6323_of_match is referenced but undefined
> 

No, of_match_ptr already takes care of this:
https://elixir.bootlin.com/linux/latest/source/include/linux/of.h#L998

Regards,
Matthias
diff mbox series

Patch

diff --git a/drivers/regulator/mt6323-regulator.c b/drivers/regulator/mt6323-regulator.c
index ff9016170db3..646742d4db74 100644
--- a/drivers/regulator/mt6323-regulator.c
+++ b/drivers/regulator/mt6323-regulator.c
@@ -406,9 +406,18 @@  static const struct platform_device_id mt6323_platform_ids[] = {
 };
 MODULE_DEVICE_TABLE(platform, mt6323_platform_ids);
 
+#ifdef CONFIG_OF
+static const struct of_device_id mt6323_of_match[] = {
+	{ .compatible = "mediatek,mt6323-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6323_of_match);
+#endif
+
 static struct platform_driver mt6323_regulator_driver = {
 	.driver = {
 		.name = "mt6323-regulator",
+		.of_match_table = of_match_ptr(mt6323_of_match),
 	},
 	.probe = mt6323_regulator_probe,
 	.id_table = mt6323_platform_ids,