mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 21:39:35 -04:00
Replace the #include of <linux/mod_devicetable.h> by the more specific <linux/device-id/*.h> where applicable. For most cases the include can be dropped completely, only a few drivers need one or two headers added. Acked-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
67 lines
2.0 KiB
C
67 lines
2.0 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/* SC16IS7xx I2C interface driver */
|
|
|
|
#include <linux/dev_printk.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/string.h>
|
|
|
|
#include "sc16is7xx.h"
|
|
|
|
static int sc16is7xx_i2c_probe(struct i2c_client *i2c)
|
|
{
|
|
const struct sc16is7xx_devtype *devtype;
|
|
struct regmap *regmaps[SC16IS7XX_MAX_PORTS];
|
|
struct regmap_config regcfg;
|
|
unsigned int i;
|
|
|
|
devtype = i2c_get_match_data(i2c);
|
|
if (!devtype)
|
|
return dev_err_probe(&i2c->dev, -ENODEV, "Failed to match device\n");
|
|
|
|
memcpy(®cfg, &sc16is7xx_regcfg, sizeof(struct regmap_config));
|
|
|
|
for (i = 0; i < devtype->nr_uart; i++) {
|
|
regcfg.name = sc16is7xx_regmap_name(i);
|
|
regcfg.read_flag_mask = sc16is7xx_regmap_port_mask(i);
|
|
regcfg.write_flag_mask = sc16is7xx_regmap_port_mask(i);
|
|
regmaps[i] = devm_regmap_init_i2c(i2c, ®cfg);
|
|
}
|
|
|
|
return sc16is7xx_probe(&i2c->dev, devtype, regmaps, i2c->irq);
|
|
}
|
|
|
|
static void sc16is7xx_i2c_remove(struct i2c_client *client)
|
|
{
|
|
sc16is7xx_remove(&client->dev);
|
|
}
|
|
|
|
static const struct i2c_device_id sc16is7xx_i2c_id_table[] = {
|
|
{ .name = "sc16is74x", .driver_data = (kernel_ulong_t)&sc16is74x_devtype },
|
|
{ .name = "sc16is740", .driver_data = (kernel_ulong_t)&sc16is74x_devtype },
|
|
{ .name = "sc16is741", .driver_data = (kernel_ulong_t)&sc16is74x_devtype },
|
|
{ .name = "sc16is750", .driver_data = (kernel_ulong_t)&sc16is750_devtype },
|
|
{ .name = "sc16is752", .driver_data = (kernel_ulong_t)&sc16is752_devtype },
|
|
{ .name = "sc16is760", .driver_data = (kernel_ulong_t)&sc16is760_devtype },
|
|
{ .name = "sc16is762", .driver_data = (kernel_ulong_t)&sc16is762_devtype },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, sc16is7xx_i2c_id_table);
|
|
|
|
static struct i2c_driver sc16is7xx_i2c_driver = {
|
|
.driver = {
|
|
.name = KBUILD_MODNAME,
|
|
.of_match_table = sc16is7xx_dt_ids,
|
|
},
|
|
.probe = sc16is7xx_i2c_probe,
|
|
.remove = sc16is7xx_i2c_remove,
|
|
.id_table = sc16is7xx_i2c_id_table,
|
|
};
|
|
|
|
module_i2c_driver(sc16is7xx_i2c_driver);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_DESCRIPTION(KBUILD_MODNAME " interface driver");
|
|
MODULE_IMPORT_NS("SERIAL_NXP_SC16IS7XX");
|