From patchwork Thu Feb 8 16:51:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 772193 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FDBF2033E; Thu, 8 Feb 2024 16:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411084; cv=none; b=pVdloxg7W3vsk9k9l11G2WQYp6+6kYBoNqyTXzIpDYpfTxZKLzNfVOGmGIbkAIB1on/iWTqCJBd0L86i6oNq3LY5lE2xM3bOEsd/weK0FjtdJGLwgDewcAx0pp6QsnaX7DW5kscyTCfojkOwiCmU8nWevI8ism7kLlW6ceG5Pbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411084; c=relaxed/simple; bh=SzcvmT0u+d+mOegkatFJAAaI6odzW0ax7/YjwwvrAw4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=hKpZAalIwsefhQCA+SkC/fCcL/jhrhD/MYvI1Z832j8dnej9Dt/iBeTUwcOAmhO2r8vLzezp8NGOzszNN9hHxWZgt4ecRI2/Qfm0uIJtlKQAqntNXt28c/HeuE4f9NmGCuo+O0o3IOSYKdi97dPU3Mr4kLRP5+6L6AjUFKMo5Ic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=xp6zcSk2; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="xp6zcSk2" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418GpGIe012008; Thu, 8 Feb 2024 10:51:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411076; bh=7eJWi6eNYuFYPK/LARry4zNJsatwYYOpsn8tijlRXkA=; h=From:To:CC:Subject:Date; b=xp6zcSk287TfpQJP+nHMwWIh4Bv6U2ezCzrOkuJ7UZOpTzq49YQtgDct55SFYcdsO 0VbF8vVxkwcFbt3dPuYmsUh1YykJwLToTG+i5JoUFVxoVYm4fTQaLgV7WwaSHL6YGk uZO5asrzq/2jkriG7FMB7o1ELy8TG83XD5XL3s4E= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418GpGfk041134 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 10:51:16 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 8 Feb 2024 10:51:15 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 418GpFwC063394; Thu, 8 Feb 2024 10:51:15 -0600 From: Andrew Davis To: Bjorn Andersson , Baolin Wang CC: , , , Andrew Davis Subject: [PATCH v2 1/4] hwspinlock: omap: Remove unneeded check for OF node Date: Thu, 8 Feb 2024 10:51:11 -0600 Message-ID: <20240208165114.63148-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 We do not use the OF node anymore, nor does it matter how we got to probe, so remove the check for of_node. Signed-off-by: Andrew Davis --- drivers/hwspinlock/omap_hwspinlock.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index a9fd9ca45f2a8..cca55143d24d4 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -74,7 +74,6 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = { static int omap_hwspinlock_probe(struct platform_device *pdev) { - struct device_node *node = pdev->dev.of_node; struct hwspinlock_device *bank; struct hwspinlock *hwlock; void __iomem *io_base; @@ -82,9 +81,6 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) /* Only a single hwspinlock block device is supported */ int base_id = 0; - if (!node) - return -ENODEV; - io_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(io_base)) return PTR_ERR(io_base); From patchwork Thu Feb 8 16:51:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 771124 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21F83823D4; Thu, 8 Feb 2024 16:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411091; cv=none; b=TjhXLwIikWIIOm32lTwbgGq5WqkvSklFdPHfeFBW7+2pnnKmtK+/M4bMPDH7woPZUuk3RB7dq8qNiZfDmVGR0CMDM2vtSKLwzEZ1xf1mmlmasZSUiSASi5gZYEL9sb+w51FEayV4RaWYyRIN+oYT3GCf9tDsD8EhYvQ5IZ/ol0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411091; c=relaxed/simple; bh=/bgoFQj8jLPHiXib2qrTtT2gzomVqVTRO7+L5T8TMP0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f5WcDMLZN4fIDxKBYhMtM4CrY5QlXJzfilb61jFDUqwHhHvauxlbfpSjBbbgWFVYDN4cjugMOwqrZbVdJLdoPb2Mby2Pjn0gjd+qt+Gh17OAQSGNeqtTQFaZZ1RQejhyNmJWmneGf+vQeTT7LAFJ/wDpQNJi7Ey6JfW9UnP0+kI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=W94LrZvj; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="W94LrZvj" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418GpGZl048968; Thu, 8 Feb 2024 10:51:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411076; bh=XgXkhbX2RXhlkR64jmiumGzBiNiAvpSx9IeblZh65dQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=W94LrZvjxTwSugcfGEB7lJIzvj3Bj+caEnV2WbbOxhPLfGdEoI4twDuwW+MfzkQTn aNo+xk/SxMNxvSH76Atll2dieR1/ByTTdamKH2ng0ip5mpdrqIKochZrOxoXeKOHUi ajxjXv5ATEo/riafph9Awy3GDxxI80btQc8hbzwQ= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418GpGMv028648 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 10:51:16 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 418GpFwD063394; Thu, 8 Feb 2024 10:51:16 -0600 From: Andrew Davis To: Bjorn Andersson , Baolin Wang CC: , , , Andrew Davis Subject: [PATCH v2 2/4] hwspinlock: omap: Use devm_pm_runtime_enable() helper Date: Thu, 8 Feb 2024 10:51:12 -0600 Message-ID: <20240208165114.63148-2-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208165114.63148-1-afd@ti.com> References: <20240208165114.63148-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This disables runtime PM on module exit automatically for us, currently we manually disable runtime PM which can be error-prone if not done in the right order or missed in some exit path. This also allows us to simplify the probe exit path and remove callbacks. Do that here. While here, as we can now return right after registering our hwspinlock, simply return directly and remove the extra debug message. Signed-off-by: Andrew Davis --- Changes for v2: - Return directly from register as suggested on v1 - Clarify commit message drivers/hwspinlock/omap_hwspinlock.c | 33 +++++++--------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index cca55143d24d4..3bd3ffab92100 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -89,10 +89,10 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) * make sure the module is enabled and clocked before reading * the module SYSSTATUS register */ - pm_runtime_enable(&pdev->dev); + devm_pm_runtime_enable(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) - goto runtime_err; + return ret; /* Determine number of locks */ i = readl(io_base + SYSSTATUS_OFFSET); @@ -104,41 +104,26 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) */ ret = pm_runtime_put(&pdev->dev); if (ret < 0) - goto runtime_err; + return ret; /* one of the four lsb's must be set, and nothing else */ - if (hweight_long(i & 0xf) != 1 || i > 8) { - ret = -EINVAL; - goto runtime_err; - } + if (hweight_long(i & 0xf) != 1 || i > 8) + return -EINVAL; num_locks = i * 32; /* actual number of locks in this device */ bank = devm_kzalloc(&pdev->dev, struct_size(bank, lock, num_locks), GFP_KERNEL); - if (!bank) { - ret = -ENOMEM; - goto runtime_err; - } + if (!bank) + return -ENOMEM; platform_set_drvdata(pdev, bank); for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; - ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, + return hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, base_id, num_locks); - if (ret) - goto runtime_err; - - dev_dbg(&pdev->dev, "Registered %d locks with HwSpinlock core\n", - num_locks); - - return 0; - -runtime_err: - pm_runtime_disable(&pdev->dev); - return ret; } static void omap_hwspinlock_remove(struct platform_device *pdev) @@ -151,8 +136,6 @@ static void omap_hwspinlock_remove(struct platform_device *pdev) dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret); return; } - - pm_runtime_disable(&pdev->dev); } static const struct of_device_id omap_hwspinlock_of_match[] = { From patchwork Thu Feb 8 16:51:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 772192 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D8917FBCA; Thu, 8 Feb 2024 16:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411086; cv=none; b=hRNSvB2xL3DFn2W4SkgUE5hIH+VqduV2VqeYqdigWCxXcfpljP3nq0ZqJ/PHcraNGCJba5zJG6wLTgFz6Fde60lvitXwR9jkoS3zIsq+7+JJWfuWrR0gIww5zg09Dm1G74px5yEzPWhxqC4pliPRrhQjAm2P5n5G5edEyZiE2Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411086; c=relaxed/simple; bh=tIaW3xLuqH8lm17q2qqTiYMsh2SjIZu10Kn5Jet9CqY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UHJmx8Q7r6i+4KMwBB9i+sFwzXEAx5snrTI/nmR+1BHi23NZbdUMhom9nOKCUnXf9b1aiaeMx51LGgSIIl2yij3vnX7pyjfDiGvSxqUVnM+3cfhZuB2kweWTvld+vCGn6B2SVe1+nCss2Y/i6e9+V29kncxd/OEcQUBkoZQg8VE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=lHTrH5qw; arc=none smtp.client-ip=198.47.19.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="lHTrH5qw" Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418GpGTA002555; Thu, 8 Feb 2024 10:51:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411076; bh=djSA4+7Ibdz7Va5HFpgHql2bnc9z2IocCEFA1yBcywI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lHTrH5qwf6zZcD9wa8FJDcRIJs39q2djIwnzu2/c+Z1iMyY9ez4a0jOE0uUyXHzcF ysUjAs8xwz/C1/Bs+NrlWbXnDmB96OH23gSI41T+bNcjVlW1NPSUcayjr3NV+J1XzX qz+3Jb4qCTPtQp+ikRgg4lOYbZD5UiSC9/Zgv2Qo= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418GpGCC021887 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 10:51:16 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 8 Feb 2024 10:51:16 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 418GpFwE063394; Thu, 8 Feb 2024 10:51:16 -0600 From: Andrew Davis To: Bjorn Andersson , Baolin Wang CC: , , , Andrew Davis Subject: [PATCH v2 3/4] hwspinlock: omap: Use devm_hwspin_lock_register() helper Date: Thu, 8 Feb 2024 10:51:13 -0600 Message-ID: <20240208165114.63148-3-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208165114.63148-1-afd@ti.com> References: <20240208165114.63148-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This will unregister the HW spinlock on module exit automatically for us, currently we manually unregister which can be error-prone if not done in the right order. This also allows us to remove the remove callback. Do that here. Signed-off-by: Andrew Davis --- Changes for v2: - Clarify commit message drivers/hwspinlock/omap_hwspinlock.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index 3bd3ffab92100..fe73da80018b1 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -117,27 +117,13 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) if (!bank) return -ENOMEM; - platform_set_drvdata(pdev, bank); - for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; - return hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, + return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops, base_id, num_locks); } -static void omap_hwspinlock_remove(struct platform_device *pdev) -{ - struct hwspinlock_device *bank = platform_get_drvdata(pdev); - int ret; - - ret = hwspin_lock_unregister(bank); - if (ret) { - dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret); - return; - } -} - static const struct of_device_id omap_hwspinlock_of_match[] = { { .compatible = "ti,omap4-hwspinlock", }, { .compatible = "ti,am64-hwspinlock", }, @@ -148,7 +134,6 @@ MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match); static struct platform_driver omap_hwspinlock_driver = { .probe = omap_hwspinlock_probe, - .remove_new = omap_hwspinlock_remove, .driver = { .name = "omap_hwspinlock", .of_match_table = omap_hwspinlock_of_match, From patchwork Thu Feb 8 16:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 771125 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAE917EF16; Thu, 8 Feb 2024 16:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411084; cv=none; b=oe1y3spIXWknpdtkHwWifoI0fAdufHJdGdAk/Det7o4IBvDdb4AHTkBY/LoNMWvo4065phOE/sbDCf5cazKDZ48/RJ0Uo6MD/ghl8XCFsZKW67IGeP6cUwaGQsELXSMYoTLOCmjouOjGW0KeKJtQAmRDRYm3IxrvcjbIDC5r9Ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411084; c=relaxed/simple; bh=gjSKd6uTc8kBAKclYk3S89l34EyVOwSZa1YaZh1NZPA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HzbeScrRSExUH4EOt4hwqXKN+ozlqSSAjsYIg2PO9xnYHO8j77/KVClXFGMBksDEPUeW7nkynUwwN1mVoBGAT8Pe9M4ts3tk+sNqZ76RpQnPYXIz0k8Ae/M3QeE9CGqyf4oEPlqzWYBgVgfwcx1ZuXka9lDAQET9juXGmA+IJJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=D0Jgklj4; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="D0Jgklj4" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 418GpHrd012029; Thu, 8 Feb 2024 10:51:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411077; bh=xCGFMX89R1mGJW8/Y6A+fGzHuBoxs28i4x77PmX5znQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=D0Jgklj4yGloL1h3M4KVZTz9AMrS/ihpMI4+HTJcBfZt7CB76YcKrqZ7tQw3Dp5gY WxdGg47uWuZ0f2yI65vcmgTqYIMKqmcKoEalqvp5fi6aDllMvP/cj+LbvOZ9rIXAac u3RcOTtbnMCRvipPJVzEJam/0OIifgxU2+a7nNBs= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418GpHjQ041144 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 10:51:17 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 10:51:17 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 8 Feb 2024 10:51:17 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 418GpFwF063394; Thu, 8 Feb 2024 10:51:16 -0600 From: Andrew Davis To: Bjorn Andersson , Baolin Wang CC: , , , Andrew Davis Subject: [PATCH v2 4/4] hwspinlock: omap: Use index to get hwspinlock pointer Date: Thu, 8 Feb 2024 10:51:14 -0600 Message-ID: <20240208165114.63148-4-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208165114.63148-1-afd@ti.com> References: <20240208165114.63148-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 For loops with multiple initializers and increments are hard to read and reason about, simplify this by using the looping index to index into the hwspinlock array. Signed-off-by: Andrew Davis --- drivers/hwspinlock/omap_hwspinlock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index fe73da80018b1..27b47b8623c09 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c @@ -75,7 +75,6 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = { static int omap_hwspinlock_probe(struct platform_device *pdev) { struct hwspinlock_device *bank; - struct hwspinlock *hwlock; void __iomem *io_base; int num_locks, i, ret; /* Only a single hwspinlock block device is supported */ @@ -117,8 +116,8 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) if (!bank) return -ENOMEM; - for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) - hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; + for (i = 0; i < num_locks; i++) + bank->lock[i].priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops, base_id, num_locks);