mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

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.6 KiB
C
66 lines
1.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Freescale MPL115A2 pressure/temperature sensor
|
|
*
|
|
* Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net>
|
|
*
|
|
* (7-bit I2C slave address 0x60)
|
|
*
|
|
* Datasheet: http://www.nxp.com/files/sensors/doc/data_sheet/MPL115A2.pdf
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/i2c.h>
|
|
|
|
#include "mpl115.h"
|
|
|
|
static int mpl115_i2c_init(struct device *dev)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static int mpl115_i2c_read(struct device *dev, u8 address)
|
|
{
|
|
return i2c_smbus_read_word_swapped(to_i2c_client(dev), address);
|
|
}
|
|
|
|
static int mpl115_i2c_write(struct device *dev, u8 address, u8 value)
|
|
{
|
|
return i2c_smbus_write_byte_data(to_i2c_client(dev), address, value);
|
|
}
|
|
|
|
static const struct mpl115_ops mpl115_i2c_ops = {
|
|
.init = mpl115_i2c_init,
|
|
.read = mpl115_i2c_read,
|
|
.write = mpl115_i2c_write,
|
|
};
|
|
|
|
static int mpl115_i2c_probe(struct i2c_client *client)
|
|
{
|
|
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
|
|
return -EOPNOTSUPP;
|
|
|
|
return mpl115_probe(&client->dev, id->name, &mpl115_i2c_ops);
|
|
}
|
|
|
|
static const struct i2c_device_id mpl115_i2c_id[] = {
|
|
{ "mpl115" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, mpl115_i2c_id);
|
|
|
|
static struct i2c_driver mpl115_i2c_driver = {
|
|
.driver = {
|
|
.name = "mpl115",
|
|
.pm = pm_ptr(&mpl115_dev_pm_ops),
|
|
},
|
|
.probe = mpl115_i2c_probe,
|
|
.id_table = mpl115_i2c_id,
|
|
};
|
|
module_i2c_driver(mpl115_i2c_driver);
|
|
|
|
MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
|
|
MODULE_DESCRIPTION("Freescale MPL115A2 pressure/temperature driver");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_IMPORT_NS("IIO_MPL115");
|