spidev.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. /*
  2. * spidev.c -- simple synchronous userspace interface to SPI devices
  3. *
  4. * Copyright (C) 2006 SWAPP
  5. * Andrea Paterniani <a.paterniani@swapp-eng.it>
  6. * Copyright (C) 2007 David Brownell (simplification, cleanup)
  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 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #include <linux/init.h>
  23. #include <linux/module.h>
  24. #include <linux/ioctl.h>
  25. #include <linux/fs.h>
  26. #include <linux/device.h>
  27. #include <linux/list.h>
  28. #include <linux/errno.h>
  29. #include <linux/mutex.h>
  30. #include <linux/slab.h>
  31. #include <linux/spi/spi.h>
  32. #include <linux/spi/spidev.h>
  33. #include <asm/uaccess.h>
  34. /*
  35. * This supports acccess to SPI devices using normal userspace I/O calls.
  36. * Note that while traditional UNIX/POSIX I/O semantics are half duplex,
  37. * and often mask message boundaries, full SPI support requires full duplex
  38. * transfers. There are several kinds of of internal message boundaries to
  39. * handle chipselect management and other protocol options.
  40. *
  41. * SPI has a character major number assigned. We allocate minor numbers
  42. * dynamically using a bitmask. You must use hotplug tools, such as udev
  43. * (or mdev with busybox) to create and destroy the /dev/spidevB.C device
  44. * nodes, since there is no fixed association of minor numbers with any
  45. * particular SPI bus or device.
  46. */
  47. #define SPIDEV_MAJOR 153 /* assigned */
  48. #define N_SPI_MINORS 32 /* ... up to 256 */
  49. static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG];
  50. /* Bit masks for spi_device.mode management. Note that incorrect
  51. * settings for CS_HIGH and 3WIRE can cause *lots* of trouble for other
  52. * devices on a shared bus: CS_HIGH, because this device will be
  53. * active when it shouldn't be; 3WIRE, because when active it won't
  54. * behave as it should.
  55. *
  56. * REVISIT should changing those two modes be privileged?
  57. */
  58. #define SPI_MODE_MASK (SPI_CPHA | SPI_CPOL | SPI_CS_HIGH \
  59. | SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP)
  60. struct spidev_data {
  61. struct device dev;
  62. spinlock_t spi_lock;
  63. struct spi_device *spi;
  64. struct list_head device_entry;
  65. struct mutex buf_lock;
  66. unsigned users;
  67. u8 *buffer;
  68. };
  69. static LIST_HEAD(device_list);
  70. static DEFINE_MUTEX(device_list_lock);
  71. static unsigned bufsiz = 4096;
  72. module_param(bufsiz, uint, S_IRUGO);
  73. MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");
  74. /*-------------------------------------------------------------------------*/
  75. /*
  76. * We can't use the standard synchronous wrappers for file I/O; we
  77. * need to protect against async removal of the underlying spi_device.
  78. */
  79. static void spidev_complete(void *arg)
  80. {
  81. complete(arg);
  82. }
  83. static ssize_t
  84. spidev_sync(struct spidev_data *spidev, struct spi_message *message)
  85. {
  86. DECLARE_COMPLETION_ONSTACK(done);
  87. int status;
  88. message->complete = spidev_complete;
  89. message->context = &done;
  90. spin_lock_irq(&spidev->spi_lock);
  91. if (spidev->spi == NULL)
  92. status = -ESHUTDOWN;
  93. else
  94. status = spi_async(spidev->spi, message);
  95. spin_unlock_irq(&spidev->spi_lock);
  96. if (status == 0) {
  97. wait_for_completion(&done);
  98. status = message->status;
  99. if (status == 0)
  100. status = message->actual_length;
  101. }
  102. return status;
  103. }
  104. static inline ssize_t
  105. spidev_sync_write(struct spidev_data *spidev, size_t len)
  106. {
  107. struct spi_transfer t = {
  108. .tx_buf = spidev->buffer,
  109. .len = len,
  110. };
  111. struct spi_message m;
  112. spi_message_init(&m);
  113. spi_message_add_tail(&t, &m);
  114. return spidev_sync(spidev, &m);
  115. }
  116. static inline ssize_t
  117. spidev_sync_read(struct spidev_data *spidev, size_t len)
  118. {
  119. struct spi_transfer t = {
  120. .rx_buf = spidev->buffer,
  121. .len = len,
  122. };
  123. struct spi_message m;
  124. spi_message_init(&m);
  125. spi_message_add_tail(&t, &m);
  126. return spidev_sync(spidev, &m);
  127. }
  128. /*-------------------------------------------------------------------------*/
  129. /* Read-only message with current device setup */
  130. static ssize_t
  131. spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
  132. {
  133. struct spidev_data *spidev;
  134. ssize_t status = 0;
  135. /* chipselect only toggles at start or end of operation */
  136. if (count > bufsiz)
  137. return -EMSGSIZE;
  138. spidev = filp->private_data;
  139. mutex_lock(&spidev->buf_lock);
  140. status = spidev_sync_read(spidev, count);
  141. if (status == 0) {
  142. unsigned long missing;
  143. missing = copy_to_user(buf, spidev->buffer, count);
  144. if (count && missing == count)
  145. status = -EFAULT;
  146. else
  147. status = count - missing;
  148. }
  149. mutex_unlock(&spidev->buf_lock);
  150. return status;
  151. }
  152. /* Write-only message with current device setup */
  153. static ssize_t
  154. spidev_write(struct file *filp, const char __user *buf,
  155. size_t count, loff_t *f_pos)
  156. {
  157. struct spidev_data *spidev;
  158. ssize_t status = 0;
  159. unsigned long missing;
  160. /* chipselect only toggles at start or end of operation */
  161. if (count > bufsiz)
  162. return -EMSGSIZE;
  163. spidev = filp->private_data;
  164. mutex_lock(&spidev->buf_lock);
  165. missing = copy_from_user(spidev->buffer, buf, count);
  166. if (missing == 0) {
  167. status = spidev_sync_write(spidev, count);
  168. if (status == 0)
  169. status = count;
  170. } else
  171. status = -EFAULT;
  172. mutex_unlock(&spidev->buf_lock);
  173. return status;
  174. }
  175. static int spidev_message(struct spidev_data *spidev,
  176. struct spi_ioc_transfer *u_xfers, unsigned n_xfers)
  177. {
  178. struct spi_message msg;
  179. struct spi_transfer *k_xfers;
  180. struct spi_transfer *k_tmp;
  181. struct spi_ioc_transfer *u_tmp;
  182. unsigned n, total;
  183. u8 *buf;
  184. int status = -EFAULT;
  185. spi_message_init(&msg);
  186. k_xfers = kcalloc(n_xfers, sizeof(*k_tmp), GFP_KERNEL);
  187. if (k_xfers == NULL)
  188. return -ENOMEM;
  189. /* Construct spi_message, copying any tx data to bounce buffer.
  190. * We walk the array of user-provided transfers, using each one
  191. * to initialize a kernel version of the same transfer.
  192. */
  193. mutex_lock(&spidev->buf_lock);
  194. buf = spidev->buffer;
  195. total = 0;
  196. for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers;
  197. n;
  198. n--, k_tmp++, u_tmp++) {
  199. k_tmp->len = u_tmp->len;
  200. total += k_tmp->len;
  201. if (total > bufsiz) {
  202. status = -EMSGSIZE;
  203. goto done;
  204. }
  205. if (u_tmp->rx_buf) {
  206. k_tmp->rx_buf = buf;
  207. if (!access_ok(VERIFY_WRITE, (u8 __user *)
  208. (uintptr_t) u_tmp->rx_buf,
  209. u_tmp->len))
  210. goto done;
  211. }
  212. if (u_tmp->tx_buf) {
  213. k_tmp->tx_buf = buf;
  214. if (copy_from_user(buf, (const u8 __user *)
  215. (uintptr_t) u_tmp->tx_buf,
  216. u_tmp->len))
  217. goto done;
  218. }
  219. buf += k_tmp->len;
  220. k_tmp->cs_change = !!u_tmp->cs_change;
  221. k_tmp->bits_per_word = u_tmp->bits_per_word;
  222. k_tmp->delay_usecs = u_tmp->delay_usecs;
  223. k_tmp->speed_hz = u_tmp->speed_hz;
  224. #ifdef VERBOSE
  225. dev_dbg(&spi->dev,
  226. " xfer len %zd %s%s%s%dbits %u usec %uHz\n",
  227. u_tmp->len,
  228. u_tmp->rx_buf ? "rx " : "",
  229. u_tmp->tx_buf ? "tx " : "",
  230. u_tmp->cs_change ? "cs " : "",
  231. u_tmp->bits_per_word ? : spi->bits_per_word,
  232. u_tmp->delay_usecs,
  233. u_tmp->speed_hz ? : spi->max_speed_hz);
  234. #endif
  235. spi_message_add_tail(k_tmp, &msg);
  236. }
  237. status = spidev_sync(spidev, &msg);
  238. if (status < 0)
  239. goto done;
  240. /* copy any rx data out of bounce buffer */
  241. buf = spidev->buffer;
  242. for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) {
  243. if (u_tmp->rx_buf) {
  244. if (__copy_to_user((u8 __user *)
  245. (uintptr_t) u_tmp->rx_buf, buf,
  246. u_tmp->len)) {
  247. status = -EFAULT;
  248. goto done;
  249. }
  250. }
  251. buf += u_tmp->len;
  252. }
  253. status = total;
  254. done:
  255. mutex_unlock(&spidev->buf_lock);
  256. kfree(k_xfers);
  257. return status;
  258. }
  259. static int
  260. spidev_ioctl(struct inode *inode, struct file *filp,
  261. unsigned int cmd, unsigned long arg)
  262. {
  263. int err = 0;
  264. int retval = 0;
  265. struct spidev_data *spidev;
  266. struct spi_device *spi;
  267. u32 tmp;
  268. unsigned n_ioc;
  269. struct spi_ioc_transfer *ioc;
  270. /* Check type and command number */
  271. if (_IOC_TYPE(cmd) != SPI_IOC_MAGIC)
  272. return -ENOTTY;
  273. /* Check access direction once here; don't repeat below.
  274. * IOC_DIR is from the user perspective, while access_ok is
  275. * from the kernel perspective; so they look reversed.
  276. */
  277. if (_IOC_DIR(cmd) & _IOC_READ)
  278. err = !access_ok(VERIFY_WRITE,
  279. (void __user *)arg, _IOC_SIZE(cmd));
  280. if (err == 0 && _IOC_DIR(cmd) & _IOC_WRITE)
  281. err = !access_ok(VERIFY_READ,
  282. (void __user *)arg, _IOC_SIZE(cmd));
  283. if (err)
  284. return -EFAULT;
  285. /* guard against device removal before, or while,
  286. * we issue this ioctl.
  287. */
  288. spidev = filp->private_data;
  289. spin_lock_irq(&spidev->spi_lock);
  290. spi = spi_dev_get(spidev->spi);
  291. spin_unlock_irq(&spidev->spi_lock);
  292. if (spi == NULL)
  293. return -ESHUTDOWN;
  294. switch (cmd) {
  295. /* read requests */
  296. case SPI_IOC_RD_MODE:
  297. retval = __put_user(spi->mode & SPI_MODE_MASK,
  298. (__u8 __user *)arg);
  299. break;
  300. case SPI_IOC_RD_LSB_FIRST:
  301. retval = __put_user((spi->mode & SPI_LSB_FIRST) ? 1 : 0,
  302. (__u8 __user *)arg);
  303. break;
  304. case SPI_IOC_RD_BITS_PER_WORD:
  305. retval = __put_user(spi->bits_per_word, (__u8 __user *)arg);
  306. break;
  307. case SPI_IOC_RD_MAX_SPEED_HZ:
  308. retval = __put_user(spi->max_speed_hz, (__u32 __user *)arg);
  309. break;
  310. /* write requests */
  311. case SPI_IOC_WR_MODE:
  312. retval = __get_user(tmp, (u8 __user *)arg);
  313. if (retval == 0) {
  314. u8 save = spi->mode;
  315. if (tmp & ~SPI_MODE_MASK) {
  316. retval = -EINVAL;
  317. break;
  318. }
  319. tmp |= spi->mode & ~SPI_MODE_MASK;
  320. spi->mode = (u8)tmp;
  321. retval = spi_setup(spi);
  322. if (retval < 0)
  323. spi->mode = save;
  324. else
  325. dev_dbg(&spi->dev, "spi mode %02x\n", tmp);
  326. }
  327. break;
  328. case SPI_IOC_WR_LSB_FIRST:
  329. retval = __get_user(tmp, (__u8 __user *)arg);
  330. if (retval == 0) {
  331. u8 save = spi->mode;
  332. if (tmp)
  333. spi->mode |= SPI_LSB_FIRST;
  334. else
  335. spi->mode &= ~SPI_LSB_FIRST;
  336. retval = spi_setup(spi);
  337. if (retval < 0)
  338. spi->mode = save;
  339. else
  340. dev_dbg(&spi->dev, "%csb first\n",
  341. tmp ? 'l' : 'm');
  342. }
  343. break;
  344. case SPI_IOC_WR_BITS_PER_WORD:
  345. retval = __get_user(tmp, (__u8 __user *)arg);
  346. if (retval == 0) {
  347. u8 save = spi->bits_per_word;
  348. spi->bits_per_word = tmp;
  349. retval = spi_setup(spi);
  350. if (retval < 0)
  351. spi->bits_per_word = save;
  352. else
  353. dev_dbg(&spi->dev, "%d bits per word\n", tmp);
  354. }
  355. break;
  356. case SPI_IOC_WR_MAX_SPEED_HZ:
  357. retval = __get_user(tmp, (__u32 __user *)arg);
  358. if (retval == 0) {
  359. u32 save = spi->max_speed_hz;
  360. spi->max_speed_hz = tmp;
  361. retval = spi_setup(spi);
  362. if (retval < 0)
  363. spi->max_speed_hz = save;
  364. else
  365. dev_dbg(&spi->dev, "%d Hz (max)\n", tmp);
  366. }
  367. break;
  368. default:
  369. /* segmented and/or full-duplex I/O request */
  370. if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0))
  371. || _IOC_DIR(cmd) != _IOC_WRITE) {
  372. retval = -ENOTTY;
  373. break;
  374. }
  375. tmp = _IOC_SIZE(cmd);
  376. if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) {
  377. retval = -EINVAL;
  378. break;
  379. }
  380. n_ioc = tmp / sizeof(struct spi_ioc_transfer);
  381. if (n_ioc == 0)
  382. break;
  383. /* copy into scratch area */
  384. ioc = kmalloc(tmp, GFP_KERNEL);
  385. if (!ioc) {
  386. retval = -ENOMEM;
  387. break;
  388. }
  389. if (__copy_from_user(ioc, (void __user *)arg, tmp)) {
  390. kfree(ioc);
  391. retval = -EFAULT;
  392. break;
  393. }
  394. /* translate to spi_message, execute */
  395. retval = spidev_message(spidev, ioc, n_ioc);
  396. kfree(ioc);
  397. break;
  398. }
  399. spi_dev_put(spi);
  400. return retval;
  401. }
  402. static int spidev_open(struct inode *inode, struct file *filp)
  403. {
  404. struct spidev_data *spidev;
  405. int status = -ENXIO;
  406. mutex_lock(&device_list_lock);
  407. list_for_each_entry(spidev, &device_list, device_entry) {
  408. if (spidev->dev.devt == inode->i_rdev) {
  409. status = 0;
  410. break;
  411. }
  412. }
  413. if (status == 0) {
  414. if (!spidev->buffer) {
  415. spidev->buffer = kmalloc(bufsiz, GFP_KERNEL);
  416. if (!spidev->buffer) {
  417. dev_dbg(&spidev->spi->dev, "open/ENOMEM\n");
  418. status = -ENOMEM;
  419. }
  420. }
  421. if (status == 0) {
  422. spidev->users++;
  423. filp->private_data = spidev;
  424. nonseekable_open(inode, filp);
  425. }
  426. } else
  427. pr_debug("spidev: nothing for minor %d\n", iminor(inode));
  428. mutex_unlock(&device_list_lock);
  429. return status;
  430. }
  431. static int spidev_release(struct inode *inode, struct file *filp)
  432. {
  433. struct spidev_data *spidev;
  434. int status = 0;
  435. mutex_lock(&device_list_lock);
  436. spidev = filp->private_data;
  437. filp->private_data = NULL;
  438. spidev->users--;
  439. if (!spidev->users) {
  440. kfree(spidev->buffer);
  441. spidev->buffer = NULL;
  442. }
  443. mutex_unlock(&device_list_lock);
  444. return status;
  445. }
  446. static struct file_operations spidev_fops = {
  447. .owner = THIS_MODULE,
  448. /* REVISIT switch to aio primitives, so that userspace
  449. * gets more complete API coverage. It'll simplify things
  450. * too, except for the locking.
  451. */
  452. .write = spidev_write,
  453. .read = spidev_read,
  454. .ioctl = spidev_ioctl,
  455. .open = spidev_open,
  456. .release = spidev_release,
  457. };
  458. /*-------------------------------------------------------------------------*/
  459. /* The main reason to have this class is to make mdev/udev create the
  460. * /dev/spidevB.C character device nodes exposing our userspace API.
  461. * It also simplifies memory management.
  462. */
  463. static void spidev_classdev_release(struct device *dev)
  464. {
  465. struct spidev_data *spidev;
  466. spidev = container_of(dev, struct spidev_data, dev);
  467. kfree(spidev);
  468. }
  469. static struct class spidev_class = {
  470. .name = "spidev",
  471. .owner = THIS_MODULE,
  472. .dev_release = spidev_classdev_release,
  473. };
  474. /*-------------------------------------------------------------------------*/
  475. static int spidev_probe(struct spi_device *spi)
  476. {
  477. struct spidev_data *spidev;
  478. int status;
  479. unsigned long minor;
  480. /* Allocate driver data */
  481. spidev = kzalloc(sizeof(*spidev), GFP_KERNEL);
  482. if (!spidev)
  483. return -ENOMEM;
  484. /* Initialize the driver data */
  485. spidev->spi = spi;
  486. spin_lock_init(&spidev->spi_lock);
  487. mutex_init(&spidev->buf_lock);
  488. INIT_LIST_HEAD(&spidev->device_entry);
  489. /* If we can allocate a minor number, hook up this device.
  490. * Reusing minors is fine so long as udev or mdev is working.
  491. */
  492. mutex_lock(&device_list_lock);
  493. minor = find_first_zero_bit(minors, N_SPI_MINORS);
  494. if (minor < N_SPI_MINORS) {
  495. spidev->dev.parent = &spi->dev;
  496. spidev->dev.class = &spidev_class;
  497. spidev->dev.devt = MKDEV(SPIDEV_MAJOR, minor);
  498. snprintf(spidev->dev.bus_id, sizeof spidev->dev.bus_id,
  499. "spidev%d.%d",
  500. spi->master->bus_num, spi->chip_select);
  501. status = device_register(&spidev->dev);
  502. } else {
  503. dev_dbg(&spi->dev, "no minor number available!\n");
  504. status = -ENODEV;
  505. }
  506. if (status == 0) {
  507. set_bit(minor, minors);
  508. dev_set_drvdata(&spi->dev, spidev);
  509. list_add(&spidev->device_entry, &device_list);
  510. }
  511. mutex_unlock(&device_list_lock);
  512. if (status != 0)
  513. kfree(spidev);
  514. return status;
  515. }
  516. static int spidev_remove(struct spi_device *spi)
  517. {
  518. struct spidev_data *spidev = dev_get_drvdata(&spi->dev);
  519. /* make sure ops on existing fds can abort cleanly */
  520. spin_lock_irq(&spidev->spi_lock);
  521. spidev->spi = NULL;
  522. spin_unlock_irq(&spidev->spi_lock);
  523. /* prevent new opens */
  524. mutex_lock(&device_list_lock);
  525. list_del(&spidev->device_entry);
  526. dev_set_drvdata(&spi->dev, NULL);
  527. clear_bit(MINOR(spidev->dev.devt), minors);
  528. device_unregister(&spidev->dev);
  529. mutex_unlock(&device_list_lock);
  530. return 0;
  531. }
  532. static struct spi_driver spidev_spi = {
  533. .driver = {
  534. .name = "spidev",
  535. .owner = THIS_MODULE,
  536. },
  537. .probe = spidev_probe,
  538. .remove = __devexit_p(spidev_remove),
  539. /* NOTE: suspend/resume methods are not necessary here.
  540. * We don't do anything except pass the requests to/from
  541. * the underlying controller. The refrigerator handles
  542. * most issues; the controller driver handles the rest.
  543. */
  544. };
  545. /*-------------------------------------------------------------------------*/
  546. static int __init spidev_init(void)
  547. {
  548. int status;
  549. /* Claim our 256 reserved device numbers. Then register a class
  550. * that will key udev/mdev to add/remove /dev nodes. Last, register
  551. * the driver which manages those device numbers.
  552. */
  553. BUILD_BUG_ON(N_SPI_MINORS > 256);
  554. status = register_chrdev(SPIDEV_MAJOR, "spi", &spidev_fops);
  555. if (status < 0)
  556. return status;
  557. status = class_register(&spidev_class);
  558. if (status < 0) {
  559. unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
  560. return status;
  561. }
  562. status = spi_register_driver(&spidev_spi);
  563. if (status < 0) {
  564. class_unregister(&spidev_class);
  565. unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
  566. }
  567. return status;
  568. }
  569. module_init(spidev_init);
  570. static void __exit spidev_exit(void)
  571. {
  572. spi_unregister_driver(&spidev_spi);
  573. class_unregister(&spidev_class);
  574. unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
  575. }
  576. module_exit(spidev_exit);
  577. MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>");
  578. MODULE_DESCRIPTION("User mode SPI device interface");
  579. MODULE_LICENSE("GPL");