mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 22:05:08 +00:00
cdd30ebb1b
Clean up the existing export namespace code along the same lines of commit 33def8498fdd ("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>
91 lines
2.1 KiB
C
91 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Driver for MPS MPQ8785 Step-Down Converter
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of_device.h>
|
|
#include "pmbus.h"
|
|
|
|
static int mpq8785_identify(struct i2c_client *client,
|
|
struct pmbus_driver_info *info)
|
|
{
|
|
int vout_mode;
|
|
|
|
vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
|
|
if (vout_mode < 0 || vout_mode == 0xff)
|
|
return vout_mode < 0 ? vout_mode : -ENODEV;
|
|
switch (vout_mode >> 5) {
|
|
case 0:
|
|
info->format[PSC_VOLTAGE_OUT] = linear;
|
|
break;
|
|
case 1:
|
|
case 2:
|
|
info->format[PSC_VOLTAGE_OUT] = direct;
|
|
info->m[PSC_VOLTAGE_OUT] = 64;
|
|
info->b[PSC_VOLTAGE_OUT] = 0;
|
|
info->R[PSC_VOLTAGE_OUT] = 1;
|
|
break;
|
|
default:
|
|
return -ENODEV;
|
|
}
|
|
|
|
return 0;
|
|
};
|
|
|
|
static struct pmbus_driver_info mpq8785_info = {
|
|
.pages = 1,
|
|
.format[PSC_VOLTAGE_IN] = direct,
|
|
.format[PSC_CURRENT_OUT] = direct,
|
|
.format[PSC_TEMPERATURE] = direct,
|
|
.m[PSC_VOLTAGE_IN] = 4,
|
|
.b[PSC_VOLTAGE_IN] = 0,
|
|
.R[PSC_VOLTAGE_IN] = 1,
|
|
.m[PSC_CURRENT_OUT] = 16,
|
|
.b[PSC_CURRENT_OUT] = 0,
|
|
.R[PSC_CURRENT_OUT] = 0,
|
|
.m[PSC_TEMPERATURE] = 1,
|
|
.b[PSC_TEMPERATURE] = 0,
|
|
.R[PSC_TEMPERATURE] = 0,
|
|
.func[0] =
|
|
PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
|
|
PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
|
|
PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
|
|
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
|
|
.identify = mpq8785_identify,
|
|
};
|
|
|
|
static int mpq8785_probe(struct i2c_client *client)
|
|
{
|
|
return pmbus_do_probe(client, &mpq8785_info);
|
|
};
|
|
|
|
static const struct i2c_device_id mpq8785_id[] = {
|
|
{ "mpq8785" },
|
|
{ },
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, mpq8785_id);
|
|
|
|
static const struct of_device_id __maybe_unused mpq8785_of_match[] = {
|
|
{ .compatible = "mps,mpq8785" },
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(of, mpq8785_of_match);
|
|
|
|
static struct i2c_driver mpq8785_driver = {
|
|
.driver = {
|
|
.name = "mpq8785",
|
|
.of_match_table = of_match_ptr(mpq8785_of_match),
|
|
},
|
|
.probe = mpq8785_probe,
|
|
.id_table = mpq8785_id,
|
|
};
|
|
|
|
module_i2c_driver(mpq8785_driver);
|
|
|
|
MODULE_AUTHOR("Charles Hsu <ythsu0511@gmail.com>");
|
|
MODULE_DESCRIPTION("PMBus driver for MPS MPQ8785");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_IMPORT_NS("PMBUS");
|