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

power: supply: bq256xx: Use i2c_get_match_data()

Use i2c_get_match_data() for OF/ID/ACPI match instead of ID lookup by
replacing OF/ACPI/ID match data from enum bq256xx_id to
struct bq256xx_chip_info.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230902202505.97609-2-biju.das.jz@bp.renesas.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Biju Das and committed by
Sebastian Reichel
f2899290 0bb80ecc

+22 -22
+22 -22
drivers/power/supply/bq256xx_charger.c
··· 1702 1702 1703 1703 bq->client = client; 1704 1704 bq->dev = dev; 1705 - bq->chip_info = &bq256xx_chip_info_tbl[id->driver_data]; 1705 + bq->chip_info = i2c_get_match_data(client); 1706 1706 1707 1707 mutex_init(&bq->lock); 1708 1708 ··· 1771 1771 } 1772 1772 1773 1773 static const struct i2c_device_id bq256xx_i2c_ids[] = { 1774 - { "bq25600", BQ25600 }, 1775 - { "bq25600d", BQ25600D }, 1776 - { "bq25601", BQ25601 }, 1777 - { "bq25601d", BQ25601D }, 1778 - { "bq25611d", BQ25611D }, 1779 - { "bq25618", BQ25618 }, 1780 - { "bq25619", BQ25619 }, 1774 + { "bq25600", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600] }, 1775 + { "bq25600d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600D] }, 1776 + { "bq25601", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601] }, 1777 + { "bq25601d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601D] }, 1778 + { "bq25611d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25611D] }, 1779 + { "bq25618", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25618] }, 1780 + { "bq25619", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25619] }, 1781 1781 {}, 1782 1782 }; 1783 1783 MODULE_DEVICE_TABLE(i2c, bq256xx_i2c_ids); 1784 1784 1785 1785 static const struct of_device_id bq256xx_of_match[] = { 1786 - { .compatible = "ti,bq25600", .data = (void *)BQ25600 }, 1787 - { .compatible = "ti,bq25600d", .data = (void *)BQ25600D }, 1788 - { .compatible = "ti,bq25601", .data = (void *)BQ25601 }, 1789 - { .compatible = "ti,bq25601d", .data = (void *)BQ25601D }, 1790 - { .compatible = "ti,bq25611d", .data = (void *)BQ25611D }, 1791 - { .compatible = "ti,bq25618", .data = (void *)BQ25618 }, 1792 - { .compatible = "ti,bq25619", .data = (void *)BQ25619 }, 1786 + { .compatible = "ti,bq25600", .data = &bq256xx_chip_info_tbl[BQ25600] }, 1787 + { .compatible = "ti,bq25600d", .data = &bq256xx_chip_info_tbl[BQ25600D] }, 1788 + { .compatible = "ti,bq25601", .data = &bq256xx_chip_info_tbl[BQ25601] }, 1789 + { .compatible = "ti,bq25601d", .data = &bq256xx_chip_info_tbl[BQ25601D] }, 1790 + { .compatible = "ti,bq25611d", .data = &bq256xx_chip_info_tbl[BQ25611D] }, 1791 + { .compatible = "ti,bq25618", .data = &bq256xx_chip_info_tbl[BQ25618] }, 1792 + { .compatible = "ti,bq25619", .data = &bq256xx_chip_info_tbl[BQ25619] }, 1793 1793 { }, 1794 1794 }; 1795 1795 MODULE_DEVICE_TABLE(of, bq256xx_of_match); 1796 1796 1797 1797 static const struct acpi_device_id bq256xx_acpi_match[] = { 1798 - { "bq25600", BQ25600 }, 1799 - { "bq25600d", BQ25600D }, 1800 - { "bq25601", BQ25601 }, 1801 - { "bq25601d", BQ25601D }, 1802 - { "bq25611d", BQ25611D }, 1803 - { "bq25618", BQ25618 }, 1804 - { "bq25619", BQ25619 }, 1798 + { "bq25600", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600] }, 1799 + { "bq25600d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25600D] }, 1800 + { "bq25601", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601] }, 1801 + { "bq25601d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25601D] }, 1802 + { "bq25611d", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25611D] }, 1803 + { "bq25618", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25618] }, 1804 + { "bq25619", (kernel_ulong_t)&bq256xx_chip_info_tbl[BQ25619] }, 1805 1805 {}, 1806 1806 }; 1807 1807 MODULE_DEVICE_TABLE(acpi, bq256xx_acpi_match);