Skip to content

Commit

Permalink
fpga: fpga-mgr: ice40-spi: Simplify registration
Browse files Browse the repository at this point in the history
Simplify registration using new devm_fpga_mgr_register() API.

Reviewed-by: Tom Rix <[email protected]>
Signed-off-by: Moritz Fischer <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
mfischer authored and gregkh committed Dec 1, 2020
1 parent 83eb4fb commit 7027b73
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions drivers/fpga/ice40-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,7 @@ static int ice40_fpga_probe(struct spi_device *spi)
if (!mgr)
return -ENOMEM;

spi_set_drvdata(spi, mgr);

return fpga_mgr_register(mgr);
}

static int ice40_fpga_remove(struct spi_device *spi)
{
struct fpga_manager *mgr = spi_get_drvdata(spi);

fpga_mgr_unregister(mgr);

return 0;
return devm_fpga_mgr_register(dev, mgr);
}

static const struct of_device_id ice40_fpga_of_match[] = {
Expand All @@ -205,7 +194,6 @@ MODULE_DEVICE_TABLE(of, ice40_fpga_of_match);

static struct spi_driver ice40_fpga_driver = {
.probe = ice40_fpga_probe,
.remove = ice40_fpga_remove,
.driver = {
.name = "ice40spi",
.of_match_table = of_match_ptr(ice40_fpga_of_match),
Expand Down

0 comments on commit 7027b73

Please sign in to comment.