All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/5] Staging: iio: adt7316: Add of_device_id table
@ 2018-11-20 16:52 Shreeya Patel
  2018-11-25 11:46   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Shreeya Patel @ 2018-11-20 16:52 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh,
	linux-iio, devel, linux-kernel

When the kernel starts up, it kicks off compiled-in drivers
that match “compatible” entries it finds in the device tree.
At a later stage (when /lib/modules is available), all kernel modules
that match “compatible” entries in the device tree are loaded.

But if there is no dt table then there should be a fall back path
with which desired kernel modules can be loaded. Hence, add
of_device_id table in the i2c driver to be able to use when there
is no dt table.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
---

Changes in v2:
  - Make the commit message appropriate and assign of_match_table
in the driver structure.

 drivers/staging/iio/addac/adt7316-i2c.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c
index 473e5e34ec00..41bc4ca008bc 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -126,9 +126,22 @@ static const struct i2c_device_id adt7316_i2c_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id);
 
+static const struct of_device_id adt7316_of_match[] = {
+	{ .compatible = "adi,adt7316" },
+	{ .compatible = "adi,adt7317" },
+	{ .compatible = "adi,adt7318" },
+	{ .compatible = "adi,adt7516" },
+	{ .compatible = "adi,adt7517" },
+	{ .compatible = "adi,adt7519" },
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, adt7316_of_match);
+
 static struct i2c_driver adt7316_driver = {
 	.driver = {
 		.name = "adt7316",
+		.of_match_table = adt7316_of_match,
 		.pm = ADT7316_PM_OPS,
 	},
 	.probe = adt7316_i2c_probe,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/5] Staging: iio: adt7316: Add of_device_id table
  2018-11-20 16:52 [PATCH v2 1/5] Staging: iio: adt7316: Add of_device_id table Shreeya Patel
@ 2018-11-25 11:46   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2018-11-25 11:46 UTC (permalink / raw)
  To: Shreeya Patel
  Cc: lars, Michael.Hennerich, knaack.h, pmeerw, gregkh, linux-iio,
	devel, linux-kernel

On Tue, 20 Nov 2018 22:22:30 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> wrote:

> When the kernel starts up, it kicks off compiled-in drivers
> that match “compatible” entries it finds in the device tree.
> At a later stage (when /lib/modules is available), all kernel modules
> that match “compatible” entries in the device tree are loaded.
> 
> But if there is no dt table then there should be a fall back path
> with which desired kernel modules can be loaded. Hence, add
> of_device_id table in the i2c driver to be able to use when there
> is no dt table.
The patch is fine, but this description is confusing.

of_device_id is a device tree table (confusing naming in the
kernel, but of is open firmware, a standard from which device tree
emerged).

I've just dropped this second paragraph from the description to
avoid confusion.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan


> 
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> ---
> 
> Changes in v2:
>   - Make the commit message appropriate and assign of_match_table
> in the driver structure.
> 
>  drivers/staging/iio/addac/adt7316-i2c.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c
> index 473e5e34ec00..41bc4ca008bc 100644
> --- a/drivers/staging/iio/addac/adt7316-i2c.c
> +++ b/drivers/staging/iio/addac/adt7316-i2c.c
> @@ -126,9 +126,22 @@ static const struct i2c_device_id adt7316_i2c_id[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id);
>  
> +static const struct of_device_id adt7316_of_match[] = {
> +	{ .compatible = "adi,adt7316" },
> +	{ .compatible = "adi,adt7317" },
> +	{ .compatible = "adi,adt7318" },
> +	{ .compatible = "adi,adt7516" },
> +	{ .compatible = "adi,adt7517" },
> +	{ .compatible = "adi,adt7519" },
> +	{ },
> +};
> +
> +MODULE_DEVICE_TABLE(of, adt7316_of_match);
> +
>  static struct i2c_driver adt7316_driver = {
>  	.driver = {
>  		.name = "adt7316",
> +		.of_match_table = adt7316_of_match,
>  		.pm = ADT7316_PM_OPS,
>  	},
>  	.probe = adt7316_i2c_probe,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/5] Staging: iio: adt7316: Add of_device_id table
@ 2018-11-25 11:46   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2018-11-25 11:46 UTC (permalink / raw)
  To: Shreeya Patel
  Cc: lars, Michael.Hennerich, knaack.h, pmeerw, gregkh, linux-iio,
	devel, linux-kernel

On Tue, 20 Nov 2018 22:22:30 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> wrote:

> When the kernel starts up, it kicks off compiled-in drivers
> that match =E2=80=9Ccompatible=E2=80=9D entries it finds in the device tr=
ee.
> At a later stage (when /lib/modules is available), all kernel modules
> that match =E2=80=9Ccompatible=E2=80=9D entries in the device tree are lo=
aded.
>=20
> But if there is no dt table then there should be a fall back path
> with which desired kernel modules can be loaded. Hence, add
> of_device_id table in the i2c driver to be able to use when there
> is no dt table.
The patch is fine, but this description is confusing.

of_device_id is a device tree table (confusing naming in the
kernel, but of is open firmware, a standard from which device tree
emerged).

I've just dropped this second paragraph from the description to
avoid confusion.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan


>=20
> Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
> ---
>=20
> Changes in v2:
>   - Make the commit message appropriate and assign of_match_table
> in the driver structure.
>=20
>  drivers/staging/iio/addac/adt7316-i2c.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>=20
> diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/ii=
o/addac/adt7316-i2c.c
> index 473e5e34ec00..41bc4ca008bc 100644
> --- a/drivers/staging/iio/addac/adt7316-i2c.c
> +++ b/drivers/staging/iio/addac/adt7316-i2c.c
> @@ -126,9 +126,22 @@ static const struct i2c_device_id adt7316_i2c_id[] =
=3D {
> =20
>  MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id);
> =20
> +static const struct of_device_id adt7316_of_match[] =3D {
> +	{ .compatible =3D "adi,adt7316" },
> +	{ .compatible =3D "adi,adt7317" },
> +	{ .compatible =3D "adi,adt7318" },
> +	{ .compatible =3D "adi,adt7516" },
> +	{ .compatible =3D "adi,adt7517" },
> +	{ .compatible =3D "adi,adt7519" },
> +	{ },
> +};
> +
> +MODULE_DEVICE_TABLE(of, adt7316_of_match);
> +
>  static struct i2c_driver adt7316_driver =3D {
>  	.driver =3D {
>  		.name =3D "adt7316",
> +		.of_match_table =3D adt7316_of_match,
>  		.pm =3D ADT7316_PM_OPS,
>  	},
>  	.probe =3D adt7316_i2c_probe,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-25 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20 16:52 [PATCH v2 1/5] Staging: iio: adt7316: Add of_device_id table Shreeya Patel
2018-11-25 11:46 ` Jonathan Cameron
2018-11-25 11:46   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.