diff options
Diffstat (limited to 'drivers/fpga/ice40-spi.c')
-rw-r--r-- | drivers/fpga/ice40-spi.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c index 7fca82023062..5981c7ee7a7d 100644 --- a/drivers/fpga/ice40-spi.c +++ b/drivers/fpga/ice40-spi.c | |||
@@ -133,6 +133,7 @@ static int ice40_fpga_probe(struct spi_device *spi) | |||
133 | { | 133 | { |
134 | struct device *dev = &spi->dev; | 134 | struct device *dev = &spi->dev; |
135 | struct ice40_fpga_priv *priv; | 135 | struct ice40_fpga_priv *priv; |
136 | struct fpga_manager *mgr; | ||
136 | int ret; | 137 | int ret; |
137 | 138 | ||
138 | priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); | 139 | priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); |
@@ -174,14 +175,26 @@ static int ice40_fpga_probe(struct spi_device *spi) | |||
174 | return ret; | 175 | return ret; |
175 | } | 176 | } |
176 | 177 | ||
177 | /* Register with the FPGA manager */ | 178 | mgr = fpga_mgr_create(dev, "Lattice iCE40 FPGA Manager", |
178 | return fpga_mgr_register(dev, "Lattice iCE40 FPGA Manager", | 179 | &ice40_fpga_ops, priv); |
179 | &ice40_fpga_ops, priv); | 180 | if (!mgr) |
181 | return -ENOMEM; | ||
182 | |||
183 | spi_set_drvdata(spi, mgr); | ||
184 | |||
185 | ret = fpga_mgr_register(mgr); | ||
186 | if (ret) | ||
187 | fpga_mgr_free(mgr); | ||
188 | |||
189 | return ret; | ||
180 | } | 190 | } |
181 | 191 | ||
182 | static int ice40_fpga_remove(struct spi_device *spi) | 192 | static int ice40_fpga_remove(struct spi_device *spi) |
183 | { | 193 | { |
184 | fpga_mgr_unregister(&spi->dev); | 194 | struct fpga_manager *mgr = spi_get_drvdata(spi); |
195 | |||
196 | fpga_mgr_unregister(mgr); | ||
197 | |||
185 | return 0; | 198 | return 0; |
186 | } | 199 | } |
187 | 200 | ||