linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Provide defines for 104-QUAD-8 magic numbers
@ 2018-05-24 20:37 William Breathitt Gray
  2018-05-24 20:37 ` [PATCH 1/2] iio: 104-quad-8: Fix off-by-one error in register selection William Breathitt Gray
  2018-05-24 20:37 ` [PATCH 2/2] iio: 104-quad-8: Provide defines for magic numbers William Breathitt Gray
  0 siblings, 2 replies; 5+ messages in thread
From: William Breathitt Gray @ 2018-05-24 20:37 UTC (permalink / raw)
  To: jic23
  Cc: knaack.h, lars, pmeerw, linux-iio, linux-kernel,
	William Breathitt Gray

Magic numbers can be difficult to understand, and at times hide bugs
that would otherwise be obvious to readers of the source code.

The first patch in this patchset provides a fix for an improperly
selected magic number (an off-by-one error). The second patch adds
defines to remove these magic numbers and thus help make the driver
source code easier to read and debug.

The discovery of the error fixed by the first patch is thanks to these
defines: the improper magic number stuck out like a sore thumb next
to the expected define symbol. So I should have used these defines from
the start.

William Breathitt Gray (2):
  iio: 104-quad-8: Fix off-by-one error in register selection
  iio: 104-quad-8: Provide defines for magic numbers

 drivers/iio/counter/104-quad-8.c | 86 ++++++++++++++++++++++----------
 1 file changed, 60 insertions(+), 26 deletions(-)

-- 
2.17.0

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

end of thread, other threads:[~2018-05-27  9:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24 20:37 [PATCH 0/2] Provide defines for 104-QUAD-8 magic numbers William Breathitt Gray
2018-05-24 20:37 ` [PATCH 1/2] iio: 104-quad-8: Fix off-by-one error in register selection William Breathitt Gray
2018-05-27  9:30   ` Jonathan Cameron
2018-05-24 20:37 ` [PATCH 2/2] iio: 104-quad-8: Provide defines for magic numbers William Breathitt Gray
2018-05-27  9:31   ` Jonathan Cameron

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).