All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Justin Stitt <justinstitt@google.com>,
	Bill Wendling <morbo@google.com>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Santosh Shilimkar <ssantosh@kernel.org>
Cc: <afd@ti.com>, Nishanth Menon <nm@ti.com>, <llvm@lists.linux.dev>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH V2 02/11] soc: ti: knav_qmss: Rename global kdev to knav_qdev to fix -Wshadow
Date: Tue, 12 May 2026 12:06:14 -0500	[thread overview]
Message-ID: <20260512170623.3174416-3-nm@ti.com> (raw)
In-Reply-To: <20260512170623.3174416-1-nm@ti.com>

Building with W=2 (clang, LLVM=1) produces 22 -Wshadow warnings in
knav_qmss_queue.c because the file-scoped singleton 'kdev' is shadowed
by a parameter of the same name in 21 internal functions and one local
variable, e.g.:

  knav_qmss_queue.c:194:49: warning: declaration shadows a variable
  in the global scope [-Wshadow]
  194 | knav_queue_match_id_to_inst(struct knav_device *kdev, unsigned id)

Rename the global singleton from kdev to knav_qdev rather than
renaming all ~21 function parameters, as this requires fewer changes
and leaves function signatures, struct field accesses, and header
macros in knav_qmss.h untouched.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes since V1:
- None.

V1: https://lore.kernel.org/all/20260508153211.3688277-3-nm@ti.com/

 drivers/soc/ti/knav_qmss_queue.c | 94 ++++++++++++++++----------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index e87a42734f25..2c103bb6edef 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -25,7 +25,7 @@
 
 #include "knav_qmss.h"
 
-static struct knav_device *kdev;
+static struct knav_device *knav_qdev;
 static DEFINE_MUTEX(knav_dev_lock);
 #define knav_dev_lock_held() \
 	lockdep_is_held(&knav_dev_lock)
@@ -205,10 +205,10 @@ knav_queue_match_id_to_inst(struct knav_device *kdev, unsigned id)
 
 static inline struct knav_queue_inst *knav_queue_find_by_id(int id)
 {
-	if (kdev->base_id <= id &&
-	    kdev->base_id + kdev->num_queues > id) {
-		id -= kdev->base_id;
-		return knav_queue_match_id_to_inst(kdev, id);
+	if (knav_qdev->base_id <= id &&
+	    knav_qdev->base_id + knav_qdev->num_queues > id) {
+		id -= knav_qdev->base_id;
+		return knav_queue_match_id_to_inst(knav_qdev, id);
 	}
 	return NULL;
 }
@@ -296,7 +296,7 @@ static struct knav_queue *knav_queue_open_by_type(const char *name,
 
 	mutex_lock(&knav_dev_lock);
 
-	for_each_instance(idx, inst, kdev) {
+	for_each_instance(idx, inst, knav_qdev) {
 		if (knav_queue_is_reserved(inst))
 			continue;
 		if (!knav_queue_match_type(inst, type))
@@ -469,9 +469,9 @@ static int knav_queue_debug_show(struct seq_file *s, void *v)
 
 	mutex_lock(&knav_dev_lock);
 	seq_printf(s, "%s: %u-%u\n",
-		   dev_name(kdev->dev), kdev->base_id,
-		   kdev->base_id + kdev->num_queues - 1);
-	for_each_instance(idx, inst, kdev)
+		   dev_name(knav_qdev->dev), knav_qdev->base_id,
+		   knav_qdev->base_id + knav_qdev->num_queues - 1);
+	for_each_instance(idx, inst, knav_qdev)
 		knav_queue_debug_show_instance(s, inst);
 	mutex_unlock(&knav_dev_lock);
 
@@ -762,17 +762,17 @@ void *knav_pool_create(const char *name,
 	unsigned last_offset;
 	int ret;
 
-	if (!kdev)
+	if (!knav_qdev)
 		return ERR_PTR(-EPROBE_DEFER);
 
-	if (!kdev->dev)
+	if (!knav_qdev->dev)
 		return ERR_PTR(-ENODEV);
 
-	pool = devm_kzalloc(kdev->dev, sizeof(*pool), GFP_KERNEL);
+	pool = devm_kzalloc(knav_qdev->dev, sizeof(*pool), GFP_KERNEL);
 	if (!pool)
 		return ERR_PTR(-ENOMEM);
 
-	for_each_region(kdev, reg_itr) {
+	for_each_region(knav_qdev, reg_itr) {
 		if (reg_itr->id != region_id)
 			continue;
 		region = reg_itr;
@@ -780,14 +780,14 @@ void *knav_pool_create(const char *name,
 	}
 
 	if (!region) {
-		dev_err(kdev->dev, "region-id(%d) not found\n", region_id);
+		dev_err(knav_qdev->dev, "region-id(%d) not found\n", region_id);
 		ret = -EINVAL;
 		goto err;
 	}
 
 	pool->queue = knav_queue_open(name, KNAV_QUEUE_GP, 0);
 	if (IS_ERR(pool->queue)) {
-		dev_err(kdev->dev,
+		dev_err(knav_qdev->dev,
 			"failed to open queue for pool(%s), error %ld\n",
 			name, PTR_ERR(pool->queue));
 		ret = PTR_ERR(pool->queue);
@@ -795,13 +795,13 @@ void *knav_pool_create(const char *name,
 	}
 
 	pool->name = kstrndup(name, KNAV_NAME_SIZE - 1, GFP_KERNEL);
-	pool->kdev = kdev;
-	pool->dev = kdev->dev;
+	pool->kdev = knav_qdev;
+	pool->dev = knav_qdev->dev;
 
 	mutex_lock(&knav_dev_lock);
 
 	if (num_desc > (region->num_desc - region->used_desc)) {
-		dev_err(kdev->dev, "out of descs in region(%d) for pool(%s)\n",
+		dev_err(knav_qdev->dev, "out of descs in region(%d) for pool(%s)\n",
 			region_id, name);
 		ret = -ENOMEM;
 		goto err_unlock;
@@ -827,10 +827,10 @@ void *knav_pool_create(const char *name,
 		pool->num_desc = num_desc;
 		pool->region_offset = last_offset;
 		region->used_desc += num_desc;
-		list_add_tail(&pool->list, &kdev->pools);
+		list_add_tail(&pool->list, &knav_qdev->pools);
 		list_add_tail(&pool->region_inst, node);
 	} else {
-		dev_err(kdev->dev, "pool(%s) create failed: fragmented desc pool in region(%d)\n",
+		dev_err(knav_qdev->dev, "pool(%s) create failed: fragmented desc pool in region(%d)\n",
 			name, region_id);
 		ret = -ENOMEM;
 		goto err_unlock;
@@ -844,7 +844,7 @@ void *knav_pool_create(const char *name,
 	mutex_unlock(&knav_dev_lock);
 err:
 	kfree(pool->name);
-	devm_kfree(kdev->dev, pool);
+	devm_kfree(knav_qdev->dev, pool);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(knav_pool_create);
@@ -872,7 +872,7 @@ void knav_pool_destroy(void *ph)
 
 	mutex_unlock(&knav_dev_lock);
 	kfree(pool->name);
-	devm_kfree(kdev->dev, pool);
+	devm_kfree(knav_qdev->dev, pool);
 }
 EXPORT_SYMBOL_GPL(knav_pool_destroy);
 
@@ -1683,7 +1683,7 @@ static inline struct knav_qmgr_info *knav_find_qmgr(unsigned id)
 {
 	struct knav_qmgr_info *qmgr;
 
-	for_each_qmgr(kdev, qmgr) {
+	for_each_qmgr(knav_qdev, qmgr) {
 		if ((id >= qmgr->start_queue) &&
 		    (id < qmgr->start_queue + qmgr->num_queues))
 			return qmgr;
@@ -1775,22 +1775,22 @@ static int knav_queue_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	kdev = devm_kzalloc(dev, sizeof(struct knav_device), GFP_KERNEL);
-	if (!kdev) {
+	knav_qdev = devm_kzalloc(dev, sizeof(struct knav_device), GFP_KERNEL);
+	if (!knav_qdev) {
 		dev_err(dev, "memory allocation failed\n");
 		return -ENOMEM;
 	}
 
 	if (device_get_match_data(dev))
-		kdev->version = QMSS_66AK2G;
+		knav_qdev->version = QMSS_66AK2G;
 
-	platform_set_drvdata(pdev, kdev);
-	kdev->dev = dev;
-	INIT_LIST_HEAD(&kdev->queue_ranges);
-	INIT_LIST_HEAD(&kdev->qmgrs);
-	INIT_LIST_HEAD(&kdev->pools);
-	INIT_LIST_HEAD(&kdev->regions);
-	INIT_LIST_HEAD(&kdev->pdsps);
+	platform_set_drvdata(pdev, knav_qdev);
+	knav_qdev->dev = dev;
+	INIT_LIST_HEAD(&knav_qdev->queue_ranges);
+	INIT_LIST_HEAD(&knav_qdev->qmgrs);
+	INIT_LIST_HEAD(&knav_qdev->pools);
+	INIT_LIST_HEAD(&knav_qdev->regions);
+	INIT_LIST_HEAD(&knav_qdev->pdsps);
 
 	pm_runtime_enable(&pdev->dev);
 	ret = pm_runtime_resume_and_get(&pdev->dev);
@@ -1805,31 +1805,31 @@ static int knav_queue_probe(struct platform_device *pdev)
 		ret = -ENODEV;
 		goto err;
 	}
-	kdev->base_id    = temp[0];
-	kdev->num_queues = temp[1];
+	knav_qdev->base_id    = temp[0];
+	knav_qdev->num_queues = temp[1];
 
 	/* Initialize queue managers using device tree configuration */
-	ret = knav_queue_init_qmgrs(kdev, node);
+	ret = knav_queue_init_qmgrs(knav_qdev, node);
 	if (ret)
 		goto err;
 
 	/* get pdsp configuration values from device tree */
-	ret = knav_queue_setup_pdsps(kdev, node);
+	ret = knav_queue_setup_pdsps(knav_qdev, node);
 	if (ret)
 		goto err;
 
 	/* get usable queue range values from device tree */
-	ret = knav_setup_queue_pools(kdev, node);
+	ret = knav_setup_queue_pools(knav_qdev, node);
 	if (ret)
 		goto err;
 
-	ret = knav_get_link_ram(kdev, "linkram0", &kdev->link_rams[0]);
+	ret = knav_get_link_ram(knav_qdev, "linkram0", &knav_qdev->link_rams[0]);
 	if (ret) {
-		dev_err(kdev->dev, "could not setup linking ram\n");
+		dev_err(knav_qdev->dev, "could not setup linking ram\n");
 		goto err;
 	}
 
-	ret = knav_get_link_ram(kdev, "linkram1", &kdev->link_rams[1]);
+	ret = knav_get_link_ram(knav_qdev, "linkram1", &knav_qdev->link_rams[1]);
 	if (ret) {
 		/*
 		 * nothing really, we have one linking ram already, so we just
@@ -1837,15 +1837,15 @@ static int knav_queue_probe(struct platform_device *pdev)
 		 */
 	}
 
-	ret = knav_queue_setup_link_ram(kdev);
+	ret = knav_queue_setup_link_ram(knav_qdev);
 	if (ret)
 		goto err;
 
-	ret = knav_queue_setup_regions(kdev, node);
+	ret = knav_queue_setup_regions(knav_qdev, node);
 	if (ret)
 		goto err;
 
-	ret = knav_queue_init_queues(kdev);
+	ret = knav_queue_init_queues(knav_qdev);
 	if (ret < 0) {
 		dev_err(dev, "hwqueue initialization failed\n");
 		goto err;
@@ -1857,9 +1857,9 @@ static int knav_queue_probe(struct platform_device *pdev)
 	return 0;
 
 err:
-	knav_queue_stop_pdsps(kdev);
-	knav_queue_free_regions(kdev);
-	knav_free_queue_ranges(kdev);
+	knav_queue_stop_pdsps(knav_qdev);
+	knav_queue_free_regions(knav_qdev);
+	knav_free_queue_ranges(knav_qdev);
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	return ret;
-- 
2.47.0



  parent reply	other threads:[~2026-05-12 17:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 17:06 [PATCH V2 00/11] soc: ti: keystone/k3 navigator queue/dma/ringacc cleanups Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 01/11] soc: ti: knav_qmss: Remove remaining redundant ENOMEM printks Nishanth Menon
2026-05-12 17:06 ` Nishanth Menon [this message]
2026-05-12 17:06 ` [PATCH V2 03/11] soc: ti: knav_qmss: Inline lockdep condition in for_each_handle_rcu Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 04/11] soc: ti: knav_qmss: Fix kernel-doc Return: tags Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 05/11] soc: ti: knav_qmss: Use %pe to print PTR_ERR() Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 06/11] soc: ti: knav_qmss: Fix __iomem annotations and __be32 type Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 07/11] soc: ti: knav_qmss_acc: Fix kernel-doc Return: tag Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 08/11] soc: ti: knav_dma: Remove unused DMA_PRIO_MASK macro Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 09/11] soc: ti: knav_dma: Remove dead check on unsigned args.args[0] Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 10/11] soc: ti: knav_dma: Use IOMEM_ERR_PTR() in pktdma_get_regs() Nishanth Menon
2026-05-12 17:06 ` [PATCH V2 11/11] soc: ti: k3-ringacc: Use str_enabled_disabled() helper Nishanth Menon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260512170623.3174416-3-nm@ti.com \
    --to=nm@ti.com \
    --cc=afd@ti.com \
    --cc=justinstitt@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=ssantosh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.