mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
4391affa10
These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. While add it, also remove commas after the sentinel entries. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20240508072928.2135858-2-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/device.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#include "kxsd9.h"
|
|
|
|
static int kxsd9_i2c_probe(struct i2c_client *i2c)
|
|
{
|
|
static const struct regmap_config config = {
|
|
.reg_bits = 8,
|
|
.val_bits = 8,
|
|
.max_register = 0x0e,
|
|
};
|
|
struct regmap *regmap;
|
|
|
|
regmap = devm_regmap_init_i2c(i2c, &config);
|
|
if (IS_ERR(regmap)) {
|
|
dev_err(&i2c->dev, "Failed to register i2c regmap: %pe\n",
|
|
regmap);
|
|
return PTR_ERR(regmap);
|
|
}
|
|
|
|
return kxsd9_common_probe(&i2c->dev,
|
|
regmap,
|
|
i2c->name);
|
|
}
|
|
|
|
static void kxsd9_i2c_remove(struct i2c_client *client)
|
|
{
|
|
kxsd9_common_remove(&client->dev);
|
|
}
|
|
|
|
static const struct of_device_id kxsd9_of_match[] = {
|
|
{ .compatible = "kionix,kxsd9", },
|
|
{ },
|
|
};
|
|
MODULE_DEVICE_TABLE(of, kxsd9_of_match);
|
|
|
|
static const struct i2c_device_id kxsd9_i2c_id[] = {
|
|
{ "kxsd9" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, kxsd9_i2c_id);
|
|
|
|
static struct i2c_driver kxsd9_i2c_driver = {
|
|
.driver = {
|
|
.name = "kxsd9",
|
|
.of_match_table = kxsd9_of_match,
|
|
.pm = pm_ptr(&kxsd9_dev_pm_ops),
|
|
},
|
|
.probe = kxsd9_i2c_probe,
|
|
.remove = kxsd9_i2c_remove,
|
|
.id_table = kxsd9_i2c_id,
|
|
};
|
|
module_i2c_driver(kxsd9_i2c_driver);
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_DESCRIPTION("KXSD9 accelerometer I2C interface");
|
|
MODULE_IMPORT_NS(IIO_KXSD9);
|