Skip to content

Commit

Permalink
fpga: of-fpga-region: accept overlays that don't program FPGA
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Moritz Fischer <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
atull-altera authored and gregkh committed Nov 28, 2017
1 parent ef3acdd commit 8a54167
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/fpga/of-fpga-region.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8a54167

Please sign in to comment.