irqbypass.c (e5451c8f8330e03ad3cfa16048b4daf961af434f) irqbypass.c (b52f3ed02221252d8ee2c7d756e76fad4a5e84f6)
1/*
2 * IRQ offload/bypass manager
3 *
4 * Copyright (C) 2015 Red Hat, Inc.
5 * Copyright (c) 2015 Linaro Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 75 unchanged lines hidden (view full) ---

84 * Add the provided IRQ producer to the list of producers and connect
85 * with any matching token found on the IRQ consumers list.
86 */
87int irq_bypass_register_producer(struct irq_bypass_producer *producer)
88{
89 struct irq_bypass_producer *tmp;
90 struct irq_bypass_consumer *consumer;
91
1/*
2 * IRQ offload/bypass manager
3 *
4 * Copyright (C) 2015 Red Hat, Inc.
5 * Copyright (c) 2015 Linaro Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 75 unchanged lines hidden (view full) ---

84 * Add the provided IRQ producer to the list of producers and connect
85 * with any matching token found on the IRQ consumers list.
86 */
87int irq_bypass_register_producer(struct irq_bypass_producer *producer)
88{
89 struct irq_bypass_producer *tmp;
90 struct irq_bypass_consumer *consumer;
91
92 if (!producer->token)
93 return -EINVAL;
94
92 might_sleep();
93
94 if (!try_module_get(THIS_MODULE))
95 return -ENODEV;
96
97 mutex_lock(&lock);
98
99 list_for_each_entry(tmp, &producers, node) {

--- 31 unchanged lines hidden (view full) ---

131 * Remove a previously registered IRQ producer from the list of producers
132 * and disconnect it from any connected IRQ consumer.
133 */
134void irq_bypass_unregister_producer(struct irq_bypass_producer *producer)
135{
136 struct irq_bypass_producer *tmp;
137 struct irq_bypass_consumer *consumer;
138
95 might_sleep();
96
97 if (!try_module_get(THIS_MODULE))
98 return -ENODEV;
99
100 mutex_lock(&lock);
101
102 list_for_each_entry(tmp, &producers, node) {

--- 31 unchanged lines hidden (view full) ---

134 * Remove a previously registered IRQ producer from the list of producers
135 * and disconnect it from any connected IRQ consumer.
136 */
137void irq_bypass_unregister_producer(struct irq_bypass_producer *producer)
138{
139 struct irq_bypass_producer *tmp;
140 struct irq_bypass_consumer *consumer;
141
142 if (!producer->token)
143 return;
144
139 might_sleep();
140
141 if (!try_module_get(THIS_MODULE))
142 return; /* nothing in the list anyway */
143
144 mutex_lock(&lock);
145
146 list_for_each_entry(tmp, &producers, node) {

--- 25 unchanged lines hidden (view full) ---

172 * Add the provided IRQ consumer to the list of consumers and connect
173 * with any matching token found on the IRQ producer list.
174 */
175int irq_bypass_register_consumer(struct irq_bypass_consumer *consumer)
176{
177 struct irq_bypass_consumer *tmp;
178 struct irq_bypass_producer *producer;
179
145 might_sleep();
146
147 if (!try_module_get(THIS_MODULE))
148 return; /* nothing in the list anyway */
149
150 mutex_lock(&lock);
151
152 list_for_each_entry(tmp, &producers, node) {

--- 25 unchanged lines hidden (view full) ---

178 * Add the provided IRQ consumer to the list of consumers and connect
179 * with any matching token found on the IRQ producer list.
180 */
181int irq_bypass_register_consumer(struct irq_bypass_consumer *consumer)
182{
183 struct irq_bypass_consumer *tmp;
184 struct irq_bypass_producer *producer;
185
180 if (!consumer->add_producer || !consumer->del_producer)
186 if (!consumer->token ||
187 !consumer->add_producer || !consumer->del_producer)
181 return -EINVAL;
182
183 might_sleep();
184
185 if (!try_module_get(THIS_MODULE))
186 return -ENODEV;
187
188 mutex_lock(&lock);

--- 33 unchanged lines hidden (view full) ---

222 * Remove a previously registered IRQ consumer from the list of consumers
223 * and disconnect it from any connected IRQ producer.
224 */
225void irq_bypass_unregister_consumer(struct irq_bypass_consumer *consumer)
226{
227 struct irq_bypass_consumer *tmp;
228 struct irq_bypass_producer *producer;
229
188 return -EINVAL;
189
190 might_sleep();
191
192 if (!try_module_get(THIS_MODULE))
193 return -ENODEV;
194
195 mutex_lock(&lock);

--- 33 unchanged lines hidden (view full) ---

229 * Remove a previously registered IRQ consumer from the list of consumers
230 * and disconnect it from any connected IRQ producer.
231 */
232void irq_bypass_unregister_consumer(struct irq_bypass_consumer *consumer)
233{
234 struct irq_bypass_consumer *tmp;
235 struct irq_bypass_producer *producer;
236
237 if (!consumer->token)
238 return;
239
230 might_sleep();
231
232 if (!try_module_get(THIS_MODULE))
233 return; /* nothing in the list anyway */
234
235 mutex_lock(&lock);
236
237 list_for_each_entry(tmp, &consumers, node) {

--- 20 unchanged lines hidden ---
240 might_sleep();
241
242 if (!try_module_get(THIS_MODULE))
243 return; /* nothing in the list anyway */
244
245 mutex_lock(&lock);
246
247 list_for_each_entry(tmp, &consumers, node) {

--- 20 unchanged lines hidden ---