From: Dumitru Ceclan mitrutzceclan@gmail.com
From: Dumitru Ceclan dumitru.ceclan@analog.com
[ Upstream commit 61cbfb5368dd50ed0d65ce21d305aa923581db2b ]
The cfg pointer is set before reading the channel number that the configuration should point to. This causes configurations to be shifted by one channel. For example setting bipolar to the first channel defined in the DT will cause bipolar mode to be active on the second defined channel.
Fix by moving the cfg pointer setting after reading the channel number.
Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels") Signed-off-by: Dumitru Ceclan dumitru.ceclan@analog.com Reviewed-by: Nuno Sa nuno.sa@analog.com Link: https://patch.msgid.link/20240806085133.114547-1-dumitru.ceclan@analog.com Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron Jonathan.Cameron@huawei.com Signed-off-by: He Lugang helugang@uniontech.com --- drivers/iio/adc/ad7124.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index e7b1d517d3de..089398a7664a 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -837,8 +837,6 @@ static int ad7124_parse_channel_config(struct iio_dev *indio_dev, st->channels = channels;
device_for_each_child_node_scoped(dev, child) { - cfg = &st->channels[channel].cfg; - ret = fwnode_property_read_u32(child, "reg", &channel); if (ret) return ret; @@ -856,6 +854,7 @@ static int ad7124_parse_channel_config(struct iio_dev *indio_dev, st->channels[channel].ain = AD7124_CHANNEL_AINP(ain[0]) | AD7124_CHANNEL_AINM(ain[1]);
+ cfg = &st->channels[channel].cfg; cfg->bipolar = fwnode_property_read_bool(child, "bipolar");
ret = fwnode_property_read_u32(child, "adi,reference-select", &tmp);
On Tue, Sep 10, 2024 at 05:07:57PM +0800, He Lugang wrote:
From: Dumitru Ceclan mitrutzceclan@gmail.com
From: Dumitru Ceclan dumitru.ceclan@analog.com
Why is this 2 different addresses?
And why was this sent twice?
confused,
greg k-h
在 2024/9/10 17:23, Greg KH 写道:
On Tue, Sep 10, 2024 at 05:07:57PM +0800, He Lugang wrote:
From: Dumitru Ceclan mitrutzceclan@gmail.com
From: Dumitru Ceclan dumitru.ceclan@analog.com
Why is this 2 different addresses?
And why was this sent twice?
confused,
greg k-h
Hi,greg
About the two email addresses because the email address mismatch message from the checkpatch.pl,so I just and the signed-off-by one,should we just ignore it?
Also pls just pass over the first patch mail because of lack of dependency.
---- Regards, Lugang
On Tue, Sep 10, 2024 at 05:43:21PM +0800, HeLuang wrote:
在 2024/9/10 17:23, Greg KH 写道:
On Tue, Sep 10, 2024 at 05:07:57PM +0800, He Lugang wrote:
From: Dumitru Ceclan mitrutzceclan@gmail.com
From: Dumitru Ceclan dumitru.ceclan@analog.com
Why is this 2 different addresses?
And why was this sent twice?
confused,
greg k-h
Hi,greg
About the two email addresses because the email address mismatch message from the checkpatch.pl,so I just and the signed-off-by one,should we just ignore it?
Please use what is in the upstream commit.
Also pls just pass over the first patch mail because of lack of dependency.
Please tell us what is going on, otherwise we get confused.
Please fix this up and resend a new series that we can take.
thanks,
greg k-h
在 2024/9/10 18:06, Greg KH 写道:
On Tue, Sep 10, 2024 at 05:43:21PM +0800, HeLuang wrote:
在 2024/9/10 17:23, Greg KH 写道:
On Tue, Sep 10, 2024 at 05:07:57PM +0800, He Lugang wrote:
From: Dumitru Ceclan mitrutzceclan@gmail.com
From: Dumitru Ceclan dumitru.ceclan@analog.com
Why is this 2 different addresses?
And why was this sent twice?
confused,
greg k-h
Hi,greg
About the two email addresses because the email address mismatch message from the checkpatch.pl,so I just and the signed-off-by one,should we just ignore it?
Please use what is in the upstream commit.
Also pls just pass over the first patch mail because of lack of dependency.
Please tell us what is going on, otherwise we get confused.
Actually 61cbfb5368dd ("iio: adc: ad7124: fix DT configuration parsing") depends on a6eaf02b8274 ("iio: adc: ad7124: Switch from of specific to fwnode based property handling") so just need to cherry-pick them together!
Please fix this up and resend a new series that we can take.
OK.
thanks,
greg k-h
linux-stable-mirror@lists.linaro.org