clk: qcom: smd-rpm: Drop the use of struct rpm_cc
Considering that struct rpm_cc is now identical to rpm_smd_clk_desc, and function qcom_smdrpm_clk_hw_get() uses rpm_cc in a read-only manner, rpm_cc can be dropped by getting the function use rpm_smd_clk_desc directly. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211031020715.21636-3-shawn.guo@linaro.org
This commit is contained in:
parent
00a123e962
commit
b406f5e92b
@ -150,11 +150,6 @@ struct clk_smd_rpm_req {
|
|||||||
__le32 value;
|
__le32 value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rpm_cc {
|
|
||||||
struct clk_smd_rpm **clks;
|
|
||||||
size_t num_clks;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct rpm_smd_clk_desc {
|
struct rpm_smd_clk_desc {
|
||||||
struct clk_smd_rpm **clks;
|
struct clk_smd_rpm **clks;
|
||||||
size_t num_clks;
|
size_t num_clks;
|
||||||
@ -1157,20 +1152,19 @@ MODULE_DEVICE_TABLE(of, rpm_smd_clk_match_table);
|
|||||||
static struct clk_hw *qcom_smdrpm_clk_hw_get(struct of_phandle_args *clkspec,
|
static struct clk_hw *qcom_smdrpm_clk_hw_get(struct of_phandle_args *clkspec,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct rpm_cc *rcc = data;
|
const struct rpm_smd_clk_desc *desc = data;
|
||||||
unsigned int idx = clkspec->args[0];
|
unsigned int idx = clkspec->args[0];
|
||||||
|
|
||||||
if (idx >= rcc->num_clks) {
|
if (idx >= desc->num_clks) {
|
||||||
pr_err("%s: invalid index %u\n", __func__, idx);
|
pr_err("%s: invalid index %u\n", __func__, idx);
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rcc->clks[idx] ? &rcc->clks[idx]->hw : ERR_PTR(-ENOENT);
|
return desc->clks[idx] ? &desc->clks[idx]->hw : ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rpm_smd_clk_probe(struct platform_device *pdev)
|
static int rpm_smd_clk_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct rpm_cc *rcc;
|
|
||||||
int ret;
|
int ret;
|
||||||
size_t num_clks, i;
|
size_t num_clks, i;
|
||||||
struct qcom_smd_rpm *rpm;
|
struct qcom_smd_rpm *rpm;
|
||||||
@ -1190,13 +1184,6 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
|
|||||||
rpm_smd_clks = desc->clks;
|
rpm_smd_clks = desc->clks;
|
||||||
num_clks = desc->num_clks;
|
num_clks = desc->num_clks;
|
||||||
|
|
||||||
rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc), GFP_KERNEL);
|
|
||||||
if (!rcc)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
rcc->clks = rpm_smd_clks;
|
|
||||||
rcc->num_clks = num_clks;
|
|
||||||
|
|
||||||
for (i = 0; i < num_clks; i++) {
|
for (i = 0; i < num_clks; i++) {
|
||||||
if (!rpm_smd_clks[i])
|
if (!rpm_smd_clks[i])
|
||||||
continue;
|
continue;
|
||||||
@ -1222,7 +1209,7 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = devm_of_clk_add_hw_provider(&pdev->dev, qcom_smdrpm_clk_hw_get,
|
ret = devm_of_clk_add_hw_provider(&pdev->dev, qcom_smdrpm_clk_hw_get,
|
||||||
rcc);
|
(void *)desc);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user