device: avoid casting away const from config_info pointer

The driver-specific config_info structure referenced from the device
structure is marked const.  Some drivers fail to preserve that
qualifier when casting the pointer to the driver-specific structure,
violating MISRA 11.8.

Changes produced by scripts/coccinelle/const_config_info.cocci.

Some changes proposed by the script are not included because they
reveal mutation of state through the const pointer, though the
code works as long as the driver-specific object is defined without
the const qualifier.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-05-12 07:14:53 -05:00 committed by Carles Cufí
commit 4f16b419e8
18 changed files with 41 additions and 41 deletions

View file

@ -20,7 +20,7 @@ extern "C" {
#define MPXXDTYY_MAX_PDM_FREQ 3250000 /* 3.25MHz */
#define DEV_CFG(dev) \
((struct mpxxdtyy_config *const)(dev)->config_info)
((const struct mpxxdtyy_config *const)(dev)->config_info)
#define DEV_DATA(dev) \
((struct mpxxdtyy_data *const)(dev)->driver_data)