* [RESEND PATCH 0/2] Enhance dt support and channel creation
@ 2019-05-18 22:41 Bárbara Fernandes
2019-05-18 22:41 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
2019-05-18 22:41 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
0 siblings, 2 replies; 6+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 22:41 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
Greg Kroah-Hartman
Cc: linux-iio, devel, linux-kernel, Bárbara Fernandes
This series of patches set a struct of_device_id with all the devices this
driver is able to manage and also add a macro to facilitate channel creation for
its two capacitance channels.
Bárbara Fernandes (2):
staging: iio: cdc: ad7150: create of_device_id array
staging: iio: cdc: ad7150: create macro for capacitance channels
drivers/staging/iio/cdc/ad7150.c | 39 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 17 deletions(-)
--
2.22.0.rc0.1.g337bb99195.dirty
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array
2019-05-18 22:41 [RESEND PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
@ 2019-05-18 22:41 ` Bárbara Fernandes
2019-05-19 10:21 ` Jonathan Cameron
2019-05-18 22:41 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
1 sibling, 1 reply; 6+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 22:41 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
Greg Kroah-Hartman
Cc: linux-iio, devel, linux-kernel, Bárbara Fernandes,
Melissa Wen, Wilson Sales
Create structure of type of_device_id in order to register all devices
the driver is able to manage.
Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Co-developed-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
---
drivers/staging/iio/cdc/ad7150.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 4b1c90e1b0ea..072094227e1b 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -655,11 +655,21 @@ static const struct i2c_device_id ad7150_id[] = {
{}
};
+static const struct of_device_id ad7150_of_i2c_match[] = {
+ { .compatible = "adi,ad7150" },
+ { .compatible = "adi,ad7151" },
+ { .compatible = "adi,ad7156" },
+ {}
+};
+
+MODULE_DEVICE_TABLE(of, ad7150_of_i2c_match);
+
MODULE_DEVICE_TABLE(i2c, ad7150_id);
static struct i2c_driver ad7150_driver = {
.driver = {
.name = "ad7150",
+ .of_match_table = ad7150_of_i2c_match
},
.probe = ad7150_probe,
.id_table = ad7150_id,
--
2.22.0.rc0.1.g337bb99195.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels
2019-05-18 22:41 [RESEND PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
2019-05-18 22:41 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
@ 2019-05-18 22:41 ` Bárbara Fernandes
2019-05-19 10:26 ` Jonathan Cameron
1 sibling, 1 reply; 6+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 22:41 UTC (permalink / raw)
To: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
Greg Kroah-Hartman
Cc: linux-iio, devel, linux-kernel, Bárbara Fernandes, Wilson Sales
Create macro for capacitance channels in order to remove the repeated
code and improve its readability.
Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
---
drivers/staging/iio/cdc/ad7150.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 072094227e1b..d8c43cabce25 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -468,24 +468,19 @@ static const struct iio_event_spec ad7150_events[] = {
},
};
+#define AD7150_CAPACITANCE_CHAN(_chan) { \
+ .type = IIO_CAPACITANCE, \
+ .indexed = 1, \
+ .channel = _chan, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
+ BIT(IIO_CHAN_INFO_AVERAGE_RAW), \
+ .event_spec = ad7150_events, \
+ .num_event_specs = ARRAY_SIZE(ad7150_events), \
+ }
+
static const struct iio_chan_spec ad7150_channels[] = {
- {
- .type = IIO_CAPACITANCE,
- .indexed = 1,
- .channel = 0,
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
- BIT(IIO_CHAN_INFO_AVERAGE_RAW),
- .event_spec = ad7150_events,
- .num_event_specs = ARRAY_SIZE(ad7150_events),
- }, {
- .type = IIO_CAPACITANCE,
- .indexed = 1,
- .channel = 1,
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
- BIT(IIO_CHAN_INFO_AVERAGE_RAW),
- .event_spec = ad7150_events,
- .num_event_specs = ARRAY_SIZE(ad7150_events),
- },
+ AD7150_CAPACITANCE_CHAN(0),
+ AD7150_CAPACITANCE_CHAN(1)
};
/*
--
2.22.0.rc0.1.g337bb99195.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array
2019-05-18 22:41 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
@ 2019-05-19 10:21 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2019-05-19 10:21 UTC (permalink / raw)
To: Bárbara Fernandes
Cc: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
linux-iio, devel, linux-kernel, Melissa Wen, Wilson Sales
On Sat, 18 May 2019 19:41:35 -0300
Bárbara Fernandes <barbara.fernandes@usp.br> wrote:
> Create structure of type of_device_id in order to register all devices
> the driver is able to manage.
>
> Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
> Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
> Co-developed-by: Melissa Wen <melissa.srw@gmail.com>
> Signed-off-by: Wilson Sales <spoonm@spoonm.org>
> Co-developed-by: Wilson Sales <spoonm@spoonm.org>
Hi,
One really minor point inline, otherwise looks good to me.
Thanks,
Jonathan
> ---
> drivers/staging/iio/cdc/ad7150.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index 4b1c90e1b0ea..072094227e1b 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -655,11 +655,21 @@ static const struct i2c_device_id ad7150_id[] = {
> {}
> };
>
> +static const struct of_device_id ad7150_of_i2c_match[] = {
> + { .compatible = "adi,ad7150" },
> + { .compatible = "adi,ad7151" },
> + { .compatible = "adi,ad7156" },
> + {}
> +};
> +
> +MODULE_DEVICE_TABLE(of, ad7150_of_i2c_match);
> +
I would suggest keeping the below MODULE_DEVICE_TABLE
entry next to the definition of ad7150_id rather than putting
this new block in between them.
In short, just move your additions below the next line.
Thanks,
Jonathan
> MODULE_DEVICE_TABLE(i2c, ad7150_id);
>
> static struct i2c_driver ad7150_driver = {
> .driver = {
> .name = "ad7150",
> + .of_match_table = ad7150_of_i2c_match
> },
> .probe = ad7150_probe,
> .id_table = ad7150_id,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels
2019-05-18 22:41 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
@ 2019-05-19 10:26 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2019-05-19 10:26 UTC (permalink / raw)
To: Bárbara Fernandes
Cc: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
linux-iio, devel, linux-kernel, Wilson Sales
On Sat, 18 May 2019 19:41:36 -0300
Bárbara Fernandes <barbara.fernandes@usp.br> wrote:
> Create macro for capacitance channels in order to remove the repeated
> code and improve its readability.
>
> Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
> Signed-off-by: Wilson Sales <spoonm@spoonm.org>
> Co-developed-by: Wilson Sales <spoonm@spoonm.org>
Not a totally clear cut case given there are only two instances, but
I think, on balance that it is an improvement.
As this isn't really connected to patch 1 in the series (or the fix
going via the other tree) I'll apply this one now. Please only
send a new version of patch 1.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders (0-day etc) to see if they can find anything
we have missed.
Some time after those test results have come in, I'll push the tree
out as togreg, and in a few weeks send a pull request to Greg to
hopefully have it pulled into his tree which is part of Linux next
and from which he will then send a pull request to Linus in the
next merge window.
Thanks,
Jonathan
> ---
> drivers/staging/iio/cdc/ad7150.c | 29 ++++++++++++-----------------
> 1 file changed, 12 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
> index 072094227e1b..d8c43cabce25 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -468,24 +468,19 @@ static const struct iio_event_spec ad7150_events[] = {
> },
> };
>
> +#define AD7150_CAPACITANCE_CHAN(_chan) { \
> + .type = IIO_CAPACITANCE, \
> + .indexed = 1, \
> + .channel = _chan, \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> + BIT(IIO_CHAN_INFO_AVERAGE_RAW), \
> + .event_spec = ad7150_events, \
> + .num_event_specs = ARRAY_SIZE(ad7150_events), \
> + }
> +
> static const struct iio_chan_spec ad7150_channels[] = {
> - {
> - .type = IIO_CAPACITANCE,
> - .indexed = 1,
> - .channel = 0,
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> - BIT(IIO_CHAN_INFO_AVERAGE_RAW),
> - .event_spec = ad7150_events,
> - .num_event_specs = ARRAY_SIZE(ad7150_events),
> - }, {
> - .type = IIO_CAPACITANCE,
> - .indexed = 1,
> - .channel = 1,
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> - BIT(IIO_CHAN_INFO_AVERAGE_RAW),
> - .event_spec = ad7150_events,
> - .num_event_specs = ARRAY_SIZE(ad7150_events),
> - },
> + AD7150_CAPACITANCE_CHAN(0),
> + AD7150_CAPACITANCE_CHAN(1)
> };
>
> /*
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels
2019-05-18 21:35 [PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
@ 2019-05-18 21:35 ` Bárbara Fernandes
0 siblings, 0 replies; 6+ messages in thread
From: Bárbara Fernandes @ 2019-05-18 21:35 UTC (permalink / raw)
To: linux-iio; +Cc: Bárbara Fernandes, Wilson Sales
Create macro for capacitance channels in order to remove the repeated
code and improve its readability.
Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed-by: Wilson Sales <spoonm@spoonm.org>
---
drivers/staging/iio/cdc/ad7150.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index 072094227e1b..d8c43cabce25 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -468,24 +468,19 @@ static const struct iio_event_spec ad7150_events[] = {
},
};
+#define AD7150_CAPACITANCE_CHAN(_chan) { \
+ .type = IIO_CAPACITANCE, \
+ .indexed = 1, \
+ .channel = _chan, \
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
+ BIT(IIO_CHAN_INFO_AVERAGE_RAW), \
+ .event_spec = ad7150_events, \
+ .num_event_specs = ARRAY_SIZE(ad7150_events), \
+ }
+
static const struct iio_chan_spec ad7150_channels[] = {
- {
- .type = IIO_CAPACITANCE,
- .indexed = 1,
- .channel = 0,
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
- BIT(IIO_CHAN_INFO_AVERAGE_RAW),
- .event_spec = ad7150_events,
- .num_event_specs = ARRAY_SIZE(ad7150_events),
- }, {
- .type = IIO_CAPACITANCE,
- .indexed = 1,
- .channel = 1,
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
- BIT(IIO_CHAN_INFO_AVERAGE_RAW),
- .event_spec = ad7150_events,
- .num_event_specs = ARRAY_SIZE(ad7150_events),
- },
+ AD7150_CAPACITANCE_CHAN(0),
+ AD7150_CAPACITANCE_CHAN(1)
};
/*
--
2.22.0.rc0.1.g337bb99195.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-19 17:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-18 22:41 [RESEND PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
2019-05-18 22:41 ` [PATCH 1/2] staging: iio: cdc: ad7150: create of_device_id array Bárbara Fernandes
2019-05-19 10:21 ` Jonathan Cameron
2019-05-18 22:41 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
2019-05-19 10:26 ` Jonathan Cameron
-- strict thread matches above, loose matches on Subject: below --
2019-05-18 21:35 [PATCH 0/2] Enhance dt support and channel creation Bárbara Fernandes
2019-05-18 21:35 ` [PATCH 2/2] staging: iio: cdc: ad7150: create macro for capacitance channels Bárbara Fernandes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).