seq_instr.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /*
  2. * Generic Instrument routines for ALSA sequencer
  3. * Copyright (c) 1999 by Jaroslav Kysela <perex@suse.cz>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #include <sound/driver.h>
  21. #include <linux/init.h>
  22. #include <linux/slab.h>
  23. #include <sound/core.h>
  24. #include "seq_clientmgr.h"
  25. #include <sound/seq_instr.h>
  26. #include <sound/initval.h>
  27. MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
  28. MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer instrument library.");
  29. MODULE_LICENSE("GPL");
  30. static void snd_instr_lock_ops(snd_seq_kinstr_list_t *list)
  31. {
  32. if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
  33. spin_lock_irqsave(&list->ops_lock, list->ops_flags);
  34. } else {
  35. down(&list->ops_mutex);
  36. }
  37. }
  38. static void snd_instr_unlock_ops(snd_seq_kinstr_list_t *list)
  39. {
  40. if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) {
  41. spin_unlock_irqrestore(&list->ops_lock, list->ops_flags);
  42. } else {
  43. up(&list->ops_mutex);
  44. }
  45. }
  46. static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic)
  47. {
  48. snd_seq_kinstr_t *instr;
  49. instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
  50. if (instr == NULL)
  51. return NULL;
  52. instr->add_len = add_len;
  53. return instr;
  54. }
  55. static int snd_seq_instr_free(snd_seq_kinstr_t *instr, int atomic)
  56. {
  57. int result = 0;
  58. if (instr == NULL)
  59. return -EINVAL;
  60. if (instr->ops && instr->ops->remove)
  61. result = instr->ops->remove(instr->ops->private_data, instr, 1);
  62. if (!result)
  63. kfree(instr);
  64. return result;
  65. }
  66. snd_seq_kinstr_list_t *snd_seq_instr_list_new(void)
  67. {
  68. snd_seq_kinstr_list_t *list;
  69. list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL);
  70. if (list == NULL)
  71. return NULL;
  72. spin_lock_init(&list->lock);
  73. spin_lock_init(&list->ops_lock);
  74. init_MUTEX(&list->ops_mutex);
  75. list->owner = -1;
  76. return list;
  77. }
  78. void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr)
  79. {
  80. snd_seq_kinstr_list_t *list;
  81. snd_seq_kinstr_t *instr;
  82. snd_seq_kcluster_t *cluster;
  83. int idx;
  84. unsigned long flags;
  85. if (list_ptr == NULL)
  86. return;
  87. list = *list_ptr;
  88. *list_ptr = NULL;
  89. if (list == NULL)
  90. return;
  91. for (idx = 0; idx < SNDRV_SEQ_INSTR_HASH_SIZE; idx++) {
  92. while ((instr = list->hash[idx]) != NULL) {
  93. list->hash[idx] = instr->next;
  94. list->count--;
  95. spin_lock_irqsave(&list->lock, flags);
  96. while (instr->use) {
  97. spin_unlock_irqrestore(&list->lock, flags);
  98. schedule_timeout_interruptible(1);
  99. spin_lock_irqsave(&list->lock, flags);
  100. }
  101. spin_unlock_irqrestore(&list->lock, flags);
  102. if (snd_seq_instr_free(instr, 0)<0)
  103. snd_printk(KERN_WARNING "instrument free problem\n");
  104. }
  105. while ((cluster = list->chash[idx]) != NULL) {
  106. list->chash[idx] = cluster->next;
  107. list->ccount--;
  108. kfree(cluster);
  109. }
  110. }
  111. kfree(list);
  112. }
  113. static int instr_free_compare(snd_seq_kinstr_t *instr,
  114. snd_seq_instr_header_t *ifree,
  115. unsigned int client)
  116. {
  117. switch (ifree->cmd) {
  118. case SNDRV_SEQ_INSTR_FREE_CMD_ALL:
  119. /* all, except private for other clients */
  120. if ((instr->instr.std & 0xff000000) == 0)
  121. return 0;
  122. if (((instr->instr.std >> 24) & 0xff) == client)
  123. return 0;
  124. return 1;
  125. case SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE:
  126. /* all my private instruments */
  127. if ((instr->instr.std & 0xff000000) == 0)
  128. return 1;
  129. if (((instr->instr.std >> 24) & 0xff) == client)
  130. return 0;
  131. return 1;
  132. case SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER:
  133. /* all my private instruments */
  134. if ((instr->instr.std & 0xff000000) == 0) {
  135. if (instr->instr.cluster == ifree->id.cluster)
  136. return 0;
  137. return 1;
  138. }
  139. if (((instr->instr.std >> 24) & 0xff) == client) {
  140. if (instr->instr.cluster == ifree->id.cluster)
  141. return 0;
  142. }
  143. return 1;
  144. }
  145. return 1;
  146. }
  147. int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list,
  148. snd_seq_instr_header_t *ifree,
  149. int client,
  150. int atomic)
  151. {
  152. snd_seq_kinstr_t *instr, *prev, *next, *flist;
  153. int idx;
  154. unsigned long flags;
  155. snd_instr_lock_ops(list);
  156. for (idx = 0; idx < SNDRV_SEQ_INSTR_HASH_SIZE; idx++) {
  157. spin_lock_irqsave(&list->lock, flags);
  158. instr = list->hash[idx];
  159. prev = flist = NULL;
  160. while (instr) {
  161. while (instr && instr_free_compare(instr, ifree, (unsigned int)client)) {
  162. prev = instr;
  163. instr = instr->next;
  164. }
  165. if (instr == NULL)
  166. continue;
  167. if (instr->ops && instr->ops->notify)
  168. instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
  169. next = instr->next;
  170. if (prev == NULL) {
  171. list->hash[idx] = next;
  172. } else {
  173. prev->next = next;
  174. }
  175. list->count--;
  176. instr->next = flist;
  177. flist = instr;
  178. instr = next;
  179. }
  180. spin_unlock_irqrestore(&list->lock, flags);
  181. while (flist) {
  182. instr = flist;
  183. flist = instr->next;
  184. while (instr->use)
  185. schedule_timeout_interruptible(1);
  186. if (snd_seq_instr_free(instr, atomic)<0)
  187. snd_printk(KERN_WARNING "instrument free problem\n");
  188. instr = next;
  189. }
  190. }
  191. snd_instr_unlock_ops(list);
  192. return 0;
  193. }
  194. static int compute_hash_instr_key(snd_seq_instr_t *instr)
  195. {
  196. int result;
  197. result = instr->bank | (instr->prg << 16);
  198. result += result >> 24;
  199. result += result >> 16;
  200. result += result >> 8;
  201. return result & (SNDRV_SEQ_INSTR_HASH_SIZE-1);
  202. }
  203. #if 0
  204. static int compute_hash_cluster_key(snd_seq_instr_cluster_t cluster)
  205. {
  206. int result;
  207. result = cluster;
  208. result += result >> 24;
  209. result += result >> 16;
  210. result += result >> 8;
  211. return result & (SNDRV_SEQ_INSTR_HASH_SIZE-1);
  212. }
  213. #endif
  214. static int compare_instr(snd_seq_instr_t *i1, snd_seq_instr_t *i2, int exact)
  215. {
  216. if (exact) {
  217. if (i1->cluster != i2->cluster ||
  218. i1->bank != i2->bank ||
  219. i1->prg != i2->prg)
  220. return 1;
  221. if ((i1->std & 0xff000000) != (i2->std & 0xff000000))
  222. return 1;
  223. if (!(i1->std & i2->std))
  224. return 1;
  225. return 0;
  226. } else {
  227. unsigned int client_check;
  228. if (i2->cluster && i1->cluster != i2->cluster)
  229. return 1;
  230. client_check = i2->std & 0xff000000;
  231. if (client_check) {
  232. if ((i1->std & 0xff000000) != client_check)
  233. return 1;
  234. } else {
  235. if ((i1->std & i2->std) != i2->std)
  236. return 1;
  237. }
  238. return i1->bank != i2->bank || i1->prg != i2->prg;
  239. }
  240. }
  241. snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list,
  242. snd_seq_instr_t *instr,
  243. int exact,
  244. int follow_alias)
  245. {
  246. unsigned long flags;
  247. int depth = 0;
  248. snd_seq_kinstr_t *result;
  249. if (list == NULL || instr == NULL)
  250. return NULL;
  251. spin_lock_irqsave(&list->lock, flags);
  252. __again:
  253. result = list->hash[compute_hash_instr_key(instr)];
  254. while (result) {
  255. if (!compare_instr(&result->instr, instr, exact)) {
  256. if (follow_alias && (result->type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)) {
  257. instr = (snd_seq_instr_t *)KINSTR_DATA(result);
  258. if (++depth > 10)
  259. goto __not_found;
  260. goto __again;
  261. }
  262. result->use++;
  263. spin_unlock_irqrestore(&list->lock, flags);
  264. return result;
  265. }
  266. result = result->next;
  267. }
  268. __not_found:
  269. spin_unlock_irqrestore(&list->lock, flags);
  270. return NULL;
  271. }
  272. void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list,
  273. snd_seq_kinstr_t *instr)
  274. {
  275. unsigned long flags;
  276. if (list == NULL || instr == NULL)
  277. return;
  278. spin_lock_irqsave(&list->lock, flags);
  279. if (instr->use <= 0) {
  280. snd_printk(KERN_ERR "free_use: fatal!!! use = %i, name = '%s'\n", instr->use, instr->name);
  281. } else {
  282. instr->use--;
  283. }
  284. spin_unlock_irqrestore(&list->lock, flags);
  285. }
  286. static snd_seq_kinstr_ops_t *instr_ops(snd_seq_kinstr_ops_t *ops, char *instr_type)
  287. {
  288. while (ops) {
  289. if (!strcmp(ops->instr_type, instr_type))
  290. return ops;
  291. ops = ops->next;
  292. }
  293. return NULL;
  294. }
  295. static int instr_result(snd_seq_event_t *ev,
  296. int type, int result,
  297. int atomic)
  298. {
  299. snd_seq_event_t sev;
  300. memset(&sev, 0, sizeof(sev));
  301. sev.type = SNDRV_SEQ_EVENT_RESULT;
  302. sev.flags = SNDRV_SEQ_TIME_STAMP_REAL | SNDRV_SEQ_EVENT_LENGTH_FIXED |
  303. SNDRV_SEQ_PRIORITY_NORMAL;
  304. sev.source = ev->dest;
  305. sev.dest = ev->source;
  306. sev.data.result.event = type;
  307. sev.data.result.result = result;
  308. #if 0
  309. printk("instr result - type = %i, result = %i, queue = %i, source.client:port = %i:%i, dest.client:port = %i:%i\n",
  310. type, result,
  311. sev.queue,
  312. sev.source.client, sev.source.port,
  313. sev.dest.client, sev.dest.port);
  314. #endif
  315. return snd_seq_kernel_client_dispatch(sev.source.client, &sev, atomic, 0);
  316. }
  317. static int instr_begin(snd_seq_kinstr_ops_t *ops,
  318. snd_seq_kinstr_list_t *list,
  319. snd_seq_event_t *ev,
  320. int atomic, int hop)
  321. {
  322. unsigned long flags;
  323. spin_lock_irqsave(&list->lock, flags);
  324. if (list->owner >= 0 && list->owner != ev->source.client) {
  325. spin_unlock_irqrestore(&list->lock, flags);
  326. return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, -EBUSY, atomic);
  327. }
  328. list->owner = ev->source.client;
  329. spin_unlock_irqrestore(&list->lock, flags);
  330. return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_BEGIN, 0, atomic);
  331. }
  332. static int instr_end(snd_seq_kinstr_ops_t *ops,
  333. snd_seq_kinstr_list_t *list,
  334. snd_seq_event_t *ev,
  335. int atomic, int hop)
  336. {
  337. unsigned long flags;
  338. /* TODO: timeout handling */
  339. spin_lock_irqsave(&list->lock, flags);
  340. if (list->owner == ev->source.client) {
  341. list->owner = -1;
  342. spin_unlock_irqrestore(&list->lock, flags);
  343. return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, 0, atomic);
  344. }
  345. spin_unlock_irqrestore(&list->lock, flags);
  346. return instr_result(ev, SNDRV_SEQ_EVENT_INSTR_END, -EINVAL, atomic);
  347. }
  348. static int instr_info(snd_seq_kinstr_ops_t *ops,
  349. snd_seq_kinstr_list_t *list,
  350. snd_seq_event_t *ev,
  351. int atomic, int hop)
  352. {
  353. return -ENXIO;
  354. }
  355. static int instr_format_info(snd_seq_kinstr_ops_t *ops,
  356. snd_seq_kinstr_list_t *list,
  357. snd_seq_event_t *ev,
  358. int atomic, int hop)
  359. {
  360. return -ENXIO;
  361. }
  362. static int instr_reset(snd_seq_kinstr_ops_t *ops,
  363. snd_seq_kinstr_list_t *list,
  364. snd_seq_event_t *ev,
  365. int atomic, int hop)
  366. {
  367. return -ENXIO;
  368. }
  369. static int instr_status(snd_seq_kinstr_ops_t *ops,
  370. snd_seq_kinstr_list_t *list,
  371. snd_seq_event_t *ev,
  372. int atomic, int hop)
  373. {
  374. return -ENXIO;
  375. }
  376. static int instr_put(snd_seq_kinstr_ops_t *ops,
  377. snd_seq_kinstr_list_t *list,
  378. snd_seq_event_t *ev,
  379. int atomic, int hop)
  380. {
  381. unsigned long flags;
  382. snd_seq_instr_header_t put;
  383. snd_seq_kinstr_t *instr;
  384. int result = -EINVAL, len, key;
  385. if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR)
  386. goto __return;
  387. if (ev->data.ext.len < sizeof(snd_seq_instr_header_t))
  388. goto __return;
  389. if (copy_from_user(&put, (void __user *)ev->data.ext.ptr, sizeof(snd_seq_instr_header_t))) {
  390. result = -EFAULT;
  391. goto __return;
  392. }
  393. snd_instr_lock_ops(list);
  394. if (put.id.instr.std & 0xff000000) { /* private instrument */
  395. put.id.instr.std &= 0x00ffffff;
  396. put.id.instr.std |= (unsigned int)ev->source.client << 24;
  397. }
  398. if ((instr = snd_seq_instr_find(list, &put.id.instr, 1, 0))) {
  399. snd_seq_instr_free_use(list, instr);
  400. snd_instr_unlock_ops(list);
  401. result = -EBUSY;
  402. goto __return;
  403. }
  404. ops = instr_ops(ops, put.data.data.format);
  405. if (ops == NULL) {
  406. snd_instr_unlock_ops(list);
  407. goto __return;
  408. }
  409. len = ops->add_len;
  410. if (put.data.type == SNDRV_SEQ_INSTR_ATYPE_ALIAS)
  411. len = sizeof(snd_seq_instr_t);
  412. instr = snd_seq_instr_new(len, atomic);
  413. if (instr == NULL) {
  414. snd_instr_unlock_ops(list);
  415. result = -ENOMEM;
  416. goto __return;
  417. }
  418. instr->ops = ops;
  419. instr->instr = put.id.instr;
  420. strlcpy(instr->name, put.data.name, sizeof(instr->name));
  421. instr->type = put.data.type;
  422. if (instr->type == SNDRV_SEQ_INSTR_ATYPE_DATA) {
  423. result = ops->put(ops->private_data,
  424. instr,
  425. (void __user *)ev->data.ext.ptr + sizeof(snd_seq_instr_header_t),
  426. ev->data.ext.len - sizeof(snd_seq_instr_header_t),
  427. atomic,
  428. put.cmd);
  429. if (result < 0) {
  430. snd_seq_instr_free(instr, atomic);
  431. snd_instr_unlock_ops(list);
  432. goto __return;
  433. }
  434. }
  435. key = compute_hash_instr_key(&instr->instr);
  436. spin_lock_irqsave(&list->lock, flags);
  437. instr->next = list->hash[key];
  438. list->hash[key] = instr;
  439. list->count++;
  440. spin_unlock_irqrestore(&list->lock, flags);
  441. snd_instr_unlock_ops(list);
  442. result = 0;
  443. __return:
  444. instr_result(ev, SNDRV_SEQ_EVENT_INSTR_PUT, result, atomic);
  445. return result;
  446. }
  447. static int instr_get(snd_seq_kinstr_ops_t *ops,
  448. snd_seq_kinstr_list_t *list,
  449. snd_seq_event_t *ev,
  450. int atomic, int hop)
  451. {
  452. return -ENXIO;
  453. }
  454. static int instr_free(snd_seq_kinstr_ops_t *ops,
  455. snd_seq_kinstr_list_t *list,
  456. snd_seq_event_t *ev,
  457. int atomic, int hop)
  458. {
  459. snd_seq_instr_header_t ifree;
  460. snd_seq_kinstr_t *instr, *prev;
  461. int result = -EINVAL;
  462. unsigned long flags;
  463. unsigned int hash;
  464. if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARUSR)
  465. goto __return;
  466. if (ev->data.ext.len < sizeof(snd_seq_instr_header_t))
  467. goto __return;
  468. if (copy_from_user(&ifree, (void __user *)ev->data.ext.ptr, sizeof(snd_seq_instr_header_t))) {
  469. result = -EFAULT;
  470. goto __return;
  471. }
  472. if (ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_ALL ||
  473. ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE ||
  474. ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER) {
  475. result = snd_seq_instr_list_free_cond(list, &ifree, ev->dest.client, atomic);
  476. goto __return;
  477. }
  478. if (ifree.cmd == SNDRV_SEQ_INSTR_FREE_CMD_SINGLE) {
  479. if (ifree.id.instr.std & 0xff000000) {
  480. ifree.id.instr.std &= 0x00ffffff;
  481. ifree.id.instr.std |= (unsigned int)ev->source.client << 24;
  482. }
  483. hash = compute_hash_instr_key(&ifree.id.instr);
  484. snd_instr_lock_ops(list);
  485. spin_lock_irqsave(&list->lock, flags);
  486. instr = list->hash[hash];
  487. prev = NULL;
  488. while (instr) {
  489. if (!compare_instr(&instr->instr, &ifree.id.instr, 1))
  490. goto __free_single;
  491. prev = instr;
  492. instr = instr->next;
  493. }
  494. result = -ENOENT;
  495. spin_unlock_irqrestore(&list->lock, flags);
  496. snd_instr_unlock_ops(list);
  497. goto __return;
  498. __free_single:
  499. if (prev) {
  500. prev->next = instr->next;
  501. } else {
  502. list->hash[hash] = instr->next;
  503. }
  504. if (instr->ops && instr->ops->notify)
  505. instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE);
  506. while (instr->use) {
  507. spin_unlock_irqrestore(&list->lock, flags);
  508. schedule_timeout_interruptible(1);
  509. spin_lock_irqsave(&list->lock, flags);
  510. }
  511. spin_unlock_irqrestore(&list->lock, flags);
  512. result = snd_seq_instr_free(instr, atomic);
  513. snd_instr_unlock_ops(list);
  514. goto __return;
  515. }
  516. __return:
  517. instr_result(ev, SNDRV_SEQ_EVENT_INSTR_FREE, result, atomic);
  518. return result;
  519. }
  520. static int instr_list(snd_seq_kinstr_ops_t *ops,
  521. snd_seq_kinstr_list_t *list,
  522. snd_seq_event_t *ev,
  523. int atomic, int hop)
  524. {
  525. return -ENXIO;
  526. }
  527. static int instr_cluster(snd_seq_kinstr_ops_t *ops,
  528. snd_seq_kinstr_list_t *list,
  529. snd_seq_event_t *ev,
  530. int atomic, int hop)
  531. {
  532. return -ENXIO;
  533. }
  534. int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops,
  535. snd_seq_kinstr_list_t *list,
  536. snd_seq_event_t *ev,
  537. int client,
  538. int atomic,
  539. int hop)
  540. {
  541. int direct = 0;
  542. snd_assert(ops != NULL && list != NULL && ev != NULL, return -EINVAL);
  543. if (snd_seq_ev_is_direct(ev)) {
  544. direct = 1;
  545. switch (ev->type) {
  546. case SNDRV_SEQ_EVENT_INSTR_BEGIN:
  547. return instr_begin(ops, list, ev, atomic, hop);
  548. case SNDRV_SEQ_EVENT_INSTR_END:
  549. return instr_end(ops, list, ev, atomic, hop);
  550. }
  551. }
  552. if ((list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT) && !direct)
  553. return -EINVAL;
  554. switch (ev->type) {
  555. case SNDRV_SEQ_EVENT_INSTR_INFO:
  556. return instr_info(ops, list, ev, atomic, hop);
  557. case SNDRV_SEQ_EVENT_INSTR_FINFO:
  558. return instr_format_info(ops, list, ev, atomic, hop);
  559. case SNDRV_SEQ_EVENT_INSTR_RESET:
  560. return instr_reset(ops, list, ev, atomic, hop);
  561. case SNDRV_SEQ_EVENT_INSTR_STATUS:
  562. return instr_status(ops, list, ev, atomic, hop);
  563. case SNDRV_SEQ_EVENT_INSTR_PUT:
  564. return instr_put(ops, list, ev, atomic, hop);
  565. case SNDRV_SEQ_EVENT_INSTR_GET:
  566. return instr_get(ops, list, ev, atomic, hop);
  567. case SNDRV_SEQ_EVENT_INSTR_FREE:
  568. return instr_free(ops, list, ev, atomic, hop);
  569. case SNDRV_SEQ_EVENT_INSTR_LIST:
  570. return instr_list(ops, list, ev, atomic, hop);
  571. case SNDRV_SEQ_EVENT_INSTR_CLUSTER:
  572. return instr_cluster(ops, list, ev, atomic, hop);
  573. }
  574. return -EINVAL;
  575. }
  576. /*
  577. * Init part
  578. */
  579. static int __init alsa_seq_instr_init(void)
  580. {
  581. return 0;
  582. }
  583. static void __exit alsa_seq_instr_exit(void)
  584. {
  585. }
  586. module_init(alsa_seq_instr_init)
  587. module_exit(alsa_seq_instr_exit)
  588. EXPORT_SYMBOL(snd_seq_instr_list_new);
  589. EXPORT_SYMBOL(snd_seq_instr_list_free);
  590. EXPORT_SYMBOL(snd_seq_instr_list_free_cond);
  591. EXPORT_SYMBOL(snd_seq_instr_find);
  592. EXPORT_SYMBOL(snd_seq_instr_free_use);
  593. EXPORT_SYMBOL(snd_seq_instr_event);