spidev.c 17 KB

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