2013-04-28 10:24:55

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH] clk: si5351: Allow to build without CONFIG_OF

In clk-si5351 there was some dependency to CONFIG_OF that permitted the
use of the driver on !CONFIG_OF platforms. This patch adds proper #ifdef
around of_clk_add_provider and removes the dependency on CONFIG_OF.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
Note:
This patch is based upon v3.9-rc8 with clk-si5351 v8 plus two fixes by
Marek Belisko applied. It has been compile-tested on x86_64 allmodconfig.

Cc: Stephen Rothwell <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Rob Landley <[email protected]>
Cc: Mike Turquette <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Dom Cobley <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Pawel Moll <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Russell King - ARM Linux <[email protected]>
Cc: Rabeeh Khoury <[email protected]>
Cc: Daniel Mack <[email protected]>
Cc: Jean-Francois Moine <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Michal Bachraty <[email protected]>
Cc: Marek Belisko <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
drivers/clk/Kconfig | 1 -
drivers/clk/clk-si5351.c | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 6412f55..5039e41 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -58,7 +58,6 @@ config COMMON_CLK_MAX77686
config COMMON_CLK_SI5351
tristate "Clock driver for SiLabs 5351A/B/C"
depends on I2C
- depends on OF
select REGMAP_I2C
select RATIONAL
---help---
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 8323c31..91c0f01 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1489,12 +1489,14 @@ static int si5351_i2c_probe(struct i2c_client *client,
}
}

+#ifdef CONFIG_OF
ret = of_clk_add_provider(client->dev.of_node, of_clk_src_onecell_get,
&drvdata->onecell);
if (ret) {
dev_err(&client->dev, "unable to add clk provider\n");
return ret;
}
+#endif

return 0;
}
--
1.7.10.4


2013-04-28 18:03:41

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] clk: si5351: Allow to build without CONFIG_OF

On Sunday 28 April 2013, Sebastian Hesselbarth wrote:
> diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
> index 8323c31..91c0f01 100644
> --- a/drivers/clk/clk-si5351.c
> +++ b/drivers/clk/clk-si5351.c
> @@ -1489,12 +1489,14 @@ static int si5351_i2c_probe(struct i2c_client *client,
> }
> }
>
> +#ifdef CONFIG_OF
> ret = of_clk_add_provider(client->dev.of_node, of_clk_src_onecell_get,
> &drvdata->onecell);
> if (ret) {
> dev_err(&client->dev, "unable to add clk provider\n");
> return ret;
> }
> +#endif
>

I think we should instead make of_clk_add_provider return 0 if CONFIG_OF
is disabled, adn we don't consider it an error condition to call it.
That is also what we return when CONFIG_OF is enabled and we boot without
a device tree.

Arnd