]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: jr3_pci: check sizes at compile time
authorIan Abbott <abbotti@mev.co.uk>
Wed, 8 Mar 2017 18:44:30 +0000 (18:44 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 13:57:00 +0000 (14:57 +0100)
commit760e4911b5e9394a5544f77118d2f0cb9145b66e
tree48fa1c9da43a44c9dfa2794523db063d94b42440
parentc646c84b5ce41a2edc128fb8e79342f6cee46a6b
staging: comedi: jr3_pci: check sizes at compile time

The driver currently checks the size of `struct jr3_sensor` is correct
when a device is attached, returning an error if it is wrong.  Replace
that with a compile-time check.  We don't care too much about the size
of `struct jr3_sensor` as it is embedded in the larger `struct
jr3_block` and is followed by a lot of padding.  We should care more
that the size of `struct jr3_block` is correct, as it describes the
overall register layout of a block, and there is an array of such blocks
(one per subdevice).  Check its size at compile-time using the
`BUILD_BUG_ON()` macro.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/jr3_pci.c