common.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238
  1. /*
  2. * Stuff used by all variants of the driver
  3. *
  4. * Copyright (c) 2001 by Stefan Eilers <Eilers.Stefan@epost.de>,
  5. * Hansjoerg Lipp <hjlipp@web.de>,
  6. * Tilman Schmidt <tilman@imap.cc>.
  7. *
  8. * =====================================================================
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. * =====================================================================
  14. */
  15. #include "gigaset.h"
  16. #include <linux/ctype.h>
  17. #include <linux/module.h>
  18. #include <linux/moduleparam.h>
  19. /* Version Information */
  20. #define DRIVER_AUTHOR "Hansjoerg Lipp <hjlipp@web.de>, Tilman Schmidt <tilman@imap.cc>, Stefan Eilers <Eilers.Stefan@epost.de>"
  21. #define DRIVER_DESC "Driver for Gigaset 307x"
  22. /* Module parameters */
  23. int gigaset_debuglevel = DEBUG_DEFAULT;
  24. EXPORT_SYMBOL_GPL(gigaset_debuglevel);
  25. module_param_named(debug, gigaset_debuglevel, int, S_IRUGO|S_IWUSR);
  26. MODULE_PARM_DESC(debug, "debug level");
  27. /*======================================================================
  28. Prototypes of internal functions
  29. */
  30. static struct cardstate *alloc_cs(struct gigaset_driver *drv);
  31. static void free_cs(struct cardstate *cs);
  32. static void make_valid(struct cardstate *cs, unsigned mask);
  33. static void make_invalid(struct cardstate *cs, unsigned mask);
  34. #define VALID_MINOR 0x01
  35. #define VALID_ID 0x02
  36. #define ASSIGNED 0x04
  37. /* bitwise byte inversion table */
  38. __u8 gigaset_invtab[256] = {
  39. 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
  40. 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
  41. 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
  42. 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
  43. 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
  44. 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
  45. 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
  46. 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
  47. 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
  48. 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
  49. 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
  50. 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
  51. 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
  52. 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
  53. 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
  54. 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
  55. 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
  56. 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
  57. 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
  58. 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
  59. 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
  60. 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
  61. 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
  62. 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
  63. 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
  64. 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
  65. 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
  66. 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
  67. 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
  68. 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
  69. 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
  70. 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
  71. };
  72. EXPORT_SYMBOL_GPL(gigaset_invtab);
  73. void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
  74. size_t len, const unsigned char *buf)
  75. {
  76. unsigned char outbuf[80];
  77. unsigned char c;
  78. size_t space = sizeof outbuf - 1;
  79. unsigned char *out = outbuf;
  80. size_t numin = len;
  81. while (numin--) {
  82. c = *buf++;
  83. if (c == '~' || c == '^' || c == '\\') {
  84. if (!space--)
  85. break;
  86. *out++ = '\\';
  87. }
  88. if (c & 0x80) {
  89. if (!space--)
  90. break;
  91. *out++ = '~';
  92. c ^= 0x80;
  93. }
  94. if (c < 0x20 || c == 0x7f) {
  95. if (!space--)
  96. break;
  97. *out++ = '^';
  98. c ^= 0x40;
  99. }
  100. if (!space--)
  101. break;
  102. *out++ = c;
  103. }
  104. *out = 0;
  105. gig_dbg(level, "%s (%u bytes): %s", msg, (unsigned) len, outbuf);
  106. }
  107. EXPORT_SYMBOL_GPL(gigaset_dbg_buffer);
  108. static int setflags(struct cardstate *cs, unsigned flags, unsigned delay)
  109. {
  110. int r;
  111. r = cs->ops->set_modem_ctrl(cs, cs->control_state, flags);
  112. cs->control_state = flags;
  113. if (r < 0)
  114. return r;
  115. if (delay) {
  116. set_current_state(TASK_INTERRUPTIBLE);
  117. schedule_timeout(delay * HZ / 1000);
  118. }
  119. return 0;
  120. }
  121. int gigaset_enterconfigmode(struct cardstate *cs)
  122. {
  123. int i, r;
  124. if (!atomic_read(&cs->connected)) {
  125. err("not connected!");
  126. return -1;
  127. }
  128. cs->control_state = TIOCM_RTS; //FIXME
  129. r = setflags(cs, TIOCM_DTR, 200);
  130. if (r < 0)
  131. goto error;
  132. r = setflags(cs, 0, 200);
  133. if (r < 0)
  134. goto error;
  135. for (i = 0; i < 5; ++i) {
  136. r = setflags(cs, TIOCM_RTS, 100);
  137. if (r < 0)
  138. goto error;
  139. r = setflags(cs, 0, 100);
  140. if (r < 0)
  141. goto error;
  142. }
  143. r = setflags(cs, TIOCM_RTS|TIOCM_DTR, 800);
  144. if (r < 0)
  145. goto error;
  146. return 0;
  147. error:
  148. dev_err(cs->dev, "error %d on setuartbits\n", -r);
  149. cs->control_state = TIOCM_RTS|TIOCM_DTR; // FIXME is this a good value?
  150. cs->ops->set_modem_ctrl(cs, 0, TIOCM_RTS|TIOCM_DTR);
  151. return -1; //r
  152. }
  153. static int test_timeout(struct at_state_t *at_state)
  154. {
  155. if (!at_state->timer_expires)
  156. return 0;
  157. if (--at_state->timer_expires) {
  158. gig_dbg(DEBUG_MCMD, "decreased timer of %p to %lu",
  159. at_state, at_state->timer_expires);
  160. return 0;
  161. }
  162. if (!gigaset_add_event(at_state->cs, at_state, EV_TIMEOUT, NULL,
  163. atomic_read(&at_state->timer_index), NULL)) {
  164. //FIXME what should we do?
  165. }
  166. return 1;
  167. }
  168. static void timer_tick(unsigned long data)
  169. {
  170. struct cardstate *cs = (struct cardstate *) data;
  171. unsigned long flags;
  172. unsigned channel;
  173. struct at_state_t *at_state;
  174. int timeout = 0;
  175. spin_lock_irqsave(&cs->lock, flags);
  176. for (channel = 0; channel < cs->channels; ++channel)
  177. if (test_timeout(&cs->bcs[channel].at_state))
  178. timeout = 1;
  179. if (test_timeout(&cs->at_state))
  180. timeout = 1;
  181. list_for_each_entry(at_state, &cs->temp_at_states, list)
  182. if (test_timeout(at_state))
  183. timeout = 1;
  184. if (atomic_read(&cs->running)) {
  185. mod_timer(&cs->timer, jiffies + msecs_to_jiffies(GIG_TICK));
  186. if (timeout) {
  187. gig_dbg(DEBUG_CMD, "scheduling timeout");
  188. tasklet_schedule(&cs->event_tasklet);
  189. }
  190. }
  191. spin_unlock_irqrestore(&cs->lock, flags);
  192. }
  193. int gigaset_get_channel(struct bc_state *bcs)
  194. {
  195. unsigned long flags;
  196. spin_lock_irqsave(&bcs->cs->lock, flags);
  197. if (bcs->use_count) {
  198. gig_dbg(DEBUG_ANY, "could not allocate channel %d",
  199. bcs->channel);
  200. spin_unlock_irqrestore(&bcs->cs->lock, flags);
  201. return 0;
  202. }
  203. ++bcs->use_count;
  204. bcs->busy = 1;
  205. gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
  206. spin_unlock_irqrestore(&bcs->cs->lock, flags);
  207. return 1;
  208. }
  209. void gigaset_free_channel(struct bc_state *bcs)
  210. {
  211. unsigned long flags;
  212. spin_lock_irqsave(&bcs->cs->lock, flags);
  213. if (!bcs->busy) {
  214. gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
  215. spin_unlock_irqrestore(&bcs->cs->lock, flags);
  216. return;
  217. }
  218. --bcs->use_count;
  219. bcs->busy = 0;
  220. gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
  221. spin_unlock_irqrestore(&bcs->cs->lock, flags);
  222. }
  223. int gigaset_get_channels(struct cardstate *cs)
  224. {
  225. unsigned long flags;
  226. int i;
  227. spin_lock_irqsave(&cs->lock, flags);
  228. for (i = 0; i < cs->channels; ++i)
  229. if (cs->bcs[i].use_count) {
  230. spin_unlock_irqrestore(&cs->lock, flags);
  231. gig_dbg(DEBUG_ANY, "could not allocate all channels");
  232. return 0;
  233. }
  234. for (i = 0; i < cs->channels; ++i)
  235. ++cs->bcs[i].use_count;
  236. spin_unlock_irqrestore(&cs->lock, flags);
  237. gig_dbg(DEBUG_ANY, "allocated all channels");
  238. return 1;
  239. }
  240. void gigaset_free_channels(struct cardstate *cs)
  241. {
  242. unsigned long flags;
  243. int i;
  244. gig_dbg(DEBUG_ANY, "unblocking all channels");
  245. spin_lock_irqsave(&cs->lock, flags);
  246. for (i = 0; i < cs->channels; ++i)
  247. --cs->bcs[i].use_count;
  248. spin_unlock_irqrestore(&cs->lock, flags);
  249. }
  250. void gigaset_block_channels(struct cardstate *cs)
  251. {
  252. unsigned long flags;
  253. int i;
  254. gig_dbg(DEBUG_ANY, "blocking all channels");
  255. spin_lock_irqsave(&cs->lock, flags);
  256. for (i = 0; i < cs->channels; ++i)
  257. ++cs->bcs[i].use_count;
  258. spin_unlock_irqrestore(&cs->lock, flags);
  259. }
  260. static void clear_events(struct cardstate *cs)
  261. {
  262. struct event_t *ev;
  263. unsigned head, tail;
  264. /* no locking needed (no reader/writer allowed) */
  265. head = atomic_read(&cs->ev_head);
  266. tail = atomic_read(&cs->ev_tail);
  267. while (tail != head) {
  268. ev = cs->events + head;
  269. kfree(ev->ptr);
  270. head = (head + 1) % MAX_EVENTS;
  271. }
  272. atomic_set(&cs->ev_head, tail);
  273. }
  274. struct event_t *gigaset_add_event(struct cardstate *cs,
  275. struct at_state_t *at_state, int type,
  276. void *ptr, int parameter, void *arg)
  277. {
  278. unsigned long flags;
  279. unsigned next, tail;
  280. struct event_t *event = NULL;
  281. spin_lock_irqsave(&cs->ev_lock, flags);
  282. tail = atomic_read(&cs->ev_tail);
  283. next = (tail + 1) % MAX_EVENTS;
  284. if (unlikely(next == atomic_read(&cs->ev_head)))
  285. err("event queue full");
  286. else {
  287. event = cs->events + tail;
  288. event->type = type;
  289. event->at_state = at_state;
  290. event->cid = -1;
  291. event->ptr = ptr;
  292. event->arg = arg;
  293. event->parameter = parameter;
  294. atomic_set(&cs->ev_tail, next);
  295. }
  296. spin_unlock_irqrestore(&cs->ev_lock, flags);
  297. return event;
  298. }
  299. EXPORT_SYMBOL_GPL(gigaset_add_event);
  300. static void free_strings(struct at_state_t *at_state)
  301. {
  302. int i;
  303. for (i = 0; i < STR_NUM; ++i) {
  304. kfree(at_state->str_var[i]);
  305. at_state->str_var[i] = NULL;
  306. }
  307. }
  308. static void clear_at_state(struct at_state_t *at_state)
  309. {
  310. free_strings(at_state);
  311. }
  312. static void dealloc_at_states(struct cardstate *cs)
  313. {
  314. struct at_state_t *cur, *next;
  315. list_for_each_entry_safe(cur, next, &cs->temp_at_states, list) {
  316. list_del(&cur->list);
  317. free_strings(cur);
  318. kfree(cur);
  319. }
  320. }
  321. static void gigaset_freebcs(struct bc_state *bcs)
  322. {
  323. int i;
  324. gig_dbg(DEBUG_INIT, "freeing bcs[%d]->hw", bcs->channel);
  325. if (!bcs->cs->ops->freebcshw(bcs)) {
  326. gig_dbg(DEBUG_INIT, "failed");
  327. }
  328. gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
  329. clear_at_state(&bcs->at_state);
  330. gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);
  331. if (bcs->skb)
  332. dev_kfree_skb(bcs->skb);
  333. for (i = 0; i < AT_NUM; ++i) {
  334. kfree(bcs->commands[i]);
  335. bcs->commands[i] = NULL;
  336. }
  337. }
  338. void gigaset_freecs(struct cardstate *cs)
  339. {
  340. int i;
  341. unsigned long flags;
  342. if (!cs)
  343. return;
  344. down(&cs->sem);
  345. if (!cs->bcs)
  346. goto f_cs;
  347. if (!cs->inbuf)
  348. goto f_bcs;
  349. spin_lock_irqsave(&cs->lock, flags);
  350. atomic_set(&cs->running, 0);
  351. spin_unlock_irqrestore(&cs->lock, flags); /* event handler and timer are
  352. not rescheduled below */
  353. tasklet_kill(&cs->event_tasklet);
  354. del_timer_sync(&cs->timer);
  355. switch (cs->cs_init) {
  356. default:
  357. gigaset_if_free(cs);
  358. gig_dbg(DEBUG_INIT, "clearing hw");
  359. cs->ops->freecshw(cs);
  360. //FIXME cmdbuf
  361. /* fall through */
  362. case 2: /* error in initcshw */
  363. /* Deregister from LL */
  364. make_invalid(cs, VALID_ID);
  365. gig_dbg(DEBUG_INIT, "clearing iif");
  366. gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD);
  367. /* fall through */
  368. case 1: /* error when regestering to LL */
  369. gig_dbg(DEBUG_INIT, "clearing at_state");
  370. clear_at_state(&cs->at_state);
  371. dealloc_at_states(cs);
  372. /* fall through */
  373. case 0: /* error in one call to initbcs */
  374. for (i = 0; i < cs->channels; ++i) {
  375. gig_dbg(DEBUG_INIT, "clearing bcs[%d]", i);
  376. gigaset_freebcs(cs->bcs + i);
  377. }
  378. clear_events(cs);
  379. gig_dbg(DEBUG_INIT, "freeing inbuf");
  380. kfree(cs->inbuf);
  381. }
  382. f_bcs: gig_dbg(DEBUG_INIT, "freeing bcs[]");
  383. kfree(cs->bcs);
  384. f_cs: gig_dbg(DEBUG_INIT, "freeing cs");
  385. up(&cs->sem);
  386. free_cs(cs);
  387. }
  388. EXPORT_SYMBOL_GPL(gigaset_freecs);
  389. void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
  390. struct cardstate *cs, int cid)
  391. {
  392. int i;
  393. INIT_LIST_HEAD(&at_state->list);
  394. at_state->waiting = 0;
  395. at_state->getstring = 0;
  396. at_state->pending_commands = 0;
  397. at_state->timer_expires = 0;
  398. at_state->timer_active = 0;
  399. atomic_set(&at_state->timer_index, 0);
  400. atomic_set(&at_state->seq_index, 0);
  401. at_state->ConState = 0;
  402. for (i = 0; i < STR_NUM; ++i)
  403. at_state->str_var[i] = NULL;
  404. at_state->int_var[VAR_ZDLE] = 0;
  405. at_state->int_var[VAR_ZCTP] = -1;
  406. at_state->int_var[VAR_ZSAU] = ZSAU_NULL;
  407. at_state->cs = cs;
  408. at_state->bcs = bcs;
  409. at_state->cid = cid;
  410. if (!cid)
  411. at_state->replystruct = cs->tabnocid;
  412. else
  413. at_state->replystruct = cs->tabcid;
  414. }
  415. static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs,
  416. struct cardstate *cs, int inputstate)
  417. /* inbuf->read must be allocated before! */
  418. {
  419. atomic_set(&inbuf->head, 0);
  420. atomic_set(&inbuf->tail, 0);
  421. inbuf->cs = cs;
  422. inbuf->bcs = bcs; /*base driver: NULL*/
  423. inbuf->rcvbuf = NULL; //FIXME
  424. inbuf->inputstate = inputstate;
  425. }
  426. /* append received bytes to inbuf */
  427. int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
  428. unsigned numbytes)
  429. {
  430. unsigned n, head, tail, bytesleft;
  431. gig_dbg(DEBUG_INTR, "received %u bytes", numbytes);
  432. if (!numbytes)
  433. return 0;
  434. bytesleft = numbytes;
  435. tail = atomic_read(&inbuf->tail);
  436. head = atomic_read(&inbuf->head);
  437. gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
  438. while (bytesleft) {
  439. if (head > tail)
  440. n = head - 1 - tail;
  441. else if (head == 0)
  442. n = (RBUFSIZE-1) - tail;
  443. else
  444. n = RBUFSIZE - tail;
  445. if (!n) {
  446. dev_err(inbuf->cs->dev,
  447. "buffer overflow (%u bytes lost)", bytesleft);
  448. break;
  449. }
  450. if (n > bytesleft)
  451. n = bytesleft;
  452. memcpy(inbuf->data + tail, src, n);
  453. bytesleft -= n;
  454. tail = (tail + n) % RBUFSIZE;
  455. src += n;
  456. }
  457. gig_dbg(DEBUG_INTR, "setting tail to %u", tail);
  458. atomic_set(&inbuf->tail, tail);
  459. return numbytes != bytesleft;
  460. }
  461. EXPORT_SYMBOL_GPL(gigaset_fill_inbuf);
  462. /* Initialize the b-channel structure */
  463. static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
  464. struct cardstate *cs, int channel)
  465. {
  466. int i;
  467. bcs->tx_skb = NULL; //FIXME -> hw part
  468. skb_queue_head_init(&bcs->squeue);
  469. bcs->corrupted = 0;
  470. bcs->trans_down = 0;
  471. bcs->trans_up = 0;
  472. gig_dbg(DEBUG_INIT, "setting up bcs[%d]->at_state", channel);
  473. gigaset_at_init(&bcs->at_state, bcs, cs, -1);
  474. bcs->rcvbytes = 0;
  475. #ifdef CONFIG_GIGASET_DEBUG
  476. bcs->emptycount = 0;
  477. #endif
  478. gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel);
  479. bcs->fcs = PPP_INITFCS;
  480. bcs->inputstate = 0;
  481. if (cs->ignoreframes) {
  482. bcs->inputstate |= INS_skip_frame;
  483. bcs->skb = NULL;
  484. } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
  485. skb_reserve(bcs->skb, HW_HDR_LEN);
  486. else {
  487. dev_warn(cs->dev, "could not allocate skb\n");
  488. bcs->inputstate |= INS_skip_frame;
  489. }
  490. bcs->channel = channel;
  491. bcs->cs = cs;
  492. bcs->chstate = 0;
  493. bcs->use_count = 1;
  494. bcs->busy = 0;
  495. bcs->ignore = cs->ignoreframes;
  496. for (i = 0; i < AT_NUM; ++i)
  497. bcs->commands[i] = NULL;
  498. gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel);
  499. if (cs->ops->initbcshw(bcs))
  500. return bcs;
  501. gig_dbg(DEBUG_INIT, " failed");
  502. gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel);
  503. if (bcs->skb)
  504. dev_kfree_skb(bcs->skb);
  505. return NULL;
  506. }
  507. /* gigaset_initcs
  508. * Allocate and initialize cardstate structure for Gigaset driver
  509. * Calls hardware dependent gigaset_initcshw() function
  510. * Calls B channel initialization function gigaset_initbcs() for each B channel
  511. * parameters:
  512. * drv hardware driver the device belongs to
  513. * channels number of B channels supported by device
  514. * onechannel !=0: B channel data and AT commands share one
  515. * communication channel
  516. * ==0: B channels have separate communication channels
  517. * ignoreframes number of frames to ignore after setting up B channel
  518. * cidmode !=0: start in CallID mode
  519. * modulename name of driver module (used for I4L registration)
  520. * return value:
  521. * pointer to cardstate structure
  522. */
  523. struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
  524. int onechannel, int ignoreframes,
  525. int cidmode, const char *modulename)
  526. {
  527. struct cardstate *cs = NULL;
  528. int i;
  529. gig_dbg(DEBUG_INIT, "allocating cs");
  530. cs = alloc_cs(drv);
  531. if (!cs)
  532. goto error;
  533. gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
  534. cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
  535. if (!cs->bcs)
  536. goto error;
  537. gig_dbg(DEBUG_INIT, "allocating inbuf");
  538. cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL);
  539. if (!cs->inbuf)
  540. goto error;
  541. cs->cs_init = 0;
  542. cs->channels = channels;
  543. cs->onechannel = onechannel;
  544. cs->ignoreframes = ignoreframes;
  545. INIT_LIST_HEAD(&cs->temp_at_states);
  546. atomic_set(&cs->running, 0);
  547. init_timer(&cs->timer); /* clear next & prev */
  548. spin_lock_init(&cs->ev_lock);
  549. atomic_set(&cs->ev_tail, 0);
  550. atomic_set(&cs->ev_head, 0);
  551. init_MUTEX_LOCKED(&cs->sem);
  552. tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
  553. (unsigned long) cs);
  554. atomic_set(&cs->commands_pending, 0);
  555. cs->cur_at_seq = 0;
  556. cs->gotfwver = -1;
  557. cs->open_count = 0;
  558. cs->dev = NULL;
  559. cs->tty = NULL;
  560. atomic_set(&cs->cidmode, cidmode != 0);
  561. //if(onechannel) { //FIXME
  562. cs->tabnocid = gigaset_tab_nocid_m10x;
  563. cs->tabcid = gigaset_tab_cid_m10x;
  564. //} else {
  565. // cs->tabnocid = gigaset_tab_nocid;
  566. // cs->tabcid = gigaset_tab_cid;
  567. //}
  568. init_waitqueue_head(&cs->waitqueue);
  569. cs->waiting = 0;
  570. atomic_set(&cs->mode, M_UNKNOWN);
  571. atomic_set(&cs->mstate, MS_UNINITIALIZED);
  572. for (i = 0; i < channels; ++i) {
  573. gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
  574. if (!gigaset_initbcs(cs->bcs + i, cs, i))
  575. goto error;
  576. }
  577. ++cs->cs_init;
  578. gig_dbg(DEBUG_INIT, "setting up at_state");
  579. spin_lock_init(&cs->lock);
  580. gigaset_at_init(&cs->at_state, NULL, cs, 0);
  581. cs->dle = 0;
  582. cs->cbytes = 0;
  583. gig_dbg(DEBUG_INIT, "setting up inbuf");
  584. if (onechannel) { //FIXME distinction necessary?
  585. gigaset_inbuf_init(cs->inbuf, cs->bcs, cs, INS_command);
  586. } else
  587. gigaset_inbuf_init(cs->inbuf, NULL, cs, INS_command);
  588. atomic_set(&cs->connected, 0);
  589. gig_dbg(DEBUG_INIT, "setting up cmdbuf");
  590. cs->cmdbuf = cs->lastcmdbuf = NULL;
  591. spin_lock_init(&cs->cmdlock);
  592. cs->curlen = 0;
  593. cs->cmdbytes = 0;
  594. gig_dbg(DEBUG_INIT, "setting up iif");
  595. if (!gigaset_register_to_LL(cs, modulename)) {
  596. err("register_isdn failed");
  597. goto error;
  598. }
  599. make_valid(cs, VALID_ID);
  600. ++cs->cs_init;
  601. gig_dbg(DEBUG_INIT, "setting up hw");
  602. if (!cs->ops->initcshw(cs))
  603. goto error;
  604. ++cs->cs_init;
  605. gigaset_if_init(cs);
  606. atomic_set(&cs->running, 1);
  607. setup_timer(&cs->timer, timer_tick, (unsigned long) cs);
  608. cs->timer.expires = jiffies + msecs_to_jiffies(GIG_TICK);
  609. /* FIXME: can jiffies increase too much until the timer is added?
  610. * Same problem(?) with mod_timer() in timer_tick(). */
  611. add_timer(&cs->timer);
  612. gig_dbg(DEBUG_INIT, "cs initialized");
  613. up(&cs->sem);
  614. return cs;
  615. error: if (cs)
  616. up(&cs->sem);
  617. gig_dbg(DEBUG_INIT, "failed");
  618. gigaset_freecs(cs);
  619. return NULL;
  620. }
  621. EXPORT_SYMBOL_GPL(gigaset_initcs);
  622. /* ReInitialize the b-channel structure */
  623. /* e.g. called on hangup, disconnect */
  624. void gigaset_bcs_reinit(struct bc_state *bcs)
  625. {
  626. struct sk_buff *skb;
  627. struct cardstate *cs = bcs->cs;
  628. unsigned long flags;
  629. while ((skb = skb_dequeue(&bcs->squeue)) != NULL)
  630. dev_kfree_skb(skb);
  631. spin_lock_irqsave(&cs->lock, flags);
  632. clear_at_state(&bcs->at_state);
  633. bcs->at_state.ConState = 0;
  634. bcs->at_state.timer_active = 0;
  635. bcs->at_state.timer_expires = 0;
  636. bcs->at_state.cid = -1; /* No CID defined */
  637. spin_unlock_irqrestore(&cs->lock, flags);
  638. bcs->inputstate = 0;
  639. #ifdef CONFIG_GIGASET_DEBUG
  640. bcs->emptycount = 0;
  641. #endif
  642. bcs->fcs = PPP_INITFCS;
  643. bcs->chstate = 0;
  644. bcs->ignore = cs->ignoreframes;
  645. if (bcs->ignore)
  646. bcs->inputstate |= INS_skip_frame;
  647. cs->ops->reinitbcshw(bcs);
  648. }
  649. static void cleanup_cs(struct cardstate *cs)
  650. {
  651. struct cmdbuf_t *cb, *tcb;
  652. int i;
  653. unsigned long flags;
  654. spin_lock_irqsave(&cs->lock, flags);
  655. atomic_set(&cs->mode, M_UNKNOWN);
  656. atomic_set(&cs->mstate, MS_UNINITIALIZED);
  657. clear_at_state(&cs->at_state);
  658. dealloc_at_states(cs);
  659. free_strings(&cs->at_state);
  660. gigaset_at_init(&cs->at_state, NULL, cs, 0);
  661. kfree(cs->inbuf->rcvbuf);
  662. cs->inbuf->rcvbuf = NULL;
  663. cs->inbuf->inputstate = INS_command;
  664. atomic_set(&cs->inbuf->head, 0);
  665. atomic_set(&cs->inbuf->tail, 0);
  666. cb = cs->cmdbuf;
  667. while (cb) {
  668. tcb = cb;
  669. cb = cb->next;
  670. kfree(tcb);
  671. }
  672. cs->cmdbuf = cs->lastcmdbuf = NULL;
  673. cs->curlen = 0;
  674. cs->cmdbytes = 0;
  675. cs->gotfwver = -1;
  676. cs->dle = 0;
  677. cs->cur_at_seq = 0;
  678. atomic_set(&cs->commands_pending, 0);
  679. cs->cbytes = 0;
  680. spin_unlock_irqrestore(&cs->lock, flags);
  681. for (i = 0; i < cs->channels; ++i) {
  682. gigaset_freebcs(cs->bcs + i);
  683. if (!gigaset_initbcs(cs->bcs + i, cs, i))
  684. break; //FIXME error handling
  685. }
  686. if (cs->waiting) {
  687. cs->cmd_result = -ENODEV;
  688. cs->waiting = 0;
  689. wake_up_interruptible(&cs->waitqueue);
  690. }
  691. }
  692. int gigaset_start(struct cardstate *cs)
  693. {
  694. if (down_interruptible(&cs->sem))
  695. return 0;
  696. atomic_set(&cs->connected, 1);
  697. if (atomic_read(&cs->mstate) != MS_LOCKED) {
  698. cs->ops->set_modem_ctrl(cs, 0, TIOCM_DTR|TIOCM_RTS);
  699. cs->ops->baud_rate(cs, B115200);
  700. cs->ops->set_line_ctrl(cs, CS8);
  701. cs->control_state = TIOCM_DTR|TIOCM_RTS;
  702. } else {
  703. //FIXME use some saved values?
  704. }
  705. cs->waiting = 1;
  706. if (!gigaset_add_event(cs, &cs->at_state, EV_START, NULL, 0, NULL)) {
  707. cs->waiting = 0;
  708. //FIXME what should we do?
  709. goto error;
  710. }
  711. gig_dbg(DEBUG_CMD, "scheduling START");
  712. gigaset_schedule_event(cs);
  713. wait_event(cs->waitqueue, !cs->waiting);
  714. /* set up device sysfs */
  715. gigaset_init_dev_sysfs(cs);
  716. up(&cs->sem);
  717. return 1;
  718. error:
  719. up(&cs->sem);
  720. return 0;
  721. }
  722. EXPORT_SYMBOL_GPL(gigaset_start);
  723. void gigaset_shutdown(struct cardstate *cs)
  724. {
  725. down(&cs->sem);
  726. cs->waiting = 1;
  727. if (!gigaset_add_event(cs, &cs->at_state, EV_SHUTDOWN, NULL, 0, NULL)) {
  728. //FIXME what should we do?
  729. goto exit;
  730. }
  731. gig_dbg(DEBUG_CMD, "scheduling SHUTDOWN");
  732. gigaset_schedule_event(cs);
  733. if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
  734. warn("%s: aborted", __func__);
  735. //FIXME
  736. }
  737. if (atomic_read(&cs->mstate) != MS_LOCKED) {
  738. //FIXME?
  739. //gigaset_baud_rate(cs, B115200);
  740. //gigaset_set_line_ctrl(cs, CS8);
  741. //gigaset_set_modem_ctrl(cs, TIOCM_DTR|TIOCM_RTS, 0);
  742. //cs->control_state = 0;
  743. } else {
  744. //FIXME use some saved values?
  745. }
  746. cleanup_cs(cs);
  747. exit:
  748. up(&cs->sem);
  749. }
  750. EXPORT_SYMBOL_GPL(gigaset_shutdown);
  751. void gigaset_stop(struct cardstate *cs)
  752. {
  753. down(&cs->sem);
  754. /* clear device sysfs */
  755. gigaset_free_dev_sysfs(cs);
  756. atomic_set(&cs->connected, 0);
  757. cs->waiting = 1;
  758. if (!gigaset_add_event(cs, &cs->at_state, EV_STOP, NULL, 0, NULL)) {
  759. //FIXME what should we do?
  760. goto exit;
  761. }
  762. gig_dbg(DEBUG_CMD, "scheduling STOP");
  763. gigaset_schedule_event(cs);
  764. if (wait_event_interruptible(cs->waitqueue, !cs->waiting)) {
  765. warn("%s: aborted", __func__);
  766. //FIXME
  767. }
  768. /* Tell the LL that the device is not available .. */
  769. gigaset_i4l_cmd(cs, ISDN_STAT_STOP); // FIXME move to event layer?
  770. cleanup_cs(cs);
  771. exit:
  772. up(&cs->sem);
  773. }
  774. EXPORT_SYMBOL_GPL(gigaset_stop);
  775. static LIST_HEAD(drivers);
  776. static spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
  777. struct cardstate *gigaset_get_cs_by_id(int id)
  778. {
  779. unsigned long flags;
  780. static struct cardstate *ret = NULL;
  781. static struct cardstate *cs;
  782. struct gigaset_driver *drv;
  783. unsigned i;
  784. spin_lock_irqsave(&driver_lock, flags);
  785. list_for_each_entry(drv, &drivers, list) {
  786. spin_lock(&drv->lock);
  787. for (i = 0; i < drv->minors; ++i) {
  788. if (drv->flags[i] & VALID_ID) {
  789. cs = drv->cs + i;
  790. if (cs->myid == id)
  791. ret = cs;
  792. }
  793. if (ret)
  794. break;
  795. }
  796. spin_unlock(&drv->lock);
  797. if (ret)
  798. break;
  799. }
  800. spin_unlock_irqrestore(&driver_lock, flags);
  801. return ret;
  802. }
  803. void gigaset_debugdrivers(void)
  804. {
  805. unsigned long flags;
  806. static struct cardstate *cs;
  807. struct gigaset_driver *drv;
  808. unsigned i;
  809. spin_lock_irqsave(&driver_lock, flags);
  810. list_for_each_entry(drv, &drivers, list) {
  811. gig_dbg(DEBUG_DRIVER, "driver %p", drv);
  812. spin_lock(&drv->lock);
  813. for (i = 0; i < drv->minors; ++i) {
  814. gig_dbg(DEBUG_DRIVER, " index %u", i);
  815. gig_dbg(DEBUG_DRIVER, " flags 0x%02x",
  816. drv->flags[i]);
  817. cs = drv->cs + i;
  818. gig_dbg(DEBUG_DRIVER, " cardstate %p", cs);
  819. gig_dbg(DEBUG_DRIVER, " minor_index %u",
  820. cs->minor_index);
  821. gig_dbg(DEBUG_DRIVER, " driver %p", cs->driver);
  822. gig_dbg(DEBUG_DRIVER, " i4l id %d", cs->myid);
  823. }
  824. spin_unlock(&drv->lock);
  825. }
  826. spin_unlock_irqrestore(&driver_lock, flags);
  827. }
  828. EXPORT_SYMBOL_GPL(gigaset_debugdrivers);
  829. struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty)
  830. {
  831. if (tty->index < 0 || tty->index >= tty->driver->num)
  832. return NULL;
  833. return gigaset_get_cs_by_minor(tty->index + tty->driver->minor_start);
  834. }
  835. struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
  836. {
  837. unsigned long flags;
  838. static struct cardstate *ret = NULL;
  839. struct gigaset_driver *drv;
  840. unsigned index;
  841. spin_lock_irqsave(&driver_lock, flags);
  842. list_for_each_entry(drv, &drivers, list) {
  843. if (minor < drv->minor || minor >= drv->minor + drv->minors)
  844. continue;
  845. index = minor - drv->minor;
  846. spin_lock(&drv->lock);
  847. if (drv->flags[index] & VALID_MINOR)
  848. ret = drv->cs + index;
  849. spin_unlock(&drv->lock);
  850. if (ret)
  851. break;
  852. }
  853. spin_unlock_irqrestore(&driver_lock, flags);
  854. return ret;
  855. }
  856. void gigaset_freedriver(struct gigaset_driver *drv)
  857. {
  858. unsigned long flags;
  859. spin_lock_irqsave(&driver_lock, flags);
  860. list_del(&drv->list);
  861. spin_unlock_irqrestore(&driver_lock, flags);
  862. gigaset_if_freedriver(drv);
  863. module_put(drv->owner);
  864. kfree(drv->cs);
  865. kfree(drv->flags);
  866. kfree(drv);
  867. }
  868. EXPORT_SYMBOL_GPL(gigaset_freedriver);
  869. /* gigaset_initdriver
  870. * Allocate and initialize gigaset_driver structure. Initialize interface.
  871. * parameters:
  872. * minor First minor number
  873. * minors Number of minors this driver can handle
  874. * procname Name of the driver
  875. * devname Name of the device files (prefix without minor number)
  876. * devfsname Devfs name of the device files without %d
  877. * return value:
  878. * Pointer to the gigaset_driver structure on success, NULL on failure.
  879. */
  880. struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
  881. const char *procname,
  882. const char *devname,
  883. const char *devfsname,
  884. const struct gigaset_ops *ops,
  885. struct module *owner)
  886. {
  887. struct gigaset_driver *drv;
  888. unsigned long flags;
  889. unsigned i;
  890. drv = kmalloc(sizeof *drv, GFP_KERNEL);
  891. if (!drv)
  892. return NULL;
  893. if (!try_module_get(owner))
  894. return NULL;
  895. drv->cs = NULL;
  896. drv->have_tty = 0;
  897. drv->minor = minor;
  898. drv->minors = minors;
  899. spin_lock_init(&drv->lock);
  900. drv->blocked = 0;
  901. drv->ops = ops;
  902. drv->owner = owner;
  903. INIT_LIST_HEAD(&drv->list);
  904. drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL);
  905. if (!drv->cs)
  906. goto out1;
  907. drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL);
  908. if (!drv->flags)
  909. goto out2;
  910. for (i = 0; i < minors; ++i) {
  911. drv->flags[i] = 0;
  912. drv->cs[i].driver = drv;
  913. drv->cs[i].ops = drv->ops;
  914. drv->cs[i].minor_index = i;
  915. }
  916. gigaset_if_initdriver(drv, procname, devname, devfsname);
  917. spin_lock_irqsave(&driver_lock, flags);
  918. list_add(&drv->list, &drivers);
  919. spin_unlock_irqrestore(&driver_lock, flags);
  920. return drv;
  921. out2:
  922. kfree(drv->cs);
  923. out1:
  924. kfree(drv);
  925. module_put(owner);
  926. return NULL;
  927. }
  928. EXPORT_SYMBOL_GPL(gigaset_initdriver);
  929. static struct cardstate *alloc_cs(struct gigaset_driver *drv)
  930. {
  931. unsigned long flags;
  932. unsigned i;
  933. static struct cardstate *ret = NULL;
  934. spin_lock_irqsave(&drv->lock, flags);
  935. for (i = 0; i < drv->minors; ++i) {
  936. if (!(drv->flags[i] & VALID_MINOR)) {
  937. drv->flags[i] = VALID_MINOR;
  938. ret = drv->cs + i;
  939. }
  940. if (ret)
  941. break;
  942. }
  943. spin_unlock_irqrestore(&drv->lock, flags);
  944. return ret;
  945. }
  946. static void free_cs(struct cardstate *cs)
  947. {
  948. unsigned long flags;
  949. struct gigaset_driver *drv = cs->driver;
  950. spin_lock_irqsave(&drv->lock, flags);
  951. drv->flags[cs->minor_index] = 0;
  952. spin_unlock_irqrestore(&drv->lock, flags);
  953. }
  954. static void make_valid(struct cardstate *cs, unsigned mask)
  955. {
  956. unsigned long flags;
  957. struct gigaset_driver *drv = cs->driver;
  958. spin_lock_irqsave(&drv->lock, flags);
  959. drv->flags[cs->minor_index] |= mask;
  960. spin_unlock_irqrestore(&drv->lock, flags);
  961. }
  962. static void make_invalid(struct cardstate *cs, unsigned mask)
  963. {
  964. unsigned long flags;
  965. struct gigaset_driver *drv = cs->driver;
  966. spin_lock_irqsave(&drv->lock, flags);
  967. drv->flags[cs->minor_index] &= ~mask;
  968. spin_unlock_irqrestore(&drv->lock, flags);
  969. }
  970. /* For drivers without fixed assignment device<->cardstate (usb) */
  971. struct cardstate *gigaset_getunassignedcs(struct gigaset_driver *drv)
  972. {
  973. unsigned long flags;
  974. struct cardstate *cs = NULL;
  975. unsigned i;
  976. spin_lock_irqsave(&drv->lock, flags);
  977. if (drv->blocked)
  978. goto exit;
  979. for (i = 0; i < drv->minors; ++i) {
  980. if ((drv->flags[i] & VALID_MINOR) &&
  981. !(drv->flags[i] & ASSIGNED)) {
  982. drv->flags[i] |= ASSIGNED;
  983. cs = drv->cs + i;
  984. break;
  985. }
  986. }
  987. exit:
  988. spin_unlock_irqrestore(&drv->lock, flags);
  989. return cs;
  990. }
  991. EXPORT_SYMBOL_GPL(gigaset_getunassignedcs);
  992. void gigaset_unassign(struct cardstate *cs)
  993. {
  994. unsigned long flags;
  995. unsigned *minor_flags;
  996. struct gigaset_driver *drv;
  997. if (!cs)
  998. return;
  999. drv = cs->driver;
  1000. spin_lock_irqsave(&drv->lock, flags);
  1001. minor_flags = drv->flags + cs->minor_index;
  1002. if (*minor_flags & VALID_MINOR)
  1003. *minor_flags &= ~ASSIGNED;
  1004. spin_unlock_irqrestore(&drv->lock, flags);
  1005. }
  1006. EXPORT_SYMBOL_GPL(gigaset_unassign);
  1007. void gigaset_blockdriver(struct gigaset_driver *drv)
  1008. {
  1009. unsigned long flags;
  1010. spin_lock_irqsave(&drv->lock, flags);
  1011. drv->blocked = 1;
  1012. spin_unlock_irqrestore(&drv->lock, flags);
  1013. }
  1014. EXPORT_SYMBOL_GPL(gigaset_blockdriver);
  1015. static int __init gigaset_init_module(void)
  1016. {
  1017. /* in accordance with the principle of least astonishment,
  1018. * setting the 'debug' parameter to 1 activates a sensible
  1019. * set of default debug levels
  1020. */
  1021. if (gigaset_debuglevel == 1)
  1022. gigaset_debuglevel = DEBUG_DEFAULT;
  1023. info(DRIVER_AUTHOR);
  1024. info(DRIVER_DESC);
  1025. return 0;
  1026. }
  1027. static void __exit gigaset_exit_module(void)
  1028. {
  1029. }
  1030. module_init(gigaset_init_module);
  1031. module_exit(gigaset_exit_module);
  1032. MODULE_AUTHOR(DRIVER_AUTHOR);
  1033. MODULE_DESCRIPTION(DRIVER_DESC);
  1034. MODULE_LICENSE("GPL");