clk: mediatek: reset: Refine and reorder functions in reset.c

To make drivers more readable, we modify the indentation of the drivers
and reorder the location of functions.

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20220523093346.28493-4-rex-bc.chen@mediatek.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Rex-BC Chen 2022-05-23 17:33:30 +08:00 committed by Stephen Boyd
parent edabcf71d1
commit 086bcb50b4
1 changed files with 37 additions and 33 deletions

View File

@ -12,44 +12,27 @@
#include "reset.h"
static int mtk_reset_assert_set_clr(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
unsigned int reg = data->regofs + ((id / 32) << 4);
return regmap_write(data->regmap, reg, BIT(id % 32));
}
static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
unsigned int reg = data->regofs + ((id / 32) << 4) + 0x4;
return regmap_write(data->regmap, reg, BIT(id % 32));
}
static int mtk_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
unsigned long id)
{
struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
return regmap_update_bits(data->regmap, data->regofs + ((id / 32) << 2),
BIT(id % 32), ~0);
return regmap_update_bits(data->regmap,
data->regofs + ((id / 32) << 2),
BIT(id % 32), ~0);
}
static int mtk_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
unsigned long id)
{
struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
return regmap_update_bits(data->regmap, data->regofs + ((id / 32) << 2),
BIT(id % 32), 0);
return regmap_update_bits(data->regmap,
data->regofs + ((id / 32) << 2),
BIT(id % 32), 0);
}
static int mtk_reset(struct reset_controller_dev *rcdev,
unsigned long id)
static int mtk_reset(struct reset_controller_dev *rcdev, unsigned long id)
{
int ret;
@ -60,8 +43,28 @@ static int mtk_reset(struct reset_controller_dev *rcdev,
return mtk_reset_deassert(rcdev, id);
}
static int mtk_reset_assert_set_clr(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
return regmap_write(data->regmap,
data->regofs + ((id / 32) << 4),
BIT(id % 32));
}
static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
return regmap_write(data->regmap,
data->regofs + ((id / 32) << 4) + 0x4,
BIT(id % 32));
}
static int mtk_reset_set_clr(struct reset_controller_dev *rcdev,
unsigned long id)
unsigned long id)
{
int ret;
@ -84,8 +87,9 @@ static const struct reset_control_ops mtk_reset_ops_set_clr = {
};
static void mtk_register_reset_controller_common(struct device_node *np,
unsigned int num_regs, int regofs,
const struct reset_control_ops *reset_ops)
unsigned int num_regs,
int regofs,
const struct reset_control_ops *reset_ops)
{
struct mtk_reset *data;
int ret;
@ -117,17 +121,17 @@ static void mtk_register_reset_controller_common(struct device_node *np,
}
void mtk_register_reset_controller(struct device_node *np,
unsigned int num_regs, int regofs)
unsigned int num_regs, int regofs)
{
mtk_register_reset_controller_common(np, num_regs, regofs,
&mtk_reset_ops);
&mtk_reset_ops);
}
void mtk_register_reset_controller_set_clr(struct device_node *np,
unsigned int num_regs, int regofs)
unsigned int num_regs, int regofs)
{
mtk_register_reset_controller_common(np, num_regs, regofs,
&mtk_reset_ops_set_clr);
&mtk_reset_ops_set_clr);
}
MODULE_LICENSE("GPL");