Skip to content

Commit 8781ec8

Browse files
glneoandersson
authored andcommitted
hwspinlock: omap: Use devm_hwspin_lock_register() helper
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 <afd@ti.com> Link: https://lore.kernel.org/r/20240208165114.63148-3-afd@ti.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent 25f7d74 commit 8781ec8

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

drivers/hwspinlock/omap_hwspinlock.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,27 +117,13 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
117117
if (!bank)
118118
return -ENOMEM;
119119

120-
platform_set_drvdata(pdev, bank);
121-
122120
for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++)
123121
hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
124122

125-
return hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
123+
return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops,
126124
base_id, num_locks);
127125
}
128126

129-
static void omap_hwspinlock_remove(struct platform_device *pdev)
130-
{
131-
struct hwspinlock_device *bank = platform_get_drvdata(pdev);
132-
int ret;
133-
134-
ret = hwspin_lock_unregister(bank);
135-
if (ret) {
136-
dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret);
137-
return;
138-
}
139-
}
140-
141127
static const struct of_device_id omap_hwspinlock_of_match[] = {
142128
{ .compatible = "ti,omap4-hwspinlock", },
143129
{ .compatible = "ti,am64-hwspinlock", },
@@ -148,7 +134,6 @@ MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);
148134

149135
static struct platform_driver omap_hwspinlock_driver = {
150136
.probe = omap_hwspinlock_probe,
151-
.remove_new = omap_hwspinlock_remove,
152137
.driver = {
153138
.name = "omap_hwspinlock",
154139
.of_match_table = omap_hwspinlock_of_match,

0 commit comments

Comments
 (0)