exynos-linux-stable/drivers/misc/mic
Arnd Bergmann 7ed623cd6f mic: avoid statically declaring a 'struct device'.
[ Upstream commit bc83f79bd2119230888fb8574639d5a51b38f903 ]

Generally, declaring a platform device as a static variable is
a bad idea and can cause all kinds of problems, in particular
with the DMA configuration and lifetime rules.

A specific problem we hit here is from a bug in clang that warns
about certain (otherwise valid) macros when used in static variables:

drivers/misc/mic/card/mic_x100.c:285:27: warning: shift count >= width of type [-Wshift-count-overflow]
static u64 mic_dma_mask = DMA_BIT_MASK(64);
                          ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:141:54: note: expanded from macro 'DMA_BIT_MASK'
 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                     ^ ~~~

A slightly better way here is to create the platform device dynamically
and set the dma mask in the probe function.
This avoids the warning and some other problems, but is still not ideal
because the device creation should really be separated from the driver,
and the fact that the device has no parent means we have to force
the dma mask rather than having it set up from the bus that the device
is actually on.

Fixes: dd8d8d44df ("misc: mic: MIC card driver specific changes to enable SCIF")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20190712092426.872625-1-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-29 10:24:29 +01:00
..
bus misc: mic: MIC VOP Bus 2016-02-09 17:32:37 -08:00
card mic: avoid statically declaring a 'struct device'. 2020-01-29 10:24:29 +01:00
common misc: mic: Remove COSM functionality from the MIC card driver 2015-10-04 12:46:06 +01:00
cosm misc: mic: Fix crash when MIC reset is invoked in RESET_FAILED state 2016-02-07 22:53:40 -08:00
cosm_client misc: mic: COSM client driver 2015-10-04 12:46:06 +01:00
host dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
scif misc: mic: fix a DMA pool free failure 2019-11-28 18:28:22 +01:00
vop misc: mic: double free on ioctl error path 2017-06-24 07:11:16 +02:00
Kconfig vhost: split out vringh Kconfig 2016-08-02 16:54:28 +03:00
Makefile misc: mic: Enable VOP debugfs and driver build 2016-02-09 17:32:37 -08:00