diff options
Diffstat (limited to 'drivers/fpga/altera-fpga2sdram.c')
| -rw-r--r-- | drivers/fpga/altera-fpga2sdram.c | 34 | 
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/fpga/altera-fpga2sdram.c b/drivers/fpga/altera-fpga2sdram.c index d4eeb74388da..23660ccd634b 100644 --- a/drivers/fpga/altera-fpga2sdram.c +++ b/drivers/fpga/altera-fpga2sdram.c @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * FPGA to SDRAM Bridge Driver for Altera SoCFPGA Devices   *   *  Copyright (C) 2013-2016 Altera Corporation, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program.  If not, see <http://www.gnu.org/licenses/>.   */  /* @@ -106,6 +95,7 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)  {  	struct device *dev = &pdev->dev;  	struct alt_fpga2sdram_data *priv; +	struct fpga_bridge *br;  	u32 enable;  	struct regmap *sysmgr;  	int ret = 0; @@ -131,10 +121,18 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)  	/* Get f2s bridge configuration saved in handoff register */  	regmap_read(sysmgr, SYSMGR_ISWGRP_HANDOFF3, &priv->mask); -	ret = fpga_bridge_register(dev, F2S_BRIDGE_NAME, -				   &altera_fpga2sdram_br_ops, priv); -	if (ret) +	br = fpga_bridge_create(dev, F2S_BRIDGE_NAME, +				&altera_fpga2sdram_br_ops, priv); +	if (!br) +		return -ENOMEM; + +	platform_set_drvdata(pdev, br); + +	ret = fpga_bridge_register(br); +	if (ret) { +		fpga_bridge_free(br);  		return ret; +	}  	dev_info(dev, "driver initialized with handoff %08x\n", priv->mask); @@ -146,7 +144,7 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)  				 (enable ? "enabling" : "disabling"));  			ret = _alt_fpga2sdram_enable_set(priv, enable);  			if (ret) { -				fpga_bridge_unregister(&pdev->dev); +				fpga_bridge_unregister(br);  				return ret;  			}  		} @@ -157,7 +155,9 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)  static int alt_fpga_bridge_remove(struct platform_device *pdev)  { -	fpga_bridge_unregister(&pdev->dev); +	struct fpga_bridge *br = platform_get_drvdata(pdev); + +	fpga_bridge_unregister(br);  	return 0;  }  |