Home
last modified time | relevance | path

Searched refs:counter (Results 1 – 25 of 1095) sorted by relevance

12345678910>>...44

/linux/drivers/net/ethernet/marvell/prestera/
H A Dprestera_counter.c50 static void prestera_counter_lock(struct prestera_counter *counter) in prestera_counter_lock() argument
52 mutex_lock(&counter->mtx); in prestera_counter_lock()
55 static void prestera_counter_unlock(struct prestera_counter *counter) in prestera_counter_unlock() argument
57 mutex_unlock(&counter->mtx); in prestera_counter_unlock()
89 prestera_counter_block_lookup_not_full(struct prestera_counter *counter, in prestera_counter_block_lookup_not_full() argument
94 prestera_counter_lock(counter); in prestera_counter_block_lookup_not_full()
95 for (i = 0; i < counter->block_list_len; i++) { in prestera_counter_block_lookup_not_full()
96 if (counter->block_list[i] && in prestera_counter_block_lookup_not_full()
97 counter->block_list[i]->client == client && in prestera_counter_block_lookup_not_full()
98 !counter->block_list[i]->full && in prestera_counter_block_lookup_not_full()
[all …]
/linux/drivers/counter/
H A Dcounter-chrdev.c68 struct counter_device *const counter = filp->private_data; in counter_chrdev_read() local
72 if (!counter->ops) in counter_chrdev_read()
79 if (kfifo_is_empty(&counter->events)) { in counter_chrdev_read()
83 err = wait_event_interruptible(counter->events_wait, in counter_chrdev_read()
84 !kfifo_is_empty(&counter->events) || in counter_chrdev_read()
85 !counter->ops); in counter_chrdev_read()
88 if (!counter->ops) in counter_chrdev_read()
92 if (mutex_lock_interruptible(&counter->events_out_lock)) in counter_chrdev_read()
94 err = kfifo_to_user(&counter->events, buf, len, &copied); in counter_chrdev_read()
95 mutex_unlock(&counter->events_out_lock); in counter_chrdev_read()
[all …]
H A Dcounter-core.c31 struct counter_device counter; member
43 struct counter_device *const counter = in counter_device_release() local
46 counter_chrdev_remove(counter); in counter_device_release()
49 kfree(container_of(counter, struct counter_device_allochelper, counter)); in counter_device_release()
70 void *counter_priv(const struct counter_device *const counter) in counter_priv() argument
73 container_of(counter, struct counter_device_allochelper, counter); in counter_priv()
91 struct counter_device *counter; in counter_alloc() local
99 counter = &ch->counter; in counter_alloc()
100 dev = &counter->dev; in counter_alloc()
108 mutex_init(&counter->ops_exist_lock); in counter_alloc()
[all …]
H A Drz-mtu3-cnt.c97 static inline struct rz_mtu3_channel *rz_mtu3_get_ch(struct counter_device *counter, int id) in rz_mtu3_get_ch() argument
99 struct rz_mtu3_cnt *const priv = counter_priv(counter); in rz_mtu3_get_ch()
105 static bool rz_mtu3_is_counter_invalid(struct counter_device *counter, int id) in rz_mtu3_is_counter_invalid() argument
107 struct rz_mtu3_cnt *const priv = counter_priv(counter); in rz_mtu3_is_counter_invalid()
110 pm_runtime_get_sync(counter->parent); in rz_mtu3_is_counter_invalid()
112 pm_runtime_put(counter->parent); in rz_mtu3_is_counter_invalid()
123 static int rz_mtu3_lock_if_counter_is_valid(struct counter_device *counter, in rz_mtu3_lock_if_counter_is_valid() argument
135 if (rz_mtu3_is_counter_invalid(counter, id)) { in rz_mtu3_lock_if_counter_is_valid()
157 static int rz_mtu3_count_read(struct counter_device *counter, in rz_mtu3_count_read() argument
160 struct rz_mtu3_channel *const ch = rz_mtu3_get_ch(counter, count->id); in rz_mtu3_count_read()
[all …]
H A Dti-ecap-capture.c100 static u8 ecap_cnt_capture_get_evmode(struct counter_device *counter) in ecap_cnt_capture_get_evmode() argument
102 struct ecap_cnt_dev *ecap_dev = counter_priv(counter); in ecap_cnt_capture_get_evmode()
105 pm_runtime_get_sync(counter->parent); in ecap_cnt_capture_get_evmode()
107 pm_runtime_put_sync(counter->parent); in ecap_cnt_capture_get_evmode()
112 static void ecap_cnt_capture_set_evmode(struct counter_device *counter, u8 ev_mode) in ecap_cnt_capture_set_evmode() argument
114 struct ecap_cnt_dev *ecap_dev = counter_priv(counter); in ecap_cnt_capture_set_evmode()
116 pm_runtime_get_sync(counter->parent); in ecap_cnt_capture_set_evmode()
118 pm_runtime_put_sync(counter->parent); in ecap_cnt_capture_set_evmode()
121 static void ecap_cnt_capture_enable(struct counter_device *counter) in ecap_cnt_capture_enable() argument
123 struct ecap_cnt_dev *ecap_dev = counter_priv(counter); in ecap_cnt_capture_enable()
[all …]
H A Dinterrupt-cnt.c32 struct counter_device *counter = dev_id; in interrupt_cnt_isr() local
33 struct interrupt_cnt_priv *priv = counter_priv(counter); in interrupt_cnt_isr()
37 counter_push_event(counter, COUNTER_EVENT_CHANGE_OF_STATE, 0); in interrupt_cnt_isr()
42 static int interrupt_cnt_enable_read(struct counter_device *counter, in interrupt_cnt_enable_read() argument
45 struct interrupt_cnt_priv *priv = counter_priv(counter); in interrupt_cnt_enable_read()
54 static int interrupt_cnt_enable_write(struct counter_device *counter, in interrupt_cnt_enable_write() argument
57 struct interrupt_cnt_priv *priv = counter_priv(counter); in interrupt_cnt_enable_write()
84 static int interrupt_cnt_action_read(struct counter_device *counter, in interrupt_cnt_action_read() argument
94 static int interrupt_cnt_read(struct counter_device *counter, in interrupt_cnt_read() argument
97 struct interrupt_cnt_priv *priv = counter_priv(counter); in interrupt_cnt_read()
[all …]
H A Dti-eqep.c138 static int ti_eqep_count_read(struct counter_device *counter, in ti_eqep_count_read() argument
141 struct ti_eqep_cnt *priv = counter_priv(counter); in ti_eqep_count_read()
150 static int ti_eqep_count_write(struct counter_device *counter, in ti_eqep_count_write() argument
153 struct ti_eqep_cnt *priv = counter_priv(counter); in ti_eqep_count_write()
163 static int ti_eqep_function_read(struct counter_device *counter, in ti_eqep_function_read() argument
167 struct ti_eqep_cnt *priv = counter_priv(counter); in ti_eqep_function_read()
190 static int ti_eqep_function_write(struct counter_device *counter, in ti_eqep_function_write() argument
194 struct ti_eqep_cnt *priv = counter_priv(counter); in ti_eqep_function_write()
219 static int ti_eqep_action_read(struct counter_device *counter, in ti_eqep_action_read() argument
224 struct ti_eqep_cnt *priv = counter_priv(counter); in ti_eqep_action_read()
[all …]
H A Dstm32-timer-cnt.c59 static int stm32_count_read(struct counter_device *counter, in stm32_count_read() argument
62 struct stm32_timer_cnt *const priv = counter_priv(counter); in stm32_count_read()
71 static int stm32_count_write(struct counter_device *counter, in stm32_count_write() argument
74 struct stm32_timer_cnt *const priv = counter_priv(counter); in stm32_count_write()
84 static int stm32_count_function_read(struct counter_device *counter, in stm32_count_function_read() argument
88 struct stm32_timer_cnt *const priv = counter_priv(counter); in stm32_count_function_read()
111 static int stm32_count_function_write(struct counter_device *counter, in stm32_count_function_write() argument
115 struct stm32_timer_cnt *const priv = counter_priv(counter); in stm32_count_function_write()
157 static int stm32_count_direction_read(struct counter_device *counter, in stm32_count_direction_read() argument
161 struct stm32_timer_cnt *const priv = counter_priv(counter); in stm32_count_direction_read()
[all …]
H A Dcounter-sysfs.c109 struct counter_device *const counter = counter_from_dev(dev); in counter_comp_u8_show() local
115 err = a->comp.device_u8_read(counter, &data); in counter_comp_u8_show()
118 err = a->comp.signal_u8_read(counter, a->parent, &data); in counter_comp_u8_show()
121 err = a->comp.count_u8_read(counter, a->parent, &data); in counter_comp_u8_show()
141 struct counter_device *const counter = counter_from_dev(dev); in counter_comp_u8_store() local
156 err = a->comp.device_u8_write(counter, data); in counter_comp_u8_store()
159 err = a->comp.signal_u8_write(counter, a->parent, data); in counter_comp_u8_store()
162 err = a->comp.count_u8_write(counter, a->parent, data); in counter_comp_u8_store()
177 struct counter_device *const counter = counter_from_dev(dev); in counter_comp_u32_show() local
184 err = a->comp.device_u32_read(counter, &data); in counter_comp_u32_show()
[all …]
H A Dmicrochip-tcb-capture.c74 static int mchp_tc_count_function_read(struct counter_device *counter, in mchp_tc_count_function_read() argument
78 struct mchp_tc_data *const priv = counter_priv(counter); in mchp_tc_count_function_read()
88 static int mchp_tc_count_function_write(struct counter_device *counter, in mchp_tc_count_function_write() argument
92 struct mchp_tc_data *const priv = counter_priv(counter); in mchp_tc_count_function_write()
150 static int mchp_tc_count_signal_read(struct counter_device *counter, in mchp_tc_count_signal_read() argument
154 struct mchp_tc_data *const priv = counter_priv(counter); in mchp_tc_count_signal_read()
170 static int mchp_tc_count_action_read(struct counter_device *counter, in mchp_tc_count_action_read() argument
175 struct mchp_tc_data *const priv = counter_priv(counter); in mchp_tc_count_action_read()
209 static int mchp_tc_count_action_write(struct counter_device *counter, in mchp_tc_count_action_write() argument
214 struct mchp_tc_data *const priv = counter_priv(counter); in mchp_tc_count_action_write()
[all …]
/linux/drivers/comedi/drivers/
H A Dni_tio.c149 void ni_tio_write(struct ni_gpct *counter, unsigned int value, in ni_tio_write() argument
153 counter->counter_dev->write(counter, value, reg); in ni_tio_write()
162 unsigned int ni_tio_read(struct ni_gpct *counter, enum ni_gpct_register reg) in ni_tio_read() argument
165 return counter->counter_dev->read(counter, reg); in ni_tio_read()
170 static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter) in ni_tio_reset_count_and_disarm() argument
172 unsigned int cidx = counter->counter_index; in ni_tio_reset_count_and_disarm()
174 ni_tio_write(counter, GI_RESET(cidx), NITIO_RESET_REG(cidx)); in ni_tio_reset_count_and_disarm()
177 static int ni_tio_clock_period_ps(const struct ni_gpct *counter, in ni_tio_clock_period_ps() argument
201 *period_ps = counter->clock_period_ps; in ni_tio_clock_period_ps()
221 static void ni_tio_set_bits_transient(struct ni_gpct *counter, in ni_tio_set_bits_transient() argument
[all …]
H A Dni_tiocmd.c38 static void ni_tio_configure_dma(struct ni_gpct *counter, in ni_tio_configure_dma() argument
41 struct ni_gpct_device *counter_dev = counter->counter_dev; in ni_tio_configure_dma()
42 unsigned int cidx = counter->counter_index; in ni_tio_configure_dma()
55 ni_tio_set_bits(counter, NITIO_INPUT_SEL_REG(cidx), mask, bits); in ni_tio_configure_dma()
69 ni_tio_set_bits(counter, NITIO_DMA_CFG_REG(cidx), mask, bits); in ni_tio_configure_dma()
78 struct ni_gpct *counter = s->private; in ni_tio_input_inttrig() local
86 spin_lock_irqsave(&counter->lock, flags); in ni_tio_input_inttrig()
87 if (counter->mite_chan) in ni_tio_input_inttrig()
88 mite_dma_arm(counter->mite_chan); in ni_tio_input_inttrig()
91 spin_unlock_irqrestore(&counter->lock, flags); in ni_tio_input_inttrig()
[all …]
/linux/security/landlock/
H A Did.c21 static void __init init_id(atomic64_t *const counter, const u32 random_32bits) in init_id() argument
39 atomic64_cmpxchg(counter, COUNTER_PRE_INIT, init); in init_id()
46 atomic64_t counter = ATOMIC64_INIT(COUNTER_PRE_INIT); in test_init_min() local
48 init_id(&counter, 0); in test_init_min()
49 KUNIT_EXPECT_EQ(test, atomic64_read(&counter), 1ULL + U32_MAX); in test_init_min()
54 atomic64_t counter = ATOMIC64_INIT(COUNTER_PRE_INIT); in test_init_max() local
56 init_id(&counter, ~0); in test_init_max()
57 KUNIT_EXPECT_EQ(test, atomic64_read(&counter), 1 + (2ULL * U32_MAX)); in test_init_max()
63 atomic64_t counter = ATOMIC64_INIT(COUNTER_PRE_INIT); in test_init_once() local
65 init_id(&counter, 0); in test_init_once()
[all …]
/linux/drivers/infiniband/core/
H A Dcounters.c82 static void auto_mode_init_counter(struct rdma_counter *counter, in auto_mode_init_counter() argument
86 struct auto_mode_param *param = &counter->mode.param; in auto_mode_init_counter()
88 counter->mode.mode = RDMA_COUNTER_MODE_AUTO; in auto_mode_init_counter()
89 counter->mode.mask = new_mask; in auto_mode_init_counter()
95 static int __rdma_counter_bind_qp(struct rdma_counter *counter, in __rdma_counter_bind_qp() argument
100 if (qp->counter) in __rdma_counter_bind_qp()
106 mutex_lock(&counter->lock); in __rdma_counter_bind_qp()
107 ret = qp->device->ops.counter_bind_qp(counter, qp, port); in __rdma_counter_bind_qp()
108 mutex_unlock(&counter->lock); in __rdma_counter_bind_qp()
151 struct rdma_counter *counter; in alloc_and_bind() local
[all …]
/linux/drivers/net/ethernet/mellanox/mlx5/core/
H A Dfs_counters.c117 struct mlx5_fc *counter; in mlx5_fc_stats_query_all_counters() local
124 xas_for_each(&xas, counter, U32_MAX) { in mlx5_fc_stats_query_all_counters()
125 if (xas_retry(&xas, counter)) in mlx5_fc_stats_query_all_counters()
127 if (unlikely(counter->id >= last_bulk_id)) { in mlx5_fc_stats_query_all_counters()
130 bulk_base_id = counter->id & ~0x3; in mlx5_fc_stats_query_all_counters()
146 if (time_after64(bulk_query_time, counter->cache.lastuse)) in mlx5_fc_stats_query_all_counters()
147 update_counter_cache(counter->id - bulk_base_id, data, in mlx5_fc_stats_query_all_counters()
148 &counter->cache); in mlx5_fc_stats_query_all_counters()
153 static void mlx5_fc_free(struct mlx5_core_dev *dev, struct mlx5_fc *counter) in mlx5_fc_free() argument
155 mlx5_cmd_fc_free(dev, counter->id); in mlx5_fc_free()
[all …]
/linux/tools/testing/selftests/net/netfilter/
H A Dnft_meta.sh30 counter iifcount {}
31 counter iifnamecount {}
32 counter iifgroupcount {}
33 counter iiftypecount {}
34 counter infproto4count {}
35 counter il4protocounter {}
36 counter imarkcounter {}
37 counter icpu0counter {}
38 counter ilastyearcounter {}
39 counter icurrentyearcounter {}
[all …]
/linux/arch/arm/include/asm/
H A Datomic.h25 #define arch_atomic_read(v) READ_ONCE((v)->counter)
26 #define arch_atomic_set(v,i) WRITE_ONCE(((v)->counter), (i))
42 prefetchw(&v->counter); \
49 : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter) \
50 : "r" (&v->counter), "Ir" (i) \
60 prefetchw(&v->counter); \
68 : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter) \
69 : "r" (&v->counter), "Ir" (i) \
81 prefetchw(&v->counter); \
89 : "=&r" (result), "=&r" (val), "=&r" (tmp), "+Qo" (v->counter) \
[all …]
/linux/include/linux/
H A Dpage_counter.h55 static inline void page_counter_init(struct page_counter *counter, in page_counter_init() argument
59 counter->usage = (atomic_long_t)ATOMIC_LONG_INIT(0); in page_counter_init()
60 counter->max = PAGE_COUNTER_MAX; in page_counter_init()
61 counter->parent = parent; in page_counter_init()
62 counter->protection_support = protection_support; in page_counter_init()
63 counter->track_failcnt = false; in page_counter_init()
66 static inline unsigned long page_counter_read(struct page_counter *counter) in page_counter_read() argument
68 return atomic_long_read(&counter->usage); in page_counter_read()
71 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages);
72 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages);
[all …]
H A Dcounter.h158 int (*action_read)(struct counter_device *counter,
162 int (*device_u8_read)(struct counter_device *counter, u8 *val);
163 int (*count_u8_read)(struct counter_device *counter,
165 int (*signal_u8_read)(struct counter_device *counter,
167 int (*device_u32_read)(struct counter_device *counter,
169 int (*count_u32_read)(struct counter_device *counter,
171 int (*signal_u32_read)(struct counter_device *counter,
173 int (*device_u64_read)(struct counter_device *counter,
175 int (*count_u64_read)(struct counter_device *counter,
177 int (*signal_u64_read)(struct counter_device *counter,
[all …]
/linux/mm/
H A Dpage_counter.c54 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages) in page_counter_cancel() argument
58 new = atomic_long_sub_return(nr_pages, &counter->usage); in page_counter_cancel()
63 atomic_long_set(&counter->usage, new); in page_counter_cancel()
65 if (track_protection(counter)) in page_counter_cancel()
66 propagate_protected_usage(counter, new); in page_counter_cancel()
76 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) in page_counter_charge() argument
79 bool protection = track_protection(counter); in page_counter_charge()
81 for (c = counter; c; c = c->parent) { in page_counter_charge()
118 bool page_counter_try_charge(struct page_counter *counter, in page_counter_try_charge() argument
123 bool protection = track_protection(counter); in page_counter_try_charge()
[all …]
/linux/arch/s390/include/asm/
H A Datomic.h20 return __atomic_read(&v->counter); in arch_atomic_read()
26 __atomic_set(&v->counter, i); in arch_atomic_set()
32 return __atomic_add_barrier(i, &v->counter) + i; in arch_atomic_add_return()
38 return __atomic_add_barrier(i, &v->counter); in arch_atomic_fetch_add()
44 __atomic_add(i, &v->counter); in arch_atomic_add()
50 __atomic_add_const(1, &v->counter); in arch_atomic_inc()
56 __atomic_add_const(-1, &v->counter); in arch_atomic_dec()
62 return __atomic_add_and_test_barrier(-i, &v->counter); in arch_atomic_sub_and_test()
68 return __atomic_add_const_and_test_barrier(-1, &v->counter); in arch_atomic_dec_and_test()
74 return __atomic_add_const_and_test_barrier(1, &v->counter); in arch_atomic_inc_and_test()
[all …]
/linux/arch/powerpc/include/asm/
H A Datomic.h33 __asm__ __volatile__("lwz %0,0(%1)" : "=r"(t) : "b"(&v->counter)); in arch_atomic_read()
35 __asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m<>"(v->counter)); in arch_atomic_read()
44 __asm__ __volatile__("stw %1,0(%2)" : "=m"(v->counter) : "r"(i), "b"(&v->counter)); in arch_atomic_set()
46 __asm__ __volatile__("stw%U0%X0 %1,%0" : "=m<>"(v->counter) : "r"(i)); in arch_atomic_set()
59 : "=&r" (t), "+m" (v->counter) \
60 : "r"#sign (a), "r" (&v->counter) \
74 : "=&r" (t), "+m" (v->counter) \
75 : "r"#sign (a), "r" (&v->counter) \
91 : "=&r" (res), "=&r" (t), "+m" (v->counter) \
92 : "r"#sign (a), "r" (&v->counter) \
[all …]
/linux/arch/x86/kernel/cpu/
H A Dperfctr-watchdog.c110 unsigned int counter; in reserve_perfctr_nmi() local
112 counter = nmi_perfctr_msr_to_bit(msr); in reserve_perfctr_nmi()
114 if (counter > NMI_MAX_COUNTER_BITS) in reserve_perfctr_nmi()
117 if (!test_and_set_bit(counter, perfctr_nmi_owner)) in reserve_perfctr_nmi()
125 unsigned int counter; in release_perfctr_nmi() local
127 counter = nmi_perfctr_msr_to_bit(msr); in release_perfctr_nmi()
129 if (counter > NMI_MAX_COUNTER_BITS) in release_perfctr_nmi()
132 clear_bit(counter, perfctr_nmi_owner); in release_perfctr_nmi()
138 unsigned int counter; in reserve_evntsel_nmi() local
140 counter = nmi_evntsel_msr_to_bit(msr); in reserve_evntsel_nmi()
[all …]
/linux/arch/x86/include/asm/
H A Datomic64_64.h15 return __READ_ONCE((v)->counter); in arch_atomic64_read()
20 __WRITE_ONCE(v->counter, i); in arch_atomic64_set()
26 : "=m" (v->counter) in arch_atomic64_add()
27 : "er" (i), "m" (v->counter) : "memory"); in arch_atomic64_add()
33 : "=m" (v->counter) in arch_atomic64_sub()
34 : "er" (i), "m" (v->counter) : "memory"); in arch_atomic64_sub()
39 return GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, e, "er", i); in arch_atomic64_sub_and_test()
46 : "=m" (v->counter) in arch_atomic64_inc()
47 : "m" (v->counter) : "memory"); in arch_atomic64_inc()
54 : "=m" (v->counter) in arch_atomic64_dec()
[all …]
/linux/tools/testing/selftests/kvm/riscv/
H A Dsbi_pmu_test.c99 static void start_counter(unsigned long counter, unsigned long start_flags, in start_counter() argument
104 ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, counter, 1, start_flags, in start_counter()
106 __GUEST_ASSERT(ret.error == 0, "Unable to start counter %ld\n", counter); in start_counter()
110 static void stop_reset_counter(unsigned long counter, unsigned long stop_flags) in stop_reset_counter() argument
114 ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, counter, 1, in stop_reset_counter()
117 "Unable to stop counter %ld\n", counter); in stop_reset_counter()
120 static void stop_counter(unsigned long counter, unsigned long stop_flags) in stop_counter() argument
124 ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, counter, 1, stop_flags, in stop_counter()
127 "Unable to stop counter %ld error %ld\n", counter, ret.error); in stop_counter()
278 unsigned long counter; in test_pmu_event() local
[all …]

12345678910>>...44