* [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks
@ 2021-03-01 13:50 Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 1/3] clk: generalize devm_clk_get() a bit Uwe Kleine-König
` (6 more replies)
0 siblings, 7 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-01 13:50 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-pwm, linux-clk, kernel, linux-kernel
Hello,
this is a brown paper bag version (aka v3) of my series adding
devm_clk_get_enabled() et al.
Changes since v2 (sent with Message-Id:
20210301110821.1445756-1-uwe@kleine-koenig.org):
- send it from the right email account to have the sender matching the
SoB line
- make __devm_clk_get static
- fix EXPORT_SYMBOL usage
The last two were found by the kernel test robot.
Range-diff can be found below.
Best regards
Uwe
Uwe Kleine-König (3):
clk: generalize devm_clk_get() a bit
clk: Provide new devm_clk_helpers for prepared and enabled clocks
pwm: atmel: Simplify using devm_clk_get_prepared()
drivers/clk/clk-devres.c | 96 +++++++++++++++++++++++++++++++++-------
drivers/pwm/pwm-atmel.c | 15 +------
include/linux/clk.h | 87 +++++++++++++++++++++++++++++++++++-
3 files changed, 168 insertions(+), 30 deletions(-)
Range-diff against v2:
1: 7203dc0837af ! 1: 3faadae49fed clk: generalize devm_clk_get a bit
@@ drivers/clk/clk-devres.c
}
-struct clk *devm_clk_get(struct device *dev, const char *id)
-+struct clk *__devm_clk_get(struct device *dev, const char *id,
-+ struct clk *(*get)(struct device *dev, const char *id),
-+ int (*init)(struct clk *clk),
-+ void (*exit)(struct clk *clk))
++static struct clk *__devm_clk_get(struct device *dev, const char *id,
++ struct clk *(*get)(struct device *dev, const char *id),
++ int (*init)(struct clk *clk),
++ void (*exit)(struct clk *clk))
{
- struct clk **ptr, *clk;
+ struct devm_clk_state *state;
2: 4d2107992b8c ! 2: 82005b4a9ea1 clk: Provide new devm_clk_helpers for prepared and enabled clocks
@@ drivers/clk/clk-devres.c: struct clk *devm_clk_get(struct device *dev, const cha
+ clk_prepare_enable, clk_disable_unprepare);
+
+}
-+EXPORT_SYMBOL(devm_clk_get_prepared);
++EXPORT_SYMBOL(devm_clk_get_enabled);
+
struct clk *devm_clk_get_optional(struct device *dev, const char *id)
{
@@ drivers/clk/clk-devres.c: struct clk *devm_clk_get(struct device *dev, const cha
+ clk_prepare_enable, clk_disable_unprepare);
+
+}
-+EXPORT_SYMBOL(devm_clk_get_optional_prepared);
++EXPORT_SYMBOL(devm_clk_get_optional_enabled);
+
struct clk_bulk_devres {
struct clk_bulk_data *clks;
3: 63f799a4ff32 = 3: 1f73d17d4da7 pwm: atmel: Simplify using devm_clk_get_prepared()
base-commit: fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
--
2.30.0
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v3 1/3] clk: generalize devm_clk_get() a bit
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
@ 2021-03-01 13:50 ` Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 2/3] clk: Provide new devm_clk_helpers for prepared and enabled clocks Uwe Kleine-König
` (5 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-01 13:50 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-pwm, linux-clk, kernel, linux-kernel
Allow to add an exit hook to devm managed clocks. Also use
clk_get_optional() in devm_clk_get_optional instead of open coding it.
The generalisation will be used in the next commit to add some more
devm_clk helpers.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/clk/clk-devres.c | 67 ++++++++++++++++++++++++++++++----------
1 file changed, 50 insertions(+), 17 deletions(-)
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index be160764911b..91c995815b57 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -4,39 +4,72 @@
#include <linux/export.h>
#include <linux/gfp.h>
+struct devm_clk_state {
+ struct clk *clk;
+ void (*exit)(struct clk *clk);
+};
+
static void devm_clk_release(struct device *dev, void *res)
{
- clk_put(*(struct clk **)res);
+ struct devm_clk_state *state = *(struct devm_clk_state **)res;
+
+ if (state->exit)
+ state->exit(state->clk);
+
+ clk_put(state->clk);
}
-struct clk *devm_clk_get(struct device *dev, const char *id)
+static struct clk *__devm_clk_get(struct device *dev, const char *id,
+ struct clk *(*get)(struct device *dev, const char *id),
+ int (*init)(struct clk *clk),
+ void (*exit)(struct clk *clk))
{
- struct clk **ptr, *clk;
+ struct devm_clk_state *state;
+ struct clk *clk;
+ int ret;
- ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL);
- if (!ptr)
+ state = devres_alloc(devm_clk_release, sizeof(*state), GFP_KERNEL);
+ if (!state)
return ERR_PTR(-ENOMEM);
- clk = clk_get(dev, id);
- if (!IS_ERR(clk)) {
- *ptr = clk;
- devres_add(dev, ptr);
- } else {
- devres_free(ptr);
+ clk = get(dev, id);
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
+ goto err_clk_get;
}
+ if (init) {
+ ret = init(clk);
+ if (ret)
+ goto err_clk_init;
+ }
+
+ state->clk = clk;
+ state->exit = exit;
+
+ devres_add(dev, state);
+
return clk;
+
+err_clk_init:
+
+ clk_put(clk);
+err_clk_get:
+
+ devres_free(state);
+ return ERR_PTR(ret);
}
-EXPORT_SYMBOL(devm_clk_get);
-struct clk *devm_clk_get_optional(struct device *dev, const char *id)
+struct clk *devm_clk_get(struct device *dev, const char *id)
{
- struct clk *clk = devm_clk_get(dev, id);
+ return __devm_clk_get(dev, id, clk_get, NULL, NULL);
- if (clk == ERR_PTR(-ENOENT))
- return NULL;
+}
+EXPORT_SYMBOL(devm_clk_get);
- return clk;
+struct clk *devm_clk_get_optional(struct device *dev, const char *id)
+{
+ return __devm_clk_get(dev, id, clk_get_optional, NULL, NULL);
}
EXPORT_SYMBOL(devm_clk_get_optional);
--
2.30.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 2/3] clk: Provide new devm_clk_helpers for prepared and enabled clocks
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 1/3] clk: generalize devm_clk_get() a bit Uwe Kleine-König
@ 2021-03-01 13:50 ` Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 3/3] pwm: atmel: Simplify using devm_clk_get_prepared() Uwe Kleine-König
` (4 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-01 13:50 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-pwm, linux-clk, kernel, linux-kernel
When a driver keeps a clock prepared (or enabled) during the whole
lifetime of the driver, these helpers allow to simplify the drivers.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/clk/clk-devres.c | 31 ++++++++++++++
include/linux/clk.h | 87 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index 91c995815b57..b54f7f0f2a35 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -67,12 +67,43 @@ struct clk *devm_clk_get(struct device *dev, const char *id)
}
EXPORT_SYMBOL(devm_clk_get);
+struct clk *devm_clk_get_prepared(struct device *dev, const char *id)
+{
+ return __devm_clk_get(dev, id, clk_get, clk_prepare, clk_unprepare);
+
+}
+EXPORT_SYMBOL(devm_clk_get_prepared);
+
+struct clk *devm_clk_get_enabled(struct device *dev, const char *id)
+{
+ return __devm_clk_get(dev, id, clk_get,
+ clk_prepare_enable, clk_disable_unprepare);
+
+}
+EXPORT_SYMBOL(devm_clk_get_enabled);
+
struct clk *devm_clk_get_optional(struct device *dev, const char *id)
{
return __devm_clk_get(dev, id, clk_get_optional, NULL, NULL);
}
EXPORT_SYMBOL(devm_clk_get_optional);
+struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id)
+{
+ return __devm_clk_get(dev, id, clk_get_optional,
+ clk_prepare, clk_unprepare);
+
+}
+EXPORT_SYMBOL(devm_clk_get_optional_prepared);
+
+struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id)
+{
+ return __devm_clk_get(dev, id, clk_get_optional,
+ clk_prepare_enable, clk_disable_unprepare);
+
+}
+EXPORT_SYMBOL(devm_clk_get_optional_enabled);
+
struct clk_bulk_devres {
struct clk_bulk_data *clks;
int num_clks;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 266e8de3cb51..b3c5da388b08 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -449,7 +449,7 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
* the clock producer. (IOW, @id may be identical strings, but
* clk_get may return different clock producers depending on @dev.)
*
- * Drivers must assume that the clock source is not enabled.
+ * Drivers must assume that the clock source is neither prepared nor enabled.
*
* devm_clk_get should not be called from within interrupt context.
*
@@ -458,6 +458,47 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
*/
struct clk *devm_clk_get(struct device *dev, const char *id);
+/**
+ * devm_clk_get_prepared - devm_clk_get() + clk_prepare()
+ * @dev: device for clock "consumer"
+ * @id: clock consumer ID
+ *
+ * Returns a struct clk corresponding to the clock producer, or
+ * valid IS_ERR() condition containing errno. The implementation
+ * uses @dev and @id to determine the clock consumer, and thereby
+ * the clock producer. (IOW, @id may be identical strings, but
+ * clk_get may return different clock producers depending on @dev.)
+ *
+ * The returned clk (if valid) is prepared. Drivers must however assume that the
+ * clock is not enabled.
+ *
+ * devm_clk_get_prepared should not be called from within interrupt context.
+ *
+ * The clock will automatically be unprepared and freed when the
+ * device is unbound from the bus.
+ */
+struct clk *devm_clk_get_prepared(struct device *dev, const char *id);
+
+/**
+ * devm_clk_get_enabled - devm_clk_get() + clk_prepare_enable()
+ * @dev: device for clock "consumer"
+ * @id: clock consumer ID
+ *
+ * Returns a struct clk corresponding to the clock producer, or
+ * valid IS_ERR() condition containing errno. The implementation
+ * uses @dev and @id to determine the clock consumer, and thereby
+ * the clock producer. (IOW, @id may be identical strings, but
+ * clk_get may return different clock producers depending on @dev.)
+ *
+ * The returned clk (if valid) is prepared and enabled.
+ *
+ * devm_clk_get_prepared should not be called from within interrupt context.
+ *
+ * The clock will automatically be disabled, unprepared and freed when the
+ * device is unbound from the bus.
+ */
+struct clk *devm_clk_get_enabled(struct device *dev, const char *id);
+
/**
* devm_clk_get_optional - lookup and obtain a managed reference to an optional
* clock producer.
@@ -469,6 +510,26 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
*/
struct clk *devm_clk_get_optional(struct device *dev, const char *id);
+/**
+ * devm_clk_get_optional_prepared - devm_clk_get_optional() + clk_prepare()
+ * @dev: device for clock "consumer"
+ * @id: clock consumer ID
+ *
+ * Behaves the same as devm_clk_get_prepared() except where there is no clock producer.
+ * In this case, instead of returning -ENOENT, the function returns NULL.
+ */
+struct clk *devm_clk_get_optional_prepared(struct device *dev, const char *id);
+
+/**
+ * devm_clk_get_optional_enabled - devm_clk_get_optional() + clk_prepare_enable()
+ * @dev: device for clock "consumer"
+ * @id: clock consumer ID
+ *
+ * Behaves the same as devm_clk_get_enabled() except where there is no clock producer.
+ * In this case, instead of returning -ENOENT, the function returns NULL.
+ */
+struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id);
+
/**
* devm_get_clk_from_child - lookup and obtain a managed reference to a
* clock producer from child node.
@@ -813,12 +874,36 @@ static inline struct clk *devm_clk_get(struct device *dev, const char *id)
return NULL;
}
+static inline struct clk *devm_clk_get_prepared(struct device *dev,
+ const char *id)
+{
+ return NULL;
+}
+
+static inline struct clk *devm_clk_get_enabled(struct device *dev,
+ const char *id)
+{
+ return NULL;
+}
+
static inline struct clk *devm_clk_get_optional(struct device *dev,
const char *id)
{
return NULL;
}
+static inline struct clk *devm_clk_get_optional_prepared(struct device *dev,
+ const char *id)
+{
+ return NULL;
+}
+
+static inline struct clk *devm_clk_get_optional_enabled(struct device *dev,
+ const char *id)
+{
+ return NULL;
+}
+
static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
struct clk_bulk_data *clks)
{
--
2.30.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v3 3/3] pwm: atmel: Simplify using devm_clk_get_prepared()
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 1/3] clk: generalize devm_clk_get() a bit Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 2/3] clk: Provide new devm_clk_helpers for prepared and enabled clocks Uwe Kleine-König
@ 2021-03-01 13:50 ` Uwe Kleine-König
2021-03-22 14:22 ` [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
` (3 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-01 13:50 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-pwm, linux-clk, kernel, linux-kernel
With devm_clk_get_prepared() caring to unprepare the clock the error
path and remove callback can be simplified accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/pwm-atmel.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index 5813339b597b..d65e23da2582 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -415,16 +415,10 @@ static int atmel_pwm_probe(struct platform_device *pdev)
if (IS_ERR(atmel_pwm->base))
return PTR_ERR(atmel_pwm->base);
- atmel_pwm->clk = devm_clk_get(&pdev->dev, NULL);
+ atmel_pwm->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(atmel_pwm->clk))
return PTR_ERR(atmel_pwm->clk);
- ret = clk_prepare(atmel_pwm->clk);
- if (ret) {
- dev_err(&pdev->dev, "failed to prepare PWM clock\n");
- return ret;
- }
-
atmel_pwm->chip.dev = &pdev->dev;
atmel_pwm->chip.ops = &atmel_pwm_ops;
atmel_pwm->chip.of_xlate = of_pwm_xlate_with_flags;
@@ -435,23 +429,18 @@ static int atmel_pwm_probe(struct platform_device *pdev)
ret = pwmchip_add(&atmel_pwm->chip);
if (ret < 0) {
dev_err(&pdev->dev, "failed to add PWM chip %d\n", ret);
- goto unprepare_clk;
+ return ret;
}
platform_set_drvdata(pdev, atmel_pwm);
return ret;
-
-unprepare_clk:
- clk_unprepare(atmel_pwm->clk);
- return ret;
}
static int atmel_pwm_remove(struct platform_device *pdev)
{
struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
- clk_unprepare(atmel_pwm->clk);
mutex_destroy(&atmel_pwm->isr_lock);
return pwmchip_remove(&atmel_pwm->chip);
--
2.30.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
` (2 preceding siblings ...)
2021-03-01 13:50 ` [PATCH v3 3/3] pwm: atmel: Simplify using devm_clk_get_prepared() Uwe Kleine-König
@ 2021-03-22 14:22 ` Uwe Kleine-König
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
` (2 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-22 14:22 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-pwm, linux-clk, kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 929 bytes --]
Hello,
On Mon, Mar 01, 2021 at 02:50:50PM +0100, Uwe Kleine-König wrote:
> Uwe Kleine-König (3):
> clk: generalize devm_clk_get() a bit
> clk: Provide new devm_clk_helpers for prepared and enabled clocks
> pwm: atmel: Simplify using devm_clk_get_prepared()
>
> drivers/clk/clk-devres.c | 96 +++++++++++++++++++++++++++++++++-------
> drivers/pwm/pwm-atmel.c | 15 +------
> include/linux/clk.h | 87 +++++++++++++++++++++++++++++++++++-
> 3 files changed, 168 insertions(+), 30 deletions(-)
can I get some feedback on this series please? The idea is on the list
since October last year with absolutely no maintainer feedback.
I think it's a good idea and not too hard to review, so I wonder what is
stopping you.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
` (3 preceding siblings ...)
2021-03-22 14:22 ` [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
@ 2021-03-24 20:12 ` Uwe Kleine-König
2021-03-24 20:22 ` Uwe Kleine-König
` (2 more replies)
2021-03-24 20:17 ` [PATCH] spi: davinci: " Uwe Kleine-König
2021-03-24 20:27 ` Uwe Kleine-König
6 siblings, 3 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-24 20:12 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Oleksij Rempel, Shawn Guo,
Sascha Hauer, Fabio Estevam, NXP Linux Team
Cc: linux-i2c, Pengutronix Kernel Team, linux-clk
devm_clk_get_prepared returns the clk already prepared and the
automatically called cleanup cares for unpreparing. So simplify .probe
and .remove accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
this simplification depends on a patch set that introduces
devm_clk_get_prepared() and friends.
The most recent version of this patch set can be found at
https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
Unfortunately I didn't get any feedback at all from the clk maintainers
on it, so I try to make other maintainers aware of it in the expectation
that the simplifications are welcome and so lure the clk maintainers to
share their thoughts.
Best regards
Uwe
drivers/i2c/busses/i2c-imx.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index b80fdc1f0092..c0e18a6caa38 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1405,16 +1405,10 @@ static int i2c_imx_probe(struct platform_device *pdev)
ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
/* Get I2C clock */
- i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
+ i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(i2c_imx->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
- "can't get I2C clock\n");
-
- ret = clk_prepare_enable(i2c_imx->clk);
- if (ret) {
- dev_err(&pdev->dev, "can't enable I2C clock, ret=%d\n", ret);
- return ret;
- }
+ "can't get prepared I2C clock\n");
/* Init queue */
init_waitqueue_head(&i2c_imx->queue);
@@ -1517,7 +1511,6 @@ static int i2c_imx_remove(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0);
if (irq >= 0)
free_irq(irq, i2c_imx);
- clk_disable_unprepare(i2c_imx->clk);
pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev);
--
2.30.2
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
` (4 preceding siblings ...)
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
@ 2021-03-24 20:17 ` Uwe Kleine-König
2021-03-24 20:22 ` Uwe Kleine-König
2021-03-30 4:09 ` kernel test robot
2021-03-24 20:27 ` Uwe Kleine-König
6 siblings, 2 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-24 20:17 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Mark Brown; +Cc: linux-spi, linux-clk, kernel
devm_clk_get_prepared returns the clk already prepared and the
automatically called cleanup cares for unpreparing. So simplify .probe
and .remove accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
this simplification depends on a patch set that introduces
devm_clk_get_prepared() and friends.
The most recent version of this patch set can be found at
https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
Unfortunately I didn't get any feedback at all from the clk maintainers
on it, so I try to make other maintainers aware of it in the expectation
that the simplifications are welcome and so lure the clk maintainers to
share their thoughts.
Best regards
Uwe
drivers/spi/spi-davinci.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 7453a1dbbc06..c170bccf9710 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -936,14 +936,11 @@ static int davinci_spi_probe(struct platform_device *pdev)
dspi->bitbang.master = master;
- dspi->clk = devm_clk_get(&pdev->dev, NULL);
+ dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(dspi->clk)) {
ret = -ENODEV;
goto free_master;
}
- ret = clk_prepare_enable(dspi->clk);
- if (ret)
- goto free_master;
master->use_gpio_descriptors = true;
master->dev.of_node = pdev->dev.of_node;
@@ -968,7 +965,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
ret = davinci_spi_request_dma(dspi);
if (ret == -EPROBE_DEFER) {
- goto free_clk;
+ goto free_master;
} else if (ret) {
dev_info(&pdev->dev, "DMA is not supported (%d)\n", ret);
dspi->dma_rx = NULL;
@@ -1012,8 +1009,6 @@ static int davinci_spi_probe(struct platform_device *pdev)
dma_release_channel(dspi->dma_rx);
dma_release_channel(dspi->dma_tx);
}
-free_clk:
- clk_disable_unprepare(dspi->clk);
free_master:
spi_master_put(master);
err:
@@ -1039,8 +1034,6 @@ static int davinci_spi_remove(struct platform_device *pdev)
spi_bitbang_stop(&dspi->bitbang);
- clk_disable_unprepare(dspi->clk);
-
if (dspi->dma_rx) {
dma_release_channel(dspi->dma_rx);
dma_release_channel(dspi->dma_tx);
--
2.30.2
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
@ 2021-03-24 20:22 ` Uwe Kleine-König
2021-03-25 4:49 ` Oleksij Rempel
2021-03-26 13:42 ` kernel test robot
2021-03-31 3:37 ` kernel test robot
2 siblings, 1 reply; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-24 20:22 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Oleksij Rempel, Shawn Guo,
Sascha Hauer, Fabio Estevam, NXP Linux Team
Cc: linux-i2c, Pengutronix Kernel Team, linux-clk
[-- Attachment #1: Type: text/plain, Size: 1850 bytes --]
On Wed, Mar 24, 2021 at 09:12:23PM +0100, Uwe Kleine-König wrote:
> devm_clk_get_prepared returns the clk already prepared and the
> automatically called cleanup cares for unpreparing. So simplify .probe
> and .remove accordingly.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> this simplification depends on a patch set that introduces
> devm_clk_get_prepared() and friends.
>
> The most recent version of this patch set can be found at
>
> https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
>
> Unfortunately I didn't get any feedback at all from the clk maintainers
> on it, so I try to make other maintainers aware of it in the expectation
> that the simplifications are welcome and so lure the clk maintainers to
> share their thoughts.
>
> Best regards
> Uwe
>
> drivers/i2c/busses/i2c-imx.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index b80fdc1f0092..c0e18a6caa38 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1405,16 +1405,10 @@ static int i2c_imx_probe(struct platform_device *pdev)
> ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
>
> /* Get I2C clock */
> - i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
> + i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
oops, I got that wrong, this must be devm_clk_get_enabled, not
devm_clk_get_prepared. So if the clk patches go in, please let me resend
a fixed patch (or adapt yourself, whatever you prefer).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()
2021-03-24 20:17 ` [PATCH] spi: davinci: " Uwe Kleine-König
@ 2021-03-24 20:22 ` Uwe Kleine-König
2021-03-30 17:04 ` Mark Brown
2021-03-30 4:09 ` kernel test robot
1 sibling, 1 reply; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-24 20:22 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Mark Brown; +Cc: linux-clk, kernel, linux-spi
[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]
On Wed, Mar 24, 2021 at 09:17:23PM +0100, Uwe Kleine-König wrote:
> devm_clk_get_prepared returns the clk already prepared and the
> automatically called cleanup cares for unpreparing. So simplify .probe
> and .remove accordingly.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> this simplification depends on a patch set that introduces
> devm_clk_get_prepared() and friends.
>
> The most recent version of this patch set can be found at
>
> https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
>
> Unfortunately I didn't get any feedback at all from the clk maintainers
> on it, so I try to make other maintainers aware of it in the expectation
> that the simplifications are welcome and so lure the clk maintainers to
> share their thoughts.
>
> Best regards
> Uwe
>
> drivers/spi/spi-davinci.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index 7453a1dbbc06..c170bccf9710 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -936,14 +936,11 @@ static int davinci_spi_probe(struct platform_device *pdev)
>
> dspi->bitbang.master = master;
>
> - dspi->clk = devm_clk_get(&pdev->dev, NULL);
> + dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
oops, I got that wrong, this must be devm_clk_get_enabled, not
devm_clk_get_prepared. So if the clk patches go in, please let me resend
a fixed patch (or adapt yourself, whatever you prefer).
Best regards
Uwe
> if (IS_ERR(dspi->clk)) {
> ret = -ENODEV;
> goto free_master;
> }
> - ret = clk_prepare_enable(dspi->clk);
> - if (ret)
> - goto free_master;
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
@ 2021-03-24 20:27 ` Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 2/3] clk: Provide new devm_clk_helpers for prepared and enabled clocks Uwe Kleine-König
` (5 subsequent siblings)
6 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-24 20:27 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Alessandro Zummo,
Alexandre Belloni, Nicolas Ferre, Ludovic Desroches
Cc: linux-clk, kernel, linux-rtc, linux-arm-kernel
devm_clk_get_enabled() returns the clk already (prepared and) enabled
and the automatically called cleanup cares for disabling (and
unpreparing). So simplify .probe() and .remove() accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
this simplification depends on a patch set that introduces
devm_clk_get_prepared() and friends.
The most recent version of this patch set can be found at
https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
Unfortunately I didn't get any feedback at all from the clk maintainers
on it, so I try to make other maintainers aware of it in the expectation
that the simplifications are welcome and so lure the clk maintainers to
share their thoughts.
Best regards
Uwe
drivers/rtc/rtc-at91sam9.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 2216be429ab7..b52e7bd26303 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -374,21 +374,14 @@ static int at91_rtc_probe(struct platform_device *pdev)
return -ENOMEM;
}
- rtc->sclk = devm_clk_get(&pdev->dev, NULL);
+ rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(rtc->sclk))
return PTR_ERR(rtc->sclk);
- ret = clk_prepare_enable(rtc->sclk);
- if (ret) {
- dev_err(&pdev->dev, "Could not enable slow clock\n");
- return ret;
- }
-
sclk_rate = clk_get_rate(rtc->sclk);
if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
dev_err(&pdev->dev, "Invalid slow clock rate\n");
- ret = -EINVAL;
- goto err_clk;
+ return -EINVAL;
}
mr = rtt_readl(rtc, MR);
@@ -406,7 +399,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtcdev)) {
ret = PTR_ERR(rtc->rtcdev);
- goto err_clk;
+ return ret;
}
rtc->rtcdev->ops = &at91_rtc_ops;
@@ -418,7 +411,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
dev_name(&rtc->rtcdev->dev), rtc);
if (ret) {
dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
- goto err_clk;
+ return ret;
}
/* NOTE: sam9260 rev A silicon has a ROM bug which resets the
@@ -432,11 +425,6 @@ static int at91_rtc_probe(struct platform_device *pdev)
dev_name(&rtc->rtcdev->dev));
return devm_rtc_register_device(rtc->rtcdev);
-
-err_clk:
- clk_disable_unprepare(rtc->sclk);
-
- return ret;
}
/*
@@ -450,8 +438,6 @@ static int at91_rtc_remove(struct platform_device *pdev)
/* disable all interrupts */
rtt_writel(rtc, MR, mr & ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN));
- clk_disable_unprepare(rtc->sclk);
-
return 0;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
@ 2021-03-24 20:27 ` Uwe Kleine-König
0 siblings, 0 replies; 25+ messages in thread
From: Uwe Kleine-König @ 2021-03-24 20:27 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Alessandro Zummo,
Alexandre Belloni, Nicolas Ferre, Ludovic Desroches
Cc: linux-clk, kernel, linux-rtc, linux-arm-kernel
devm_clk_get_enabled() returns the clk already (prepared and) enabled
and the automatically called cleanup cares for disabling (and
unpreparing). So simplify .probe() and .remove() accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
this simplification depends on a patch set that introduces
devm_clk_get_prepared() and friends.
The most recent version of this patch set can be found at
https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
Unfortunately I didn't get any feedback at all from the clk maintainers
on it, so I try to make other maintainers aware of it in the expectation
that the simplifications are welcome and so lure the clk maintainers to
share their thoughts.
Best regards
Uwe
drivers/rtc/rtc-at91sam9.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 2216be429ab7..b52e7bd26303 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -374,21 +374,14 @@ static int at91_rtc_probe(struct platform_device *pdev)
return -ENOMEM;
}
- rtc->sclk = devm_clk_get(&pdev->dev, NULL);
+ rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(rtc->sclk))
return PTR_ERR(rtc->sclk);
- ret = clk_prepare_enable(rtc->sclk);
- if (ret) {
- dev_err(&pdev->dev, "Could not enable slow clock\n");
- return ret;
- }
-
sclk_rate = clk_get_rate(rtc->sclk);
if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
dev_err(&pdev->dev, "Invalid slow clock rate\n");
- ret = -EINVAL;
- goto err_clk;
+ return -EINVAL;
}
mr = rtt_readl(rtc, MR);
@@ -406,7 +399,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtcdev)) {
ret = PTR_ERR(rtc->rtcdev);
- goto err_clk;
+ return ret;
}
rtc->rtcdev->ops = &at91_rtc_ops;
@@ -418,7 +411,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
dev_name(&rtc->rtcdev->dev), rtc);
if (ret) {
dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
- goto err_clk;
+ return ret;
}
/* NOTE: sam9260 rev A silicon has a ROM bug which resets the
@@ -432,11 +425,6 @@ static int at91_rtc_probe(struct platform_device *pdev)
dev_name(&rtc->rtcdev->dev));
return devm_rtc_register_device(rtc->rtcdev);
-
-err_clk:
- clk_disable_unprepare(rtc->sclk);
-
- return ret;
}
/*
@@ -450,8 +438,6 @@ static int at91_rtc_remove(struct platform_device *pdev)
/* disable all interrupts */
rtt_writel(rtc, MR, mr & ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN));
- clk_disable_unprepare(rtc->sclk);
-
return 0;
}
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
2021-03-24 20:27 ` Uwe Kleine-König
(?)
@ 2021-03-25 1:11 ` kernel test robot
-1 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-25 1:11 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd,
Alessandro Zummo, Alexandre Belloni, Nicolas Ferre,
Ludovic Desroches
Cc: kbuild-all, linux-clk, kernel, linux-rtc, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 5497 bytes --]
Hi "Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.12-rc4 next-20210324]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/rtc/rtc-at91sam9.c: In function 'at91_rtc_probe':
drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled'; did you mean 'memcg_kmem_enabled'? [-Werror=implicit-function-declaration]
377 | rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~
| memcg_kmem_enabled
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
377 | rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +377 drivers/rtc/rtc-at91sam9.c
331
332 /*
333 * Initialize and install RTC driver
334 */
335 static int at91_rtc_probe(struct platform_device *pdev)
336 {
337 struct sam9_rtc *rtc;
338 int ret, irq;
339 u32 mr;
340 unsigned int sclk_rate;
341 struct of_phandle_args args;
342
343 irq = platform_get_irq(pdev, 0);
344 if (irq < 0)
345 return irq;
346
347 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
348 if (!rtc)
349 return -ENOMEM;
350
351 spin_lock_init(&rtc->lock);
352 rtc->irq = irq;
353
354 /* platform setup code should have handled this; sigh */
355 if (!device_can_wakeup(&pdev->dev))
356 device_init_wakeup(&pdev->dev, 1);
357
358 platform_set_drvdata(pdev, rtc);
359
360 rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
361 if (IS_ERR(rtc->rtt))
362 return PTR_ERR(rtc->rtt);
363
364 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
365 "atmel,rtt-rtc-time-reg", 1, 0,
366 &args);
367 if (ret)
368 return ret;
369
370 rtc->gpbr = syscon_node_to_regmap(args.np);
371 rtc->gpbr_offset = args.args[0];
372 if (IS_ERR(rtc->gpbr)) {
373 dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
374 return -ENOMEM;
375 }
376
> 377 rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
378 if (IS_ERR(rtc->sclk))
379 return PTR_ERR(rtc->sclk);
380
381 sclk_rate = clk_get_rate(rtc->sclk);
382 if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
383 dev_err(&pdev->dev, "Invalid slow clock rate\n");
384 return -EINVAL;
385 }
386
387 mr = rtt_readl(rtc, MR);
388
389 /* unless RTT is counting at 1 Hz, re-initialize it */
390 if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
391 mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
392 gpbr_writel(rtc, 0);
393 }
394
395 /* disable all interrupts (same as on shutdown path) */
396 mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
397 rtt_writel(rtc, MR, mr);
398
399 rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
400 if (IS_ERR(rtc->rtcdev)) {
401 ret = PTR_ERR(rtc->rtcdev);
402 return ret;
403 }
404
405 rtc->rtcdev->ops = &at91_rtc_ops;
406 rtc->rtcdev->range_max = U32_MAX;
407
408 /* register irq handler after we know what name we'll use */
409 ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
410 IRQF_SHARED | IRQF_COND_SUSPEND,
411 dev_name(&rtc->rtcdev->dev), rtc);
412 if (ret) {
413 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
414 return ret;
415 }
416
417 /* NOTE: sam9260 rev A silicon has a ROM bug which resets the
418 * RTT on at least some reboots. If you have that chip, you must
419 * initialize the time from some external source like a GPS, wall
420 * clock, discrete RTC, etc
421 */
422
423 if (gpbr_readl(rtc) == 0)
424 dev_warn(&pdev->dev, "%s: SET TIME!\n",
425 dev_name(&rtc->rtcdev->dev));
426
427 return devm_rtc_register_device(rtc->rtcdev);
428 }
429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67452 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
@ 2021-03-25 1:11 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-25 1:11 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd,
Alessandro Zummo, Alexandre Belloni, Nicolas Ferre,
Ludovic Desroches
Cc: kbuild-all, linux-clk, kernel, linux-rtc, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 5497 bytes --]
Hi "Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.12-rc4 next-20210324]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/rtc/rtc-at91sam9.c: In function 'at91_rtc_probe':
drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled'; did you mean 'memcg_kmem_enabled'? [-Werror=implicit-function-declaration]
377 | rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~
| memcg_kmem_enabled
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
377 | rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +377 drivers/rtc/rtc-at91sam9.c
331
332 /*
333 * Initialize and install RTC driver
334 */
335 static int at91_rtc_probe(struct platform_device *pdev)
336 {
337 struct sam9_rtc *rtc;
338 int ret, irq;
339 u32 mr;
340 unsigned int sclk_rate;
341 struct of_phandle_args args;
342
343 irq = platform_get_irq(pdev, 0);
344 if (irq < 0)
345 return irq;
346
347 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
348 if (!rtc)
349 return -ENOMEM;
350
351 spin_lock_init(&rtc->lock);
352 rtc->irq = irq;
353
354 /* platform setup code should have handled this; sigh */
355 if (!device_can_wakeup(&pdev->dev))
356 device_init_wakeup(&pdev->dev, 1);
357
358 platform_set_drvdata(pdev, rtc);
359
360 rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
361 if (IS_ERR(rtc->rtt))
362 return PTR_ERR(rtc->rtt);
363
364 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
365 "atmel,rtt-rtc-time-reg", 1, 0,
366 &args);
367 if (ret)
368 return ret;
369
370 rtc->gpbr = syscon_node_to_regmap(args.np);
371 rtc->gpbr_offset = args.args[0];
372 if (IS_ERR(rtc->gpbr)) {
373 dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
374 return -ENOMEM;
375 }
376
> 377 rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
378 if (IS_ERR(rtc->sclk))
379 return PTR_ERR(rtc->sclk);
380
381 sclk_rate = clk_get_rate(rtc->sclk);
382 if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
383 dev_err(&pdev->dev, "Invalid slow clock rate\n");
384 return -EINVAL;
385 }
386
387 mr = rtt_readl(rtc, MR);
388
389 /* unless RTT is counting at 1 Hz, re-initialize it */
390 if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
391 mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
392 gpbr_writel(rtc, 0);
393 }
394
395 /* disable all interrupts (same as on shutdown path) */
396 mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
397 rtt_writel(rtc, MR, mr);
398
399 rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
400 if (IS_ERR(rtc->rtcdev)) {
401 ret = PTR_ERR(rtc->rtcdev);
402 return ret;
403 }
404
405 rtc->rtcdev->ops = &at91_rtc_ops;
406 rtc->rtcdev->range_max = U32_MAX;
407
408 /* register irq handler after we know what name we'll use */
409 ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
410 IRQF_SHARED | IRQF_COND_SUSPEND,
411 dev_name(&rtc->rtcdev->dev), rtc);
412 if (ret) {
413 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
414 return ret;
415 }
416
417 /* NOTE: sam9260 rev A silicon has a ROM bug which resets the
418 * RTT on at least some reboots. If you have that chip, you must
419 * initialize the time from some external source like a GPS, wall
420 * clock, discrete RTC, etc
421 */
422
423 if (gpbr_readl(rtc) == 0)
424 dev_warn(&pdev->dev, "%s: SET TIME!\n",
425 dev_name(&rtc->rtcdev->dev));
426
427 return devm_rtc_register_device(rtc->rtcdev);
428 }
429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67452 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
@ 2021-03-25 1:11 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-25 1:11 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5644 bytes --]
Hi "Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v5.12-rc4 next-20210324]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/rtc/rtc-at91sam9.c: In function 'at91_rtc_probe':
drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled'; did you mean 'memcg_kmem_enabled'? [-Werror=implicit-function-declaration]
377 | rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~
| memcg_kmem_enabled
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
377 | rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +377 drivers/rtc/rtc-at91sam9.c
331
332 /*
333 * Initialize and install RTC driver
334 */
335 static int at91_rtc_probe(struct platform_device *pdev)
336 {
337 struct sam9_rtc *rtc;
338 int ret, irq;
339 u32 mr;
340 unsigned int sclk_rate;
341 struct of_phandle_args args;
342
343 irq = platform_get_irq(pdev, 0);
344 if (irq < 0)
345 return irq;
346
347 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
348 if (!rtc)
349 return -ENOMEM;
350
351 spin_lock_init(&rtc->lock);
352 rtc->irq = irq;
353
354 /* platform setup code should have handled this; sigh */
355 if (!device_can_wakeup(&pdev->dev))
356 device_init_wakeup(&pdev->dev, 1);
357
358 platform_set_drvdata(pdev, rtc);
359
360 rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
361 if (IS_ERR(rtc->rtt))
362 return PTR_ERR(rtc->rtt);
363
364 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
365 "atmel,rtt-rtc-time-reg", 1, 0,
366 &args);
367 if (ret)
368 return ret;
369
370 rtc->gpbr = syscon_node_to_regmap(args.np);
371 rtc->gpbr_offset = args.args[0];
372 if (IS_ERR(rtc->gpbr)) {
373 dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
374 return -ENOMEM;
375 }
376
> 377 rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
378 if (IS_ERR(rtc->sclk))
379 return PTR_ERR(rtc->sclk);
380
381 sclk_rate = clk_get_rate(rtc->sclk);
382 if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
383 dev_err(&pdev->dev, "Invalid slow clock rate\n");
384 return -EINVAL;
385 }
386
387 mr = rtt_readl(rtc, MR);
388
389 /* unless RTT is counting at 1 Hz, re-initialize it */
390 if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
391 mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
392 gpbr_writel(rtc, 0);
393 }
394
395 /* disable all interrupts (same as on shutdown path) */
396 mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
397 rtt_writel(rtc, MR, mr);
398
399 rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
400 if (IS_ERR(rtc->rtcdev)) {
401 ret = PTR_ERR(rtc->rtcdev);
402 return ret;
403 }
404
405 rtc->rtcdev->ops = &at91_rtc_ops;
406 rtc->rtcdev->range_max = U32_MAX;
407
408 /* register irq handler after we know what name we'll use */
409 ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
410 IRQF_SHARED | IRQF_COND_SUSPEND,
411 dev_name(&rtc->rtcdev->dev), rtc);
412 if (ret) {
413 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
414 return ret;
415 }
416
417 /* NOTE: sam9260 rev A silicon has a ROM bug which resets the
418 * RTT on at least some reboots. If you have that chip, you must
419 * initialize the time from some external source like a GPS, wall
420 * clock, discrete RTC, etc
421 */
422
423 if (gpbr_readl(rtc) == 0)
424 dev_warn(&pdev->dev, "%s: SET TIME!\n",
425 dev_name(&rtc->rtcdev->dev));
426
427 return devm_rtc_register_device(rtc->rtcdev);
428 }
429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 67452 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
2021-03-24 20:22 ` Uwe Kleine-König
@ 2021-03-25 4:49 ` Oleksij Rempel
0 siblings, 0 replies; 25+ messages in thread
From: Oleksij Rempel @ 2021-03-25 4:49 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Michael Turquette, Stephen Boyd, Oleksij Rempel, Shawn Guo,
Sascha Hauer, Fabio Estevam, NXP Linux Team, linux-i2c,
Pengutronix Kernel Team, linux-clk
On Wed, Mar 24, 2021 at 09:22:32PM +0100, Uwe Kleine-König wrote:
> On Wed, Mar 24, 2021 at 09:12:23PM +0100, Uwe Kleine-König wrote:
> > devm_clk_get_prepared returns the clk already prepared and the
> > automatically called cleanup cares for unpreparing. So simplify .probe
> > and .remove accordingly.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> > Hello,
> >
> > this simplification depends on a patch set that introduces
> > devm_clk_get_prepared() and friends.
> >
> > The most recent version of this patch set can be found at
> >
> > https://lore.kernel.org/r/20210301135053.1462168-1-u.kleine-koenig@pengutronix.de
> >
> > Unfortunately I didn't get any feedback at all from the clk maintainers
> > on it, so I try to make other maintainers aware of it in the expectation
> > that the simplifications are welcome and so lure the clk maintainers to
> > share their thoughts.
> >
> > Best regards
> > Uwe
> >
> > drivers/i2c/busses/i2c-imx.c | 11 ++---------
> > 1 file changed, 2 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> > index b80fdc1f0092..c0e18a6caa38 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -1405,16 +1405,10 @@ static int i2c_imx_probe(struct platform_device *pdev)
> > ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
> >
> > /* Get I2C clock */
> > - i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
> > + i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
>
> oops, I got that wrong, this must be devm_clk_get_enabled, not
> devm_clk_get_prepared. So if the clk patches go in, please let me resend
> a fixed patch (or adapt yourself, whatever you prefer).
Hi,
please send fixed version :)
regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
2021-03-24 20:27 ` Uwe Kleine-König
(?)
@ 2021-03-25 15:15 ` kernel test robot
-1 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-25 15:15 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd,
Alessandro Zummo, Alexandre Belloni, Nicolas Ferre,
Ludovic Desroches
Cc: kbuild-all, clang-built-linux, linux-clk, kernel, linux-rtc,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 5581 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v5.12-rc4 next-20210325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-randconfig-r002-20210325 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d6b4aa80d6df62b924a12af030c5ded868ee4f1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled' [-Werror,-Wimplicit-function-declaration]
rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
^
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: incompatible integer to pointer conversion assigning to 'struct clk *' from 'int' [-Wint-conversion]
rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +/devm_clk_get_enabled +377 drivers/rtc/rtc-at91sam9.c
331
332 /*
333 * Initialize and install RTC driver
334 */
335 static int at91_rtc_probe(struct platform_device *pdev)
336 {
337 struct sam9_rtc *rtc;
338 int ret, irq;
339 u32 mr;
340 unsigned int sclk_rate;
341 struct of_phandle_args args;
342
343 irq = platform_get_irq(pdev, 0);
344 if (irq < 0)
345 return irq;
346
347 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
348 if (!rtc)
349 return -ENOMEM;
350
351 spin_lock_init(&rtc->lock);
352 rtc->irq = irq;
353
354 /* platform setup code should have handled this; sigh */
355 if (!device_can_wakeup(&pdev->dev))
356 device_init_wakeup(&pdev->dev, 1);
357
358 platform_set_drvdata(pdev, rtc);
359
360 rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
361 if (IS_ERR(rtc->rtt))
362 return PTR_ERR(rtc->rtt);
363
364 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
365 "atmel,rtt-rtc-time-reg", 1, 0,
366 &args);
367 if (ret)
368 return ret;
369
370 rtc->gpbr = syscon_node_to_regmap(args.np);
371 rtc->gpbr_offset = args.args[0];
372 if (IS_ERR(rtc->gpbr)) {
373 dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
374 return -ENOMEM;
375 }
376
> 377 rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
378 if (IS_ERR(rtc->sclk))
379 return PTR_ERR(rtc->sclk);
380
381 sclk_rate = clk_get_rate(rtc->sclk);
382 if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
383 dev_err(&pdev->dev, "Invalid slow clock rate\n");
384 return -EINVAL;
385 }
386
387 mr = rtt_readl(rtc, MR);
388
389 /* unless RTT is counting at 1 Hz, re-initialize it */
390 if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
391 mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
392 gpbr_writel(rtc, 0);
393 }
394
395 /* disable all interrupts (same as on shutdown path) */
396 mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
397 rtt_writel(rtc, MR, mr);
398
399 rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
400 if (IS_ERR(rtc->rtcdev)) {
401 ret = PTR_ERR(rtc->rtcdev);
402 return ret;
403 }
404
405 rtc->rtcdev->ops = &at91_rtc_ops;
406 rtc->rtcdev->range_max = U32_MAX;
407
408 /* register irq handler after we know what name we'll use */
409 ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
410 IRQF_SHARED | IRQF_COND_SUSPEND,
411 dev_name(&rtc->rtcdev->dev), rtc);
412 if (ret) {
413 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
414 return ret;
415 }
416
417 /* NOTE: sam9260 rev A silicon has a ROM bug which resets the
418 * RTT on at least some reboots. If you have that chip, you must
419 * initialize the time from some external source like a GPS, wall
420 * clock, discrete RTC, etc
421 */
422
423 if (gpbr_readl(rtc) == 0)
424 dev_warn(&pdev->dev, "%s: SET TIME!\n",
425 dev_name(&rtc->rtcdev->dev));
426
427 return devm_rtc_register_device(rtc->rtcdev);
428 }
429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43058 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
@ 2021-03-25 15:15 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-25 15:15 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd,
Alessandro Zummo, Alexandre Belloni, Nicolas Ferre,
Ludovic Desroches
Cc: kbuild-all, clang-built-linux, linux-clk, kernel, linux-rtc,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 5581 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v5.12-rc4 next-20210325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-randconfig-r002-20210325 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d6b4aa80d6df62b924a12af030c5ded868ee4f1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled' [-Werror,-Wimplicit-function-declaration]
rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
^
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: incompatible integer to pointer conversion assigning to 'struct clk *' from 'int' [-Wint-conversion]
rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +/devm_clk_get_enabled +377 drivers/rtc/rtc-at91sam9.c
331
332 /*
333 * Initialize and install RTC driver
334 */
335 static int at91_rtc_probe(struct platform_device *pdev)
336 {
337 struct sam9_rtc *rtc;
338 int ret, irq;
339 u32 mr;
340 unsigned int sclk_rate;
341 struct of_phandle_args args;
342
343 irq = platform_get_irq(pdev, 0);
344 if (irq < 0)
345 return irq;
346
347 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
348 if (!rtc)
349 return -ENOMEM;
350
351 spin_lock_init(&rtc->lock);
352 rtc->irq = irq;
353
354 /* platform setup code should have handled this; sigh */
355 if (!device_can_wakeup(&pdev->dev))
356 device_init_wakeup(&pdev->dev, 1);
357
358 platform_set_drvdata(pdev, rtc);
359
360 rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
361 if (IS_ERR(rtc->rtt))
362 return PTR_ERR(rtc->rtt);
363
364 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
365 "atmel,rtt-rtc-time-reg", 1, 0,
366 &args);
367 if (ret)
368 return ret;
369
370 rtc->gpbr = syscon_node_to_regmap(args.np);
371 rtc->gpbr_offset = args.args[0];
372 if (IS_ERR(rtc->gpbr)) {
373 dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
374 return -ENOMEM;
375 }
376
> 377 rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
378 if (IS_ERR(rtc->sclk))
379 return PTR_ERR(rtc->sclk);
380
381 sclk_rate = clk_get_rate(rtc->sclk);
382 if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
383 dev_err(&pdev->dev, "Invalid slow clock rate\n");
384 return -EINVAL;
385 }
386
387 mr = rtt_readl(rtc, MR);
388
389 /* unless RTT is counting at 1 Hz, re-initialize it */
390 if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
391 mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
392 gpbr_writel(rtc, 0);
393 }
394
395 /* disable all interrupts (same as on shutdown path) */
396 mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
397 rtt_writel(rtc, MR, mr);
398
399 rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
400 if (IS_ERR(rtc->rtcdev)) {
401 ret = PTR_ERR(rtc->rtcdev);
402 return ret;
403 }
404
405 rtc->rtcdev->ops = &at91_rtc_ops;
406 rtc->rtcdev->range_max = U32_MAX;
407
408 /* register irq handler after we know what name we'll use */
409 ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
410 IRQF_SHARED | IRQF_COND_SUSPEND,
411 dev_name(&rtc->rtcdev->dev), rtc);
412 if (ret) {
413 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
414 return ret;
415 }
416
417 /* NOTE: sam9260 rev A silicon has a ROM bug which resets the
418 * RTT on at least some reboots. If you have that chip, you must
419 * initialize the time from some external source like a GPS, wall
420 * clock, discrete RTC, etc
421 */
422
423 if (gpbr_readl(rtc) == 0)
424 dev_warn(&pdev->dev, "%s: SET TIME!\n",
425 dev_name(&rtc->rtcdev->dev));
426
427 return devm_rtc_register_device(rtc->rtcdev);
428 }
429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 43058 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled()
@ 2021-03-25 15:15 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-25 15:15 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5728 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v5.12-rc4 next-20210325]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-randconfig-r002-20210325 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d6b4aa80d6df62b924a12af030c5ded868ee4f1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/782e62ed210e25e760c5607b2ac2dbf16f56ea0f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/rtc-at91sma9-Simplify-using-devm_clk_get_enabled/20210325-042956
git checkout 782e62ed210e25e760c5607b2ac2dbf16f56ea0f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/rtc/rtc-at91sam9.c:377:14: error: implicit declaration of function 'devm_clk_get_enabled' [-Werror,-Wimplicit-function-declaration]
rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
^
>> drivers/rtc/rtc-at91sam9.c:377:12: warning: incompatible integer to pointer conversion assigning to 'struct clk *' from 'int' [-Wint-conversion]
rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +/devm_clk_get_enabled +377 drivers/rtc/rtc-at91sam9.c
331
332 /*
333 * Initialize and install RTC driver
334 */
335 static int at91_rtc_probe(struct platform_device *pdev)
336 {
337 struct sam9_rtc *rtc;
338 int ret, irq;
339 u32 mr;
340 unsigned int sclk_rate;
341 struct of_phandle_args args;
342
343 irq = platform_get_irq(pdev, 0);
344 if (irq < 0)
345 return irq;
346
347 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
348 if (!rtc)
349 return -ENOMEM;
350
351 spin_lock_init(&rtc->lock);
352 rtc->irq = irq;
353
354 /* platform setup code should have handled this; sigh */
355 if (!device_can_wakeup(&pdev->dev))
356 device_init_wakeup(&pdev->dev, 1);
357
358 platform_set_drvdata(pdev, rtc);
359
360 rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
361 if (IS_ERR(rtc->rtt))
362 return PTR_ERR(rtc->rtt);
363
364 ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
365 "atmel,rtt-rtc-time-reg", 1, 0,
366 &args);
367 if (ret)
368 return ret;
369
370 rtc->gpbr = syscon_node_to_regmap(args.np);
371 rtc->gpbr_offset = args.args[0];
372 if (IS_ERR(rtc->gpbr)) {
373 dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
374 return -ENOMEM;
375 }
376
> 377 rtc->sclk = devm_clk_get_enabled(&pdev->dev, NULL);
378 if (IS_ERR(rtc->sclk))
379 return PTR_ERR(rtc->sclk);
380
381 sclk_rate = clk_get_rate(rtc->sclk);
382 if (!sclk_rate || sclk_rate > AT91_RTT_RTPRES) {
383 dev_err(&pdev->dev, "Invalid slow clock rate\n");
384 return -EINVAL;
385 }
386
387 mr = rtt_readl(rtc, MR);
388
389 /* unless RTT is counting at 1 Hz, re-initialize it */
390 if ((mr & AT91_RTT_RTPRES) != sclk_rate) {
391 mr = AT91_RTT_RTTRST | (sclk_rate & AT91_RTT_RTPRES);
392 gpbr_writel(rtc, 0);
393 }
394
395 /* disable all interrupts (same as on shutdown path) */
396 mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
397 rtt_writel(rtc, MR, mr);
398
399 rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
400 if (IS_ERR(rtc->rtcdev)) {
401 ret = PTR_ERR(rtc->rtcdev);
402 return ret;
403 }
404
405 rtc->rtcdev->ops = &at91_rtc_ops;
406 rtc->rtcdev->range_max = U32_MAX;
407
408 /* register irq handler after we know what name we'll use */
409 ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
410 IRQF_SHARED | IRQF_COND_SUSPEND,
411 dev_name(&rtc->rtcdev->dev), rtc);
412 if (ret) {
413 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq);
414 return ret;
415 }
416
417 /* NOTE: sam9260 rev A silicon has a ROM bug which resets the
418 * RTT on at least some reboots. If you have that chip, you must
419 * initialize the time from some external source like a GPS, wall
420 * clock, discrete RTC, etc
421 */
422
423 if (gpbr_readl(rtc) == 0)
424 dev_warn(&pdev->dev, "%s: SET TIME!\n",
425 dev_name(&rtc->rtcdev->dev));
426
427 return devm_rtc_register_device(rtc->rtcdev);
428 }
429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 43058 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
@ 2021-03-26 13:42 ` kernel test robot
2021-03-26 13:42 ` kernel test robot
2021-03-31 3:37 ` kernel test robot
2 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-26 13:42 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd,
Oleksij Rempel, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team
Cc: kbuild-all, clang-built-linux, linux-i2c,
Pengutronix Kernel Team, linux-clk
[-- Attachment #1: Type: text/plain, Size: 7005 bytes --]
Hi "Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on clk/clk-next shawnguo/for-next v5.12-rc4 next-20210326]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: arm64-randconfig-r033-20210326 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f490a5969bd52c8a48586f134ff8f02ccbb295b3)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/2241b5e30667c72568ec9dc31ab14475bb04a408
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
git checkout 2241b5e30667c72568ec9dc31ab14475bb04a408
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/i2c/busses/i2c-imx.c:1408:17: error: implicit declaration of function 'devm_clk_get_prepared' [-Werror,-Wimplicit-function-declaration]
i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
^
>> drivers/i2c/busses/i2c-imx.c:1408:15: warning: incompatible integer to pointer conversion assigning to 'struct clk *' from 'int' [-Wint-conversion]
i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +1408 drivers/i2c/busses/i2c-imx.c
1363
1364 static int i2c_imx_probe(struct platform_device *pdev)
1365 {
1366 struct imx_i2c_struct *i2c_imx;
1367 struct resource *res;
1368 struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
1369 void __iomem *base;
1370 int irq, ret;
1371 dma_addr_t phy_addr;
1372 const struct imx_i2c_hwdata *match;
1373
1374 dev_dbg(&pdev->dev, "<%s>\n", __func__);
1375
1376 irq = platform_get_irq(pdev, 0);
1377 if (irq < 0)
1378 return irq;
1379
1380 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1381 base = devm_ioremap_resource(&pdev->dev, res);
1382 if (IS_ERR(base))
1383 return PTR_ERR(base);
1384
1385 phy_addr = (dma_addr_t)res->start;
1386 i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL);
1387 if (!i2c_imx)
1388 return -ENOMEM;
1389
1390 match = device_get_match_data(&pdev->dev);
1391 if (match)
1392 i2c_imx->hwdata = match;
1393 else
1394 i2c_imx->hwdata = (struct imx_i2c_hwdata *)
1395 platform_get_device_id(pdev)->driver_data;
1396
1397 /* Setup i2c_imx driver structure */
1398 strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name));
1399 i2c_imx->adapter.owner = THIS_MODULE;
1400 i2c_imx->adapter.algo = &i2c_imx_algo;
1401 i2c_imx->adapter.dev.parent = &pdev->dev;
1402 i2c_imx->adapter.nr = pdev->id;
1403 i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
1404 i2c_imx->base = base;
1405 ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
1406
1407 /* Get I2C clock */
> 1408 i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
1409 if (IS_ERR(i2c_imx->clk))
1410 return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
1411 "can't get prepared I2C clock\n");
1412
1413 /* Init queue */
1414 init_waitqueue_head(&i2c_imx->queue);
1415
1416 /* Set up adapter data */
1417 i2c_set_adapdata(&i2c_imx->adapter, i2c_imx);
1418
1419 /* Set up platform driver data */
1420 platform_set_drvdata(pdev, i2c_imx);
1421
1422 pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
1423 pm_runtime_use_autosuspend(&pdev->dev);
1424 pm_runtime_set_active(&pdev->dev);
1425 pm_runtime_enable(&pdev->dev);
1426
1427 ret = pm_runtime_get_sync(&pdev->dev);
1428 if (ret < 0)
1429 goto rpm_disable;
1430
1431 /* Request IRQ */
1432 ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
1433 pdev->name, i2c_imx);
1434 if (ret) {
1435 dev_err(&pdev->dev, "can't claim irq %d\n", irq);
1436 goto rpm_disable;
1437 }
1438
1439 /* Set up clock divider */
1440 i2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
1441 ret = of_property_read_u32(pdev->dev.of_node,
1442 "clock-frequency", &i2c_imx->bitrate);
1443 if (ret < 0 && pdata && pdata->bitrate)
1444 i2c_imx->bitrate = pdata->bitrate;
1445 i2c_imx->clk_change_nb.notifier_call = i2c_imx_clk_notifier_call;
1446 clk_notifier_register(i2c_imx->clk, &i2c_imx->clk_change_nb);
1447 i2c_imx_set_clk(i2c_imx, clk_get_rate(i2c_imx->clk));
1448
1449 i2c_imx_reset_regs(i2c_imx);
1450
1451 /* Init optional bus recovery function */
1452 ret = i2c_imx_init_recovery_info(i2c_imx, pdev);
1453 /* Give it another chance if pinctrl used is not ready yet */
1454 if (ret == -EPROBE_DEFER)
1455 goto clk_notifier_unregister;
1456
1457 /* Add I2C adapter */
1458 ret = i2c_add_numbered_adapter(&i2c_imx->adapter);
1459 if (ret < 0)
1460 goto clk_notifier_unregister;
1461
1462 pm_runtime_mark_last_busy(&pdev->dev);
1463 pm_runtime_put_autosuspend(&pdev->dev);
1464
1465 dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
1466 dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
1467 dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
1468 i2c_imx->adapter.name);
1469 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
1470
1471 /* Init DMA config if supported */
1472 i2c_imx_dma_request(i2c_imx, phy_addr);
1473
1474 return 0; /* Return OK */
1475
1476 clk_notifier_unregister:
1477 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
1478 free_irq(irq, i2c_imx);
1479 rpm_disable:
1480 pm_runtime_put_noidle(&pdev->dev);
1481 pm_runtime_disable(&pdev->dev);
1482 pm_runtime_set_suspended(&pdev->dev);
1483 pm_runtime_dont_use_autosuspend(&pdev->dev);
1484 clk_disable_unprepare(i2c_imx->clk);
1485 return ret;
1486 }
1487
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41819 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
@ 2021-03-26 13:42 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-26 13:42 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7178 bytes --]
Hi "Uwe,
I love your patch! Perhaps something to improve:
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on clk/clk-next shawnguo/for-next v5.12-rc4 next-20210326]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: arm64-randconfig-r033-20210326 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project f490a5969bd52c8a48586f134ff8f02ccbb295b3)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/2241b5e30667c72568ec9dc31ab14475bb04a408
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
git checkout 2241b5e30667c72568ec9dc31ab14475bb04a408
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/i2c/busses/i2c-imx.c:1408:17: error: implicit declaration of function 'devm_clk_get_prepared' [-Werror,-Wimplicit-function-declaration]
i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
^
>> drivers/i2c/busses/i2c-imx.c:1408:15: warning: incompatible integer to pointer conversion assigning to 'struct clk *' from 'int' [-Wint-conversion]
i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
vim +1408 drivers/i2c/busses/i2c-imx.c
1363
1364 static int i2c_imx_probe(struct platform_device *pdev)
1365 {
1366 struct imx_i2c_struct *i2c_imx;
1367 struct resource *res;
1368 struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
1369 void __iomem *base;
1370 int irq, ret;
1371 dma_addr_t phy_addr;
1372 const struct imx_i2c_hwdata *match;
1373
1374 dev_dbg(&pdev->dev, "<%s>\n", __func__);
1375
1376 irq = platform_get_irq(pdev, 0);
1377 if (irq < 0)
1378 return irq;
1379
1380 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1381 base = devm_ioremap_resource(&pdev->dev, res);
1382 if (IS_ERR(base))
1383 return PTR_ERR(base);
1384
1385 phy_addr = (dma_addr_t)res->start;
1386 i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL);
1387 if (!i2c_imx)
1388 return -ENOMEM;
1389
1390 match = device_get_match_data(&pdev->dev);
1391 if (match)
1392 i2c_imx->hwdata = match;
1393 else
1394 i2c_imx->hwdata = (struct imx_i2c_hwdata *)
1395 platform_get_device_id(pdev)->driver_data;
1396
1397 /* Setup i2c_imx driver structure */
1398 strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name));
1399 i2c_imx->adapter.owner = THIS_MODULE;
1400 i2c_imx->adapter.algo = &i2c_imx_algo;
1401 i2c_imx->adapter.dev.parent = &pdev->dev;
1402 i2c_imx->adapter.nr = pdev->id;
1403 i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
1404 i2c_imx->base = base;
1405 ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
1406
1407 /* Get I2C clock */
> 1408 i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
1409 if (IS_ERR(i2c_imx->clk))
1410 return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
1411 "can't get prepared I2C clock\n");
1412
1413 /* Init queue */
1414 init_waitqueue_head(&i2c_imx->queue);
1415
1416 /* Set up adapter data */
1417 i2c_set_adapdata(&i2c_imx->adapter, i2c_imx);
1418
1419 /* Set up platform driver data */
1420 platform_set_drvdata(pdev, i2c_imx);
1421
1422 pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
1423 pm_runtime_use_autosuspend(&pdev->dev);
1424 pm_runtime_set_active(&pdev->dev);
1425 pm_runtime_enable(&pdev->dev);
1426
1427 ret = pm_runtime_get_sync(&pdev->dev);
1428 if (ret < 0)
1429 goto rpm_disable;
1430
1431 /* Request IRQ */
1432 ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
1433 pdev->name, i2c_imx);
1434 if (ret) {
1435 dev_err(&pdev->dev, "can't claim irq %d\n", irq);
1436 goto rpm_disable;
1437 }
1438
1439 /* Set up clock divider */
1440 i2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
1441 ret = of_property_read_u32(pdev->dev.of_node,
1442 "clock-frequency", &i2c_imx->bitrate);
1443 if (ret < 0 && pdata && pdata->bitrate)
1444 i2c_imx->bitrate = pdata->bitrate;
1445 i2c_imx->clk_change_nb.notifier_call = i2c_imx_clk_notifier_call;
1446 clk_notifier_register(i2c_imx->clk, &i2c_imx->clk_change_nb);
1447 i2c_imx_set_clk(i2c_imx, clk_get_rate(i2c_imx->clk));
1448
1449 i2c_imx_reset_regs(i2c_imx);
1450
1451 /* Init optional bus recovery function */
1452 ret = i2c_imx_init_recovery_info(i2c_imx, pdev);
1453 /* Give it another chance if pinctrl used is not ready yet */
1454 if (ret == -EPROBE_DEFER)
1455 goto clk_notifier_unregister;
1456
1457 /* Add I2C adapter */
1458 ret = i2c_add_numbered_adapter(&i2c_imx->adapter);
1459 if (ret < 0)
1460 goto clk_notifier_unregister;
1461
1462 pm_runtime_mark_last_busy(&pdev->dev);
1463 pm_runtime_put_autosuspend(&pdev->dev);
1464
1465 dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
1466 dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
1467 dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
1468 i2c_imx->adapter.name);
1469 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
1470
1471 /* Init DMA config if supported */
1472 i2c_imx_dma_request(i2c_imx, phy_addr);
1473
1474 return 0; /* Return OK */
1475
1476 clk_notifier_unregister:
1477 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
1478 free_irq(irq, i2c_imx);
1479 rpm_disable:
1480 pm_runtime_put_noidle(&pdev->dev);
1481 pm_runtime_disable(&pdev->dev);
1482 pm_runtime_set_suspended(&pdev->dev);
1483 pm_runtime_dont_use_autosuspend(&pdev->dev);
1484 clk_disable_unprepare(i2c_imx->clk);
1485 return ret;
1486 }
1487
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41819 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()
2021-03-24 20:17 ` [PATCH] spi: davinci: " Uwe Kleine-König
@ 2021-03-30 4:09 ` kernel test robot
2021-03-30 4:09 ` kernel test robot
1 sibling, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-30 4:09 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd, Mark Brown
Cc: kbuild-all, linux-spi, linux-clk, kernel
[-- Attachment #1: Type: text/plain, Size: 7634 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on spi/for-next]
[also build test ERROR on v5.12-rc5 next-20210329]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/spi-davinci-Simplify-using-devm_clk_get_prepared/20210325-041955
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/d4207ccf698f3daec6f45ba37439f303cd20196c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/spi-davinci-Simplify-using-devm_clk_get_prepared/20210325-041955
git checkout d4207ccf698f3daec6f45ba37439f303cd20196c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/spi/spi-davinci.c: In function 'davinci_spi_probe':
>> drivers/spi/spi-davinci.c:939:14: error: implicit declaration of function 'devm_clk_get_prepared' [-Werror=implicit-function-declaration]
939 | dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-davinci.c:939:12: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
939 | dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +/devm_clk_get_prepared +939 drivers/spi/spi-davinci.c
856
857 /**
858 * davinci_spi_probe - probe function for SPI Master Controller
859 * @pdev: platform_device structure which contains plateform specific data
860 *
861 * According to Linux Device Model this function will be invoked by Linux
862 * with platform_device struct which contains the device specific info.
863 * This function will map the SPI controller's memory, register IRQ,
864 * Reset SPI controller and setting its registers to default value.
865 * It will invoke spi_bitbang_start to create work queue so that client driver
866 * can register transfer method to work queue.
867 */
868 static int davinci_spi_probe(struct platform_device *pdev)
869 {
870 struct spi_master *master;
871 struct davinci_spi *dspi;
872 struct davinci_spi_platform_data *pdata;
873 struct resource *r;
874 int ret = 0;
875 u32 spipc0;
876
877 master = spi_alloc_master(&pdev->dev, sizeof(struct davinci_spi));
878 if (master == NULL) {
879 ret = -ENOMEM;
880 goto err;
881 }
882
883 platform_set_drvdata(pdev, master);
884
885 dspi = spi_master_get_devdata(master);
886
887 if (dev_get_platdata(&pdev->dev)) {
888 pdata = dev_get_platdata(&pdev->dev);
889 dspi->pdata = *pdata;
890 } else {
891 /* update dspi pdata with that from the DT */
892 ret = spi_davinci_get_pdata(pdev, dspi);
893 if (ret < 0)
894 goto free_master;
895 }
896
897 /* pdata in dspi is now updated and point pdata to that */
898 pdata = &dspi->pdata;
899
900 dspi->bytes_per_word = devm_kcalloc(&pdev->dev,
901 pdata->num_chipselect,
902 sizeof(*dspi->bytes_per_word),
903 GFP_KERNEL);
904 if (dspi->bytes_per_word == NULL) {
905 ret = -ENOMEM;
906 goto free_master;
907 }
908
909 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
910 if (r == NULL) {
911 ret = -ENOENT;
912 goto free_master;
913 }
914
915 dspi->pbase = r->start;
916
917 dspi->base = devm_ioremap_resource(&pdev->dev, r);
918 if (IS_ERR(dspi->base)) {
919 ret = PTR_ERR(dspi->base);
920 goto free_master;
921 }
922
923 init_completion(&dspi->done);
924
925 ret = platform_get_irq(pdev, 0);
926 if (ret == 0)
927 ret = -EINVAL;
928 if (ret < 0)
929 goto free_master;
930 dspi->irq = ret;
931
932 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq,
933 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);
934 if (ret)
935 goto free_master;
936
937 dspi->bitbang.master = master;
938
> 939 dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
940 if (IS_ERR(dspi->clk)) {
941 ret = -ENODEV;
942 goto free_master;
943 }
944
945 master->use_gpio_descriptors = true;
946 master->dev.of_node = pdev->dev.of_node;
947 master->bus_num = pdev->id;
948 master->num_chipselect = pdata->num_chipselect;
949 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
950 master->flags = SPI_MASTER_MUST_RX;
951 master->setup = davinci_spi_setup;
952 master->cleanup = davinci_spi_cleanup;
953 master->can_dma = davinci_spi_can_dma;
954
955 dspi->bitbang.chipselect = davinci_spi_chipselect;
956 dspi->bitbang.setup_transfer = davinci_spi_setup_transfer;
957 dspi->prescaler_limit = pdata->prescaler_limit;
958 dspi->version = pdata->version;
959
960 dspi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_WORD;
961 if (dspi->version == SPI_VERSION_2)
962 dspi->bitbang.flags |= SPI_READY;
963
964 dspi->bitbang.txrx_bufs = davinci_spi_bufs;
965
966 ret = davinci_spi_request_dma(dspi);
967 if (ret == -EPROBE_DEFER) {
968 goto free_master;
969 } else if (ret) {
970 dev_info(&pdev->dev, "DMA is not supported (%d)\n", ret);
971 dspi->dma_rx = NULL;
972 dspi->dma_tx = NULL;
973 }
974
975 dspi->get_rx = davinci_spi_rx_buf_u8;
976 dspi->get_tx = davinci_spi_tx_buf_u8;
977
978 /* Reset In/OUT SPI module */
979 iowrite32(0, dspi->base + SPIGCR0);
980 udelay(100);
981 iowrite32(1, dspi->base + SPIGCR0);
982
983 /* Set up SPIPC0. CS and ENA init is done in davinci_spi_setup */
984 spipc0 = SPIPC0_DIFUN_MASK | SPIPC0_DOFUN_MASK | SPIPC0_CLKFUN_MASK;
985 iowrite32(spipc0, dspi->base + SPIPC0);
986
987 if (pdata->intr_line)
988 iowrite32(SPI_INTLVL_1, dspi->base + SPILVL);
989 else
990 iowrite32(SPI_INTLVL_0, dspi->base + SPILVL);
991
992 iowrite32(CS_DEFAULT, dspi->base + SPIDEF);
993
994 /* master mode default */
995 set_io_bits(dspi->base + SPIGCR1, SPIGCR1_CLKMOD_MASK);
996 set_io_bits(dspi->base + SPIGCR1, SPIGCR1_MASTER_MASK);
997 set_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
998
999 ret = spi_bitbang_start(&dspi->bitbang);
1000 if (ret)
1001 goto free_dma;
1002
1003 dev_info(&pdev->dev, "Controller at 0x%p\n", dspi->base);
1004
1005 return ret;
1006
1007 free_dma:
1008 if (dspi->dma_rx) {
1009 dma_release_channel(dspi->dma_rx);
1010 dma_release_channel(dspi->dma_tx);
1011 }
1012 free_master:
1013 spi_master_put(master);
1014 err:
1015 return ret;
1016 }
1017
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54314 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()
@ 2021-03-30 4:09 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-30 4:09 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7843 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on spi/for-next]
[also build test ERROR on v5.12-rc5 next-20210329]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/spi-davinci-Simplify-using-devm_clk_get_prepared/20210325-041955
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/d4207ccf698f3daec6f45ba37439f303cd20196c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/spi-davinci-Simplify-using-devm_clk_get_prepared/20210325-041955
git checkout d4207ccf698f3daec6f45ba37439f303cd20196c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/spi/spi-davinci.c: In function 'davinci_spi_probe':
>> drivers/spi/spi-davinci.c:939:14: error: implicit declaration of function 'devm_clk_get_prepared' [-Werror=implicit-function-declaration]
939 | dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-davinci.c:939:12: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
939 | dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +/devm_clk_get_prepared +939 drivers/spi/spi-davinci.c
856
857 /**
858 * davinci_spi_probe - probe function for SPI Master Controller
859 * @pdev: platform_device structure which contains plateform specific data
860 *
861 * According to Linux Device Model this function will be invoked by Linux
862 * with platform_device struct which contains the device specific info.
863 * This function will map the SPI controller's memory, register IRQ,
864 * Reset SPI controller and setting its registers to default value.
865 * It will invoke spi_bitbang_start to create work queue so that client driver
866 * can register transfer method to work queue.
867 */
868 static int davinci_spi_probe(struct platform_device *pdev)
869 {
870 struct spi_master *master;
871 struct davinci_spi *dspi;
872 struct davinci_spi_platform_data *pdata;
873 struct resource *r;
874 int ret = 0;
875 u32 spipc0;
876
877 master = spi_alloc_master(&pdev->dev, sizeof(struct davinci_spi));
878 if (master == NULL) {
879 ret = -ENOMEM;
880 goto err;
881 }
882
883 platform_set_drvdata(pdev, master);
884
885 dspi = spi_master_get_devdata(master);
886
887 if (dev_get_platdata(&pdev->dev)) {
888 pdata = dev_get_platdata(&pdev->dev);
889 dspi->pdata = *pdata;
890 } else {
891 /* update dspi pdata with that from the DT */
892 ret = spi_davinci_get_pdata(pdev, dspi);
893 if (ret < 0)
894 goto free_master;
895 }
896
897 /* pdata in dspi is now updated and point pdata to that */
898 pdata = &dspi->pdata;
899
900 dspi->bytes_per_word = devm_kcalloc(&pdev->dev,
901 pdata->num_chipselect,
902 sizeof(*dspi->bytes_per_word),
903 GFP_KERNEL);
904 if (dspi->bytes_per_word == NULL) {
905 ret = -ENOMEM;
906 goto free_master;
907 }
908
909 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
910 if (r == NULL) {
911 ret = -ENOENT;
912 goto free_master;
913 }
914
915 dspi->pbase = r->start;
916
917 dspi->base = devm_ioremap_resource(&pdev->dev, r);
918 if (IS_ERR(dspi->base)) {
919 ret = PTR_ERR(dspi->base);
920 goto free_master;
921 }
922
923 init_completion(&dspi->done);
924
925 ret = platform_get_irq(pdev, 0);
926 if (ret == 0)
927 ret = -EINVAL;
928 if (ret < 0)
929 goto free_master;
930 dspi->irq = ret;
931
932 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq,
933 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);
934 if (ret)
935 goto free_master;
936
937 dspi->bitbang.master = master;
938
> 939 dspi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
940 if (IS_ERR(dspi->clk)) {
941 ret = -ENODEV;
942 goto free_master;
943 }
944
945 master->use_gpio_descriptors = true;
946 master->dev.of_node = pdev->dev.of_node;
947 master->bus_num = pdev->id;
948 master->num_chipselect = pdata->num_chipselect;
949 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
950 master->flags = SPI_MASTER_MUST_RX;
951 master->setup = davinci_spi_setup;
952 master->cleanup = davinci_spi_cleanup;
953 master->can_dma = davinci_spi_can_dma;
954
955 dspi->bitbang.chipselect = davinci_spi_chipselect;
956 dspi->bitbang.setup_transfer = davinci_spi_setup_transfer;
957 dspi->prescaler_limit = pdata->prescaler_limit;
958 dspi->version = pdata->version;
959
960 dspi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_WORD;
961 if (dspi->version == SPI_VERSION_2)
962 dspi->bitbang.flags |= SPI_READY;
963
964 dspi->bitbang.txrx_bufs = davinci_spi_bufs;
965
966 ret = davinci_spi_request_dma(dspi);
967 if (ret == -EPROBE_DEFER) {
968 goto free_master;
969 } else if (ret) {
970 dev_info(&pdev->dev, "DMA is not supported (%d)\n", ret);
971 dspi->dma_rx = NULL;
972 dspi->dma_tx = NULL;
973 }
974
975 dspi->get_rx = davinci_spi_rx_buf_u8;
976 dspi->get_tx = davinci_spi_tx_buf_u8;
977
978 /* Reset In/OUT SPI module */
979 iowrite32(0, dspi->base + SPIGCR0);
980 udelay(100);
981 iowrite32(1, dspi->base + SPIGCR0);
982
983 /* Set up SPIPC0. CS and ENA init is done in davinci_spi_setup */
984 spipc0 = SPIPC0_DIFUN_MASK | SPIPC0_DOFUN_MASK | SPIPC0_CLKFUN_MASK;
985 iowrite32(spipc0, dspi->base + SPIPC0);
986
987 if (pdata->intr_line)
988 iowrite32(SPI_INTLVL_1, dspi->base + SPILVL);
989 else
990 iowrite32(SPI_INTLVL_0, dspi->base + SPILVL);
991
992 iowrite32(CS_DEFAULT, dspi->base + SPIDEF);
993
994 /* master mode default */
995 set_io_bits(dspi->base + SPIGCR1, SPIGCR1_CLKMOD_MASK);
996 set_io_bits(dspi->base + SPIGCR1, SPIGCR1_MASTER_MASK);
997 set_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
998
999 ret = spi_bitbang_start(&dspi->bitbang);
1000 if (ret)
1001 goto free_dma;
1002
1003 dev_info(&pdev->dev, "Controller at 0x%p\n", dspi->base);
1004
1005 return ret;
1006
1007 free_dma:
1008 if (dspi->dma_rx) {
1009 dma_release_channel(dspi->dma_rx);
1010 dma_release_channel(dspi->dma_tx);
1011 }
1012 free_master:
1013 spi_master_put(master);
1014 err:
1015 return ret;
1016 }
1017
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 54314 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] spi: davinci: Simplify using devm_clk_get_prepared()
2021-03-24 20:22 ` Uwe Kleine-König
@ 2021-03-30 17:04 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2021-03-30 17:04 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Michael Turquette, Stephen Boyd, linux-clk, kernel, linux-spi
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
On Wed, Mar 24, 2021 at 09:22:58PM +0100, Uwe Kleine-König wrote:
> oops, I got that wrong, this must be devm_clk_get_enabled, not
> devm_clk_get_prepared. So if the clk patches go in, please let me resend
> a fixed patch (or adapt yourself, whatever you prefer).
I'll look out for your resubmission.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
@ 2021-03-31 3:37 ` kernel test robot
2021-03-26 13:42 ` kernel test robot
2021-03-31 3:37 ` kernel test robot
2 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-31 3:37 UTC (permalink / raw)
To: Uwe Kleine-König, Michael Turquette, Stephen Boyd,
Oleksij Rempel, Shawn Guo, Sascha Hauer, Fabio Estevam,
NXP Linux Team
Cc: kbuild-all, linux-i2c, Pengutronix Kernel Team, linux-clk
[-- Attachment #1: Type: text/plain, Size: 6886 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on clk/clk-next shawnguo/for-next v5.12-rc5 next-20210330]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2241b5e30667c72568ec9dc31ab14475bb04a408
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
git checkout 2241b5e30667c72568ec9dc31ab14475bb04a408
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/i2c/busses/i2c-imx.c: In function 'i2c_imx_probe':
>> drivers/i2c/busses/i2c-imx.c:1408:17: error: implicit declaration of function 'devm_clk_get_prepared' [-Werror=implicit-function-declaration]
1408 | i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-imx.c:1408:15: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1408 | i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +/devm_clk_get_prepared +1408 drivers/i2c/busses/i2c-imx.c
1363
1364 static int i2c_imx_probe(struct platform_device *pdev)
1365 {
1366 struct imx_i2c_struct *i2c_imx;
1367 struct resource *res;
1368 struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
1369 void __iomem *base;
1370 int irq, ret;
1371 dma_addr_t phy_addr;
1372 const struct imx_i2c_hwdata *match;
1373
1374 dev_dbg(&pdev->dev, "<%s>\n", __func__);
1375
1376 irq = platform_get_irq(pdev, 0);
1377 if (irq < 0)
1378 return irq;
1379
1380 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1381 base = devm_ioremap_resource(&pdev->dev, res);
1382 if (IS_ERR(base))
1383 return PTR_ERR(base);
1384
1385 phy_addr = (dma_addr_t)res->start;
1386 i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL);
1387 if (!i2c_imx)
1388 return -ENOMEM;
1389
1390 match = device_get_match_data(&pdev->dev);
1391 if (match)
1392 i2c_imx->hwdata = match;
1393 else
1394 i2c_imx->hwdata = (struct imx_i2c_hwdata *)
1395 platform_get_device_id(pdev)->driver_data;
1396
1397 /* Setup i2c_imx driver structure */
1398 strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name));
1399 i2c_imx->adapter.owner = THIS_MODULE;
1400 i2c_imx->adapter.algo = &i2c_imx_algo;
1401 i2c_imx->adapter.dev.parent = &pdev->dev;
1402 i2c_imx->adapter.nr = pdev->id;
1403 i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
1404 i2c_imx->base = base;
1405 ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
1406
1407 /* Get I2C clock */
> 1408 i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
1409 if (IS_ERR(i2c_imx->clk))
1410 return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
1411 "can't get prepared I2C clock\n");
1412
1413 /* Init queue */
1414 init_waitqueue_head(&i2c_imx->queue);
1415
1416 /* Set up adapter data */
1417 i2c_set_adapdata(&i2c_imx->adapter, i2c_imx);
1418
1419 /* Set up platform driver data */
1420 platform_set_drvdata(pdev, i2c_imx);
1421
1422 pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
1423 pm_runtime_use_autosuspend(&pdev->dev);
1424 pm_runtime_set_active(&pdev->dev);
1425 pm_runtime_enable(&pdev->dev);
1426
1427 ret = pm_runtime_get_sync(&pdev->dev);
1428 if (ret < 0)
1429 goto rpm_disable;
1430
1431 /* Request IRQ */
1432 ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
1433 pdev->name, i2c_imx);
1434 if (ret) {
1435 dev_err(&pdev->dev, "can't claim irq %d\n", irq);
1436 goto rpm_disable;
1437 }
1438
1439 /* Set up clock divider */
1440 i2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
1441 ret = of_property_read_u32(pdev->dev.of_node,
1442 "clock-frequency", &i2c_imx->bitrate);
1443 if (ret < 0 && pdata && pdata->bitrate)
1444 i2c_imx->bitrate = pdata->bitrate;
1445 i2c_imx->clk_change_nb.notifier_call = i2c_imx_clk_notifier_call;
1446 clk_notifier_register(i2c_imx->clk, &i2c_imx->clk_change_nb);
1447 i2c_imx_set_clk(i2c_imx, clk_get_rate(i2c_imx->clk));
1448
1449 i2c_imx_reset_regs(i2c_imx);
1450
1451 /* Init optional bus recovery function */
1452 ret = i2c_imx_init_recovery_info(i2c_imx, pdev);
1453 /* Give it another chance if pinctrl used is not ready yet */
1454 if (ret == -EPROBE_DEFER)
1455 goto clk_notifier_unregister;
1456
1457 /* Add I2C adapter */
1458 ret = i2c_add_numbered_adapter(&i2c_imx->adapter);
1459 if (ret < 0)
1460 goto clk_notifier_unregister;
1461
1462 pm_runtime_mark_last_busy(&pdev->dev);
1463 pm_runtime_put_autosuspend(&pdev->dev);
1464
1465 dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
1466 dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
1467 dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
1468 i2c_imx->adapter.name);
1469 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
1470
1471 /* Init DMA config if supported */
1472 i2c_imx_dma_request(i2c_imx, phy_addr);
1473
1474 return 0; /* Return OK */
1475
1476 clk_notifier_unregister:
1477 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
1478 free_irq(irq, i2c_imx);
1479 rpm_disable:
1480 pm_runtime_put_noidle(&pdev->dev);
1481 pm_runtime_disable(&pdev->dev);
1482 pm_runtime_set_suspended(&pdev->dev);
1483 pm_runtime_dont_use_autosuspend(&pdev->dev);
1484 clk_disable_unprepare(i2c_imx->clk);
1485 return ret;
1486 }
1487
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54357 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] i2c: imx: Simplify using devm_clk_get_prepared()
@ 2021-03-31 3:37 ` kernel test robot
0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-03-31 3:37 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7058 bytes --]
Hi "Uwe,
I love your patch! Yet something to improve:
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on clk/clk-next shawnguo/for-next v5.12-rc5 next-20210330]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: arm-multi_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2241b5e30667c72568ec9dc31ab14475bb04a408
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Uwe-Kleine-K-nig/i2c-imx-Simplify-using-devm_clk_get_prepared/20210325-041454
git checkout 2241b5e30667c72568ec9dc31ab14475bb04a408
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/i2c/busses/i2c-imx.c: In function 'i2c_imx_probe':
>> drivers/i2c/busses/i2c-imx.c:1408:17: error: implicit declaration of function 'devm_clk_get_prepared' [-Werror=implicit-function-declaration]
1408 | i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-imx.c:1408:15: warning: assignment to 'struct clk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1408 | i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
| ^
cc1: some warnings being treated as errors
vim +/devm_clk_get_prepared +1408 drivers/i2c/busses/i2c-imx.c
1363
1364 static int i2c_imx_probe(struct platform_device *pdev)
1365 {
1366 struct imx_i2c_struct *i2c_imx;
1367 struct resource *res;
1368 struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
1369 void __iomem *base;
1370 int irq, ret;
1371 dma_addr_t phy_addr;
1372 const struct imx_i2c_hwdata *match;
1373
1374 dev_dbg(&pdev->dev, "<%s>\n", __func__);
1375
1376 irq = platform_get_irq(pdev, 0);
1377 if (irq < 0)
1378 return irq;
1379
1380 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1381 base = devm_ioremap_resource(&pdev->dev, res);
1382 if (IS_ERR(base))
1383 return PTR_ERR(base);
1384
1385 phy_addr = (dma_addr_t)res->start;
1386 i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL);
1387 if (!i2c_imx)
1388 return -ENOMEM;
1389
1390 match = device_get_match_data(&pdev->dev);
1391 if (match)
1392 i2c_imx->hwdata = match;
1393 else
1394 i2c_imx->hwdata = (struct imx_i2c_hwdata *)
1395 platform_get_device_id(pdev)->driver_data;
1396
1397 /* Setup i2c_imx driver structure */
1398 strlcpy(i2c_imx->adapter.name, pdev->name, sizeof(i2c_imx->adapter.name));
1399 i2c_imx->adapter.owner = THIS_MODULE;
1400 i2c_imx->adapter.algo = &i2c_imx_algo;
1401 i2c_imx->adapter.dev.parent = &pdev->dev;
1402 i2c_imx->adapter.nr = pdev->id;
1403 i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
1404 i2c_imx->base = base;
1405 ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
1406
1407 /* Get I2C clock */
> 1408 i2c_imx->clk = devm_clk_get_prepared(&pdev->dev, NULL);
1409 if (IS_ERR(i2c_imx->clk))
1410 return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
1411 "can't get prepared I2C clock\n");
1412
1413 /* Init queue */
1414 init_waitqueue_head(&i2c_imx->queue);
1415
1416 /* Set up adapter data */
1417 i2c_set_adapdata(&i2c_imx->adapter, i2c_imx);
1418
1419 /* Set up platform driver data */
1420 platform_set_drvdata(pdev, i2c_imx);
1421
1422 pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT);
1423 pm_runtime_use_autosuspend(&pdev->dev);
1424 pm_runtime_set_active(&pdev->dev);
1425 pm_runtime_enable(&pdev->dev);
1426
1427 ret = pm_runtime_get_sync(&pdev->dev);
1428 if (ret < 0)
1429 goto rpm_disable;
1430
1431 /* Request IRQ */
1432 ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
1433 pdev->name, i2c_imx);
1434 if (ret) {
1435 dev_err(&pdev->dev, "can't claim irq %d\n", irq);
1436 goto rpm_disable;
1437 }
1438
1439 /* Set up clock divider */
1440 i2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
1441 ret = of_property_read_u32(pdev->dev.of_node,
1442 "clock-frequency", &i2c_imx->bitrate);
1443 if (ret < 0 && pdata && pdata->bitrate)
1444 i2c_imx->bitrate = pdata->bitrate;
1445 i2c_imx->clk_change_nb.notifier_call = i2c_imx_clk_notifier_call;
1446 clk_notifier_register(i2c_imx->clk, &i2c_imx->clk_change_nb);
1447 i2c_imx_set_clk(i2c_imx, clk_get_rate(i2c_imx->clk));
1448
1449 i2c_imx_reset_regs(i2c_imx);
1450
1451 /* Init optional bus recovery function */
1452 ret = i2c_imx_init_recovery_info(i2c_imx, pdev);
1453 /* Give it another chance if pinctrl used is not ready yet */
1454 if (ret == -EPROBE_DEFER)
1455 goto clk_notifier_unregister;
1456
1457 /* Add I2C adapter */
1458 ret = i2c_add_numbered_adapter(&i2c_imx->adapter);
1459 if (ret < 0)
1460 goto clk_notifier_unregister;
1461
1462 pm_runtime_mark_last_busy(&pdev->dev);
1463 pm_runtime_put_autosuspend(&pdev->dev);
1464
1465 dev_dbg(&i2c_imx->adapter.dev, "claimed irq %d\n", irq);
1466 dev_dbg(&i2c_imx->adapter.dev, "device resources: %pR\n", res);
1467 dev_dbg(&i2c_imx->adapter.dev, "adapter name: \"%s\"\n",
1468 i2c_imx->adapter.name);
1469 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
1470
1471 /* Init DMA config if supported */
1472 i2c_imx_dma_request(i2c_imx, phy_addr);
1473
1474 return 0; /* Return OK */
1475
1476 clk_notifier_unregister:
1477 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
1478 free_irq(irq, i2c_imx);
1479 rpm_disable:
1480 pm_runtime_put_noidle(&pdev->dev);
1481 pm_runtime_disable(&pdev->dev);
1482 pm_runtime_set_suspended(&pdev->dev);
1483 pm_runtime_dont_use_autosuspend(&pdev->dev);
1484 clk_disable_unprepare(i2c_imx->clk);
1485 return ret;
1486 }
1487
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 54357 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2021-03-31 3:38 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 13:50 [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 1/3] clk: generalize devm_clk_get() a bit Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 2/3] clk: Provide new devm_clk_helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-01 13:50 ` [PATCH v3 3/3] pwm: atmel: Simplify using devm_clk_get_prepared() Uwe Kleine-König
2021-03-22 14:22 ` [PATCH v3 0/3] clk: provide new devm helpers for prepared and enabled clocks Uwe Kleine-König
2021-03-24 20:12 ` [PATCH] i2c: imx: Simplify using devm_clk_get_prepared() Uwe Kleine-König
2021-03-24 20:22 ` Uwe Kleine-König
2021-03-25 4:49 ` Oleksij Rempel
2021-03-26 13:42 ` kernel test robot
2021-03-26 13:42 ` kernel test robot
2021-03-31 3:37 ` kernel test robot
2021-03-31 3:37 ` kernel test robot
2021-03-24 20:17 ` [PATCH] spi: davinci: " Uwe Kleine-König
2021-03-24 20:22 ` Uwe Kleine-König
2021-03-30 17:04 ` Mark Brown
2021-03-30 4:09 ` kernel test robot
2021-03-30 4:09 ` kernel test robot
2021-03-24 20:27 ` [PATCH] rtc: at91sma9: Simplify using devm_clk_get_enabled() Uwe Kleine-König
2021-03-24 20:27 ` Uwe Kleine-König
2021-03-25 1:11 ` kernel test robot
2021-03-25 1:11 ` kernel test robot
2021-03-25 1:11 ` kernel test robot
2021-03-25 15:15 ` kernel test robot
2021-03-25 15:15 ` kernel test robot
2021-03-25 15:15 ` kernel test robot
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.