Skip to content

Commit 356fa49

Browse files
committed
Merge tag 'soc-fsl-next-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux into soc/drivers
NXP/FSL SoC driver updates for v6.5 - fsl-mc: Make remove function return void - QE USB: fix build issue caused by missing dependency * tag 'soc-fsl-next-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux: bus: fsl-mc: fsl-mc-allocator: Drop a write-only variable bus: fsl-mc: fsl-mc-allocator: Initialize mc_bus_dev before use soc/fsl/qe: fix usb.c build errors bus: fsl-mc: Make remove function return void soc: fsl: dpio: Suppress duplicated error reporting on device remove bus: fsl-mc: fsl-mc-allocator: Improve error reporting bus: fsl-mc: fsl-mc-allocator: Drop if block with always wrong condition bus: fsl-mc: dprc: Push down error message from fsl_mc_driver_remove() bus: fsl-mc: Only warn once about errors on device unbind Link: https://lore.kernel.org/r/20230621222503.12402-1-leoyang.li@nxp.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 3f711c2 + fb9c384 commit 356fa49

12 files changed

Lines changed: 32 additions & 56 deletions

File tree

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -835,15 +835,14 @@ 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

842-
if (!is_fsl_mc_bus_dprc(mc_dev))
843-
return -EINVAL;
844-
845-
if (!mc_bus->irq_resources)
846-
return -EINVAL;
842+
if (!mc_bus->irq_resources) {
843+
dev_err(&mc_dev->dev, "No irq resources, so unbinding the device failed\n");
844+
return;
845+
}
847846

848847
if (dev_get_msi_domain(&mc_dev->dev))
849848
dprc_teardown_irq(mc_dev);
@@ -853,7 +852,6 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)
853852
dprc_cleanup(mc_dev);
854853

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

859857
static const struct fsl_mc_device_id match_id_table[] = {

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

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,32 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
103103
struct fsl_mc_resource *resource;
104104
int error = -EINVAL;
105105

106-
if (!fsl_mc_is_allocatable(mc_dev))
107-
goto out;
106+
mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
107+
mc_bus = to_fsl_mc_bus(mc_bus_dev);
108108

109109
resource = mc_dev->resource;
110-
if (!resource || resource->data != mc_dev)
110+
if (!resource || resource->data != mc_dev) {
111+
dev_err(&mc_bus_dev->dev, "resource mismatch\n");
111112
goto out;
113+
}
112114

113-
mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
114-
mc_bus = to_fsl_mc_bus(mc_bus_dev);
115115
res_pool = resource->parent_pool;
116-
if (res_pool != &mc_bus->resource_pools[resource->type])
116+
if (res_pool != &mc_bus->resource_pools[resource->type]) {
117+
dev_err(&mc_bus_dev->dev, "pool mismatch\n");
117118
goto out;
119+
}
118120

119121
mutex_lock(&res_pool->mutex);
120122

121-
if (res_pool->max_count <= 0)
123+
if (res_pool->max_count <= 0) {
124+
dev_err(&mc_bus_dev->dev, "max_count underflow\n");
122125
goto out_unlock;
126+
}
123127
if (res_pool->free_count <= 0 ||
124-
res_pool->free_count > res_pool->max_count)
128+
res_pool->free_count > res_pool->max_count) {
129+
dev_err(&mc_bus_dev->dev, "free_count mismatch\n");
125130
goto out_unlock;
131+
}
126132

127133
/*
128134
* If the device is currently allocated, its resource is not
@@ -557,12 +563,9 @@ static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
557563
struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
558564
struct fsl_mc_resource_pool *res_pool =
559565
&mc_bus->resource_pools[pool_type];
560-
int free_count = 0;
561566

562-
list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
563-
free_count++;
567+
list_for_each_entry_safe(resource, next, &res_pool->free_list, node)
564568
devm_kfree(&mc_bus_dev->dev, resource);
565-
}
566569
}
567570

568571
void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev)
@@ -609,22 +612,18 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
609612
* fsl_mc_allocator_remove - callback invoked when an allocatable device is
610613
* being removed from the system
611614
*/
612-
static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
615+
static void fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
613616
{
614617
int error;
615618

616-
if (!fsl_mc_is_allocatable(mc_dev))
617-
return -EINVAL;
618-
619619
if (mc_dev->resource) {
620620
error = fsl_mc_resource_pool_remove_device(mc_dev);
621621
if (error < 0)
622-
return error;
622+
return;
623623
}
624624

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

630629
static const struct fsl_mc_device_id match_id_table[] = {

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,13 +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);
462-
return error;
463-
}
458+
mc_drv->remove(mc_dev);
464459

465460
return 0;
466461
}

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 & 7 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;
@@ -297,14 +297,8 @@ static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
297297

298298
dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
299299

300-
fsl_mc_portal_free(dpio_dev->mc_io);
301-
302-
return 0;
303-
304300
err_open:
305301
fsl_mc_portal_free(dpio_dev->mc_io);
306-
307-
return err;
308302
}
309303

310304
static const struct fsl_mc_device_id dpaa2_dpio_match_id_table[] = {

drivers/soc/fsl/qe/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ config QE_TDM
6262

6363
config QE_USB
6464
bool
65+
depends on QUICC_ENGINE
6566
default y if USB_FSL_QE
6667
help
6768
QE USB Controller support

0 commit comments

Comments
 (0)