staging: wfx: do not probe the device if not in the DT
Since the WF200 VID/PID are not reliable, it's recommended to declare it in the DT. Until now, if the device was not declared, the driver just printed a warning and continue. But, the risk of a collision is too high, the driver now returns an error. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20220113085524.1110708-32-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a948178e7e
commit
71b8331380
@ -7,3 +7,7 @@ config WFX
|
||||
help
|
||||
This is a driver for Silicons Labs WFxxx series (WF200 and further)
|
||||
chipsets. This chip can be found on SPI or SDIO buses.
|
||||
|
||||
Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts,
|
||||
the driver won't probe the device if it is not also declared in the
|
||||
Device Tree.
|
||||
|
@ -204,24 +204,17 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!pdata) {
|
||||
dev_warn(&func->dev, "no compatible device found in DT\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL);
|
||||
if (!bus)
|
||||
return -ENOMEM;
|
||||
|
||||
if (np) {
|
||||
if (!of_match_node(wfx_sdio_of_match, np)) {
|
||||
dev_warn(&func->dev, "no compatible device found in DT\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
bus->of_irq = irq_of_parse_and_map(np, 0);
|
||||
} else {
|
||||
dev_warn(&func->dev,
|
||||
"device is not declared in DT, features will be limited\n");
|
||||
/* FIXME: ignore VID/PID and only rely on device tree */
|
||||
// return -ENODEV;
|
||||
}
|
||||
|
||||
bus->func = func;
|
||||
bus->of_irq = irq_of_parse_and_map(np, 0);
|
||||
sdio_set_drvdata(func, bus);
|
||||
func->card->quirks |= MMC_QUIRK_LENIENT_FN0 |
|
||||
MMC_QUIRK_BLKSZ_FOR_BYTE_MODE |
|
||||
@ -268,8 +261,6 @@ static void wfx_sdio_remove(struct sdio_func *func)
|
||||
#define SDIO_DEVICE_ID_SILABS_WF200 0x1000
|
||||
static const struct sdio_device_id wfx_sdio_ids[] = {
|
||||
{ SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) },
|
||||
/* FIXME: ignore VID/PID and only rely on device tree */
|
||||
// { SDIO_DEVICE(SDIO_ANY_ID, SDIO_ANY_ID) },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids);
|
||||
|
Loading…
x
Reference in New Issue
Block a user