[PATCH v2 09/16] fpga: region: fix slow warning with more than one overlay

Alan Tull
2017-04-20T14:10:45Z

Prevent applying more than one overlay to a region.

This fixes a slow warning that happens when more than
one overlay is applied and then removed.

Signed-off-by: Alan Tull <atull@kernel.org>
---
v2: split out from another patch
---
drivers/fpga/fpga-region.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
index c2730a8..d6f2313 100644
--- a/drivers/fpga/fpga-region.c
+++ b/drivers/fpga/fpga-region.c
@@ -355,6 +355,11 @@ static int fpga_region_notify_pre_apply(struct fpga_region *region,
const char *firmware_name;
int ret;

+ if (region->info) {
+ dev_err(dev, "Region already has overlay applied.\n");
+ return -EINVAL;
+ }
+
/*
* Reject overlay if child FPGA Regions added in the overlay have
* firmware-name property (would mean that an FPGA region that has
--
2.7.4