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>
63 lines
1.5 KiB
C
63 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* IIO accel I2C driver for Freescale MMA7455L 3-axis 10-bit accelerometer
|
|
* Copyright 2015 Joachim Eastwood <manabian@gmail.com>
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#include "mma7455.h"
|
|
|
|
static int mma7455_i2c_probe(struct i2c_client *i2c)
|
|
{
|
|
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
|
struct regmap *regmap;
|
|
const char *name = NULL;
|
|
|
|
regmap = devm_regmap_init_i2c(i2c, &mma7455_core_regmap);
|
|
if (IS_ERR(regmap))
|
|
return PTR_ERR(regmap);
|
|
|
|
if (id)
|
|
name = id->name;
|
|
|
|
return mma7455_core_probe(&i2c->dev, regmap, name);
|
|
}
|
|
|
|
static void mma7455_i2c_remove(struct i2c_client *i2c)
|
|
{
|
|
mma7455_core_remove(&i2c->dev);
|
|
}
|
|
|
|
static const struct i2c_device_id mma7455_i2c_ids[] = {
|
|
{ "mma7455" },
|
|
{ "mma7456" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, mma7455_i2c_ids);
|
|
|
|
static const struct of_device_id mma7455_of_match[] = {
|
|
{ .compatible = "fsl,mma7455" },
|
|
{ .compatible = "fsl,mma7456" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, mma7455_of_match);
|
|
|
|
static struct i2c_driver mma7455_i2c_driver = {
|
|
.probe = mma7455_i2c_probe,
|
|
.remove = mma7455_i2c_remove,
|
|
.id_table = mma7455_i2c_ids,
|
|
.driver = {
|
|
.name = "mma7455-i2c",
|
|
.of_match_table = mma7455_of_match,
|
|
},
|
|
};
|
|
module_i2c_driver(mma7455_i2c_driver);
|
|
|
|
MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
|
|
MODULE_DESCRIPTION("Freescale MMA7455L I2C accelerometer driver");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_IMPORT_NS(IIO_MMA7455);
|