Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1701639

[PATCH 4/5] fpga: altera-hps2fpga: fix multiple init of l3_remap_lock

From Alan Tull <atull@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 4/5] fpga: altera-hps2fpga: fix multiple init of l3_remap_lock
Date 2017-08-02 04:30 +0200
Message-ID <u9RA6-3Rb-27@gated-at.bofh.it> (permalink)
References <u9RA5-3Rb-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Ian Abbott <abbotti@mev.co.uk>

The global spinlock `l3_remap_lock` is reinitialized every time the
"probe" function `alt_fpga_bridge_probe()` is called.  It should only be
initialized once.  Use `DEFINE_SPINLOCK()` to initialize it statically.

Fixes: e5f8efa5c8bf ("ARM: socfpga: fpga bridge driver support")
Cc: <stable@vger.kernel.org> # 4.10+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-By: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alan Tull <atull@kernel.org>
---
 drivers/fpga/altera-hps2fpga.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c
index e6c948b..406d2f1 100644
--- a/drivers/fpga/altera-hps2fpga.c
+++ b/drivers/fpga/altera-hps2fpga.c
@@ -66,7 +66,7 @@ static int alt_hps2fpga_enable_show(struct fpga_bridge *bridge)
 
 /* The L3 REMAP register is write only, so keep a cached value. */
 static unsigned int l3_remap_shadow;
-static spinlock_t l3_remap_lock;
+static DEFINE_SPINLOCK(l3_remap_lock);
 
 static int _alt_hps2fpga_enable_set(struct altera_hps2fpga_data *priv,
 				    bool enable)
@@ -177,8 +177,6 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	spin_lock_init(&l3_remap_lock);
-
 	if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) {
 		if (enable > 1) {
 			dev_warn(dev, "invalid bridge-enable %u > 1\n", enable);
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] patches for FPGA Alan Tull <atull@kernel.org> - 2017-08-02 04:30 +0200
  [PATCH 5/5] MAINTAINERS: fpga: Update email and add patchwork URL Alan Tull <atull@kernel.org> - 2017-08-02 04:30 +0200
  [PATCH 1/5] fpga: Convert to using %pOF instead of full_name Alan Tull <atull@kernel.org> - 2017-08-02 04:30 +0200
  [PATCH 3/5] fpga: altera-hps2fpga: add NULL check on of_match_device() return value Alan Tull <atull@kernel.org> - 2017-08-02 04:30 +0200
  [PATCH 2/5] ARM: socfpga: explicitly request exclusive reset control Alan Tull <atull@kernel.org> - 2017-08-02 04:30 +0200
  [PATCH 4/5] fpga: altera-hps2fpga: fix multiple init of l3_remap_lock Alan Tull <atull@kernel.org> - 2017-08-02 04:30 +0200

csiph-web