linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: introduce macros to set bits_per_word_mask
@ 2013-05-22  2:36 Stephen Warren
       [not found] ` <1369190195-14598-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  2013-05-22 15:58 ` [PATCH 1/2] spi: introduce macros to set bits_per_word_mask Mark Brown
  0 siblings, 2 replies; 12+ messages in thread
From: Stephen Warren @ 2013-05-22  2:36 UTC (permalink / raw)
  To: Mark Brown, Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

Introduce two macros to make setting up spi_master.bits_per_word_mask
easier, and avoid mistakes like writing BIT(n) instead of BIT(n - 1).

SPI_BPW_MASK is for a single supported value of bits_per_word_mask.

SPI_BPW_RANGE_MASK represents a contiguous set of bit lengths.

Signed-off-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
---
 include/linux/spi/spi.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 6ff26c8..1737256 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -308,6 +308,8 @@ struct spi_master {
 
 	/* bitmask of supported bits_per_word for transfers */
 	u32			bits_per_word_mask;
+#define SPI_BPW_MASK(bits) BIT((bits) - 1)
+#define SPI_BPW_RANGE_MASK(min, max) ((BIT(max) - 1) - (BIT(min) - 1))
 
 	/* other constraints relevant to this driver */
 	u16			flags;
-- 
1.7.10.4


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-07-09 21:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22  2:36 [PATCH 1/2] spi: introduce macros to set bits_per_word_mask Stephen Warren
     [not found] ` <1369190195-14598-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-22  2:36   ` [PATCH 2/2] spi: convert drivers to use bits_per_word_mask Stephen Warren
2013-05-24 17:16     ` H Hartley Sweeten
2013-05-29 19:49     ` Mark Brown
     [not found]     ` <1369190195-14598-2-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-31  8:45       ` Arnd Bergmann
2013-05-31 16:10         ` Stephen Warren
     [not found]           ` <51A8CB87.80201-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-31 21:23             ` Arnd Bergmann
2013-07-09 15:47     ` Michal Simek
2013-07-09 15:50       ` Stephen Warren
2013-07-09 21:49       ` Mark Brown
2013-07-09 21:56         ` Mark Brown
2013-05-22 15:58 ` [PATCH 1/2] spi: introduce macros to set bits_per_word_mask Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).