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>
76 lines
1.8 KiB
C
76 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Hardware monitoring driver for STMicroelectronics digital controller PM6764TR
|
|
*/
|
|
|
|
#include <linux/err.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/pmbus.h>
|
|
#include "pmbus.h"
|
|
|
|
#define PM6764TR_PMBUS_READ_VOUT 0xD4
|
|
|
|
static int pm6764tr_read_word_data(struct i2c_client *client, int page, int phase, int reg)
|
|
{
|
|
int ret;
|
|
|
|
switch (reg) {
|
|
case PMBUS_VIRT_READ_VMON:
|
|
ret = pmbus_read_word_data(client, page, phase, PM6764TR_PMBUS_READ_VOUT);
|
|
break;
|
|
default:
|
|
ret = -ENODATA;
|
|
break;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
static struct pmbus_driver_info pm6764tr_info = {
|
|
.pages = 1,
|
|
.format[PSC_VOLTAGE_IN] = linear,
|
|
.format[PSC_VOLTAGE_OUT] = vid,
|
|
.format[PSC_TEMPERATURE] = linear,
|
|
.format[PSC_CURRENT_OUT] = linear,
|
|
.format[PSC_POWER] = linear,
|
|
.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
|
|
PMBUS_HAVE_IOUT | PMBUS_HAVE_POUT | PMBUS_HAVE_VMON |
|
|
PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_VOUT |
|
|
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
|
|
.read_word_data = pm6764tr_read_word_data,
|
|
};
|
|
|
|
static int pm6764tr_probe(struct i2c_client *client)
|
|
{
|
|
return pmbus_do_probe(client, &pm6764tr_info);
|
|
}
|
|
|
|
static const struct i2c_device_id pm6764tr_id[] = {
|
|
{"pm6764tr"},
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, pm6764tr_id);
|
|
|
|
static const struct of_device_id __maybe_unused pm6764tr_of_match[] = {
|
|
{.compatible = "st,pm6764tr"},
|
|
{}
|
|
};
|
|
|
|
/* This is the driver that will be inserted */
|
|
static struct i2c_driver pm6764tr_driver = {
|
|
.driver = {
|
|
.name = "pm6764tr",
|
|
.of_match_table = of_match_ptr(pm6764tr_of_match),
|
|
},
|
|
.probe = pm6764tr_probe,
|
|
.id_table = pm6764tr_id,
|
|
};
|
|
|
|
module_i2c_driver(pm6764tr_driver);
|
|
|
|
MODULE_AUTHOR("Charles Hsu");
|
|
MODULE_DESCRIPTION("PMBus driver for ST PM6764TR");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_IMPORT_NS("PMBUS");
|