diff options
author | Alan Tull <atull@kernel.org> | 2017-11-15 15:20:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-28 10:30:38 -0500 |
commit | 8a54167925341ab2a9c3133618dbddfc1a46f8aa (patch) | |
tree | 2244aa5db47f75bd5bc2801c1261b68cf548d863 /drivers/fpga/of-fpga-region.c | |
parent | ef3acdd820752e0abb5f1ec899025967d0dccf3d (diff) |
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>
Diffstat (limited to 'drivers/fpga/of-fpga-region.c')
-rw-r--r-- | drivers/fpga/of-fpga-region.c | 11 |
1 files 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, | |||
298 | struct fpga_image_info *info; | 298 | struct fpga_image_info *info; |
299 | int ret; | 299 | int ret; |
300 | 300 | ||
301 | if (region->info) { | ||
302 | dev_err(dev, "Region already has overlay applied.\n"); | ||
303 | return -EINVAL; | ||
304 | } | ||
305 | |||
306 | info = of_fpga_region_parse_ov(region, nd->overlay); | 301 | info = of_fpga_region_parse_ov(region, nd->overlay); |
307 | if (IS_ERR(info)) | 302 | if (IS_ERR(info)) |
308 | return PTR_ERR(info); | 303 | return PTR_ERR(info); |
309 | 304 | ||
305 | /* If overlay doesn't program the FPGA, accept it anyway. */ | ||
310 | if (!info) | 306 | if (!info) |
311 | return 0; | 307 | return 0; |
312 | 308 | ||
309 | if (region->info) { | ||
310 | dev_err(dev, "Region already has overlay applied.\n"); | ||
311 | return -EINVAL; | ||
312 | } | ||
313 | |||
313 | region->info = info; | 314 | region->info = info; |
314 | ret = fpga_region_program_fpga(region); | 315 | ret = fpga_region_program_fpga(region); |
315 | if (ret) { | 316 | if (ret) { |