Unverified Commit 356fa497 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'soc-fsl-next-v6.5' of...

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: default avatarArnd Bergmann <arnd@arndb.de>
parents 3f711c24 fb9c3846
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -835,15 +835,14 @@ 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 (!is_fsl_mc_bus_dprc(mc_dev))
		return -EINVAL;

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

	if (dev_get_msi_domain(&mc_dev->dev))
		dprc_teardown_irq(mc_dev);
@@ -853,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[] = {
+17 −18
Original line number Diff line number Diff line
@@ -103,26 +103,32 @@ static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
	struct fsl_mc_resource *resource;
	int error = -EINVAL;

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

	resource = mc_dev->resource;
	if (!resource || resource->data != mc_dev)
	if (!resource || resource->data != mc_dev) {
		dev_err(&mc_bus_dev->dev, "resource mismatch\n");
		goto out;
	}

	mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
	mc_bus = to_fsl_mc_bus(mc_bus_dev);
	res_pool = resource->parent_pool;
	if (res_pool != &mc_bus->resource_pools[resource->type])
	if (res_pool != &mc_bus->resource_pools[resource->type]) {
		dev_err(&mc_bus_dev->dev, "pool mismatch\n");
		goto out;
	}

	mutex_lock(&res_pool->mutex);

	if (res_pool->max_count <= 0)
	if (res_pool->max_count <= 0) {
		dev_err(&mc_bus_dev->dev, "max_count underflow\n");
		goto out_unlock;
	}
	if (res_pool->free_count <= 0 ||
	    res_pool->free_count > res_pool->max_count)
	    res_pool->free_count > res_pool->max_count) {
		dev_err(&mc_bus_dev->dev, "free_count mismatch\n");
		goto out_unlock;
	}

	/*
	 * If the device is currently allocated, its resource is not
@@ -557,13 +563,10 @@ static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
	struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev);
	struct fsl_mc_resource_pool *res_pool =
					&mc_bus->resource_pools[pool_type];
	int free_count = 0;

	list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
		free_count++;
	list_for_each_entry_safe(resource, next, &res_pool->free_list, node)
		devm_kfree(&mc_bus_dev->dev, resource);
}
}

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)
 * 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 (!fsl_mc_is_allocatable(mc_dev))
		return -EINVAL;

	if (mc_dev->resource) {
		error = fsl_mc_resource_pool_remove_device(mc_dev);
		if (error < 0)
			return error;
			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 −6
Original line number Diff line number Diff line
@@ -454,13 +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);
		return 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