Commit 59272ad8 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Li Yang
Browse files

bus: fsl-mc: Make remove function return void



The value returned by an fsl-mc driver's remove function is mostly
ignored.  (Only an error message is printed if the value is non-zero
and then device removal continues unconditionally.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com> # sanity checks
Reviewed-by: default avatarLaurentiu Tudor <laurentiu.tudor@nxp.com>
Tested-by: default avatarLaurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: default avatarLi Yang <leoyang.li@nxp.com>
parent c27ea8e6
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -835,13 +835,13 @@ EXPORT_SYMBOL_GPL(dprc_cleanup);
 * It tears down the interrupts that were configured for the DPRC device.
 * It destroys the interrupt pool associated with this MC bus.
 */
static int dprc_remove(struct fsl_mc_device *mc_dev)
static void dprc_remove(struct fsl_mc_device *mc_dev)
{
	struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);

	if (!mc_bus->irq_resources) {
		dev_err(&mc_dev->dev, "No irq resources, so unbinding the device failed\n");
		return 0;
		return;
	}

	if (dev_get_msi_domain(&mc_dev->dev))
@@ -852,7 +852,6 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)
	dprc_cleanup(mc_dev);

	dev_info(&mc_dev->dev, "DPRC device unbound from driver");
	return 0;
}

static const struct fsl_mc_device_id match_id_table[] = {
+2 −3
Original line number Diff line number Diff line
@@ -614,19 +614,18 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
 * fsl_mc_allocator_remove - callback invoked when an allocatable device is
 * being removed from the system
 */
static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
static void fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
{
	int error;

	if (mc_dev->resource) {
		error = fsl_mc_resource_pool_remove_device(mc_dev);
		if (error < 0)
			return 0;
			return;
	}

	dev_dbg(&mc_dev->dev,
		"Allocatable fsl-mc device unbound from fsl_mc_allocator driver");
	return 0;
}

static const struct fsl_mc_device_id match_id_table[] = {
+1 −4
Original line number Diff line number Diff line
@@ -454,11 +454,8 @@ static int fsl_mc_driver_remove(struct device *dev)
{
	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
	int error;

	error = mc_drv->remove(mc_dev);
	if (error < 0)
		dev_err(dev, "%s failed: %d\n", __func__, error);
	mc_drv->remove(mc_dev);

	return 0;
}
+1 −3
Original line number Diff line number Diff line
@@ -5402,7 +5402,7 @@ static int dpaa2_caam_probe(struct fsl_mc_device *dpseci_dev)
	return err;
}

static int __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev)
static void __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev)
{
	struct device *dev;
	struct dpaa2_caam_priv *priv;
@@ -5443,8 +5443,6 @@ static int __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev)
	free_percpu(priv->ppriv);
	fsl_mc_portal_free(priv->mc_io);
	kmem_cache_destroy(qi_cache);

	return 0;
}

int dpaa2_caam_enqueue(struct device *dev, struct caam_request *req)
+1 −3
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
	return err;
}

static int dpaa2_qdma_remove(struct fsl_mc_device *ls_dev)
static void dpaa2_qdma_remove(struct fsl_mc_device *ls_dev)
{
	struct dpaa2_qdma_engine *dpaa2_qdma;
	struct dpaa2_qdma_priv *priv;
@@ -787,8 +787,6 @@ static int dpaa2_qdma_remove(struct fsl_mc_device *ls_dev)
	dma_async_device_unregister(&dpaa2_qdma->dma_dev);
	kfree(priv);
	kfree(dpaa2_qdma);

	return 0;
}

static void dpaa2_qdma_shutdown(struct fsl_mc_device *ls_dev)
Loading