Skip to content

Commit ee4d790

Browse files
nunojsajic23
authored andcommitted
iio: imu: adis16475: add spi_device_id table
This prevents the warning message "SPI driver has no spi_device_id for..." when registering the driver. More importantly, it makes sure that module autoloading works as spi relies on spi: modaliases and not of. While at it, move the of_device_id table to it's natural place. Fixes: fff7352 ("iio: imu: Add support for adis16475") Signed-off-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 3b8157e commit ee4d790

File tree

1 file changed

+72
-45
lines changed

1 file changed

+72
-45
lines changed

drivers/iio/imu/adis16475.c

Lines changed: 72 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,50 +1406,6 @@ static int adis16475_config_irq_pin(struct adis16475 *st)
14061406
return 0;
14071407
}
14081408

1409-
static const struct of_device_id adis16475_of_match[] = {
1410-
{ .compatible = "adi,adis16470",
1411-
.data = &adis16475_chip_info[ADIS16470] },
1412-
{ .compatible = "adi,adis16475-1",
1413-
.data = &adis16475_chip_info[ADIS16475_1] },
1414-
{ .compatible = "adi,adis16475-2",
1415-
.data = &adis16475_chip_info[ADIS16475_2] },
1416-
{ .compatible = "adi,adis16475-3",
1417-
.data = &adis16475_chip_info[ADIS16475_3] },
1418-
{ .compatible = "adi,adis16477-1",
1419-
.data = &adis16475_chip_info[ADIS16477_1] },
1420-
{ .compatible = "adi,adis16477-2",
1421-
.data = &adis16475_chip_info[ADIS16477_2] },
1422-
{ .compatible = "adi,adis16477-3",
1423-
.data = &adis16475_chip_info[ADIS16477_3] },
1424-
{ .compatible = "adi,adis16465-1",
1425-
.data = &adis16475_chip_info[ADIS16465_1] },
1426-
{ .compatible = "adi,adis16465-2",
1427-
.data = &adis16475_chip_info[ADIS16465_2] },
1428-
{ .compatible = "adi,adis16465-3",
1429-
.data = &adis16475_chip_info[ADIS16465_3] },
1430-
{ .compatible = "adi,adis16467-1",
1431-
.data = &adis16475_chip_info[ADIS16467_1] },
1432-
{ .compatible = "adi,adis16467-2",
1433-
.data = &adis16475_chip_info[ADIS16467_2] },
1434-
{ .compatible = "adi,adis16467-3",
1435-
.data = &adis16475_chip_info[ADIS16467_3] },
1436-
{ .compatible = "adi,adis16500",
1437-
.data = &adis16475_chip_info[ADIS16500] },
1438-
{ .compatible = "adi,adis16505-1",
1439-
.data = &adis16475_chip_info[ADIS16505_1] },
1440-
{ .compatible = "adi,adis16505-2",
1441-
.data = &adis16475_chip_info[ADIS16505_2] },
1442-
{ .compatible = "adi,adis16505-3",
1443-
.data = &adis16475_chip_info[ADIS16505_3] },
1444-
{ .compatible = "adi,adis16507-1",
1445-
.data = &adis16475_chip_info[ADIS16507_1] },
1446-
{ .compatible = "adi,adis16507-2",
1447-
.data = &adis16475_chip_info[ADIS16507_2] },
1448-
{ .compatible = "adi,adis16507-3",
1449-
.data = &adis16475_chip_info[ADIS16507_3] },
1450-
{ },
1451-
};
1452-
MODULE_DEVICE_TABLE(of, adis16475_of_match);
14531409

14541410
static int adis16475_probe(struct spi_device *spi)
14551411
{
@@ -1463,7 +1419,7 @@ static int adis16475_probe(struct spi_device *spi)
14631419

14641420
st = iio_priv(indio_dev);
14651421

1466-
st->info = device_get_match_data(&spi->dev);
1422+
st->info = spi_get_device_match_data(spi);
14671423
if (!st->info)
14681424
return -EINVAL;
14691425

@@ -1503,12 +1459,83 @@ static int adis16475_probe(struct spi_device *spi)
15031459
return 0;
15041460
}
15051461

1462+
static const struct of_device_id adis16475_of_match[] = {
1463+
{ .compatible = "adi,adis16470",
1464+
.data = &adis16475_chip_info[ADIS16470] },
1465+
{ .compatible = "adi,adis16475-1",
1466+
.data = &adis16475_chip_info[ADIS16475_1] },
1467+
{ .compatible = "adi,adis16475-2",
1468+
.data = &adis16475_chip_info[ADIS16475_2] },
1469+
{ .compatible = "adi,adis16475-3",
1470+
.data = &adis16475_chip_info[ADIS16475_3] },
1471+
{ .compatible = "adi,adis16477-1",
1472+
.data = &adis16475_chip_info[ADIS16477_1] },
1473+
{ .compatible = "adi,adis16477-2",
1474+
.data = &adis16475_chip_info[ADIS16477_2] },
1475+
{ .compatible = "adi,adis16477-3",
1476+
.data = &adis16475_chip_info[ADIS16477_3] },
1477+
{ .compatible = "adi,adis16465-1",
1478+
.data = &adis16475_chip_info[ADIS16465_1] },
1479+
{ .compatible = "adi,adis16465-2",
1480+
.data = &adis16475_chip_info[ADIS16465_2] },
1481+
{ .compatible = "adi,adis16465-3",
1482+
.data = &adis16475_chip_info[ADIS16465_3] },
1483+
{ .compatible = "adi,adis16467-1",
1484+
.data = &adis16475_chip_info[ADIS16467_1] },
1485+
{ .compatible = "adi,adis16467-2",
1486+
.data = &adis16475_chip_info[ADIS16467_2] },
1487+
{ .compatible = "adi,adis16467-3",
1488+
.data = &adis16475_chip_info[ADIS16467_3] },
1489+
{ .compatible = "adi,adis16500",
1490+
.data = &adis16475_chip_info[ADIS16500] },
1491+
{ .compatible = "adi,adis16505-1",
1492+
.data = &adis16475_chip_info[ADIS16505_1] },
1493+
{ .compatible = "adi,adis16505-2",
1494+
.data = &adis16475_chip_info[ADIS16505_2] },
1495+
{ .compatible = "adi,adis16505-3",
1496+
.data = &adis16475_chip_info[ADIS16505_3] },
1497+
{ .compatible = "adi,adis16507-1",
1498+
.data = &adis16475_chip_info[ADIS16507_1] },
1499+
{ .compatible = "adi,adis16507-2",
1500+
.data = &adis16475_chip_info[ADIS16507_2] },
1501+
{ .compatible = "adi,adis16507-3",
1502+
.data = &adis16475_chip_info[ADIS16507_3] },
1503+
{ },
1504+
};
1505+
MODULE_DEVICE_TABLE(of, adis16475_of_match);
1506+
1507+
static const struct spi_device_id adis16475_ids[] = {
1508+
{ "adis16470", (kernel_ulong_t)&adis16475_chip_info[ADIS16470] },
1509+
{ "adis16475-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_1] },
1510+
{ "adis16475-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_2] },
1511+
{ "adis16475-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_3] },
1512+
{ "adis16477-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_1] },
1513+
{ "adis16477-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_2] },
1514+
{ "adis16477-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_3] },
1515+
{ "adis16465-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_1] },
1516+
{ "adis16465-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_2] },
1517+
{ "adis16465-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_3] },
1518+
{ "adis16467-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_1] },
1519+
{ "adis16467-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_2] },
1520+
{ "adis16467-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_3] },
1521+
{ "adis16500", (kernel_ulong_t)&adis16475_chip_info[ADIS16500] },
1522+
{ "adis16505-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_1] },
1523+
{ "adis16505-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_2] },
1524+
{ "adis16505-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_3] },
1525+
{ "adis16507-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_1] },
1526+
{ "adis16507-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_2] },
1527+
{ "adis16507-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_3] },
1528+
{ }
1529+
};
1530+
MODULE_DEVICE_TABLE(spi, adis16475_ids);
1531+
15061532
static struct spi_driver adis16475_driver = {
15071533
.driver = {
15081534
.name = "adis16475",
15091535
.of_match_table = adis16475_of_match,
15101536
},
15111537
.probe = adis16475_probe,
1538+
.id_table = adis16475_ids,
15121539
};
15131540
module_spi_driver(adis16475_driver);
15141541

0 commit comments

Comments
 (0)