blob: ad878f0a8cb4ae1e518b7ec04d56b533dfce46b3 [file] [log] [blame]
From d6b4e837b8893976774e98ccba7a1887c7cd03f9 Mon Sep 17 00:00:00 2001
From: Alan Tull <atull@kernel.org>
Date: Wed, 15 Nov 2017 14:20:26 -0600
Subject: [PATCH 1675/1795] fpga: of-fpga-region: accept overlays that don't
program FPGA
The FPGA may already have a static image programmed when
Linux boots. In that case a DT overlay may be used to add
the devices that already exist. This commit allows that
by shuffling the order of some checks.
Signed-off-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8a54167925341ab2a9c3133618dbddfc1a46f8aa)
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/fpga/of-fpga-region.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c
index 1533506ef0e4..c6b21194dcbc 100644
--- a/drivers/fpga/of-fpga-region.c
+++ b/drivers/fpga/of-fpga-region.c
@@ -298,18 +298,19 @@ static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
struct fpga_image_info *info;
int ret;
- if (region->info) {
- dev_err(dev, "Region already has overlay applied.\n");
- return -EINVAL;
- }
-
info = of_fpga_region_parse_ov(region, nd->overlay);
if (IS_ERR(info))
return PTR_ERR(info);
+ /* If overlay doesn't program the FPGA, accept it anyway. */
if (!info)
return 0;
+ if (region->info) {
+ dev_err(dev, "Region already has overlay applied.\n");
+ return -EINVAL;
+ }
+
region->info = info;
ret = fpga_region_program_fpga(region);
if (ret) {
--
2.19.0