aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-11-04 06:02:03 -0500
committerMark Brown <broonie@kernel.org>2015-11-04 06:02:03 -0500
commit8c603485752ae844748db94148adc2b46e621d28 (patch)
tree10e752655bc747f6d45d4afc50546e5d4dabfebc
parentf0a2a049f5e33670448b189bfb05d73a5a37ff25 (diff)
parent97d56dc6826896852dae1a2bdab7a42ecde32c6f (diff)
Merge remote-tracking branch 'spi/topic/doc' into spi-next
-rw-r--r--drivers/spi/spi.c102
-rw-r--r--include/linux/spi/spi.h38
2 files changed, 117 insertions, 23 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 6a306340dd25..f9e92f535cbb 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -123,6 +123,28 @@ SPI_STATISTICS_SHOW(bytes, "%llu");
123SPI_STATISTICS_SHOW(bytes_rx, "%llu"); 123SPI_STATISTICS_SHOW(bytes_rx, "%llu");
124SPI_STATISTICS_SHOW(bytes_tx, "%llu"); 124SPI_STATISTICS_SHOW(bytes_tx, "%llu");
125 125
126#define SPI_STATISTICS_TRANSFER_BYTES_HISTO(index, number) \
127 SPI_STATISTICS_SHOW_NAME(transfer_bytes_histo##index, \
128 "transfer_bytes_histo_" number, \
129 transfer_bytes_histo[index], "%lu")
130SPI_STATISTICS_TRANSFER_BYTES_HISTO(0, "0-1");
131SPI_STATISTICS_TRANSFER_BYTES_HISTO(1, "2-3");
132SPI_STATISTICS_TRANSFER_BYTES_HISTO(2, "4-7");
133SPI_STATISTICS_TRANSFER_BYTES_HISTO(3, "8-15");
134SPI_STATISTICS_TRANSFER_BYTES_HISTO(4, "16-31");
135SPI_STATISTICS_TRANSFER_BYTES_HISTO(5, "32-63");
136SPI_STATISTICS_TRANSFER_BYTES_HISTO(6, "64-127");
137SPI_STATISTICS_TRANSFER_BYTES_HISTO(7, "128-255");
138SPI_STATISTICS_TRANSFER_BYTES_HISTO(8, "256-511");
139SPI_STATISTICS_TRANSFER_BYTES_HISTO(9, "512-1023");
140SPI_STATISTICS_TRANSFER_BYTES_HISTO(10, "1024-2047");
141SPI_STATISTICS_TRANSFER_BYTES_HISTO(11, "2048-4095");
142SPI_STATISTICS_TRANSFER_BYTES_HISTO(12, "4096-8191");
143SPI_STATISTICS_TRANSFER_BYTES_HISTO(13, "8192-16383");
144SPI_STATISTICS_TRANSFER_BYTES_HISTO(14, "16384-32767");
145SPI_STATISTICS_TRANSFER_BYTES_HISTO(15, "32768-65535");
146SPI_STATISTICS_TRANSFER_BYTES_HISTO(16, "65536+");
147
126static struct attribute *spi_dev_attrs[] = { 148static struct attribute *spi_dev_attrs[] = {
127 &dev_attr_modalias.attr, 149 &dev_attr_modalias.attr,
128 NULL, 150 NULL,
@@ -143,6 +165,23 @@ static struct attribute *spi_device_statistics_attrs[] = {
143 &dev_attr_spi_device_bytes.attr, 165 &dev_attr_spi_device_bytes.attr,
144 &dev_attr_spi_device_bytes_rx.attr, 166 &dev_attr_spi_device_bytes_rx.attr,
145 &dev_attr_spi_device_bytes_tx.attr, 167 &dev_attr_spi_device_bytes_tx.attr,
168 &dev_attr_spi_device_transfer_bytes_histo0.attr,
169 &dev_attr_spi_device_transfer_bytes_histo1.attr,
170 &dev_attr_spi_device_transfer_bytes_histo2.attr,
171 &dev_attr_spi_device_transfer_bytes_histo3.attr,
172 &dev_attr_spi_device_transfer_bytes_histo4.attr,
173 &dev_attr_spi_device_transfer_bytes_histo5.attr,
174 &dev_attr_spi_device_transfer_bytes_histo6.attr,
175 &dev_attr_spi_device_transfer_bytes_histo7.attr,
176 &dev_attr_spi_device_transfer_bytes_histo8.attr,
177 &dev_attr_spi_device_transfer_bytes_histo9.attr,
178 &dev_attr_spi_device_transfer_bytes_histo10.attr,
179 &dev_attr_spi_device_transfer_bytes_histo11.attr,
180 &dev_attr_spi_device_transfer_bytes_histo12.attr,
181 &dev_attr_spi_device_transfer_bytes_histo13.attr,
182 &dev_attr_spi_device_transfer_bytes_histo14.attr,
183 &dev_attr_spi_device_transfer_bytes_histo15.attr,
184 &dev_attr_spi_device_transfer_bytes_histo16.attr,
146 NULL, 185 NULL,
147}; 186};
148 187
@@ -168,6 +207,23 @@ static struct attribute *spi_master_statistics_attrs[] = {
168 &dev_attr_spi_master_bytes.attr, 207 &dev_attr_spi_master_bytes.attr,
169 &dev_attr_spi_master_bytes_rx.attr, 208 &dev_attr_spi_master_bytes_rx.attr,
170 &dev_attr_spi_master_bytes_tx.attr, 209 &dev_attr_spi_master_bytes_tx.attr,
210 &dev_attr_spi_master_transfer_bytes_histo0.attr,
211 &dev_attr_spi_master_transfer_bytes_histo1.attr,
212 &dev_attr_spi_master_transfer_bytes_histo2.attr,
213 &dev_attr_spi_master_transfer_bytes_histo3.attr,
214 &dev_attr_spi_master_transfer_bytes_histo4.attr,
215 &dev_attr_spi_master_transfer_bytes_histo5.attr,
216 &dev_attr_spi_master_transfer_bytes_histo6.attr,
217 &dev_attr_spi_master_transfer_bytes_histo7.attr,
218 &dev_attr_spi_master_transfer_bytes_histo8.attr,
219 &dev_attr_spi_master_transfer_bytes_histo9.attr,
220 &dev_attr_spi_master_transfer_bytes_histo10.attr,
221 &dev_attr_spi_master_transfer_bytes_histo11.attr,
222 &dev_attr_spi_master_transfer_bytes_histo12.attr,
223 &dev_attr_spi_master_transfer_bytes_histo13.attr,
224 &dev_attr_spi_master_transfer_bytes_histo14.attr,
225 &dev_attr_spi_master_transfer_bytes_histo15.attr,
226 &dev_attr_spi_master_transfer_bytes_histo16.attr,
171 NULL, 227 NULL,
172}; 228};
173 229
@@ -186,10 +242,15 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
186 struct spi_master *master) 242 struct spi_master *master)
187{ 243{
188 unsigned long flags; 244 unsigned long flags;
245 int l2len = min(fls(xfer->len), SPI_STATISTICS_HISTO_SIZE) - 1;
246
247 if (l2len < 0)
248 l2len = 0;
189 249
190 spin_lock_irqsave(&stats->lock, flags); 250 spin_lock_irqsave(&stats->lock, flags);
191 251
192 stats->transfers++; 252 stats->transfers++;
253 stats->transfer_bytes_histo[l2len]++;
193 254
194 stats->bytes += xfer->len; 255 stats->bytes += xfer->len;
195 if ((xfer->tx_buf) && 256 if ((xfer->tx_buf) &&
@@ -317,6 +378,8 @@ static void spi_drv_shutdown(struct device *dev)
317 * spi_register_driver - register a SPI driver 378 * spi_register_driver - register a SPI driver
318 * @sdrv: the driver to register 379 * @sdrv: the driver to register
319 * Context: can sleep 380 * Context: can sleep
381 *
382 * Return: zero on success, else a negative error code.
320 */ 383 */
321int spi_register_driver(struct spi_driver *sdrv) 384int spi_register_driver(struct spi_driver *sdrv)
322{ 385{
@@ -368,7 +431,7 @@ static DEFINE_MUTEX(board_lock);
368 * needs to discard the spi_device without adding it, then it should 431 * needs to discard the spi_device without adding it, then it should
369 * call spi_dev_put() on it. 432 * call spi_dev_put() on it.
370 * 433 *
371 * Returns a pointer to the new device, or NULL. 434 * Return: a pointer to the new device, or NULL.
372 */ 435 */
373struct spi_device *spi_alloc_device(struct spi_master *master) 436struct spi_device *spi_alloc_device(struct spi_master *master)
374{ 437{
@@ -427,7 +490,7 @@ static int spi_dev_check(struct device *dev, void *data)
427 * Companion function to spi_alloc_device. Devices allocated with 490 * Companion function to spi_alloc_device. Devices allocated with
428 * spi_alloc_device can be added onto the spi bus with this function. 491 * spi_alloc_device can be added onto the spi bus with this function.
429 * 492 *
430 * Returns 0 on success; negative errno on failure 493 * Return: 0 on success; negative errno on failure
431 */ 494 */
432int spi_add_device(struct spi_device *spi) 495int spi_add_device(struct spi_device *spi)
433{ 496{
@@ -500,7 +563,7 @@ EXPORT_SYMBOL_GPL(spi_add_device);
500 * this is exported so that for example a USB or parport based adapter 563 * this is exported so that for example a USB or parport based adapter
501 * driver could add devices (which it would learn about out-of-band). 564 * driver could add devices (which it would learn about out-of-band).
502 * 565 *
503 * Returns the new device, or NULL. 566 * Return: the new device, or NULL.
504 */ 567 */
505struct spi_device *spi_new_device(struct spi_master *master, 568struct spi_device *spi_new_device(struct spi_master *master,
506 struct spi_board_info *chip) 569 struct spi_board_info *chip)
@@ -572,6 +635,8 @@ static void spi_match_master_to_boardinfo(struct spi_master *master,
572 * 635 *
573 * The board info passed can safely be __initdata ... but be careful of 636 * The board info passed can safely be __initdata ... but be careful of
574 * any embedded pointers (platform_data, etc), they're copied as-is. 637 * any embedded pointers (platform_data, etc), they're copied as-is.
638 *
639 * Return: zero on success, else a negative error code.
575 */ 640 */
576int spi_register_board_info(struct spi_board_info const *info, unsigned n) 641int spi_register_board_info(struct spi_board_info const *info, unsigned n)
577{ 642{
@@ -1149,6 +1214,8 @@ static int spi_init_queue(struct spi_master *master)
1149 * 1214 *
1150 * If there are more messages in the queue, the next message is returned from 1215 * If there are more messages in the queue, the next message is returned from
1151 * this call. 1216 * this call.
1217 *
1218 * Return: the next message in the queue, else NULL if the queue is empty.
1152 */ 1219 */
1153struct spi_message *spi_get_next_queued_message(struct spi_master *master) 1220struct spi_message *spi_get_next_queued_message(struct spi_master *master)
1154{ 1221{
@@ -1312,6 +1379,8 @@ static int __spi_queued_transfer(struct spi_device *spi,
1312 * spi_queued_transfer - transfer function for queued transfers 1379 * spi_queued_transfer - transfer function for queued transfers
1313 * @spi: spi device which is requesting transfer 1380 * @spi: spi device which is requesting transfer
1314 * @msg: spi message which is to handled is queued to driver queue 1381 * @msg: spi message which is to handled is queued to driver queue
1382 *
1383 * Return: zero on success, else a negative error code.
1315 */ 1384 */
1316static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) 1385static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg)
1317{ 1386{
@@ -1611,12 +1680,13 @@ static struct class spi_master_class = {
1611 * only ones directly touching chip registers. It's how they allocate 1680 * only ones directly touching chip registers. It's how they allocate
1612 * an spi_master structure, prior to calling spi_register_master(). 1681 * an spi_master structure, prior to calling spi_register_master().
1613 * 1682 *
1614 * This must be called from context that can sleep. It returns the SPI 1683 * This must be called from context that can sleep.
1615 * master structure on success, else NULL.
1616 * 1684 *
1617 * The caller is responsible for assigning the bus number and initializing 1685 * The caller is responsible for assigning the bus number and initializing
1618 * the master's methods before calling spi_register_master(); and (after errors 1686 * the master's methods before calling spi_register_master(); and (after errors
1619 * adding the device) calling spi_master_put() to prevent a memory leak. 1687 * adding the device) calling spi_master_put() to prevent a memory leak.
1688 *
1689 * Return: the SPI master structure on success, else NULL.
1620 */ 1690 */
1621struct spi_master *spi_alloc_master(struct device *dev, unsigned size) 1691struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
1622{ 1692{
@@ -1700,6 +1770,8 @@ static int of_spi_register_master(struct spi_master *master)
1700 * success, else a negative error code (dropping the master's refcount). 1770 * success, else a negative error code (dropping the master's refcount).
1701 * After a successful return, the caller is responsible for calling 1771 * After a successful return, the caller is responsible for calling
1702 * spi_unregister_master(). 1772 * spi_unregister_master().
1773 *
1774 * Return: zero on success, else a negative error code.
1703 */ 1775 */
1704int spi_register_master(struct spi_master *master) 1776int spi_register_master(struct spi_master *master)
1705{ 1777{
@@ -1793,6 +1865,8 @@ static void devm_spi_unregister(struct device *dev, void *res)
1793 * 1865 *
1794 * Register a SPI device as with spi_register_master() which will 1866 * Register a SPI device as with spi_register_master() which will
1795 * automatically be unregister 1867 * automatically be unregister
1868 *
1869 * Return: zero on success, else a negative error code.
1796 */ 1870 */
1797int devm_spi_register_master(struct device *dev, struct spi_master *master) 1871int devm_spi_register_master(struct device *dev, struct spi_master *master)
1798{ 1872{
@@ -1898,6 +1972,8 @@ static int __spi_master_match(struct device *dev, const void *data)
1898 * arch init time. It returns a refcounted pointer to the relevant 1972 * arch init time. It returns a refcounted pointer to the relevant
1899 * spi_master (which the caller must release), or NULL if there is 1973 * spi_master (which the caller must release), or NULL if there is
1900 * no such master registered. 1974 * no such master registered.
1975 *
1976 * Return: the SPI master structure on success, else NULL.
1901 */ 1977 */
1902struct spi_master *spi_busnum_to_master(u16 bus_num) 1978struct spi_master *spi_busnum_to_master(u16 bus_num)
1903{ 1979{
@@ -1951,6 +2027,8 @@ static int __spi_validate_bits_per_word(struct spi_master *master, u8 bits_per_w
1951 * that the underlying controller or its driver does not support. For 2027 * that the underlying controller or its driver does not support. For
1952 * example, not all hardware supports wire transfers using nine bit words, 2028 * example, not all hardware supports wire transfers using nine bit words,
1953 * LSB-first wire encoding, or active-high chipselects. 2029 * LSB-first wire encoding, or active-high chipselects.
2030 *
2031 * Return: zero on success, else a negative error code.
1954 */ 2032 */
1955int spi_setup(struct spi_device *spi) 2033int spi_setup(struct spi_device *spi)
1956{ 2034{
@@ -2169,6 +2247,8 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
2169 * no other spi_message queued to that device will be processed. 2247 * no other spi_message queued to that device will be processed.
2170 * (This rule applies equally to all the synchronous transfer calls, 2248 * (This rule applies equally to all the synchronous transfer calls,
2171 * which are wrappers around this core asynchronous primitive.) 2249 * which are wrappers around this core asynchronous primitive.)
2250 *
2251 * Return: zero on success, else a negative error code.
2172 */ 2252 */
2173int spi_async(struct spi_device *spi, struct spi_message *message) 2253int spi_async(struct spi_device *spi, struct spi_message *message)
2174{ 2254{
@@ -2221,6 +2301,8 @@ EXPORT_SYMBOL_GPL(spi_async);
2221 * no other spi_message queued to that device will be processed. 2301 * no other spi_message queued to that device will be processed.
2222 * (This rule applies equally to all the synchronous transfer calls, 2302 * (This rule applies equally to all the synchronous transfer calls,
2223 * which are wrappers around this core asynchronous primitive.) 2303 * which are wrappers around this core asynchronous primitive.)
2304 *
2305 * Return: zero on success, else a negative error code.
2224 */ 2306 */
2225int spi_async_locked(struct spi_device *spi, struct spi_message *message) 2307int spi_async_locked(struct spi_device *spi, struct spi_message *message)
2226{ 2308{
@@ -2336,7 +2418,7 @@ static int __spi_sync(struct spi_device *spi, struct spi_message *message,
2336 * Also, the caller is guaranteeing that the memory associated with the 2418 * Also, the caller is guaranteeing that the memory associated with the
2337 * message will not be freed before this call returns. 2419 * message will not be freed before this call returns.
2338 * 2420 *
2339 * It returns zero on success, else a negative error code. 2421 * Return: zero on success, else a negative error code.
2340 */ 2422 */
2341int spi_sync(struct spi_device *spi, struct spi_message *message) 2423int spi_sync(struct spi_device *spi, struct spi_message *message)
2342{ 2424{
@@ -2358,7 +2440,7 @@ EXPORT_SYMBOL_GPL(spi_sync);
2358 * SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must 2440 * SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must
2359 * be released by a spi_bus_unlock call when the exclusive access is over. 2441 * be released by a spi_bus_unlock call when the exclusive access is over.
2360 * 2442 *
2361 * It returns zero on success, else a negative error code. 2443 * Return: zero on success, else a negative error code.
2362 */ 2444 */
2363int spi_sync_locked(struct spi_device *spi, struct spi_message *message) 2445int spi_sync_locked(struct spi_device *spi, struct spi_message *message)
2364{ 2446{
@@ -2379,7 +2461,7 @@ EXPORT_SYMBOL_GPL(spi_sync_locked);
2379 * exclusive access is over. Data transfer must be done by spi_sync_locked 2461 * exclusive access is over. Data transfer must be done by spi_sync_locked
2380 * and spi_async_locked calls when the SPI bus lock is held. 2462 * and spi_async_locked calls when the SPI bus lock is held.
2381 * 2463 *
2382 * It returns zero on success, else a negative error code. 2464 * Return: always zero.
2383 */ 2465 */
2384int spi_bus_lock(struct spi_master *master) 2466int spi_bus_lock(struct spi_master *master)
2385{ 2467{
@@ -2408,7 +2490,7 @@ EXPORT_SYMBOL_GPL(spi_bus_lock);
2408 * This call releases an SPI bus lock previously obtained by an spi_bus_lock 2490 * This call releases an SPI bus lock previously obtained by an spi_bus_lock
2409 * call. 2491 * call.
2410 * 2492 *
2411 * It returns zero on success, else a negative error code. 2493 * Return: always zero.
2412 */ 2494 */
2413int spi_bus_unlock(struct spi_master *master) 2495int spi_bus_unlock(struct spi_master *master)
2414{ 2496{
@@ -2443,6 +2525,8 @@ static u8 *buf;
2443 * portable code should never use this for more than 32 bytes. 2525 * portable code should never use this for more than 32 bytes.
2444 * Performance-sensitive or bulk transfer code should instead use 2526 * Performance-sensitive or bulk transfer code should instead use
2445 * spi_{async,sync}() calls with dma-safe buffers. 2527 * spi_{async,sync}() calls with dma-safe buffers.
2528 *
2529 * Return: zero on success, else a negative error code.
2446 */ 2530 */
2447int spi_write_then_read(struct spi_device *spi, 2531int spi_write_then_read(struct spi_device *spi,
2448 const void *txbuf, unsigned n_tx, 2532 const void *txbuf, unsigned n_tx,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 6b00f18f5e6b..635bff60eda5 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -51,6 +51,8 @@ extern struct bus_type spi_bus_type;
51 * @bytes_tx: number of bytes sent to device 51 * @bytes_tx: number of bytes sent to device
52 * @bytes_rx: number of bytes received from device 52 * @bytes_rx: number of bytes received from device
53 * 53 *
54 * @transfer_bytes_histo:
55 * transfer bytes histogramm
54 */ 56 */
55struct spi_statistics { 57struct spi_statistics {
56 spinlock_t lock; /* lock for the whole structure */ 58 spinlock_t lock; /* lock for the whole structure */
@@ -68,6 +70,8 @@ struct spi_statistics {
68 unsigned long long bytes_rx; 70 unsigned long long bytes_rx;
69 unsigned long long bytes_tx; 71 unsigned long long bytes_tx;
70 72
73#define SPI_STATISTICS_HISTO_SIZE 17
74 unsigned long transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE];
71}; 75};
72 76
73void spi_statistics_add_transfer_stats(struct spi_statistics *stats, 77void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
@@ -843,8 +847,10 @@ extern int spi_bus_unlock(struct spi_master *master);
843 * @len: data buffer size 847 * @len: data buffer size
844 * Context: can sleep 848 * Context: can sleep
845 * 849 *
846 * This writes the buffer and returns zero or a negative error code. 850 * This function writes the buffer @buf.
847 * Callable only from contexts that can sleep. 851 * Callable only from contexts that can sleep.
852 *
853 * Return: zero on success, else a negative error code.
848 */ 854 */
849static inline int 855static inline int
850spi_write(struct spi_device *spi, const void *buf, size_t len) 856spi_write(struct spi_device *spi, const void *buf, size_t len)
@@ -867,8 +873,10 @@ spi_write(struct spi_device *spi, const void *buf, size_t len)
867 * @len: data buffer size 873 * @len: data buffer size
868 * Context: can sleep 874 * Context: can sleep
869 * 875 *
870 * This reads the buffer and returns zero or a negative error code. 876 * This function reads the buffer @buf.
871 * Callable only from contexts that can sleep. 877 * Callable only from contexts that can sleep.
878 *
879 * Return: zero on success, else a negative error code.
872 */ 880 */
873static inline int 881static inline int
874spi_read(struct spi_device *spi, void *buf, size_t len) 882spi_read(struct spi_device *spi, void *buf, size_t len)
@@ -895,7 +903,7 @@ spi_read(struct spi_device *spi, void *buf, size_t len)
895 * 903 *
896 * For more specific semantics see spi_sync(). 904 * For more specific semantics see spi_sync().
897 * 905 *
898 * It returns zero on success, else a negative error code. 906 * Return: Return: zero on success, else a negative error code.
899 */ 907 */
900static inline int 908static inline int
901spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, 909spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
@@ -919,9 +927,10 @@ extern int spi_write_then_read(struct spi_device *spi,
919 * @cmd: command to be written before data is read back 927 * @cmd: command to be written before data is read back
920 * Context: can sleep 928 * Context: can sleep
921 * 929 *
922 * This returns the (unsigned) eight bit number returned by the 930 * Callable only from contexts that can sleep.
923 * device, or else a negative error code. Callable only from 931 *
924 * contexts that can sleep. 932 * Return: the (unsigned) eight bit number returned by the
933 * device, or else a negative error code.
925 */ 934 */
926static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd) 935static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
927{ 936{
@@ -940,12 +949,13 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
940 * @cmd: command to be written before data is read back 949 * @cmd: command to be written before data is read back
941 * Context: can sleep 950 * Context: can sleep
942 * 951 *
943 * This returns the (unsigned) sixteen bit number returned by the
944 * device, or else a negative error code. Callable only from
945 * contexts that can sleep.
946 *
947 * The number is returned in wire-order, which is at least sometimes 952 * The number is returned in wire-order, which is at least sometimes
948 * big-endian. 953 * big-endian.
954 *
955 * Callable only from contexts that can sleep.
956 *
957 * Return: the (unsigned) sixteen bit number returned by the
958 * device, or else a negative error code.
949 */ 959 */
950static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) 960static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
951{ 961{
@@ -964,13 +974,13 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
964 * @cmd: command to be written before data is read back 974 * @cmd: command to be written before data is read back
965 * Context: can sleep 975 * Context: can sleep
966 * 976 *
967 * This returns the (unsigned) sixteen bit number returned by the device in cpu
968 * endianness, or else a negative error code. Callable only from contexts that
969 * can sleep.
970 *
971 * This function is similar to spi_w8r16, with the exception that it will 977 * This function is similar to spi_w8r16, with the exception that it will
972 * convert the read 16 bit data word from big-endian to native endianness. 978 * convert the read 16 bit data word from big-endian to native endianness.
973 * 979 *
980 * Callable only from contexts that can sleep.
981 *
982 * Return: the (unsigned) sixteen bit number returned by the device in cpu
983 * endianness, or else a negative error code.
974 */ 984 */
975static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) 985static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd)
976 986