The clock-frequency property is optional according to the DT binding.
Do not emit a warning when the property is missing and fall back to the
default frequency instead.
Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC")
Suggested-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
drivers/i2c/busses/i2c-k1.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c
index f0c35e23f4f2e139da0d09f314f3eb0e0462a382..c829618a66a214a12b46d63bf06ba7947b9dbbb8 100644
--- a/drivers/i2c/busses/i2c-k1.c
+++ b/drivers/i2c/busses/i2c-k1.c
@@ -651,9 +651,7 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
if (!i2c)
return -ENOMEM;
- ret = of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq);
- if (ret && ret != -EINVAL)
- dev_warn(dev, "failed to read clock-frequency property: %d\n", ret);
+ of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq);
/* For now, this driver doesn't support high-speed. */
if (i2c->clock_freq > SPACEMIT_I2C_MAX_STANDARD_MODE_FREQ &&
--
2.52.0
Hi Troy,
On Fri, Dec 26, 2025 at 04:32:01PM +0800, Troy Mitchell wrote:
> The clock-frequency property is optional according to the DT binding.
> Do not emit a warning when the property is missing and fall back to the
> default frequency instead.
>
> Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC")
besides Alex' suggestion, please, remove Fixes here. This is not
worth being treated as a fix. What you are doing here is just
remove a warning.
Thanks,
Andi
On 12/26/25 2:32 AM, Troy Mitchell wrote:
> The clock-frequency property is optional according to the DT binding.
> Do not emit a warning when the property is missing and fall back to the
> default frequency instead.
>
> Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC")
> Suggested-by: Alex Elder <elder@riscstar.com>
> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Any error reading the "clock-frequency" property will simply leave
i2c->clock_freq alone. This is good.
But the lines that follow this issue a warning if i2c->clock_freq
is 0. If it's optional, you should simply use a default value,
and although you could state that rate with dev_info(), you should
not warn about it.
-Alex
> ---
> drivers/i2c/busses/i2c-k1.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c
> index f0c35e23f4f2e139da0d09f314f3eb0e0462a382..c829618a66a214a12b46d63bf06ba7947b9dbbb8 100644
> --- a/drivers/i2c/busses/i2c-k1.c
> +++ b/drivers/i2c/busses/i2c-k1.c
> @@ -651,9 +651,7 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
> if (!i2c)
> return -ENOMEM;
>
> - ret = of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq);
> - if (ret && ret != -EINVAL)
> - dev_warn(dev, "failed to read clock-frequency property: %d\n", ret);
> + of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq);
>
> /* For now, this driver doesn't support high-speed. */
> if (i2c->clock_freq > SPACEMIT_I2C_MAX_STANDARD_MODE_FREQ &&
>
On Sun, Dec 28, 2025 at 06:56:38PM -0600, Alex Elder wrote:
> On 12/26/25 2:32 AM, Troy Mitchell wrote:
> > The clock-frequency property is optional according to the DT binding.
> > Do not emit a warning when the property is missing and fall back to the
> > default frequency instead.
> >
> > Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC")
> > Suggested-by: Alex Elder <elder@riscstar.com>
> > Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
>
> Any error reading the "clock-frequency" property will simply leave
> i2c->clock_freq alone. This is good.
>
> But the lines that follow this issue a warning if i2c->clock_freq
> is 0. If it's optional, you should simply use a default value,
> and although you could state that rate with dev_info(), you should
> not warn about it.
Thanks! I get your point!
- Troy
© 2016 - 2026 Red Hat, Inc.