[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220504122601.335495-11-y.oudjana@protonmail.com>
Date: Wed, 4 May 2022 16:25:59 +0400
From: Yassine Oudjana <yassine.oudjana@...il.com>
To: Matthias Brugger <matthias.bgg@...il.com>,
Stephen Boyd <sboyd@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>
Cc: Yassine Oudjana <y.oudjana@...tonmail.com>,
Yassine Oudjana <yassine.oudjana@...il.com>,
Chun-Jie Chen <chun-jie.chen@...iatek.com>,
Chen-Yu Tsai <wenst@...omium.org>,
Tinghan Shen <tinghan.shen@...iatek.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Weiyi Lu <weiyi.lu@...iatek.com>,
Ikjoon Jang <ikjn@...omium.org>,
Miles Chen <miles.chen@...iatek.com>,
Sam Shih <sam.shih@...iatek.com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 10/13] clk: mediatek: reset: Return mtk_reset pointer on register
From: Yassine Oudjana <y.oudjana@...tonmail.com>
Return a struct mtk_reset* when registering a reset controller
in preparation for adding an unregister helper that will take
it as an argument.
Signed-off-by: Yassine Oudjana <y.oudjana@...tonmail.com>
---
drivers/clk/mediatek/clk-mtk.h | 6 +++---
drivers/clk/mediatek/reset.c | 22 ++++++++++++----------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
index bf6565aa7319..317905ec4a36 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -190,10 +190,10 @@ void mtk_free_clk_data(struct clk_onecell_data *clk_data);
struct clk *mtk_clk_register_ref2usb_tx(const char *name,
const char *parent_name, void __iomem *reg);
-void mtk_register_reset_controller(struct device_node *np,
- unsigned int num_regs, int regofs);
+struct mtk_reset *mtk_register_reset_controller(struct device_node *np,
+ unsigned int num_regs, int regofs);
-void mtk_register_reset_controller_set_clr(struct device_node *np,
+struct mtk_reset *mtk_register_reset_controller_set_clr(struct device_node *np,
unsigned int num_regs, int regofs);
struct mtk_clk_desc {
diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c
index 6c2effe6afef..f853bc8a7092 100644
--- a/drivers/clk/mediatek/reset.c
+++ b/drivers/clk/mediatek/reset.c
@@ -90,9 +90,9 @@ static const struct reset_control_ops mtk_reset_ops_set_clr = {
.reset = mtk_reset_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)
+static struct mtk_reset *mtk_register_reset_controller_common(
+ struct device_node *np, unsigned int num_regs, int regofs,
+ const struct reset_control_ops *reset_ops)
{
struct mtk_reset *data;
int ret;
@@ -101,12 +101,12 @@ static void mtk_register_reset_controller_common(struct device_node *np,
regmap = device_node_to_regmap(np);
if (IS_ERR(regmap)) {
pr_err("Cannot find regmap for %pOF: %pe\n", np, regmap);
- return;
+ return (struct mtk_reset *)regmap;
}
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
- return;
+ return ERR_PTR(-ENOMEM);
data->regmap = regmap;
data->regofs = regofs;
@@ -119,22 +119,24 @@ static void mtk_register_reset_controller_common(struct device_node *np,
if (ret) {
pr_err("could not register reset controller: %d\n", ret);
kfree(data);
- return;
+ return ERR_PTR(ret);
}
+
+ return data;
}
-void mtk_register_reset_controller(struct device_node *np,
+struct mtk_reset *mtk_register_reset_controller(struct device_node *np,
unsigned int num_regs, int regofs)
{
- mtk_register_reset_controller_common(np, num_regs, regofs,
+ return mtk_register_reset_controller_common(np, num_regs, regofs,
&mtk_reset_ops);
}
EXPORT_SYMBOL_GPL(mtk_register_reset_controller);
-void mtk_register_reset_controller_set_clr(struct device_node *np,
+struct mtk_reset *mtk_register_reset_controller_set_clr(struct device_node *np,
unsigned int num_regs, int regofs)
{
- mtk_register_reset_controller_common(np, num_regs, regofs,
+ return mtk_register_reset_controller_common(np, num_regs, regofs,
&mtk_reset_ops_set_clr);
}
EXPORT_SYMBOL_GPL(mtk_register_reset_controller_set_clr);
--
2.36.0
Powered by blists - more mailing lists