* [PATCH v1] i2c:i2c-stm32f7: fix setup structure
@ 2017-09-21 13:30 Pierre-Yves MORDRET
[not found] ` <1506000609-27409-1-git-send-email-pierre-yves.mordret-qxv4g6HH51o@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Pierre-Yves MORDRET @ 2017-09-21 13:30 UTC (permalink / raw)
To: Wolfram Sang, Rob Herring, Mark Rutland, Maxime Coquelin,
Alexandre Torgue, Russell King, linux-i2c, devicetree,
linux-arm-kernel, linux-kernel
Cc: Pierre-Yves MORDRET
I2C drive setup structure is not properly allocated.
Make it static instead of pointer to store driver data.
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
---
drivers/i2c/busses/i2c-stm32f7.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 47c67b0..42ebdb1 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -215,7 +215,7 @@ struct stm32f7_i2c_dev {
unsigned int msg_num;
unsigned int msg_id;
struct stm32f7_i2c_msg f7_msg;
- struct stm32f7_i2c_setup *setup;
+ struct stm32f7_i2c_setup setup;
struct stm32f7_i2c_timings timing;
};
@@ -537,7 +537,7 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev)
writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR);
/* Enable I2C */
- if (i2c_dev->setup->analog_filter)
+ if (i2c_dev->setup.analog_filter)
stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
STM32F7_I2C_CR1_ANFOFF);
else
@@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
}
setup = of_device_get_match_data(&pdev->dev);
- i2c_dev->setup->rise_time = setup->rise_time;
- i2c_dev->setup->fall_time = setup->fall_time;
- i2c_dev->setup->dnf = setup->dnf;
- i2c_dev->setup->analog_filter = setup->analog_filter;
+ i2c_dev->setup = *setup;
ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
&rise_time);
if (!ret)
- i2c_dev->setup->rise_time = rise_time;
+ i2c_dev->setup.rise_time = rise_time;
ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns",
&fall_time);
if (!ret)
- i2c_dev->setup->fall_time = fall_time;
+ i2c_dev->setup.fall_time = fall_time;
- ret = stm32f7_i2c_setup_timing(i2c_dev, i2c_dev->setup);
+ ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup);
if (ret)
goto clk_free;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] i2c:i2c-stm32f7: fix setup structure
[not found] ` <1506000609-27409-1-git-send-email-pierre-yves.mordret-qxv4g6HH51o@public.gmane.org>
@ 2017-10-05 11:14 ` Wolfram Sang
2017-10-06 7:53 ` Pierre Yves MORDRET
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2017-10-05 11:14 UTC (permalink / raw)
To: Pierre-Yves MORDRET
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue,
Russell King, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 410 bytes --]
On Thu, Sep 21, 2017 at 03:30:09PM +0200, Pierre-Yves MORDRET wrote:
> I2C drive setup structure is not properly allocated.
> Make it static instead of pointer to store driver data.
>
> Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret-qxv4g6HH51o@public.gmane.org>
Ouch! How did it work before?
Applied to for-current, thanks! Please provide a Fixes: tag next time,
did this for you now.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] i2c:i2c-stm32f7: fix setup structure
2017-10-05 11:14 ` Wolfram Sang
@ 2017-10-06 7:53 ` Pierre Yves MORDRET
0 siblings, 0 replies; 3+ messages in thread
From: Pierre Yves MORDRET @ 2017-10-06 7:53 UTC (permalink / raw)
To: Wolfram Sang
Cc: Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue,
Russell King, linux-i2c, devicetree, linux-arm-kernel,
linux-kernel
On 10/05/2017 01:14 PM, Wolfram Sang wrote:
> On Thu, Sep 21, 2017 at 03:30:09PM +0200, Pierre-Yves MORDRET wrote:
>> I2C drive setup structure is not properly allocated.
>> Make it static instead of pointer to store driver data.
>>
>> Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
>
> Ouch! How did it work before?
Well yes it did. When it has been discovered during internal code review I was
skeptical but it turned out to be true. I tested on STM32 F7/H7 without any
trouble : scary !
>
> Applied to for-current, thanks! Please provide a Fixes: tag next time,
> did this for you now.
>
Sorry I wasn't aware about that. I gonna remember for the next time.
Thanks !
Py
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-06 7:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21 13:30 [PATCH v1] i2c:i2c-stm32f7: fix setup structure Pierre-Yves MORDRET
[not found] ` <1506000609-27409-1-git-send-email-pierre-yves.mordret-qxv4g6HH51o@public.gmane.org>
2017-10-05 11:14 ` Wolfram Sang
2017-10-06 7:53 ` Pierre Yves MORDRET
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).