Commit 7764d0cd authored by Vaibhav Hiremath's avatar Vaibhav Hiremath Committed by Stephen Boyd

clk: s2mps11: Use kcalloc instead of kzalloc for array allocation

This patch cleans up the driver for,

  - Use devm_kcalloc() variant instead of devm_kzalloc() for array
    allocation.
  - clk_prepare()/unprepare(), remove "ret" variable as it is not required
  - use __exit for cleanup function

As I am referring this driver as a reference for my 88pm800 clk driver,
applying same changes here as well.
Signed-off-by: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: default avatarAnand Moon <linux.amoon@gmail.com>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent a57aa185
...@@ -58,21 +58,17 @@ static struct s2mps11_clk *to_s2mps11_clk(struct clk_hw *hw) ...@@ -58,21 +58,17 @@ static struct s2mps11_clk *to_s2mps11_clk(struct clk_hw *hw)
static int s2mps11_clk_prepare(struct clk_hw *hw) static int s2mps11_clk_prepare(struct clk_hw *hw)
{ {
struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
int ret;
ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, return regmap_update_bits(s2mps11->iodev->regmap_pmic,
s2mps11->reg, s2mps11->reg,
s2mps11->mask, s2mps11->mask); s2mps11->mask, s2mps11->mask);
return ret;
} }
static void s2mps11_clk_unprepare(struct clk_hw *hw) static void s2mps11_clk_unprepare(struct clk_hw *hw)
{ {
struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
int ret;
ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg,
s2mps11->mask, ~s2mps11->mask); s2mps11->mask, ~s2mps11->mask);
} }
...@@ -186,15 +182,15 @@ static int s2mps11_clk_probe(struct platform_device *pdev) ...@@ -186,15 +182,15 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
struct clk_init_data *clks_init; struct clk_init_data *clks_init;
int i, ret = 0; int i, ret = 0;
s2mps11_clks = devm_kzalloc(&pdev->dev, sizeof(*s2mps11_clk) * s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
S2MPS11_CLKS_NUM, GFP_KERNEL); sizeof(*s2mps11_clk), GFP_KERNEL);
if (!s2mps11_clks) if (!s2mps11_clks)
return -ENOMEM; return -ENOMEM;
s2mps11_clk = s2mps11_clks; s2mps11_clk = s2mps11_clks;
clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) * clk_table = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
S2MPS11_CLKS_NUM, GFP_KERNEL); sizeof(struct clk *), GFP_KERNEL);
if (!clk_table) if (!clk_table)
return -ENOMEM; return -ENOMEM;
...@@ -316,7 +312,7 @@ static int __init s2mps11_clk_init(void) ...@@ -316,7 +312,7 @@ static int __init s2mps11_clk_init(void)
} }
subsys_initcall(s2mps11_clk_init); subsys_initcall(s2mps11_clk_init);
static void __init s2mps11_clk_cleanup(void) static void __exit s2mps11_clk_cleanup(void)
{ {
platform_driver_unregister(&s2mps11_clk_driver); platform_driver_unregister(&s2mps11_clk_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment