linux/drivers/fpga/of-fpga-region.c
/**
 * of_fpga_region_notify_pre_apply - pre-apply overlay notification
 *
 * @region: FPGA region that the overlay was applied to
 * @nd: overlay notification data
 *
 * Called when an overlay targeted to a FPGA Region is about to be applied.
 * Parses the overlay for properties that influence how the FPGA will be
 * programmed and does some checking. If the checks pass, programs the FPGA.
 * If the checks fail, overlay is rejected and does not get added to the
 * live tree.
 *
 * Returns 0 for success or negative error code for failure.
 */
pre-apply overlay notification
@region: FPGA region that the overlay was applied to
@nd: overlay notification data

Called when an overlay targeted to a FPGA Region is about to be applied.
Parses the overlay for properties that influence how the FPGA will be
programmed and does some checking. If the checks pass, programs the FPGA.
If the checks fail, overlay is rejected and does not get added to the
live tree.

Returns 0 for success or negative error code for failure.
pre - apply overlay notification @region : FPGA region that the overlay was applied to @nd : overlay notification data Called when an overlay targeted to a FPGA Region is about to be applied . Parses the overlay for properties that influence how the FPGA will be programmed and does some checking . If the checks pass programs the FPGA . If the checks fail overlay is rejected and does not get added to the live tree . Returns 0 for success or negative error code for failure .
static int of_fpga_region_notify_pre_apply(struct fpga_region *region,
					   struct of_overlay_notify_data *nd)
{
	struct device *dev = &region->dev;
	struct fpga_image_info *info;
	int ret;
	info = of_fpga_region_parse_ov(region, nd->overlay);
	if (IS_ERR(info))
		return PTR_ERR(info);
	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) {
		fpga_image_info_free(info);
		region->info = NULL;
	}
	return ret;
}
static int of_fpga_region_notify_pre_apply ( struct fpga_region * region , struct of_overlay_notify_data * nd ) { struct device * dev = & region -> dev ; struct fpga_image_info * info ; int ret ; info = of_fpga_region_parse_ov ( region , nd -> overlay ) ; if ( IS_ERR ( info ) ) return PTR_ERR ( info ) ; if ( ! info ) return 0 ; if ( region -> info ) { dev_err ( dev , " \n " ) ; return - EINVAL ; } region -> info = info ; ret = fpga_region_program_fpga ( region ) ; if ( ret ) { fpga_image_info_free ( info ) ; region -> info = NULL ; } return ret ; }
of_fpga_region_notify_pre_apply - pre-apply overlay notification
 @region: FPGA region that the overlay was applied to
 @nd: overlay notification data
of_fpga_region_notify_pre_apply - pre - apply overlay notification @region : FPGA region that the overlay was applied to @nd : overlay notification data
/* If overlay doesn't program the FPGA, accept it anyway. */ /* error; reject overlay */