diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-06-05 11:20:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-15 13:43:21 +0200 |
commit | e8989a48ca5111122b73fe905baf07ea29f1c197 (patch) | |
tree | db72451fbd3b73f69a968d132189a5a04dc5a9c9 /drivers/char | |
parent | bus: fsl-mc: don't assume child devices are all fsl-mc devices (diff) | |
download | linux-e8989a48ca5111122b73fe905baf07ea29f1c197.tar.xz linux-e8989a48ca5111122b73fe905baf07ea29f1c197.zip |
char: xilinx_hwicap: Fold hwicap_remove() into only caller
hwicap_remove() is only called by hwicap_drv_remove(). Simplify by
unrolling the former into the latter function.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Michal Simek <michal.simek@amd.com>
Message-ID: <20230605092047.50472-1-u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index a46f637da959..c4d75e684be6 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -721,27 +721,6 @@ static struct hwicap_driver_config fifo_icap_config = { .reset = fifo_icap_reset, }; -static int hwicap_remove(struct device *dev) -{ - struct hwicap_drvdata *drvdata; - - drvdata = dev_get_drvdata(dev); - - if (!drvdata) - return 0; - - device_destroy(icap_class, drvdata->devt); - cdev_del(&drvdata->cdev); - iounmap(drvdata->base_address); - release_mem_region(drvdata->mem_start, drvdata->mem_size); - kfree(drvdata); - - mutex_lock(&icap_sem); - probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0; - mutex_unlock(&icap_sem); - return 0; /* success */ -} - #ifdef CONFIG_OF static int hwicap_of_probe(struct platform_device *op, const struct hwicap_driver_config *config) @@ -827,7 +806,24 @@ static int hwicap_drv_probe(struct platform_device *pdev) static int hwicap_drv_remove(struct platform_device *pdev) { - return hwicap_remove(&pdev->dev); + struct device *dev = &pdev->dev; + struct hwicap_drvdata *drvdata; + + drvdata = dev_get_drvdata(dev); + if (!drvdata) + return 0; + + device_destroy(icap_class, drvdata->devt); + cdev_del(&drvdata->cdev); + iounmap(drvdata->base_address); + release_mem_region(drvdata->mem_start, drvdata->mem_size); + kfree(drvdata); + + mutex_lock(&icap_sem); + probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0; + mutex_unlock(&icap_sem); + + return 0; } #ifdef CONFIG_OF |