Searched refs:hwlock (Results 1 - 16 of 16) sorted by relevance

/linux-4.4.14/drivers/hwspinlock/
H A Dhwspinlock_core.c66 * @hwlock: an hwspinlock which we want to trylock
89 int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) __hwspin_trylock() argument
93 BUG_ON(!hwlock); __hwspin_trylock()
110 ret = spin_trylock_irqsave(&hwlock->lock, *flags); __hwspin_trylock()
112 ret = spin_trylock_irq(&hwlock->lock); __hwspin_trylock()
114 ret = spin_trylock(&hwlock->lock); __hwspin_trylock()
121 ret = hwlock->bank->ops->trylock(hwlock); __hwspin_trylock()
123 /* if hwlock is already taken, undo spin_trylock_* and exit */ __hwspin_trylock()
126 spin_unlock_irqrestore(&hwlock->lock, *flags); __hwspin_trylock()
128 spin_unlock_irq(&hwlock->lock); __hwspin_trylock()
130 spin_unlock(&hwlock->lock); __hwspin_trylock()
153 * @hwlock: the hwspinlock to be locked
159 * This function locks the given @hwlock. If the @hwlock
174 * Returns 0 when the @hwlock was successfully taken, and an appropriate
175 * error code otherwise (most notably -ETIMEDOUT if the @hwlock is still
178 int __hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to, __hwspin_lock_timeout() argument
188 ret = __hwspin_trylock(hwlock, mode, flags); __hwspin_lock_timeout()
203 if (hwlock->bank->ops->relax) __hwspin_lock_timeout()
204 hwlock->bank->ops->relax(hwlock); __hwspin_lock_timeout()
213 * @hwlock: a previously-acquired hwspinlock which we want to unlock
219 * @hwlock must be already locked before calling this function: it is a bug
220 * to call unlock on a @hwlock that is already unlocked.
230 void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) __hwspin_unlock() argument
232 BUG_ON(!hwlock); __hwspin_unlock()
249 hwlock->bank->ops->unlock(hwlock); __hwspin_unlock()
253 spin_unlock_irqrestore(&hwlock->lock, *flags); __hwspin_unlock()
255 spin_unlock_irq(&hwlock->lock); __hwspin_unlock()
257 spin_unlock(&hwlock->lock); __hwspin_unlock()
264 * @hwlock_spec: hwlock specifier as found in the device tree
283 * @np: device node from which to request the specific hwlock
284 * @index: index of the hwlock in the list of values
298 struct hwspinlock *hwlock; of_hwspin_lock_get_id() local
304 ret = of_parse_phandle_with_args(np, "hwlocks", "#hwlock-cells", index, of_hwspin_lock_get_id()
313 hwlock = radix_tree_deref_slot(slot); of_hwspin_lock_get_id()
314 if (unlikely(!hwlock)) of_hwspin_lock_get_id()
316 if (radix_tree_is_indirect_ptr(hwlock)) { of_hwspin_lock_get_id()
321 if (hwlock->bank->dev->of_node == args.np) { of_hwspin_lock_get_id()
331 if (id < 0 || id >= hwlock->bank->num_locks) { of_hwspin_lock_get_id()
335 id += hwlock->bank->base_id; of_hwspin_lock_get_id()
343 static int hwspin_lock_register_single(struct hwspinlock *hwlock, int id) hwspin_lock_register_single() argument
350 ret = radix_tree_insert(&hwspinlock_tree, id, hwlock); hwspin_lock_register_single()
361 WARN_ON(tmp != hwlock); hwspin_lock_register_single()
370 struct hwspinlock *hwlock = NULL; hwspin_lock_unregister_single() local
382 hwlock = radix_tree_delete(&hwspinlock_tree, id); hwspin_lock_unregister_single()
383 if (!hwlock) { hwspin_lock_unregister_single()
390 return hwlock; hwspin_lock_unregister_single()
411 struct hwspinlock *hwlock; hwspin_lock_register() local
426 hwlock = &bank->lock[i]; hwspin_lock_register()
428 spin_lock_init(&hwlock->lock); hwspin_lock_register()
429 hwlock->bank = bank; hwspin_lock_register()
431 ret = hwspin_lock_register_single(hwlock, base_id + i); hwspin_lock_register()
458 struct hwspinlock *hwlock, *tmp; hwspin_lock_unregister() local
462 hwlock = &bank->lock[i]; hwspin_lock_unregister()
469 WARN_ON(tmp != hwlock); hwspin_lock_unregister()
486 static int __hwspin_lock_request(struct hwspinlock *hwlock) __hwspin_lock_request() argument
488 struct device *dev = hwlock->bank->dev; __hwspin_lock_request()
508 tmp = radix_tree_tag_clear(&hwspinlock_tree, hwlock_to_id(hwlock), __hwspin_lock_request()
512 WARN_ON(tmp != hwlock); __hwspin_lock_request()
519 * @hwlock: a valid hwspinlock instance
521 * Returns the id number of a given @hwlock, or -EINVAL if @hwlock is invalid.
523 int hwspin_lock_get_id(struct hwspinlock *hwlock) hwspin_lock_get_id() argument
525 if (!hwlock) { hwspin_lock_get_id()
526 pr_err("invalid hwlock\n"); hwspin_lock_get_id()
530 return hwlock_to_id(hwlock); hwspin_lock_get_id()
541 * id of a given hwlock, use hwspin_lock_get_id()).
549 struct hwspinlock *hwlock; hwspin_lock_request() local
555 ret = radix_tree_gang_lookup_tag(&hwspinlock_tree, (void **)&hwlock, hwspin_lock_request()
559 hwlock = NULL; hwspin_lock_request()
567 ret = __hwspin_lock_request(hwlock); hwspin_lock_request()
569 hwlock = NULL; hwspin_lock_request()
573 return hwlock; hwspin_lock_request()
592 struct hwspinlock *hwlock; hwspin_lock_request_specific() local
598 hwlock = radix_tree_lookup(&hwspinlock_tree, id); hwspin_lock_request_specific()
599 if (!hwlock) { hwspin_lock_request_specific()
605 WARN_ON(hwlock_to_id(hwlock) != id); hwspin_lock_request_specific()
611 hwlock = NULL; hwspin_lock_request_specific()
616 ret = __hwspin_lock_request(hwlock); hwspin_lock_request_specific()
618 hwlock = NULL; hwspin_lock_request_specific()
622 return hwlock; hwspin_lock_request_specific()
628 * @hwlock: the specific hwspinlock to free
630 * This function mark @hwlock as free again.
631 * Should only be called with an @hwlock that was retrieved from
638 int hwspin_lock_free(struct hwspinlock *hwlock) hwspin_lock_free() argument
644 if (!hwlock) { hwspin_lock_free()
645 pr_err("invalid hwlock\n"); hwspin_lock_free()
649 dev = hwlock->bank->dev; hwspin_lock_free()
653 ret = radix_tree_tag_get(&hwspinlock_tree, hwlock_to_id(hwlock), hwspin_lock_free()
656 dev_err(dev, "%s: hwlock is already free\n", __func__); hwspin_lock_free()
668 tmp = radix_tree_tag_set(&hwspinlock_tree, hwlock_to_id(hwlock), hwspin_lock_free()
672 WARN_ON(tmp != hwlock); hwspin_lock_free()
H A Dhwspinlock_internal.h70 static inline int hwlock_to_id(struct hwspinlock *hwlock) hwlock_to_id() argument
72 int local_id = hwlock - &hwlock->bank->lock[0]; hwlock_to_id()
74 return hwlock->bank->base_id + local_id; hwlock_to_id()
H A Dsirf_hwspinlock.c59 struct hwspinlock *hwlock; sirf_hwspinlock_probe() local
66 sizeof(*hwlock) * HW_SPINLOCK_NUMBER, GFP_KERNEL); sirf_hwspinlock_probe()
76 hwlock = &hwspin->bank.lock[idx]; sirf_hwspinlock_probe()
77 hwlock->priv = hwspin->io_base + HW_SPINLOCK_OFFSET(idx); sirf_hwspinlock_probe()
H A Domap_hwspinlock.c86 struct hwspinlock *hwlock; omap_hwspinlock_probe() local
135 bank = kzalloc(sizeof(*bank) + num_locks * sizeof(*hwlock), GFP_KERNEL); omap_hwspinlock_probe()
143 for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) omap_hwspinlock_probe()
144 hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; omap_hwspinlock_probe()
H A Du8500_hsem.c98 struct hwspinlock *hwlock; u8500_hsem_probe() local
122 bank = kzalloc(sizeof(*bank) + num_locks * sizeof(*hwlock), GFP_KERNEL); u8500_hsem_probe()
130 for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) u8500_hsem_probe()
131 hwlock->priv = io_base + HSEM_REGISTER_OFFSET + sizeof(u32) * i; u8500_hsem_probe()
/linux-4.4.14/include/linux/
H A Dhwspinlock.h69 int hwspin_lock_free(struct hwspinlock *hwlock);
71 int hwspin_lock_get_id(struct hwspinlock *hwlock);
102 static inline int hwspin_lock_free(struct hwspinlock *hwlock) hwspin_lock_free() argument
108 int __hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to, __hwspin_lock_timeout() argument
115 int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) __hwspin_trylock() argument
121 void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) __hwspin_unlock() argument
130 static inline int hwspin_lock_get_id(struct hwspinlock *hwlock) hwspin_lock_get_id() argument
139 * @hwlock: an hwspinlock which we want to trylock
151 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
154 int hwspin_trylock_irqsave(struct hwspinlock *hwlock, unsigned long *flags) hwspin_trylock_irqsave() argument
156 return __hwspin_trylock(hwlock, HWLOCK_IRQSTATE, flags); hwspin_trylock_irqsave()
161 * @hwlock: an hwspinlock which we want to trylock
171 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
173 static inline int hwspin_trylock_irq(struct hwspinlock *hwlock) hwspin_trylock_irq() argument
175 return __hwspin_trylock(hwlock, HWLOCK_IRQ, NULL); hwspin_trylock_irq()
180 * @hwlock: an hwspinlock which we want to trylock
191 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
193 static inline int hwspin_trylock(struct hwspinlock *hwlock) hwspin_trylock() argument
195 return __hwspin_trylock(hwlock, 0, NULL); hwspin_trylock()
200 * @hwlock: the hwspinlock to be locked
204 * This function locks the underlying @hwlock. If the @hwlock
212 * Returns 0 when the @hwlock was successfully taken, and an appropriate
213 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
216 static inline int hwspin_lock_timeout_irqsave(struct hwspinlock *hwlock, hwspin_lock_timeout_irqsave() argument
219 return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQSTATE, flags); hwspin_lock_timeout_irqsave()
224 * @hwlock: the hwspinlock to be locked
227 * This function locks the underlying @hwlock. If the @hwlock
235 * Returns 0 when the @hwlock was successfully taken, and an appropriate
236 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
240 int hwspin_lock_timeout_irq(struct hwspinlock *hwlock, unsigned int to) hwspin_lock_timeout_irq() argument
242 return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQ, NULL); hwspin_lock_timeout_irq()
247 * @hwlock: the hwspinlock to be locked
250 * This function locks the underlying @hwlock. If the @hwlock
260 * Returns 0 when the @hwlock was successfully taken, and an appropriate
261 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
265 int hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to) hwspin_lock_timeout() argument
267 return __hwspin_lock_timeout(hwlock, to, 0, NULL); hwspin_lock_timeout()
272 * @hwlock: a previously-acquired hwspinlock which we want to unlock
279 * @hwlock must be already locked before calling this function: it is a bug
280 * to call unlock on a @hwlock that is already unlocked.
282 static inline void hwspin_unlock_irqrestore(struct hwspinlock *hwlock, hwspin_unlock_irqrestore() argument
285 __hwspin_unlock(hwlock, HWLOCK_IRQSTATE, flags); hwspin_unlock_irqrestore()
290 * @hwlock: a previously-acquired hwspinlock which we want to unlock
295 * @hwlock must be already locked (e.g. by hwspin_trylock_irq()) before
296 * calling this function: it is a bug to call unlock on a @hwlock that is
299 static inline void hwspin_unlock_irq(struct hwspinlock *hwlock) hwspin_unlock_irq() argument
301 __hwspin_unlock(hwlock, HWLOCK_IRQ, NULL); hwspin_unlock_irq()
306 * @hwlock: a previously-acquired hwspinlock which we want to unlock
311 * @hwlock must be already locked (e.g. by hwspin_trylock()) before calling
312 * this function: it is a bug to call unlock on a @hwlock that is already
315 static inline void hwspin_unlock(struct hwspinlock *hwlock) hwspin_unlock() argument
317 __hwspin_unlock(hwlock, 0, NULL); hwspin_unlock()
/linux-4.4.14/drivers/isdn/hardware/mISDN/
H A DmISDNisar.c213 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
215 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
230 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
242 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
271 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
282 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
302 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
324 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
342 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
348 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
369 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
376 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
399 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
401 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
404 spin_lock_irqsave(isar->hwlock, flags); load_firmware()
410 spin_unlock_irqrestore(isar->hwlock, flags); load_firmware()
1489 spin_lock_irqsave(ich->is->hwlock, flags); isar_l2l1()
1495 spin_unlock_irqrestore(ich->is->hwlock, flags); isar_l2l1()
1498 spin_lock_irqsave(ich->is->hwlock, flags); isar_l2l1()
1503 spin_unlock_irqrestore(ich->is->hwlock, flags); isar_l2l1()
1509 spin_lock_irqsave(ich->is->hwlock, flags); isar_l2l1()
1512 spin_unlock_irqrestore(ich->is->hwlock, flags); isar_l2l1()
1533 spin_lock_irqsave(ich->is->hwlock, flags); isar_l2l1()
1535 spin_unlock_irqrestore(ich->is->hwlock, flags); isar_l2l1()
1592 spin_lock_irqsave(ich->is->hwlock, flags); isar_bctrl()
1595 spin_unlock_irqrestore(ich->is->hwlock, flags); isar_bctrl()
H A DmISDNipac.c580 spin_lock_irqsave(isac->hwlock, flags); isac_l1hw()
586 spin_unlock_irqrestore(isac->hwlock, flags); isac_l1hw()
589 spin_unlock_irqrestore(isac->hwlock, flags); isac_l1hw()
614 spin_lock_irqsave(isac->hwlock, flags); isac_ctrl()
628 spin_unlock_irqrestore(isac->hwlock, flags); isac_ctrl()
650 spin_lock_irqsave(isac->hwlock, flags); isac_l1cmd()
652 spin_unlock_irqrestore(isac->hwlock, flags); isac_l1cmd()
655 spin_lock_irqsave(isac->hwlock, flags); isac_l1cmd()
657 spin_unlock_irqrestore(isac->hwlock, flags); isac_l1cmd()
660 spin_lock_irqsave(isac->hwlock, flags); isac_l1cmd()
667 spin_unlock_irqrestore(isac->hwlock, flags); isac_l1cmd()
685 spin_lock_irqsave(isac->hwlock, flags); isac_l1cmd()
687 spin_unlock_irqrestore(isac->hwlock, flags); isac_l1cmd()
734 spin_lock_irqsave(isac->hwlock, flags); dbusy_timer_handler()
752 spin_unlock_irqrestore(isac->hwlock, flags); dbusy_timer_handler()
1358 spin_lock_irqsave(hx->ip->hwlock, flags); hscx_l2l1()
1364 spin_unlock_irqrestore(hx->ip->hwlock, flags); hscx_l2l1()
1367 spin_lock_irqsave(hx->ip->hwlock, flags); hscx_l2l1()
1372 spin_unlock_irqrestore(hx->ip->hwlock, flags); hscx_l2l1()
1378 spin_lock_irqsave(hx->ip->hwlock, flags); hscx_l2l1()
1381 spin_unlock_irqrestore(hx->ip->hwlock, flags); hscx_l2l1()
1415 spin_lock_irqsave(hx->ip->hwlock, flags); hscx_bctrl()
1418 spin_unlock_irqrestore(hx->ip->hwlock, flags); hscx_bctrl()
H A Dipac.h32 spinlock_t *hwlock; /* lock HW access */ member in struct:isac_hw
73 spinlock_t *hwlock; /* lock HW access */ member in struct:ipac_hw
H A Dspeedfax.c387 card->isac.hwlock = &card->lock; setup_instance()
388 card->isar.hwlock = &card->lock; setup_instance()
H A Disar.h47 spinlock_t *hwlock; /* lock HW access */ member in struct:isar_hw
H A DmISDNinfineon.c916 card->ipac.isac.hwlock = &card->lock; setup_instance()
917 card->ipac.hwlock = &card->lock; setup_instance()
H A Davmfritz.c1052 card->isac.hwlock = &card->lock; setup_instance()
H A Dnetjet.c1025 card->isac.hwlock = &card->lock; setup_instance()
/linux-4.4.14/drivers/soc/qcom/
H A Dsmem.c230 * @hwlock: reference to a hwspinlock
239 struct hwspinlock *hwlock; member in struct:qcom_smem
404 ret = hwspin_lock_timeout_irqsave(__smem->hwlock, qcom_smem_alloc()
415 hwspin_unlock_irqrestore(__smem->hwlock, &flags); qcom_smem_alloc()
506 ret = hwspin_lock_timeout_irqsave(__smem->hwlock, qcom_smem_get()
517 hwspin_unlock_irqrestore(__smem->hwlock, &flags); qcom_smem_get()
744 dev_err(&pdev->dev, "failed to retrieve hwlock\n"); qcom_smem_probe()
748 smem->hwlock = hwspin_lock_request_specific(hwlock_id); qcom_smem_probe()
749 if (!smem->hwlock) qcom_smem_probe()
759 hwspin_lock_free(__smem->hwlock); qcom_smem_remove()
/linux-4.4.14/drivers/net/ethernet/micrel/
H A Dksz884x.c1405 * @hwlock: Spinlock to prevent hardware from accessing.
1430 spinlock_t hwlock; member in struct:dev_info
4755 spin_lock_irq(&hw_priv->hwlock); transmit_cleanup()
4789 spin_unlock_irq(&hw_priv->hwlock); transmit_cleanup()
4867 spin_lock_irq(&hw_priv->hwlock); netdev_tx()
4896 spin_unlock_irq(&hw_priv->hwlock); netdev_tx()
5195 spin_lock_irq(&hw_priv->hwlock); rx_proc_task()
5197 spin_unlock_irq(&hw_priv->hwlock); rx_proc_task()
5214 spin_lock_irq(&hw_priv->hwlock); tx_proc_task()
5216 spin_unlock_irq(&hw_priv->hwlock); tx_proc_task()
5253 spin_lock(&hw_priv->hwlock); netdev_intr()
5259 spin_unlock(&hw_priv->hwlock); netdev_intr()
5308 spin_unlock(&hw_priv->hwlock); netdev_intr()
7028 spin_lock_init(&hw_priv->hwlock); pcidev_init()

Completed in 434 milliseconds