linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
@ 2015-02-27  3:50 Axel Lin
  2015-02-27 13:27 ` Sylwester Nawrocki
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2015-02-27  3:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Sylwester Nawrocki, Kyungmin Park, linux-samsung-soc, linux-kernel

The state->regmap is initialized by devm_regmap_init_mmio().
So it's fine to use spin_lock rather than mutex to protct state->regmap rmw
operations.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi Sylwester,
I don't have this hardware handy, so can you test if this patch works.
This patch is on top of my previous patch (phy: exynos-mipi-video: Fixup the test for state->regmap)
Thanks,
Axel
 drivers/phy/phy-exynos-mipi-video.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c
index d196493..8d6d117 100644
--- a/drivers/phy/phy-exynos-mipi-video.c
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -43,7 +43,6 @@ struct exynos_mipi_video_phy {
 	} phys[EXYNOS_MIPI_PHYS_NUM];
 	spinlock_t slock;
 	void __iomem *regs;
-	struct mutex mutex;
 	struct regmap *regmap;
 };
 
@@ -59,8 +58,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 	else
 		reset = EXYNOS4_MIPI_PHY_SRESETN;
 
+	spin_lock(&state->slock);
+
 	if (!IS_ERR(state->regmap)) {
-		mutex_lock(&state->mutex);
 		regmap_read(state->regmap, offset, &val);
 		if (on)
 			val |= reset;
@@ -72,7 +72,6 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 		else if (!(val & EXYNOS4_MIPI_PHY_RESET_MASK))
 			val &= ~EXYNOS4_MIPI_PHY_ENABLE;
 		regmap_write(state->regmap, offset, val);
-		mutex_unlock(&state->mutex);
 	} else {
 		addr = state->regs + EXYNOS_MIPI_PHY_CONTROL(id / 2);
 
@@ -90,9 +89,9 @@ static int __set_phy_state(struct exynos_mipi_video_phy *state,
 			val &= ~EXYNOS4_MIPI_PHY_ENABLE;
 
 		writel(val, addr);
-		spin_unlock(&state->slock);
 	}
 
+	spin_unlock(&state->slock);
 	return 0;
 }
 
@@ -158,7 +157,6 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, state);
 	spin_lock_init(&state->slock);
-	mutex_init(&state->mutex);
 
 	for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) {
 		struct phy *phy = devm_phy_create(dev, NULL,
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
  2015-02-27  3:50 [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations Axel Lin
@ 2015-02-27 13:27 ` Sylwester Nawrocki
  2015-03-04 12:24   ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 5+ messages in thread
From: Sylwester Nawrocki @ 2015-02-27 13:27 UTC (permalink / raw)
  To: Axel Lin
  Cc: Kishon Vijay Abraham I, Sylwester Nawrocki, Kyungmin Park,
	linux-samsung-soc, linux-kernel

On 27/02/15 04:50, Axel Lin wrote:
> he state->regmap is initialized by devm_regmap_init_mmio().
> So it's fine to use spin_lock rather than mutex to protct state->regmap rmw
> operations.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> Hi Sylwester,
> I don't have this hardware handy, so can you test if this patch works.
> This patch is on top of my previous patch (phy: exynos-mipi-video: Fixup 
> the test for state->regmap)

Thanks for the patch, it looks good to me. I somehow missed the syscon
already uses a spinlock for regmap protection.

v4.0-rc1 seems devastated as far as exynos4 is concerned, it may take
some time until I get around and fix all the issues so I tested your
patch on v3.19. It all works well as expected.

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

-- 
Thanks,
Sylwester

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
  2015-02-27 13:27 ` Sylwester Nawrocki
@ 2015-03-04 12:24   ` Kishon Vijay Abraham I
  2015-03-04 12:47     ` Sylwester Nawrocki
  0 siblings, 1 reply; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-04 12:24 UTC (permalink / raw)
  To: Sylwester Nawrocki, Axel Lin
  Cc: Sylwester Nawrocki, Kyungmin Park, linux-samsung-soc, linux-kernel

Hi,

On Friday 27 February 2015 06:57 PM, Sylwester Nawrocki wrote:
> On 27/02/15 04:50, Axel Lin wrote:
>> he state->regmap is initialized by devm_regmap_init_mmio().
>> So it's fine to use spin_lock rather than mutex to protct state->regmap rmw
>> operations.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> ---
>> Hi Sylwester,
>> I don't have this hardware handy, so can you test if this patch works.
>> This patch is on top of my previous patch (phy: exynos-mipi-video: Fixup
>> the test for state->regmap)
>
> Thanks for the patch, it looks good to me. I somehow missed the syscon
> already uses a spinlock for regmap protection.
>
> v4.0-rc1 seems devastated as far as exynos4 is concerned, it may take
> some time until I get around and fix all the issues so I tested your
> patch on v3.19. It all works well as expected.
>
> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

This patch doesn't apply on 4.0-rc1. Can to refresh it to mainline
latest?

Cheers
Kishon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
  2015-03-04 12:24   ` Kishon Vijay Abraham I
@ 2015-03-04 12:47     ` Sylwester Nawrocki
  2015-03-04 12:53       ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 5+ messages in thread
From: Sylwester Nawrocki @ 2015-03-04 12:47 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Axel Lin, Sylwester Nawrocki, Kyungmin Park, linux-samsung-soc,
	linux-kernel

Hi,

On 04/03/15 13:24, Kishon Vijay Abraham I wrote:
> This patch doesn't apply on 4.0-rc1. Can to refresh it to mainline
> latest?

It depends on Axel's previous patch: "phy: exynos-mipi-video: Fixup
the test for state->regmap". Are there any issues even with that patch
applied ?

-- 
Thanks
Sylwester

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations
  2015-03-04 12:47     ` Sylwester Nawrocki
@ 2015-03-04 12:53       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 5+ messages in thread
From: Kishon Vijay Abraham I @ 2015-03-04 12:53 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: Axel Lin, Sylwester Nawrocki, Kyungmin Park, linux-samsung-soc,
	linux-kernel



On Wednesday 04 March 2015 06:17 PM, Sylwester Nawrocki wrote:
> Hi,
>
> On 04/03/15 13:24, Kishon Vijay Abraham I wrote:
>> This patch doesn't apply on 4.0-rc1. Can to refresh it to mainline
>> latest?
>
> It depends on Axel's previous patch: "phy: exynos-mipi-video: Fixup
> the test for state->regmap". Are there any issues even with that patch
> applied ?

no. okay I'll apply in that order.

Cheers
kishon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-04 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27  3:50 [PATCH RFT] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations Axel Lin
2015-02-27 13:27 ` Sylwester Nawrocki
2015-03-04 12:24   ` Kishon Vijay Abraham I
2015-03-04 12:47     ` Sylwester Nawrocki
2015-03-04 12:53       ` Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).