Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwlock-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux

Pull hwspinlock updates from Bjorn Andersson:
"Some code cleanup for the OMAP hwspinlock driver"

* tag 'hwlock-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
hwspinlock: omap: Use index to get hwspinlock pointer
hwspinlock: omap: Use devm_hwspin_lock_register() helper
hwspinlock: omap: Use devm_pm_runtime_enable() helper
hwspinlock: omap: Remove unneeded check for OF node

+10 -47
+10 -47
drivers/hwspinlock/omap_hwspinlock.c
··· 74 74 75 75 static int omap_hwspinlock_probe(struct platform_device *pdev) 76 76 { 77 - struct device_node *node = pdev->dev.of_node; 78 77 struct hwspinlock_device *bank; 79 - struct hwspinlock *hwlock; 80 78 void __iomem *io_base; 81 79 int num_locks, i, ret; 82 80 /* Only a single hwspinlock block device is supported */ 83 81 int base_id = 0; 84 - 85 - if (!node) 86 - return -ENODEV; 87 82 88 83 io_base = devm_platform_ioremap_resource(pdev, 0); 89 84 if (IS_ERR(io_base)) ··· 88 93 * make sure the module is enabled and clocked before reading 89 94 * the module SYSSTATUS register 90 95 */ 91 - pm_runtime_enable(&pdev->dev); 96 + devm_pm_runtime_enable(&pdev->dev); 92 97 ret = pm_runtime_resume_and_get(&pdev->dev); 93 98 if (ret < 0) 94 - goto runtime_err; 99 + return ret; 95 100 96 101 /* Determine number of locks */ 97 102 i = readl(io_base + SYSSTATUS_OFFSET); ··· 103 108 */ 104 109 ret = pm_runtime_put(&pdev->dev); 105 110 if (ret < 0) 106 - goto runtime_err; 111 + return ret; 107 112 108 113 /* one of the four lsb's must be set, and nothing else */ 109 - if (hweight_long(i & 0xf) != 1 || i > 8) { 110 - ret = -EINVAL; 111 - goto runtime_err; 112 - } 114 + if (hweight_long(i & 0xf) != 1 || i > 8) 115 + return -EINVAL; 113 116 114 117 num_locks = i * 32; /* actual number of locks in this device */ 115 118 116 119 bank = devm_kzalloc(&pdev->dev, struct_size(bank, lock, num_locks), 117 120 GFP_KERNEL); 118 - if (!bank) { 119 - ret = -ENOMEM; 120 - goto runtime_err; 121 - } 121 + if (!bank) 122 + return -ENOMEM; 122 123 123 - platform_set_drvdata(pdev, bank); 124 + for (i = 0; i < num_locks; i++) 125 + bank->lock[i].priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; 124 126 125 - for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) 126 - hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; 127 - 128 - ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, 127 + return devm_hwspin_lock_register(&pdev->dev, bank, &omap_hwspinlock_ops, 129 128 base_id, num_locks); 130 - if (ret) 131 - goto runtime_err; 132 - 133 - dev_dbg(&pdev->dev, "Registered %d locks with HwSpinlock core\n", 134 - num_locks); 135 - 136 - return 0; 137 - 138 - runtime_err: 139 - pm_runtime_disable(&pdev->dev); 140 - return ret; 141 - } 142 - 143 - static void omap_hwspinlock_remove(struct platform_device *pdev) 144 - { 145 - struct hwspinlock_device *bank = platform_get_drvdata(pdev); 146 - int ret; 147 - 148 - ret = hwspin_lock_unregister(bank); 149 - if (ret) { 150 - dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret); 151 - return; 152 - } 153 - 154 - pm_runtime_disable(&pdev->dev); 155 129 } 156 130 157 131 static const struct of_device_id omap_hwspinlock_of_match[] = { ··· 133 169 134 170 static struct platform_driver omap_hwspinlock_driver = { 135 171 .probe = omap_hwspinlock_probe, 136 - .remove_new = omap_hwspinlock_remove, 137 172 .driver = { 138 173 .name = "omap_hwspinlock", 139 174 .of_match_table = omap_hwspinlock_of_match,