mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +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>
74 lines
2.2 KiB
C
74 lines
2.2 KiB
C
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
|
|
/*
|
|
* Copyright (c) 2019 BayLibre, SAS.
|
|
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
|
*/
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/module.h>
|
|
|
|
#include "clk-regmap.h"
|
|
#include "clk-cpu-dyndiv.h"
|
|
|
|
static inline struct meson_clk_cpu_dyndiv_data *
|
|
meson_clk_cpu_dyndiv_data(struct clk_regmap *clk)
|
|
{
|
|
return (struct meson_clk_cpu_dyndiv_data *)clk->data;
|
|
}
|
|
|
|
static unsigned long meson_clk_cpu_dyndiv_recalc_rate(struct clk_hw *hw,
|
|
unsigned long prate)
|
|
{
|
|
struct clk_regmap *clk = to_clk_regmap(hw);
|
|
struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk);
|
|
|
|
return divider_recalc_rate(hw, prate,
|
|
meson_parm_read(clk->map, &data->div),
|
|
NULL, 0, data->div.width);
|
|
}
|
|
|
|
static int meson_clk_cpu_dyndiv_determine_rate(struct clk_hw *hw,
|
|
struct clk_rate_request *req)
|
|
{
|
|
struct clk_regmap *clk = to_clk_regmap(hw);
|
|
struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk);
|
|
|
|
return divider_determine_rate(hw, req, NULL, data->div.width, 0);
|
|
}
|
|
|
|
static int meson_clk_cpu_dyndiv_set_rate(struct clk_hw *hw, unsigned long rate,
|
|
unsigned long parent_rate)
|
|
{
|
|
struct clk_regmap *clk = to_clk_regmap(hw);
|
|
struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk);
|
|
unsigned int val;
|
|
int ret;
|
|
|
|
ret = divider_get_val(rate, parent_rate, NULL, data->div.width, 0);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
val = (unsigned int)ret << data->div.shift;
|
|
|
|
/* Write the SYS_CPU_DYN_ENABLE bit before changing the divider */
|
|
meson_parm_write(clk->map, &data->dyn, 1);
|
|
|
|
/* Update the divider while removing the SYS_CPU_DYN_ENABLE bit */
|
|
return regmap_update_bits(clk->map, data->div.reg_off,
|
|
SETPMASK(data->div.width, data->div.shift) |
|
|
SETPMASK(data->dyn.width, data->dyn.shift),
|
|
val);
|
|
};
|
|
|
|
const struct clk_ops meson_clk_cpu_dyndiv_ops = {
|
|
.recalc_rate = meson_clk_cpu_dyndiv_recalc_rate,
|
|
.determine_rate = meson_clk_cpu_dyndiv_determine_rate,
|
|
.set_rate = meson_clk_cpu_dyndiv_set_rate,
|
|
};
|
|
EXPORT_SYMBOL_NS_GPL(meson_clk_cpu_dyndiv_ops, "CLK_MESON");
|
|
|
|
MODULE_DESCRIPTION("Amlogic CPU Dynamic Clock divider");
|
|
MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_IMPORT_NS("CLK_MESON");
|