2020-07-14 09:12:21

by Qing Zhang

[permalink] [raw]
Subject: [PATCH] spi: Use clk_prepare_enable and clk_disable_unprepare

Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
calls as required by common clock framework.

Signed-off-by: Qing Zhang <[email protected]>
---
drivers/spi/spi-coldfire-qspi.c | 4 ++--
drivers/spi/spi-omap-uwire.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index f80e06c..8996115 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -387,7 +387,7 @@ static int mcfqspi_probe(struct platform_device *pdev)
status = PTR_ERR(mcfqspi->clk);
goto fail0;
}
- clk_enable(mcfqspi->clk);
+ clk_prepare_enable(mcfqspi->clk);

master->bus_num = pdata->bus_num;
master->num_chipselect = pdata->num_chipselect;
@@ -425,7 +425,7 @@ static int mcfqspi_probe(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
mcfqspi_cs_teardown(mcfqspi);
fail1:
- clk_disable(mcfqspi->clk);
+ clk_disable_unprepare(mcfqspi->clk);
fail0:
spi_master_put(master);

diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c
index ce8dbdb..71402f7 100644
--- a/drivers/spi/spi-omap-uwire.c
+++ b/drivers/spi/spi-omap-uwire.c
@@ -443,7 +443,7 @@ static void uwire_cleanup(struct spi_device *spi)
static void uwire_off(struct uwire_spi *uwire)
{
uwire_write_reg(UWIRE_SR3, 0);
- clk_disable(uwire->ck);
+ clk_disable_unprepare(uwire->ck);
spi_master_put(uwire->bitbang.master);
}

@@ -475,7 +475,7 @@ static int uwire_probe(struct platform_device *pdev)
spi_master_put(master);
return status;
}
- clk_enable(uwire->ck);
+ clk_prepare_enable(uwire->ck);

if (cpu_is_omap7xx())
uwire_idx_shift = 1;
--
2.1.0


2020-07-14 09:44:59

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] spi: Use clk_prepare_enable and clk_disable_unprepare

On Tue, Jul 14, 2020 at 05:09:14PM +0800, Qing Zhang wrote:
> Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
> calls as required by common clock framework.
>
> Signed-off-by: Qing Zhang <[email protected]>
> ---
> drivers/spi/spi-coldfire-qspi.c | 4 ++--

Are you sure that ColdFire uses the common clock framework?

> drivers/spi/spi-omap-uwire.c | 4 ++--

It makes life easier if you send per-driver patches, that makes it
easier for driver maintainers to review things and means that issues
with a change in one driver won't hold up another.


Attachments:
(No filename) (598.00 B)
signature.asc (499.00 B)
Download all attachments

2020-07-14 12:18:06

by Qing Zhang

[permalink] [raw]
Subject: Re: Re: [PATCH] spi: Use clk_prepare_enable and clk_disable_unprepare




&gt; -----Original Messages-----
&gt; From: "Mark Brown" <[email protected]>
&gt; Sent Time: 2020-07-14 17:44:06 (Tuesday)
&gt; To: "Qing Zhang" <[email protected]>
&gt; Cc: [email protected], [email protected], "Xuefeng Li" <[email protected]>, "Tiezhu Yang" <[email protected]>
&gt; Subject: Re: [PATCH] spi: Use clk_prepare_enable and clk_disable_unprepare
&gt;
&gt; On Tue, Jul 14, 2020 at 05:09:14PM +0800, Qing Zhang wrote:
&gt; &gt; Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
&gt; &gt; calls as required by common clock framework.
&gt; &gt;
&gt; &gt; Signed-off-by: Qing Zhang <[email protected]>
&gt; &gt; ---
&gt; &gt; drivers/spi/spi-coldfire-qspi.c | 4 ++--
&gt;
&gt; Are you sure that ColdFire uses the common clock framework?
&gt;
&gt; &gt; drivers/spi/spi-omap-uwire.c | 4 ++--
&gt;
&gt; It makes life easier if you send per-driver patches, that makes it
&gt; easier for driver maintainers to review things and means that issues
&gt; with a change in one driver won't hold up another.


Hi Mark,


Thank you for your suggestion.

I will split this patch into two patches and then send v2.
</[email protected]></[email protected]></[email protected]></[email protected]></[email protected]>

2020-07-16 09:15:05

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] spi: Use clk_prepare_enable and clk_disable_unprepare

On Tue, Jul 14, 2020 at 11:45 AM Mark Brown <[email protected]> wrote:
> On Tue, Jul 14, 2020 at 05:09:14PM +0800, Qing Zhang wrote:
> > Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
> > calls as required by common clock framework.
> >
> > Signed-off-by: Qing Zhang <[email protected]>
> > ---
> > drivers/spi/spi-coldfire-qspi.c | 4 ++--
>
> Are you sure that ColdFire uses the common clock framework?

Should be fine, as per include/linux/clk.h:

#ifdef CONFIG_HAVE_CLK_PREPARE
int clk_prepare(struct clk *clk);
int __must_check clk_bulk_prepare(int num_clks,
const struct clk_bulk_data *clks);
#else
static inline int clk_prepare(struct clk *clk)
{
might_sleep();
return 0;
}

static inline int __must_check
clk_bulk_prepare(int num_clks, const struct clk_bulk_data *clks)
{
might_sleep();
return 0;
}
#endif

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds