diff options
author | Adrian Bunk <bunk@kernel.org> | 2008-01-19 03:00:42 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:10 -0500 |
commit | e9888f5498083f5e4d873cbbe16aa97d89aa1342 (patch) | |
tree | 00daae7fa1768dc413b13301acd394b06d16704f /net/irda/irda_device.c | |
parent | 5d780cd6585d242d9592a479fe75a007fd75155d (diff) |
[IrDA]: Irport removal - part 1
This patch removes IrPORT and the old dongle drivers (all off them
have replacement drivers).
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/irda_device.c')
-rw-r--r-- | net/irda/irda_device.c | 169 |
1 files changed, 1 insertions, 168 deletions
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 435b563d29a6..87185910d0ee 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c | |||
@@ -57,20 +57,6 @@ static void __irda_task_delete(struct irda_task *task); | |||
57 | static hashbin_t *dongles = NULL; | 57 | static hashbin_t *dongles = NULL; |
58 | static hashbin_t *tasks = NULL; | 58 | static hashbin_t *tasks = NULL; |
59 | 59 | ||
60 | #ifdef CONFIG_IRDA_DEBUG | ||
61 | static const char *task_state[] = { | ||
62 | "IRDA_TASK_INIT", | ||
63 | "IRDA_TASK_DONE", | ||
64 | "IRDA_TASK_WAIT", | ||
65 | "IRDA_TASK_WAIT1", | ||
66 | "IRDA_TASK_WAIT2", | ||
67 | "IRDA_TASK_WAIT3", | ||
68 | "IRDA_TASK_CHILD_INIT", | ||
69 | "IRDA_TASK_CHILD_WAIT", | ||
70 | "IRDA_TASK_CHILD_DONE", | ||
71 | }; | ||
72 | #endif /* CONFIG_IRDA_DEBUG */ | ||
73 | |||
74 | static void irda_task_timer_expired(void *data); | 60 | static void irda_task_timer_expired(void *data); |
75 | 61 | ||
76 | int __init irda_device_init( void) | 62 | int __init irda_device_init( void) |
@@ -176,14 +162,6 @@ int irda_device_is_receiving(struct net_device *dev) | |||
176 | return req.ifr_receiving; | 162 | return req.ifr_receiving; |
177 | } | 163 | } |
178 | 164 | ||
179 | void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state) | ||
180 | { | ||
181 | IRDA_DEBUG(2, "%s(), state = %s\n", __FUNCTION__, task_state[state]); | ||
182 | |||
183 | task->state = state; | ||
184 | } | ||
185 | EXPORT_SYMBOL(irda_task_next_state); | ||
186 | |||
187 | static void __irda_task_delete(struct irda_task *task) | 165 | static void __irda_task_delete(struct irda_task *task) |
188 | { | 166 | { |
189 | del_timer(&task->timer); | 167 | del_timer(&task->timer); |
@@ -191,14 +169,13 @@ static void __irda_task_delete(struct irda_task *task) | |||
191 | kfree(task); | 169 | kfree(task); |
192 | } | 170 | } |
193 | 171 | ||
194 | void irda_task_delete(struct irda_task *task) | 172 | static void irda_task_delete(struct irda_task *task) |
195 | { | 173 | { |
196 | /* Unregister task */ | 174 | /* Unregister task */ |
197 | hashbin_remove(tasks, (long) task, NULL); | 175 | hashbin_remove(tasks, (long) task, NULL); |
198 | 176 | ||
199 | __irda_task_delete(task); | 177 | __irda_task_delete(task); |
200 | } | 178 | } |
201 | EXPORT_SYMBOL(irda_task_delete); | ||
202 | 179 | ||
203 | /* | 180 | /* |
204 | * Function irda_task_kick (task) | 181 | * Function irda_task_kick (task) |
@@ -272,51 +249,6 @@ static int irda_task_kick(struct irda_task *task) | |||
272 | } | 249 | } |
273 | 250 | ||
274 | /* | 251 | /* |
275 | * Function irda_task_execute (instance, function, finished) | ||
276 | * | ||
277 | * This function registers and tries to execute tasks that may take some | ||
278 | * time to complete. We do it this hairy way since we may have been | ||
279 | * called from interrupt context, so it's not possible to use | ||
280 | * schedule_timeout() | ||
281 | * Two important notes : | ||
282 | * o Make sure you irda_task_delete(task); in case you delete the | ||
283 | * calling instance. | ||
284 | * o No real need to lock when calling this function, but you may | ||
285 | * want to lock within the task handler. | ||
286 | * Jean II | ||
287 | */ | ||
288 | struct irda_task *irda_task_execute(void *instance, | ||
289 | IRDA_TASK_CALLBACK function, | ||
290 | IRDA_TASK_CALLBACK finished, | ||
291 | struct irda_task *parent, void *param) | ||
292 | { | ||
293 | struct irda_task *task; | ||
294 | |||
295 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | ||
296 | |||
297 | task = kmalloc(sizeof(struct irda_task), GFP_ATOMIC); | ||
298 | if (!task) | ||
299 | return NULL; | ||
300 | |||
301 | task->state = IRDA_TASK_INIT; | ||
302 | task->instance = instance; | ||
303 | task->function = function; | ||
304 | task->finished = finished; | ||
305 | task->parent = parent; | ||
306 | task->param = param; | ||
307 | task->magic = IRDA_TASK_MAGIC; | ||
308 | |||
309 | init_timer(&task->timer); | ||
310 | |||
311 | /* Register task */ | ||
312 | hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL); | ||
313 | |||
314 | /* No time to waste, so lets get going! */ | ||
315 | return irda_task_kick(task) ? NULL : task; | ||
316 | } | ||
317 | EXPORT_SYMBOL(irda_task_execute); | ||
318 | |||
319 | /* | ||
320 | * Function irda_task_timer_expired (data) | 252 | * Function irda_task_timer_expired (data) |
321 | * | 253 | * |
322 | * Task time has expired. We now try to execute task (again), and restart | 254 | * Task time has expired. We now try to execute task (again), and restart |
@@ -364,105 +296,6 @@ struct net_device *alloc_irdadev(int sizeof_priv) | |||
364 | } | 296 | } |
365 | EXPORT_SYMBOL(alloc_irdadev); | 297 | EXPORT_SYMBOL(alloc_irdadev); |
366 | 298 | ||
367 | /* | ||
368 | * Function irda_device_init_dongle (self, type, qos) | ||
369 | * | ||
370 | * Initialize attached dongle. | ||
371 | * | ||
372 | * Important : request_module require us to call this function with | ||
373 | * a process context and irq enabled. - Jean II | ||
374 | */ | ||
375 | dongle_t *irda_device_dongle_init(struct net_device *dev, int type) | ||
376 | { | ||
377 | struct dongle_reg *reg; | ||
378 | dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL); | ||
379 | |||
380 | might_sleep(); | ||
381 | |||
382 | spin_lock(&dongles->hb_spinlock); | ||
383 | reg = hashbin_find(dongles, type, NULL); | ||
384 | |||
385 | #ifdef CONFIG_KMOD | ||
386 | /* Try to load the module needed */ | ||
387 | if (!reg && capable(CAP_SYS_MODULE)) { | ||
388 | spin_unlock(&dongles->hb_spinlock); | ||
389 | |||
390 | request_module("irda-dongle-%d", type); | ||
391 | |||
392 | spin_lock(&dongles->hb_spinlock); | ||
393 | reg = hashbin_find(dongles, type, NULL); | ||
394 | } | ||
395 | #endif | ||
396 | |||
397 | if (!reg || !try_module_get(reg->owner) ) { | ||
398 | IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n", | ||
399 | type); | ||
400 | kfree(dongle); | ||
401 | dongle = NULL; | ||
402 | } | ||
403 | if (dongle) { | ||
404 | /* Bind the registration info to this particular instance */ | ||
405 | dongle->issue = reg; | ||
406 | dongle->dev = dev; | ||
407 | } | ||
408 | spin_unlock(&dongles->hb_spinlock); | ||
409 | return dongle; | ||
410 | } | ||
411 | EXPORT_SYMBOL(irda_device_dongle_init); | ||
412 | |||
413 | /* | ||
414 | * Function irda_device_dongle_cleanup (dongle) | ||
415 | */ | ||
416 | int irda_device_dongle_cleanup(dongle_t *dongle) | ||
417 | { | ||
418 | IRDA_ASSERT(dongle != NULL, return -1;); | ||
419 | |||
420 | dongle->issue->close(dongle); | ||
421 | module_put(dongle->issue->owner); | ||
422 | kfree(dongle); | ||
423 | |||
424 | return 0; | ||
425 | } | ||
426 | EXPORT_SYMBOL(irda_device_dongle_cleanup); | ||
427 | |||
428 | /* | ||
429 | * Function irda_device_register_dongle (dongle) | ||
430 | */ | ||
431 | int irda_device_register_dongle(struct dongle_reg *new) | ||
432 | { | ||
433 | spin_lock(&dongles->hb_spinlock); | ||
434 | /* Check if this dongle has been registered before */ | ||
435 | if (hashbin_find(dongles, new->type, NULL)) { | ||
436 | IRDA_MESSAGE("%s: Dongle type %x already registered\n", | ||
437 | __FUNCTION__, new->type); | ||
438 | } else { | ||
439 | /* Insert IrDA dongle into hashbin */ | ||
440 | hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL); | ||
441 | } | ||
442 | spin_unlock(&dongles->hb_spinlock); | ||
443 | |||
444 | return 0; | ||
445 | } | ||
446 | EXPORT_SYMBOL(irda_device_register_dongle); | ||
447 | |||
448 | /* | ||
449 | * Function irda_device_unregister_dongle (dongle) | ||
450 | * | ||
451 | * Unregister dongle, and remove dongle from list of registered dongles | ||
452 | * | ||
453 | */ | ||
454 | void irda_device_unregister_dongle(struct dongle_reg *dongle) | ||
455 | { | ||
456 | struct dongle *node; | ||
457 | |||
458 | spin_lock(&dongles->hb_spinlock); | ||
459 | node = hashbin_remove(dongles, dongle->type, NULL); | ||
460 | if (!node) | ||
461 | IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__); | ||
462 | spin_unlock(&dongles->hb_spinlock); | ||
463 | } | ||
464 | EXPORT_SYMBOL(irda_device_unregister_dongle); | ||
465 | |||
466 | #ifdef CONFIG_ISA_DMA_API | 299 | #ifdef CONFIG_ISA_DMA_API |
467 | /* | 300 | /* |
468 | * Function setup_dma (idev, buffer, count, mode) | 301 | * Function setup_dma (idev, buffer, count, mode) |