Skip to content

Commit 59272ad

Browse files
ukleinekLi Yang
authored andcommitted
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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com> Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com> # sanity checks Reviewed-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Tested-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
1 parent c27ea8e commit 59272ad

11 files changed

Lines changed: 13 additions & 31 deletions

File tree

drivers/bus/fsl-mc/dprc-driver.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,13 +835,13 @@ EXPORT_SYMBOL_GPL(dprc_cleanup);
835835
* It tears down the interrupts that were configured for the DPRC device.
836836
* It destroys the interrupt pool associated with this MC bus.
837837
*/
838-
static int dprc_remove(struct fsl_mc_device *mc_dev)
838+
static void dprc_remove(struct fsl_mc_device *mc_dev)
839839
{
840840
struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev);
841841

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

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

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

858857
static const struct fsl_mc_device_id match_id_table[] = {

drivers/bus/fsl-mc/fsl-mc-allocator.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,19 +614,18 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
614614
* fsl_mc_allocator_remove - callback invoked when an allocatable device is
615615
* being removed from the system
616616
*/
617-
static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
617+
static void fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
618618
{
619619
int error;
620620

621621
if (mc_dev->resource) {
622622
error = fsl_mc_resource_pool_remove_device(mc_dev);
623623
if (error < 0)
624-
return 0;
624+
return;
625625
}
626626

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

632631
static const struct fsl_mc_device_id match_id_table[] = {

drivers/bus/fsl-mc/fsl-mc-bus.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,8 @@ static int fsl_mc_driver_remove(struct device *dev)
454454
{
455455
struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
456456
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
457-
int error;
458457

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

463460
return 0;
464461
}

drivers/crypto/caam/caamalg_qi2.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5402,7 +5402,7 @@ static int dpaa2_caam_probe(struct fsl_mc_device *dpseci_dev)
54025402
return err;
54035403
}
54045404

5405-
static int __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev)
5405+
static void __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev)
54065406
{
54075407
struct device *dev;
54085408
struct dpaa2_caam_priv *priv;
@@ -5443,8 +5443,6 @@ static int __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev)
54435443
free_percpu(priv->ppriv);
54445444
fsl_mc_portal_free(priv->mc_io);
54455445
kmem_cache_destroy(qi_cache);
5446-
5447-
return 0;
54485446
}
54495447

54505448
int dpaa2_caam_enqueue(struct device *dev, struct caam_request *req)

drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static int dpaa2_qdma_probe(struct fsl_mc_device *dpdmai_dev)
765765
return err;
766766
}
767767

768-
static int dpaa2_qdma_remove(struct fsl_mc_device *ls_dev)
768+
static void dpaa2_qdma_remove(struct fsl_mc_device *ls_dev)
769769
{
770770
struct dpaa2_qdma_engine *dpaa2_qdma;
771771
struct dpaa2_qdma_priv *priv;
@@ -787,8 +787,6 @@ static int dpaa2_qdma_remove(struct fsl_mc_device *ls_dev)
787787
dma_async_device_unregister(&dpaa2_qdma->dma_dev);
788788
kfree(priv);
789789
kfree(dpaa2_qdma);
790-
791-
return 0;
792790
}
793791

794792
static void dpaa2_qdma_shutdown(struct fsl_mc_device *ls_dev)

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5025,7 +5025,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev)
50255025
return err;
50265026
}
50275027

5028-
static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
5028+
static void dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
50295029
{
50305030
struct device *dev;
50315031
struct net_device *net_dev;
@@ -5073,8 +5073,6 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
50735073
dev_dbg(net_dev->dev.parent, "Removed interface %s\n", net_dev->name);
50745074

50755075
free_netdev(net_dev);
5076-
5077-
return 0;
50785076
}
50795077

50805078
static const struct fsl_mc_device_id dpaa2_eth_match_id_table[] = {

drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static int dpaa2_ptp_probe(struct fsl_mc_device *mc_dev)
219219
return err;
220220
}
221221

222-
static int dpaa2_ptp_remove(struct fsl_mc_device *mc_dev)
222+
static void dpaa2_ptp_remove(struct fsl_mc_device *mc_dev)
223223
{
224224
struct device *dev = &mc_dev->dev;
225225
struct ptp_qoriq *ptp_qoriq;
@@ -232,8 +232,6 @@ static int dpaa2_ptp_remove(struct fsl_mc_device *mc_dev)
232232
fsl_mc_free_irqs(mc_dev);
233233
dprtc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);
234234
fsl_mc_portal_free(mc_dev->mc_io);
235-
236-
return 0;
237235
}
238236

239237
static const struct fsl_mc_device_id dpaa2_ptp_match_id_table[] = {

drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3221,7 +3221,7 @@ static void dpaa2_switch_teardown(struct fsl_mc_device *sw_dev)
32213221
dev_warn(dev, "dpsw_close err %d\n", err);
32223222
}
32233223

3224-
static int dpaa2_switch_remove(struct fsl_mc_device *sw_dev)
3224+
static void dpaa2_switch_remove(struct fsl_mc_device *sw_dev)
32253225
{
32263226
struct ethsw_port_priv *port_priv;
32273227
struct ethsw_core *ethsw;
@@ -3252,8 +3252,6 @@ static int dpaa2_switch_remove(struct fsl_mc_device *sw_dev)
32523252
kfree(ethsw);
32533253

32543254
dev_set_drvdata(dev, NULL);
3255-
3256-
return 0;
32573255
}
32583256

32593257
static int dpaa2_switch_probe_port(struct ethsw_core *ethsw,

drivers/soc/fsl/dpio/dpio-driver.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static void dpio_teardown_irqs(struct fsl_mc_device *dpio_dev)
270270
fsl_mc_free_irqs(dpio_dev);
271271
}
272272

273-
static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
273+
static void dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
274274
{
275275
struct device *dev;
276276
struct dpio_priv *priv;
@@ -299,8 +299,6 @@ static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
299299

300300
err_open:
301301
fsl_mc_portal_free(dpio_dev->mc_io);
302-
303-
return 0;
304302
}
305303

306304
static const struct fsl_mc_device_id dpaa2_dpio_match_id_table[] = {

drivers/vfio/fsl-mc/vfio_fsl_mc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,15 +570,14 @@ static void vfio_fsl_mc_release_dev(struct vfio_device *core_vdev)
570570
mutex_destroy(&vdev->igate);
571571
}
572572

573-
static int vfio_fsl_mc_remove(struct fsl_mc_device *mc_dev)
573+
static void vfio_fsl_mc_remove(struct fsl_mc_device *mc_dev)
574574
{
575575
struct device *dev = &mc_dev->dev;
576576
struct vfio_fsl_mc_device *vdev = dev_get_drvdata(dev);
577577

578578
vfio_unregister_group_dev(&vdev->vdev);
579579
dprc_remove_devices(mc_dev, NULL, 0);
580580
vfio_put_device(&vdev->vdev);
581-
return 0;
582581
}
583582

584583
static const struct vfio_device_ops vfio_fsl_mc_ops = {

0 commit comments

Comments
 (0)