• Home
  • Raw
  • Download

Lines Matching refs:qh

57 #define for_each_handle_rcu(qh, inst)				\  argument
58 list_for_each_entry_rcu(qh, &inst->handles, list, \
86 struct knav_queue *qh; in knav_queue_notify() local
92 for_each_handle_rcu(qh, inst) { in knav_queue_notify()
93 if (atomic_read(&qh->notifier_enabled) <= 0) in knav_queue_notify()
95 if (WARN_ON(!qh->notifier_fn)) in knav_queue_notify()
97 this_cpu_inc(qh->stats->notifies); in knav_queue_notify()
98 qh->notifier_fn(qh->notifier_fn_arg); in knav_queue_notify()
218 struct knav_queue *qh; in __knav_queue_open() local
222 qh = devm_kzalloc(inst->kdev->dev, sizeof(*qh), GFP_KERNEL); in __knav_queue_open()
223 if (!qh) in __knav_queue_open()
226 qh->stats = alloc_percpu(struct knav_queue_stats); in __knav_queue_open()
227 if (!qh->stats) { in __knav_queue_open()
232 qh->flags = flags; in __knav_queue_open()
233 qh->inst = inst; in __knav_queue_open()
235 qh->reg_push = &inst->qmgr->reg_push[id]; in __knav_queue_open()
236 qh->reg_pop = &inst->qmgr->reg_pop[id]; in __knav_queue_open()
237 qh->reg_peek = &inst->qmgr->reg_peek[id]; in __knav_queue_open()
250 list_add_tail_rcu(&qh->list, &inst->handles); in __knav_queue_open()
251 return qh; in __knav_queue_open()
254 if (qh->stats) in __knav_queue_open()
255 free_percpu(qh->stats); in __knav_queue_open()
256 devm_kfree(inst->kdev->dev, qh); in __knav_queue_open()
264 struct knav_queue *qh; in knav_queue_open_by_id() local
268 qh = ERR_PTR(-ENODEV); in knav_queue_open_by_id()
273 qh = ERR_PTR(-EEXIST); in knav_queue_open_by_id()
277 qh = ERR_PTR(-EBUSY); in knav_queue_open_by_id()
282 qh = __knav_queue_open(inst, name, flags); in knav_queue_open_by_id()
287 return qh; in knav_queue_open_by_id()
294 struct knav_queue *qh = ERR_PTR(-EINVAL); in knav_queue_open_by_type() local
306 qh = __knav_queue_open(inst, name, flags); in knav_queue_open_by_type()
312 return qh; in knav_queue_open_by_type()
323 static int knav_queue_enable_notifier(struct knav_queue *qh) in knav_queue_enable_notifier() argument
325 struct knav_queue_inst *inst = qh->inst; in knav_queue_enable_notifier()
328 if (WARN_ON(!qh->notifier_fn)) in knav_queue_enable_notifier()
332 first = (atomic_inc_return(&qh->notifier_enabled) == 1); in knav_queue_enable_notifier()
344 static int knav_queue_disable_notifier(struct knav_queue *qh) in knav_queue_disable_notifier() argument
346 struct knav_queue_inst *inst = qh->inst; in knav_queue_disable_notifier()
349 last = (atomic_dec_return(&qh->notifier_enabled) == 0); in knav_queue_disable_notifier()
360 static int knav_queue_set_notifier(struct knav_queue *qh, in knav_queue_set_notifier() argument
363 knav_queue_notify_fn old_fn = qh->notifier_fn; in knav_queue_set_notifier()
368 if (!(qh->inst->range->flags & (RANGE_HAS_ACCUMULATOR | RANGE_HAS_IRQ))) in knav_queue_set_notifier()
372 knav_queue_disable_notifier(qh); in knav_queue_set_notifier()
374 qh->notifier_fn = cfg->fn; in knav_queue_set_notifier()
375 qh->notifier_fn_arg = cfg->fn_arg; in knav_queue_set_notifier()
378 knav_queue_enable_notifier(qh); in knav_queue_set_notifier()
421 struct knav_queue *qh = qhandle; in knav_queue_get_count() local
422 struct knav_queue_inst *inst = qh->inst; in knav_queue_get_count()
424 return readl_relaxed(&qh->reg_peek[0].entry_count) + in knav_queue_get_count()
432 struct knav_queue *qh; in knav_queue_debug_show_instance() local
445 for_each_handle_rcu(qh, inst) { in knav_queue_debug_show_instance()
447 pushes += per_cpu_ptr(qh->stats, cpu)->pushes; in knav_queue_debug_show_instance()
448 pops += per_cpu_ptr(qh->stats, cpu)->pops; in knav_queue_debug_show_instance()
449 push_errors += per_cpu_ptr(qh->stats, cpu)->push_errors; in knav_queue_debug_show_instance()
450 pop_errors += per_cpu_ptr(qh->stats, cpu)->pop_errors; in knav_queue_debug_show_instance()
451 notifies += per_cpu_ptr(qh->stats, cpu)->notifies; in knav_queue_debug_show_instance()
455 qh, in knav_queue_debug_show_instance()
458 knav_queue_get_count(qh), in knav_queue_debug_show_instance()
502 static int knav_queue_flush(struct knav_queue *qh) in knav_queue_flush() argument
504 struct knav_queue_inst *inst = qh->inst; in knav_queue_flush()
529 struct knav_queue *qh = ERR_PTR(-EINVAL); in knav_queue_open() local
535 qh = knav_queue_open_by_type(name, id, flags); in knav_queue_open()
539 qh = knav_queue_open_by_id(name, id, flags); in knav_queue_open()
542 return qh; in knav_queue_open()
552 struct knav_queue *qh = qhandle; in knav_queue_close() local
553 struct knav_queue_inst *inst = qh->inst; in knav_queue_close()
555 while (atomic_read(&qh->notifier_enabled) > 0) in knav_queue_close()
556 knav_queue_disable_notifier(qh); in knav_queue_close()
559 list_del_rcu(&qh->list); in knav_queue_close()
568 free_percpu(qh->stats); in knav_queue_close()
569 devm_kfree(inst->kdev->dev, qh); in knav_queue_close()
584 struct knav_queue *qh = qhandle; in knav_queue_device_control() local
590 ret = qh->inst->kdev->base_id + qh->inst->id; in knav_queue_device_control()
594 ret = knav_queue_flush(qh); in knav_queue_device_control()
599 ret = knav_queue_set_notifier(qh, cfg); in knav_queue_device_control()
603 ret = knav_queue_enable_notifier(qh); in knav_queue_device_control()
607 ret = knav_queue_disable_notifier(qh); in knav_queue_device_control()
611 ret = knav_queue_get_count(qh); in knav_queue_device_control()
636 struct knav_queue *qh = qhandle; in knav_queue_push() local
640 writel_relaxed(val, &qh->reg_push[0].ptr_size_thresh); in knav_queue_push()
642 this_cpu_inc(qh->stats->pushes); in knav_queue_push()
656 struct knav_queue *qh = qhandle; in knav_queue_pop() local
657 struct knav_queue_inst *inst = qh->inst; in knav_queue_pop()
671 val = readl_relaxed(&qh->reg_pop[0].ptr_size_thresh); in knav_queue_pop()
680 this_cpu_inc(qh->stats->pops); in knav_queue_pop()