Commit 055be595 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

fpga: altera-hps2fpga: fix multiple init of l3_remap_lock

commit 4ae2bd4b upstream.

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: e5f8efa5 ("ARM: socfpga: fpga bridge driver support")
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-By: default avatarMoritz Fischer <mdf@kernel.org>
Signed-off-by: default avatarAlan Tull <atull@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ba89dc8d
...@@ -66,7 +66,7 @@ static int alt_hps2fpga_enable_show(struct fpga_bridge *bridge) ...@@ -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. */ /* The L3 REMAP register is write only, so keep a cached value. */
static unsigned int l3_remap_shadow; 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, static int _alt_hps2fpga_enable_set(struct altera_hps2fpga_data *priv,
bool enable) bool enable)
...@@ -171,8 +171,6 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) ...@@ -171,8 +171,6 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
return -EBUSY; return -EBUSY;
} }
spin_lock_init(&l3_remap_lock);
if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) { if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) {
if (enable > 1) { if (enable > 1) {
dev_warn(dev, "invalid bridge-enable %u > 1\n", enable); dev_warn(dev, "invalid bridge-enable %u > 1\n", enable);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment