mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +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>
63 lines
1.5 KiB
C
63 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* ScioSense ENS160 multi-gas sensor I2C driver
|
|
*
|
|
* Copyright (c) 2024 Gustavo Silva <gustavograzs@gmail.com>
|
|
*
|
|
* 7-Bit I2C slave address is:
|
|
* - 0x52 if ADDR pin LOW
|
|
* - 0x53 if ADDR pin HIGH
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#include "ens160.h"
|
|
|
|
static const struct regmap_config ens160_regmap_i2c_conf = {
|
|
.reg_bits = 8,
|
|
.val_bits = 8,
|
|
};
|
|
|
|
static int ens160_i2c_probe(struct i2c_client *client)
|
|
{
|
|
struct regmap *regmap;
|
|
|
|
regmap = devm_regmap_init_i2c(client, &ens160_regmap_i2c_conf);
|
|
if (IS_ERR(regmap))
|
|
return dev_err_probe(&client->dev, PTR_ERR(regmap),
|
|
"Failed to register i2c regmap\n");
|
|
|
|
return devm_ens160_core_probe(&client->dev, regmap, client->irq,
|
|
"ens160");
|
|
}
|
|
|
|
static const struct i2c_device_id ens160_i2c_id[] = {
|
|
{ "ens160" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, ens160_i2c_id);
|
|
|
|
static const struct of_device_id ens160_of_i2c_match[] = {
|
|
{ .compatible = "sciosense,ens160" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, ens160_of_i2c_match);
|
|
|
|
static struct i2c_driver ens160_i2c_driver = {
|
|
.driver = {
|
|
.name = "ens160",
|
|
.of_match_table = ens160_of_i2c_match,
|
|
.pm = pm_sleep_ptr(&ens160_pm_ops),
|
|
},
|
|
.probe = ens160_i2c_probe,
|
|
.id_table = ens160_i2c_id,
|
|
};
|
|
module_i2c_driver(ens160_i2c_driver);
|
|
|
|
MODULE_AUTHOR("Gustavo Silva <gustavograzs@gmail.com>");
|
|
MODULE_DESCRIPTION("ScioSense ENS160 I2C driver");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_IMPORT_NS("IIO_ENS160");
|