blob: b60a8da6350ace6bb9615a06ce8d8d257e0fe1a6 [file] [log] [blame]
Bill Pemberton0b52b742012-09-20 16:55:27 -04001/*
2 *
3 * Copyright 1999-2003 Digi International (www.digi.com)
4 * Jeff Randall
5 * James Puzzo <jamesp at digi dot com>
6 * Scott Kilau <Scott_Kilau at digi dot com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
15 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 */
19
20/*
21 * Driver specific includes
22 */
23#include <linux/module.h>
24#include <linux/slab.h>
25#include <linux/tty.h>
Bill Pemberton0b52b742012-09-20 16:55:27 -040026
27/*
28 * PortServer includes
29 */
30#include "dgrp_common.h"
31
32
33MODULE_LICENSE("GPL");
34MODULE_AUTHOR("Digi International, http://www.digi.com");
35MODULE_DESCRIPTION("RealPort driver for Digi's ethernet-based serial connectivity product line");
36MODULE_VERSION(DIGI_VERSION);
37
38struct list_head nd_struct_list;
39struct dgrp_poll_data dgrp_poll_data;
40
Bill Pemberton0b52b742012-09-20 16:55:27 -040041int dgrp_register_cudevices = 1;/* Turn on/off registering legacy cu devices */
42int dgrp_register_prdevices = 1;/* Turn on/off registering transparent print */
43int dgrp_poll_tick = 20; /* Poll interval - in ms */
44
Bill Pemberton0b52b742012-09-20 16:55:27 -040045module_param_named(register_cudevices, dgrp_register_cudevices, int, 0644);
46MODULE_PARM_DESC(register_cudevices, "Turn on/off registering legacy cu devices");
47
48module_param_named(register_prdevices, dgrp_register_prdevices, int, 0644);
49MODULE_PARM_DESC(register_prdevices, "Turn on/off registering transparent print devices");
50
51module_param_named(pollrate, dgrp_poll_tick, int, 0644);
52MODULE_PARM_DESC(pollrate, "Poll interval in ms");
53
Bill Pemberton0b52b742012-09-20 16:55:27 -040054/*
55 * init_module()
56 *
57 * Module load. This is where it all starts.
58 */
navin patidarecc837a2013-08-19 14:46:25 +053059static int __init dgrp_init_module(void)
Bill Pemberton0b52b742012-09-20 16:55:27 -040060{
Alexey Khoroshilov7e1389a2013-04-06 01:14:23 +040061 int ret;
62
Bill Pemberton0b52b742012-09-20 16:55:27 -040063 INIT_LIST_HEAD(&nd_struct_list);
64
65 spin_lock_init(&dgrp_poll_data.poll_lock);
66 init_timer(&dgrp_poll_data.timer);
67 dgrp_poll_data.poll_tick = dgrp_poll_tick;
68 dgrp_poll_data.timer.function = dgrp_poll_handler;
69 dgrp_poll_data.timer.data = (unsigned long) &dgrp_poll_data;
70
Alexey Khoroshilov7e1389a2013-04-06 01:14:23 +040071 ret = dgrp_create_class_sysfs_files();
72 if (ret)
73 return ret;
Bill Pemberton0b52b742012-09-20 16:55:27 -040074
75 dgrp_register_proc();
76
77 return 0;
78}
79
80
81/*
82 * Module unload. This is where it all ends.
83 */
navin patidarecc837a2013-08-19 14:46:25 +053084static void __exit dgrp_cleanup_module(void)
Bill Pemberton0b52b742012-09-20 16:55:27 -040085{
86 struct nd_struct *nd, *next;
87
88 /*
89 * Attempting to free resources in backwards
90 * order of allocation, in case that helps
91 * memory pool fragmentation.
92 */
93 dgrp_unregister_proc();
94
95 dgrp_remove_class_sysfs_files();
96
97
98 list_for_each_entry_safe(nd, next, &nd_struct_list, list) {
99 dgrp_tty_uninit(nd);
100 kfree(nd);
101 }
102}
navin patidarecc837a2013-08-19 14:46:25 +0530103
104module_init(dgrp_init_module);
105module_exit(dgrp_cleanup_module);