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>
78 lines
1.8 KiB
C
78 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2016 Maxime Ripard
|
|
* Maxime Ripard <maxime.ripard@free-electrons.com>
|
|
*/
|
|
|
|
#include <linux/delay.h>
|
|
#include <linux/io.h>
|
|
#include <linux/reset-controller.h>
|
|
|
|
#include "ccu_reset.h"
|
|
|
|
static int ccu_reset_assert(struct reset_controller_dev *rcdev,
|
|
unsigned long id)
|
|
{
|
|
struct ccu_reset *ccu = rcdev_to_ccu_reset(rcdev);
|
|
const struct ccu_reset_map *map = &ccu->reset_map[id];
|
|
unsigned long flags;
|
|
u32 reg;
|
|
|
|
spin_lock_irqsave(ccu->lock, flags);
|
|
|
|
reg = readl(ccu->base + map->reg);
|
|
writel(reg & ~map->bit, ccu->base + map->reg);
|
|
|
|
spin_unlock_irqrestore(ccu->lock, flags);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int ccu_reset_deassert(struct reset_controller_dev *rcdev,
|
|
unsigned long id)
|
|
{
|
|
struct ccu_reset *ccu = rcdev_to_ccu_reset(rcdev);
|
|
const struct ccu_reset_map *map = &ccu->reset_map[id];
|
|
unsigned long flags;
|
|
u32 reg;
|
|
|
|
spin_lock_irqsave(ccu->lock, flags);
|
|
|
|
reg = readl(ccu->base + map->reg);
|
|
writel(reg | map->bit, ccu->base + map->reg);
|
|
|
|
spin_unlock_irqrestore(ccu->lock, flags);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int ccu_reset_reset(struct reset_controller_dev *rcdev,
|
|
unsigned long id)
|
|
{
|
|
ccu_reset_assert(rcdev, id);
|
|
udelay(10);
|
|
ccu_reset_deassert(rcdev, id);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int ccu_reset_status(struct reset_controller_dev *rcdev,
|
|
unsigned long id)
|
|
{
|
|
struct ccu_reset *ccu = rcdev_to_ccu_reset(rcdev);
|
|
const struct ccu_reset_map *map = &ccu->reset_map[id];
|
|
|
|
/*
|
|
* The reset control API expects 0 if reset is not asserted,
|
|
* which is the opposite of what our hardware uses.
|
|
*/
|
|
return !(map->bit & readl(ccu->base + map->reg));
|
|
}
|
|
|
|
const struct reset_control_ops ccu_reset_ops = {
|
|
.assert = ccu_reset_assert,
|
|
.deassert = ccu_reset_deassert,
|
|
.reset = ccu_reset_reset,
|
|
.status = ccu_reset_status,
|
|
};
|
|
EXPORT_SYMBOL_NS_GPL(ccu_reset_ops, "SUNXI_CCU");
|