mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
cdd30ebb1b
Clean up the existing export namespace code along the same lines of
commit 33def8498f
("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
71 lines
1.8 KiB
C
71 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
|
|
* - BMI088
|
|
* - BMI085
|
|
* - BMI090L
|
|
*
|
|
* Copyright 2023 Jun Yan <jerrysteve1101@gmail.com>
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/slab.h>
|
|
|
|
#include "bmi088-accel.h"
|
|
|
|
static int bmi088_accel_probe(struct i2c_client *i2c)
|
|
{
|
|
struct regmap *regmap;
|
|
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
|
|
|
|
regmap = devm_regmap_init_i2c(i2c, &bmi088_regmap_conf);
|
|
if (IS_ERR(regmap)) {
|
|
dev_err(&i2c->dev, "Failed to initialize i2c regmap\n");
|
|
return PTR_ERR(regmap);
|
|
}
|
|
|
|
return bmi088_accel_core_probe(&i2c->dev, regmap, i2c->irq,
|
|
id->driver_data);
|
|
}
|
|
|
|
static void bmi088_accel_remove(struct i2c_client *i2c)
|
|
{
|
|
bmi088_accel_core_remove(&i2c->dev);
|
|
}
|
|
|
|
static const struct of_device_id bmi088_of_match[] = {
|
|
{ .compatible = "bosch,bmi085-accel" },
|
|
{ .compatible = "bosch,bmi088-accel" },
|
|
{ .compatible = "bosch,bmi090l-accel" },
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(of, bmi088_of_match);
|
|
|
|
static const struct i2c_device_id bmi088_accel_id[] = {
|
|
{ "bmi085-accel", BOSCH_BMI085 },
|
|
{ "bmi088-accel", BOSCH_BMI088 },
|
|
{ "bmi090l-accel", BOSCH_BMI090L },
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, bmi088_accel_id);
|
|
|
|
static struct i2c_driver bmi088_accel_driver = {
|
|
.driver = {
|
|
.name = "bmi088_accel_i2c",
|
|
.pm = pm_ptr(&bmi088_accel_pm_ops),
|
|
.of_match_table = bmi088_of_match,
|
|
},
|
|
.probe = bmi088_accel_probe,
|
|
.remove = bmi088_accel_remove,
|
|
.id_table = bmi088_accel_id,
|
|
};
|
|
module_i2c_driver(bmi088_accel_driver);
|
|
|
|
MODULE_AUTHOR("Jun Yan <jerrysteve1101@gmail.com>");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_DESCRIPTION("BMI088 accelerometer driver (I2C)");
|
|
MODULE_IMPORT_NS("IIO_BMI088");
|