diff mbox series

input: max77650-onkey: add of_match table

Message ID 20191210100753.11090-1-brgl@bgdev.pl (mailing list archive)
State Mainlined
Commit ce535a2efb48d8d4c4e4b97e2764d7cee73d9b55
Headers show
Series input: max77650-onkey: add of_match table | expand

Commit Message

Bartosz Golaszewski Dec. 10, 2019, 10:07 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

We need the of_match table if we want to use the compatible string in
the pmic's child node and get the onkey driver loaded automatically.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/input/misc/max77650-onkey.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Bartosz Golaszewski Jan. 3, 2020, 1:12 p.m. UTC | #1
wt., 10 gru 2019 o 11:08 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> We need the of_match table if we want to use the compatible string in
> the pmic's child node and get the onkey driver loaded automatically.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Gentle ping.

Bart
Bartosz Golaszewski Jan. 10, 2020, 1:06 p.m. UTC | #2
pt., 3 sty 2020 o 14:12 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
>
> wt., 10 gru 2019 o 11:08 Bartosz Golaszewski <brgl@bgdev.pl> napisał(a):
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > We need the of_match table if we want to use the compatible string in
> > the pmic's child node and get the onkey driver loaded automatically.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> Gentle ping.
>
> Bart

Another week, another ping.

Cheers,
Bart
Dmitry Torokhov Jan. 10, 2020, 6:28 p.m. UTC | #3
On Tue, Dec 10, 2019 at 11:07:53AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> We need the of_match table if we want to use the compatible string in
> the pmic's child node and get the onkey driver loaded automatically.

Do we really need of_match table or adding

MODULE_ALIAS("platform:max77650-onkey");

will work as well?

In general, do we ever instantiate onkey portion from device tree? Or
is it always an MFD cell that is instantiated unconditionally?

> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/input/misc/max77650-onkey.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/input/misc/max77650-onkey.c b/drivers/input/misc/max77650-onkey.c
> index 4d875f2ac13d..ee55f22dbca5 100644
> --- a/drivers/input/misc/max77650-onkey.c
> +++ b/drivers/input/misc/max77650-onkey.c
> @@ -108,9 +108,16 @@ static int max77650_onkey_probe(struct platform_device *pdev)
>  	return input_register_device(onkey->input);
>  }
>  
> +static const struct of_device_id max77650_onkey_of_match[] = {
> +	{ .compatible = "maxim,max77650-onkey" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, max77650_onkey_of_match);
> +
>  static struct platform_driver max77650_onkey_driver = {
>  	.driver = {
>  		.name = "max77650-onkey",
> +		.of_match_table = max77650_onkey_of_match,
>  	},
>  	.probe = max77650_onkey_probe,
>  };
> -- 
> 2.23.0
> 

Thanks.
Bartosz Golaszewski Jan. 11, 2020, 10:22 a.m. UTC | #4
pt., 10 sty 2020 o 19:28 Dmitry Torokhov <dmitry.torokhov@gmail.com> napisał(a):
>
> On Tue, Dec 10, 2019 at 11:07:53AM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > We need the of_match table if we want to use the compatible string in
> > the pmic's child node and get the onkey driver loaded automatically.
>
> Do we really need of_match table or adding
>

Not really. Technically not anyway but we merged bindings that define
it (at the time I didn't know any better) and seems we're stuck with
it. Please see the discussion below a similar patch for regulator
subsystem[1].

> MODULE_ALIAS("platform:max77650-onkey");
>

This is already in there, but if someone defines the compatible in the
device tree as per bindings, the module won't be loaded despite the
MODULE_ALIAS() definition.

> will work as well?
>
> In general, do we ever instantiate onkey portion from device tree? Or
> is it always an MFD cell that is instantiated unconditionally?
>

Bart

[1] https://lkml.org/lkml/2019/12/10/271
Dmitry Torokhov Jan. 17, 2020, 4:24 a.m. UTC | #5
On Sat, Jan 11, 2020 at 11:22:55AM +0100, Bartosz Golaszewski wrote:
> pt., 10 sty 2020 o 19:28 Dmitry Torokhov <dmitry.torokhov@gmail.com> napisał(a):
> >
> > On Tue, Dec 10, 2019 at 11:07:53AM +0100, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > We need the of_match table if we want to use the compatible string in
> > > the pmic's child node and get the onkey driver loaded automatically.
> >
> > Do we really need of_match table or adding
> >
> 
> Not really. Technically not anyway but we merged bindings that define
> it (at the time I didn't know any better) and seems we're stuck with
> it. Please see the discussion below a similar patch for regulator
> subsystem[1].
> 
> > MODULE_ALIAS("platform:max77650-onkey");
> >
> 
> This is already in there, but if someone defines the compatible in the
> device tree as per bindings, the module won't be loaded despite the
> MODULE_ALIAS() definition.

I see. Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/misc/max77650-onkey.c b/drivers/input/misc/max77650-onkey.c
index 4d875f2ac13d..ee55f22dbca5 100644
--- a/drivers/input/misc/max77650-onkey.c
+++ b/drivers/input/misc/max77650-onkey.c
@@ -108,9 +108,16 @@  static int max77650_onkey_probe(struct platform_device *pdev)
 	return input_register_device(onkey->input);
 }
 
+static const struct of_device_id max77650_onkey_of_match[] = {
+	{ .compatible = "maxim,max77650-onkey" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, max77650_onkey_of_match);
+
 static struct platform_driver max77650_onkey_driver = {
 	.driver = {
 		.name = "max77650-onkey",
+		.of_match_table = max77650_onkey_of_match,
 	},
 	.probe = max77650_onkey_probe,
 };