Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: magnetometer: yamaha-yas530: Use pointers as driver data

Unify ID tables to use pointers for driver data. It will allow
to simplify the driver later on.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
741d1e37 3f8dd0a7

+13 -10
+13 -10
drivers/iio/magnetometer/yamaha-yas530.c
··· 32 32 #include <linux/mod_devicetable.h> 33 33 #include <linux/mutex.h> 34 34 #include <linux/pm_runtime.h> 35 + #include <linux/property.h> 35 36 #include <linux/regmap.h> 36 37 #include <linux/regulator/consumer.h> 37 38 #include <linux/random.h> ··· 1438 1437 goto assert_reset; 1439 1438 } 1440 1439 1441 - yas5xx->chip_info = &yas5xx_chip_info_tbl[id->driver_data]; 1442 - ci = yas5xx->chip_info; 1440 + ci = device_get_match_data(dev); 1441 + if (!ci) 1442 + ci = (const struct yas5xx_chip_info *)id->driver_data; 1443 + yas5xx->chip_info = ci; 1443 1444 1444 1445 ret = regmap_read(yas5xx->map, YAS5XX_DEVICE_ID, &id_check); 1445 1446 if (ret) ··· 1588 1585 yas5xx_runtime_resume, NULL); 1589 1586 1590 1587 static const struct i2c_device_id yas5xx_id[] = { 1591 - {"yas530", yas530 }, 1592 - {"yas532", yas532 }, 1593 - {"yas533", yas533 }, 1594 - {"yas537", yas537 }, 1588 + {"yas530", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas530] }, 1589 + {"yas532", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas532] }, 1590 + {"yas533", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas533] }, 1591 + {"yas537", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas537] }, 1595 1592 {} 1596 1593 }; 1597 1594 MODULE_DEVICE_TABLE(i2c, yas5xx_id); 1598 1595 1599 1596 static const struct of_device_id yas5xx_of_match[] = { 1600 - { .compatible = "yamaha,yas530", }, 1601 - { .compatible = "yamaha,yas532", }, 1602 - { .compatible = "yamaha,yas533", }, 1603 - { .compatible = "yamaha,yas537", }, 1597 + { .compatible = "yamaha,yas530", &yas5xx_chip_info_tbl[yas530] }, 1598 + { .compatible = "yamaha,yas532", &yas5xx_chip_info_tbl[yas532] }, 1599 + { .compatible = "yamaha,yas533", &yas5xx_chip_info_tbl[yas533] }, 1600 + { .compatible = "yamaha,yas537", &yas5xx_chip_info_tbl[yas537] }, 1604 1601 {} 1605 1602 }; 1606 1603 MODULE_DEVICE_TABLE(of, yas5xx_of_match);