mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-27 06:50:37 +00:00

Use `\t(\{ ?\},|\{\}|\{\s*/\*.*\*/\s*\},?)$` regex to find and replace the array sentinel in all IIO drivers to the same style. For some time, we've been trying to consistently use `{ }` (no trailing comma, no comment, one space between braces) for array sentinels in the IIO subsystem. Still nearly 50% of existing code uses a different style. To save reviewers from having to request this trivial change as frequently, let's normalize the style in all existing IIO drivers. At least when code is copy/pasted to new drivers, the style will be consistent. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://patch.msgid.link/20250411-iio-sentinel-normalization-v1-1-d293de3e3d93@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
74 lines
1.9 KiB
C
74 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* 3-axis magnetometer driver supporting following I2C Bosch-Sensortec chips:
|
|
* - BMC150
|
|
* - BMC156
|
|
* - BMM150
|
|
*
|
|
* Copyright (c) 2016, Intel Corporation.
|
|
*/
|
|
#include <linux/device.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#include "bmc150_magn.h"
|
|
|
|
static int bmc150_magn_i2c_probe(struct i2c_client *client)
|
|
{
|
|
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
|
struct regmap *regmap;
|
|
const char *name = NULL;
|
|
|
|
regmap = devm_regmap_init_i2c(client, &bmc150_magn_regmap_config);
|
|
if (IS_ERR(regmap)) {
|
|
dev_err(&client->dev, "Failed to initialize i2c regmap\n");
|
|
return PTR_ERR(regmap);
|
|
}
|
|
|
|
if (id)
|
|
name = id->name;
|
|
|
|
return bmc150_magn_probe(&client->dev, regmap, client->irq, name);
|
|
}
|
|
|
|
static void bmc150_magn_i2c_remove(struct i2c_client *client)
|
|
{
|
|
bmc150_magn_remove(&client->dev);
|
|
}
|
|
|
|
static const struct i2c_device_id bmc150_magn_i2c_id[] = {
|
|
{ "bmc150_magn" },
|
|
{ "bmc156_magn" },
|
|
{ "bmm150_magn" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, bmc150_magn_i2c_id);
|
|
|
|
static const struct of_device_id bmc150_magn_of_match[] = {
|
|
{ .compatible = "bosch,bmc150_magn" },
|
|
{ .compatible = "bosch,bmc156_magn" },
|
|
{ .compatible = "bosch,bmm150_magn" }, /* deprecated compatible */
|
|
{ .compatible = "bosch,bmm150" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, bmc150_magn_of_match);
|
|
|
|
static struct i2c_driver bmc150_magn_driver = {
|
|
.driver = {
|
|
.name = "bmc150_magn_i2c",
|
|
.of_match_table = bmc150_magn_of_match,
|
|
.pm = &bmc150_magn_pm_ops,
|
|
},
|
|
.probe = bmc150_magn_i2c_probe,
|
|
.remove = bmc150_magn_i2c_remove,
|
|
.id_table = bmc150_magn_i2c_id,
|
|
};
|
|
module_i2c_driver(bmc150_magn_driver);
|
|
|
|
MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_DESCRIPTION("BMC150 I2C magnetometer driver");
|
|
MODULE_IMPORT_NS("IIO_BMC150_MAGN");
|