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>
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Support for PNI RM3100 3-axis geomagnetic sensor on a spi bus.
|
|
*
|
|
* Copyright (C) 2018 Song Qiang <songqiang1304521@gmail.com>
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include "rm3100.h"
|
|
|
|
static const struct regmap_config rm3100_regmap_config = {
|
|
.reg_bits = 8,
|
|
.val_bits = 8,
|
|
|
|
.rd_table = &rm3100_readable_table,
|
|
.wr_table = &rm3100_writable_table,
|
|
.volatile_table = &rm3100_volatile_table,
|
|
|
|
.read_flag_mask = 0x80,
|
|
|
|
.cache_type = REGCACHE_RBTREE,
|
|
};
|
|
|
|
static int rm3100_probe(struct spi_device *spi)
|
|
{
|
|
struct regmap *regmap;
|
|
int ret;
|
|
|
|
/* Actually this device supports both mode 0 and mode 3. */
|
|
spi->mode = SPI_MODE_0;
|
|
/* Data rates cannot exceed 1Mbits. */
|
|
spi->max_speed_hz = 1000000;
|
|
spi->bits_per_word = 8;
|
|
ret = spi_setup(spi);
|
|
if (ret)
|
|
return ret;
|
|
|
|
regmap = devm_regmap_init_spi(spi, &rm3100_regmap_config);
|
|
if (IS_ERR(regmap))
|
|
return PTR_ERR(regmap);
|
|
|
|
return rm3100_common_probe(&spi->dev, regmap, spi->irq);
|
|
}
|
|
|
|
static const struct of_device_id rm3100_dt_match[] = {
|
|
{ .compatible = "pni,rm3100", },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, rm3100_dt_match);
|
|
|
|
static struct spi_driver rm3100_driver = {
|
|
.driver = {
|
|
.name = "rm3100-spi",
|
|
.of_match_table = rm3100_dt_match,
|
|
},
|
|
.probe = rm3100_probe,
|
|
};
|
|
module_spi_driver(rm3100_driver);
|
|
|
|
MODULE_AUTHOR("Song Qiang <songqiang1304521@gmail.com>");
|
|
MODULE_DESCRIPTION("PNI RM3100 3-axis magnetometer spi driver");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_IMPORT_NS("IIO_RM3100");
|