linux-uconsole/drivers/misc
Arnd Bergmann ba5cc235ea mic: avoid statically declaring a 'struct device'.
[ Upstream commit bc83f79bd2 ]

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-27 14:51:02 +01:00
..
altera-stapl altera-stapl: check for a null key before strcasecmp'ing it 2019-12-13 08:51:56 +01:00
c2port
cardreader
cb710
cxl misc: cxl: Fix possible null pointer dereference 2019-11-24 08:21:03 +01:00
echo
eeprom eeprom: at24: make spd world-readable again 2019-08-06 19:06:57 +02:00
genwqe misc: genwqe: should return proper error value. 2019-11-20 18:47:31 +01:00
ibmasm
lis3lv02d
lkdtm lkdtm: support llvm-objcopy 2019-07-14 08:11:21 +02:00
mei mei: replace POLL* with EPOLL* for write queues. 2020-01-27 14:49:57 +01:00
mic mic: avoid statically declaring a 'struct device'. 2020-01-27 14:51:02 +01:00
ocxl
sgi-gru
sgi-xp misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa 2020-01-27 14:50:51 +01:00
ti-st
vmw_vmci VMCI: Release resource if the work is already queued 2019-09-06 10:22:20 +02:00
ad525x_dpot-i2c.c
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c
apds9802als.c
aspeed-lpc-ctrl.c
aspeed-lpc-snoop.c soc: aspeed: Fix snoop_file_poll()'s return type 2020-01-27 14:49:53 +01:00
atmel-ssc.c
atmel_tclib.c
bh1770glc.c
cs5535-mfgpt.c
ds1682.c
dummy-irq.c
enclosure.c scsi: enclosure: Fix stale device oops with hot replug 2020-01-17 19:47:03 +01:00
fsa9480.c
hmc6352.c
hpilo.c
hpilo.h
ibmvmc.c
ibmvmc.h
ics932s401.c
ioc4.c
isl29003.c
isl29020.c
Kconfig
kgdbts.c misc: kgdbts: Fix restrict error 2019-11-20 18:47:31 +01:00
lattice-ecp3-config.c
Makefile
pch_phub.c
pci_endpoint_test.c misc: pci_endpoint_test: Fix test_reg_bar to be updated in pci_endpoint_test 2019-06-15 11:54:06 +02:00
phantom.c
pti.c
qcom-coincell.c
spear13xx_pcie_gadget.c
sram-exec.c
sram.c
sram.h
tifm_7xx1.c
tifm_core.c
tsl2550.c
vexpress-syscfg.c
vmw_balloon.c