drm/tegra: dc: Remove redundant spinlock
authorThierry Reding <treding@nvidia.com>
Thu, 14 Dec 2017 12:50:19 +0000 (13:50 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 21 Dec 2017 13:52:35 +0000 (14:52 +0100)
The spinlock is only used to serialize accesses to the DC_CMD_INT_MASK
register. However, this register is accesses either with interrupts
masked (in tegra_crtc_atomic_enable()) or protected by the vbl_lock and
vblank_time_lock spinlocks of the DRM device. Therefore, these accesses
don't need any extra serialization and the lock can be removed.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/dc.h

index edae21197fc6c8fdbf4a9c1e2dd9b481eb2f3587..cd84d8514d48c2f5e6055ade7a7d73b707659c1e 100644 (file)
@@ -1261,31 +1261,23 @@ static u32 tegra_dc_get_vblank_counter(struct drm_crtc *crtc)
 static int tegra_dc_enable_vblank(struct drm_crtc *crtc)
 {
        struct tegra_dc *dc = to_tegra_dc(crtc);
-       unsigned long value, flags;
-
-       spin_lock_irqsave(&dc->lock, flags);
+       u32 value;
 
        value = tegra_dc_readl(dc, DC_CMD_INT_MASK);
        value |= VBLANK_INT;
        tegra_dc_writel(dc, value, DC_CMD_INT_MASK);
 
-       spin_unlock_irqrestore(&dc->lock, flags);
-
        return 0;
 }
 
 static void tegra_dc_disable_vblank(struct drm_crtc *crtc)
 {
        struct tegra_dc *dc = to_tegra_dc(crtc);
-       unsigned long value, flags;
-
-       spin_lock_irqsave(&dc->lock, flags);
+       u32 value;
 
        value = tegra_dc_readl(dc, DC_CMD_INT_MASK);
        value &= ~VBLANK_INT;
        tegra_dc_writel(dc, value, DC_CMD_INT_MASK);
-
-       spin_unlock_irqrestore(&dc->lock, flags);
 }
 
 static const struct drm_crtc_funcs tegra_crtc_funcs = {
@@ -2033,7 +2025,6 @@ static int tegra_dc_probe(struct platform_device *pdev)
 
        dc->soc = of_device_get_match_data(&pdev->dev);
 
-       spin_lock_init(&dc->lock);
        INIT_LIST_HEAD(&dc->list);
        dc->dev = &pdev->dev;
 
index d680027fa272fcfbaffe562f3c5f39b14043fd07..7dd02f07244f957f3c388d7bbbd52ff4e13a5c96 100644 (file)
@@ -71,7 +71,6 @@ struct tegra_dc {
        struct host1x_client client;
        struct host1x_syncpt *syncpt;
        struct device *dev;
-       spinlock_t lock;
 
        struct drm_crtc base;
        unsigned int powergate;