linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] s2mps11 clock driver refactoring
@ 2016-01-20 10:14 Andi Shyti
  2016-01-20 10:14 ` [PATCH v3 1/4] clk: s2mps11: merge two for loops in one Andi Shyti
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Andi Shyti @ 2016-01-20 10:14 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Sangbeom Kim, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd, linux-kernel, linux-clk, Andi Shyti, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

Hi,

This patchset contains some code refactoring on the s2mps11 clock
device driver. The main goal is to remove some dead code and
improve its readability.

At any iteration the patchset is getting a patch more, so that
this time there are four patches :)

Thanks to Krzysztof for his review, the changset is coming from
his suggestions:

V1 -> V2
 - the order of the patches has changed
 - the second patch has been added and it merges a for loop
   inside
   a previous one
 - the 3rd patch (which in the first version was the 1st)
   contains some more redundant variables removal.

V2 -> V3
 - The "merge two for loops in one" has been moved as first patch
 - removed the global variable clk_data

The patches have been applied on next-20160120 and tested on
Odroid Xu4.

Andi Shyti (4):
  clk: s2mps11: merge two for loops in one
  clk: s2mps11: allocate only one structure for clock init
  clk: s2mps11: remove redundant static variables declaration
  clk: s2mps11: remove redundant code

 drivers/clk/clk-s2mps11.c | 108 +++++++++++++---------------------------------
 1 file changed, 31 insertions(+), 77 deletions(-)

-- 
2.7.0.rc3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 1/4] clk: s2mps11: merge two for loops in one
  2016-01-20 10:14 [PATCH v3 0/4] s2mps11 clock driver refactoring Andi Shyti
@ 2016-01-20 10:14 ` Andi Shyti
  2016-01-21  0:20   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  2016-01-20 10:14 ` [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init Andi Shyti
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Andi Shyti @ 2016-01-20 10:14 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Sangbeom Kim, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd, linux-kernel, linux-clk, Andi Shyti, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

the driver already loops once, there is no reason to loop again
for a different purpose. Merge the second loop into the first.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/clk/clk-s2mps11.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index d266299..e7b97f4 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -244,12 +244,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 			ret = -ENOMEM;
 			goto err_reg;
 		}
-	}
-
-	for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
-		/* Skip clocks not present on S2MPS14 */
-		if (!clks_init[i].name)
-			continue;
 		clk_table[i] = s2mps11_clks[i].clk;
 	}
 
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init
  2016-01-20 10:14 [PATCH v3 0/4] s2mps11 clock driver refactoring Andi Shyti
  2016-01-20 10:14 ` [PATCH v3 1/4] clk: s2mps11: merge two for loops in one Andi Shyti
@ 2016-01-20 10:14 ` Andi Shyti
  2016-01-21  0:23   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  2016-01-20 10:14 ` [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration Andi Shyti
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Andi Shyti @ 2016-01-20 10:14 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Sangbeom Kim, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd, linux-kernel, linux-clk, Andi Shyti, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

The driver allocates three structures, s2mpsxx_clk_init, for
three different clock types (s2mps11, s2mps13 and s2mps14). They
are quite similar but they differ only by the name. Only one of
these structures is used, while the others lie unused in the
memory.

The clock's name, though, is not such a meaningful information
and by assigning the same name to the initial data we can avoid
over allocation. The common name chosen will be s2mps11,
coherently with the device driver name, instead of the clock
device.

Therefore, remove the structures associated to s2mps13 and
s2mps14 and use only the one referred to s2mps11 for all kind of
clocks.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/clk/clk-s2mps11.c | 51 +++++++----------------------------------------
 1 file changed, 7 insertions(+), 44 deletions(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index e7b97f4..3ff2162 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -99,6 +99,7 @@ static struct clk_ops s2mps11_clk_ops = {
 	.recalc_rate	= s2mps11_clk_recalc_rate,
 };
 
+/* This s2mps11_clks_init tructure is common to s2mps11, s2mps13 and s2mps14 */
 static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
 	[S2MPS11_CLK_AP] = {
 		.name = "s2mps11_ap",
@@ -117,37 +118,6 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
 	},
 };
 
-static struct clk_init_data s2mps13_clks_init[S2MPS11_CLKS_NUM] = {
-	[S2MPS11_CLK_AP] = {
-		.name = "s2mps13_ap",
-		.ops = &s2mps11_clk_ops,
-		.flags = CLK_IS_ROOT,
-	},
-	[S2MPS11_CLK_CP] = {
-		.name = "s2mps13_cp",
-		.ops = &s2mps11_clk_ops,
-		.flags = CLK_IS_ROOT,
-	},
-	[S2MPS11_CLK_BT] = {
-		.name = "s2mps13_bt",
-		.ops = &s2mps11_clk_ops,
-		.flags = CLK_IS_ROOT,
-	},
-};
-
-static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
-	[S2MPS11_CLK_AP] = {
-		.name = "s2mps14_ap",
-		.ops = &s2mps11_clk_ops,
-		.flags = CLK_IS_ROOT,
-	},
-	[S2MPS11_CLK_BT] = {
-		.name = "s2mps14_bt",
-		.ops = &s2mps11_clk_ops,
-		.flags = CLK_IS_ROOT,
-	},
-};
-
 static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
 		struct clk_init_data *clks_init)
 {
@@ -164,12 +134,9 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
 		return ERR_PTR(-EINVAL);
 	}
 
-	for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
-		if (!clks_init[i].name)
-			continue; /* Skip clocks not present in some devices */
+	for (i = 0; i < S2MPS11_CLKS_NUM; i++)
 		of_property_read_string_index(clk_np, "clock-output-names", i,
 				&clks_init[i].name);
-	}
 
 	return clk_np;
 }
@@ -179,8 +146,8 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
 	unsigned int s2mps11_reg;
-	struct clk_init_data *clks_init;
 	int i, ret = 0;
+	enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data;
 
 	s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
 				sizeof(*s2mps11_clk), GFP_KERNEL);
@@ -194,22 +161,18 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	if (!clk_table)
 		return -ENOMEM;
 
-	switch(platform_get_device_id(pdev)->driver_data) {
+	switch (hwid) {
 	case S2MPS11X:
 		s2mps11_reg = S2MPS11_REG_RTC_CTRL;
-		clks_init = s2mps11_clks_init;
 		break;
 	case S2MPS13X:
 		s2mps11_reg = S2MPS13_REG_RTCCTRL;
-		clks_init = s2mps13_clks_init;
 		break;
 	case S2MPS14X:
 		s2mps11_reg = S2MPS14_REG_RTCCTRL;
-		clks_init = s2mps14_clks_init;
 		break;
 	case S5M8767X:
 		s2mps11_reg = S5M8767_REG_CTRL1;
-		clks_init = s2mps11_clks_init;
 		break;
 	default:
 		dev_err(&pdev->dev, "Invalid device type\n");
@@ -217,15 +180,15 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	}
 
 	/* Store clocks of_node in first element of s2mps11_clks array */
-	s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, clks_init);
+	s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, s2mps11_clks_init);
 	if (IS_ERR(s2mps11_clks->clk_np))
 		return PTR_ERR(s2mps11_clks->clk_np);
 
 	for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) {
-		if (!clks_init[i].name)
+		if (i == S2MPS11_CLK_CP && hwid == S2MPS14X)
 			continue; /* Skip clocks not present in some devices */
 		s2mps11_clk->iodev = iodev;
-		s2mps11_clk->hw.init = &clks_init[i];
+		s2mps11_clk->hw.init = &s2mps11_clks_init[i];
 		s2mps11_clk->mask = 1 << i;
 		s2mps11_clk->reg = s2mps11_reg;
 
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration
  2016-01-20 10:14 [PATCH v3 0/4] s2mps11 clock driver refactoring Andi Shyti
  2016-01-20 10:14 ` [PATCH v3 1/4] clk: s2mps11: merge two for loops in one Andi Shyti
  2016-01-20 10:14 ` [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init Andi Shyti
@ 2016-01-20 10:14 ` Andi Shyti
  2016-01-21  0:29   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  2016-01-20 10:14 ` [PATCH v3 4/4] clk: s2mps11: remove redundant code Andi Shyti
  2016-01-21  0:18 ` [PATCH v3 0/4] s2mps11 clock driver refactoring Krzysztof Kozlowski
  4 siblings, 2 replies; 14+ messages in thread
From: Andi Shyti @ 2016-01-20 10:14 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Sangbeom Kim, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd, linux-kernel, linux-clk, Andi Shyti, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

The clk_table and clk_data are declared static. The clk_table
contains the three clock data stractures belonging to the s2mps11
driver. In the probe function it gets stored into clk_data.

Remove clk_table and refer directly to clk_data.

clk_data, itself, is also declared static. Declare locally it
and allocate it inside the probe function, as it is not used
anywhere else.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/clk/clk-s2mps11.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index 3ff2162..fac0e20 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -30,9 +30,6 @@
 
 #define s2mps11_name(a) (a->hw.init->name)
 
-static struct clk **clk_table;
-static struct clk_onecell_data clk_data;
-
 enum {
 	S2MPS11_CLK_AP = 0,
 	S2MPS11_CLK_CP,
@@ -145,6 +142,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 {
 	struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
 	struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
+	struct clk_onecell_data *clk_data;
 	unsigned int s2mps11_reg;
 	int i, ret = 0;
 	enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data;
@@ -156,9 +154,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 
 	s2mps11_clk = s2mps11_clks;
 
-	clk_table = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
+	clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL);
+	if (!clk_data)
+		return -ENOMEM;
+
+	clk_data->clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
 				sizeof(struct clk *), GFP_KERNEL);
-	if (!clk_table)
+	if (!clk_data->clks)
 		return -ENOMEM;
 
 	switch (hwid) {
@@ -207,13 +209,12 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 			ret = -ENOMEM;
 			goto err_reg;
 		}
-		clk_table[i] = s2mps11_clks[i].clk;
+		clk_data->clks[i] = s2mps11_clks[i].clk;
 	}
 
-	clk_data.clks = clk_table;
-	clk_data.clk_num = S2MPS11_CLKS_NUM;
+	clk_data->clk_num = S2MPS11_CLKS_NUM;
 	of_clk_add_provider(s2mps11_clks->clk_np, of_clk_src_onecell_get,
-			&clk_data);
+			clk_data);
 
 	platform_set_drvdata(pdev, s2mps11_clks);
 
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 4/4] clk: s2mps11: remove redundant code
  2016-01-20 10:14 [PATCH v3 0/4] s2mps11 clock driver refactoring Andi Shyti
                   ` (2 preceding siblings ...)
  2016-01-20 10:14 ` [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration Andi Shyti
@ 2016-01-20 10:14 ` Andi Shyti
  2016-01-21  0:29   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  2016-01-21  0:18 ` [PATCH v3 0/4] s2mps11 clock driver refactoring Krzysztof Kozlowski
  4 siblings, 2 replies; 14+ messages in thread
From: Andi Shyti @ 2016-01-20 10:14 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Sangbeom Kim, Krzysztof Kozlowski, Michael Turquette,
	Stephen Boyd, linux-kernel, linux-clk, Andi Shyti, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

The definition of s2mps11_name is meant to resolve the name of a
given clock. Remove it because the clocks have the same name we
can get it directly from the s2mps11_clks_init structure.

While in the probe function the s2mps11_clks is used only to
iterate through the s2mps11_clks. The naming itself brings
confusion and the readability does not improve much.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/clk/clk-s2mps11.c | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index fac0e20..371150a 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -28,8 +28,6 @@
 #include <linux/mfd/samsung/s5m8767.h>
 #include <linux/mfd/samsung/core.h>
 
-#define s2mps11_name(a) (a->hw.init->name)
-
 enum {
 	S2MPS11_CLK_AP = 0,
 	S2MPS11_CLK_CP,
@@ -141,19 +139,17 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
 static int s2mps11_clk_probe(struct platform_device *pdev)
 {
 	struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
-	struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
+	struct s2mps11_clk *s2mps11_clks;
 	struct clk_onecell_data *clk_data;
 	unsigned int s2mps11_reg;
 	int i, ret = 0;
 	enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data;
 
 	s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
-				sizeof(*s2mps11_clk), GFP_KERNEL);
+				sizeof(*s2mps11_clks), GFP_KERNEL);
 	if (!s2mps11_clks)
 		return -ENOMEM;
 
-	s2mps11_clk = s2mps11_clks;
-
 	clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL);
 	if (!clk_data)
 		return -ENOMEM;
@@ -186,26 +182,26 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	if (IS_ERR(s2mps11_clks->clk_np))
 		return PTR_ERR(s2mps11_clks->clk_np);
 
-	for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) {
+	for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
 		if (i == S2MPS11_CLK_CP && hwid == S2MPS14X)
 			continue; /* Skip clocks not present in some devices */
-		s2mps11_clk->iodev = iodev;
-		s2mps11_clk->hw.init = &s2mps11_clks_init[i];
-		s2mps11_clk->mask = 1 << i;
-		s2mps11_clk->reg = s2mps11_reg;
-
-		s2mps11_clk->clk = devm_clk_register(&pdev->dev,
-							&s2mps11_clk->hw);
-		if (IS_ERR(s2mps11_clk->clk)) {
+		s2mps11_clks[i].iodev = iodev;
+		s2mps11_clks[i].hw.init = &s2mps11_clks_init[i];
+		s2mps11_clks[i].mask = 1 << i;
+		s2mps11_clks[i].reg = s2mps11_reg;
+
+		s2mps11_clks[i].clk = devm_clk_register(&pdev->dev,
+							&s2mps11_clks[i].hw);
+		if (IS_ERR(s2mps11_clks[i].clk)) {
 			dev_err(&pdev->dev, "Fail to register : %s\n",
-						s2mps11_name(s2mps11_clk));
-			ret = PTR_ERR(s2mps11_clk->clk);
+						s2mps11_clks_init[i].name);
+			ret = PTR_ERR(s2mps11_clks[i].clk);
 			goto err_reg;
 		}
 
-		s2mps11_clk->lookup = clkdev_create(s2mps11_clk->clk,
-					s2mps11_name(s2mps11_clk), NULL);
-		if (!s2mps11_clk->lookup) {
+		s2mps11_clks[i].lookup = clkdev_create(s2mps11_clks[i].clk,
+					s2mps11_clks_init[i].name, NULL);
+		if (!s2mps11_clks[i].lookup) {
 			ret = -ENOMEM;
 			goto err_reg;
 		}
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 0/4] s2mps11 clock driver refactoring
  2016-01-20 10:14 [PATCH v3 0/4] s2mps11 clock driver refactoring Andi Shyti
                   ` (3 preceding siblings ...)
  2016-01-20 10:14 ` [PATCH v3 4/4] clk: s2mps11: remove redundant code Andi Shyti
@ 2016-01-21  0:18 ` Krzysztof Kozlowski
  4 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2016-01-21  0:18 UTC (permalink / raw)
  To: Andi Shyti, linux-samsung-soc
  Cc: Sangbeom Kim, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-clk, Andi Shyti, Yadwinder Singh Brar, Jaehoon Chung

On 20.01.2016 19:14, Andi Shyti wrote:
> Hi,
> 
> This patchset contains some code refactoring on the s2mps11 clock
> device driver. The main goal is to remove some dead code and
> improve its readability.
> 
> At any iteration the patchset is getting a patch more, so that
> this time there are four patches :)

Which means that if I have more comments now, you will send a v5 with 5
patches inside? Oh...

BR,
Krzysztof

> 
> Thanks to Krzysztof for his review, the changset is coming from
> his suggestions:
> 
> V1 -> V2
>  - the order of the patches has changed
>  - the second patch has been added and it merges a for loop
>    inside
>    a previous one
>  - the 3rd patch (which in the first version was the 1st)
>    contains some more redundant variables removal.
> 
> V2 -> V3
>  - The "merge two for loops in one" has been moved as first patch
>  - removed the global variable clk_data
> 
> The patches have been applied on next-20160120 and tested on
> Odroid Xu4.
> 
> Andi Shyti (4):
>   clk: s2mps11: merge two for loops in one
>   clk: s2mps11: allocate only one structure for clock init
>   clk: s2mps11: remove redundant static variables declaration
>   clk: s2mps11: remove redundant code
> 
>  drivers/clk/clk-s2mps11.c | 108 +++++++++++++---------------------------------
>  1 file changed, 31 insertions(+), 77 deletions(-)
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/4] clk: s2mps11: merge two for loops in one
  2016-01-20 10:14 ` [PATCH v3 1/4] clk: s2mps11: merge two for loops in one Andi Shyti
@ 2016-01-21  0:20   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2016-01-21  0:20 UTC (permalink / raw)
  To: Andi Shyti, linux-samsung-soc
  Cc: Sangbeom Kim, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-clk, Andi Shyti, Yadwinder Singh Brar, Jaehoon Chung

On 20.01.2016 19:14, Andi Shyti wrote:
> the driver already loops once, there is no reason to loop again

I pointed this at v2:
s/the/The/

Apart from that:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init
  2016-01-20 10:14 ` [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init Andi Shyti
@ 2016-01-21  0:23   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2016-01-21  0:23 UTC (permalink / raw)
  To: Andi Shyti, linux-samsung-soc
  Cc: Sangbeom Kim, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-clk, Andi Shyti, Yadwinder Singh Brar, Jaehoon Chung

On 20.01.2016 19:14, Andi Shyti wrote:
> The driver allocates three structures, s2mpsxx_clk_init, for
> three different clock types (s2mps11, s2mps13 and s2mps14). They
> are quite similar but they differ only by the name. Only one of
> these structures is used, while the others lie unused in the
> memory.
> 
> The clock's name, though, is not such a meaningful information
> and by assigning the same name to the initial data we can avoid
> over allocation. The common name chosen will be s2mps11,
> coherently with the device driver name, instead of the clock
> device.
> 
> Therefore, remove the structures associated to s2mps13 and
> s2mps14 and use only the one referred to s2mps11 for all kind of
> clocks.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
>  drivers/clk/clk-s2mps11.c | 51 +++++++----------------------------------------
>  1 file changed, 7 insertions(+), 44 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 4/4] clk: s2mps11: remove redundant code
  2016-01-20 10:14 ` [PATCH v3 4/4] clk: s2mps11: remove redundant code Andi Shyti
@ 2016-01-21  0:29   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2016-01-21  0:29 UTC (permalink / raw)
  To: Andi Shyti, linux-samsung-soc
  Cc: Sangbeom Kim, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-clk, Andi Shyti, Yadwinder Singh Brar, Jaehoon Chung

On 20.01.2016 19:14, Andi Shyti wrote:
> The definition of s2mps11_name is meant to resolve the name of a
> given clock. Remove it because the clocks have the same name we
> can get it directly from the s2mps11_clks_init structure.
> 
> While in the probe function the s2mps11_clks is used only to
> iterate through the s2mps11_clks. The naming itself brings
> confusion and the readability does not improve much.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  drivers/clk/clk-s2mps11.c | 36 ++++++++++++++++--------------------
>  1 file changed, 16 insertions(+), 20 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration
  2016-01-20 10:14 ` [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration Andi Shyti
@ 2016-01-21  0:29   ` Krzysztof Kozlowski
  2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2016-01-21  0:29 UTC (permalink / raw)
  To: Andi Shyti, linux-samsung-soc
  Cc: Sangbeom Kim, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-clk, Andi Shyti, Yadwinder Singh Brar, Jaehoon Chung

On 20.01.2016 19:14, Andi Shyti wrote:
> The clk_table and clk_data are declared static. The clk_table
> contains the three clock data stractures belonging to the s2mps11

s/stractures/structures/

Rest looks good:
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 1/4] clk: s2mps11: merge two for loops in one
  2016-01-20 10:14 ` [PATCH v3 1/4] clk: s2mps11: merge two for loops in one Andi Shyti
  2016-01-21  0:20   ` Krzysztof Kozlowski
@ 2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2016-01-30  0:34 UTC (permalink / raw)
  To: Andi Shyti
  Cc: linux-samsung-soc, Sangbeom Kim, Krzysztof Kozlowski,
	Michael Turquette, linux-kernel, linux-clk, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

On 01/20, Andi Shyti wrote:
> the driver already loops once, there is no reason to loop again
> for a different purpose. Merge the second loop into the first.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init
  2016-01-20 10:14 ` [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init Andi Shyti
  2016-01-21  0:23   ` Krzysztof Kozlowski
@ 2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2016-01-30  0:34 UTC (permalink / raw)
  To: Andi Shyti
  Cc: linux-samsung-soc, Sangbeom Kim, Krzysztof Kozlowski,
	Michael Turquette, linux-kernel, linux-clk, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

On 01/20, Andi Shyti wrote:
> The driver allocates three structures, s2mpsxx_clk_init, for
> three different clock types (s2mps11, s2mps13 and s2mps14). They
> are quite similar but they differ only by the name. Only one of
> these structures is used, while the others lie unused in the
> memory.
> 
> The clock's name, though, is not such a meaningful information
> and by assigning the same name to the initial data we can avoid
> over allocation. The common name chosen will be s2mps11,
> coherently with the device driver name, instead of the clock
> device.
> 
> Therefore, remove the structures associated to s2mps13 and
> s2mps14 and use only the one referred to s2mps11 for all kind of
> clocks.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration
  2016-01-20 10:14 ` [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration Andi Shyti
  2016-01-21  0:29   ` Krzysztof Kozlowski
@ 2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2016-01-30  0:34 UTC (permalink / raw)
  To: Andi Shyti
  Cc: linux-samsung-soc, Sangbeom Kim, Krzysztof Kozlowski,
	Michael Turquette, linux-kernel, linux-clk, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

On 01/20, Andi Shyti wrote:
> The clk_table and clk_data are declared static. The clk_table
> contains the three clock data stractures belonging to the s2mps11
> driver. In the probe function it gets stored into clk_data.
> 
> Remove clk_table and refer directly to clk_data.
> 
> clk_data, itself, is also declared static. Declare locally it
> and allocate it inside the probe function, as it is not used
> anywhere else.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 4/4] clk: s2mps11: remove redundant code
  2016-01-20 10:14 ` [PATCH v3 4/4] clk: s2mps11: remove redundant code Andi Shyti
  2016-01-21  0:29   ` Krzysztof Kozlowski
@ 2016-01-30  0:34   ` Stephen Boyd
  1 sibling, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2016-01-30  0:34 UTC (permalink / raw)
  To: Andi Shyti
  Cc: linux-samsung-soc, Sangbeom Kim, Krzysztof Kozlowski,
	Michael Turquette, linux-kernel, linux-clk, Andi Shyti,
	Yadwinder Singh Brar, Jaehoon Chung

On 01/20, Andi Shyti wrote:
> The definition of s2mps11_name is meant to resolve the name of a
> given clock. Remove it because the clocks have the same name we
> can get it directly from the s2mps11_clks_init structure.
> 
> While in the probe function the s2mps11_clks is used only to
> iterate through the s2mps11_clks. The naming itself brings
> confusion and the readability does not improve much.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-01-30  0:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 10:14 [PATCH v3 0/4] s2mps11 clock driver refactoring Andi Shyti
2016-01-20 10:14 ` [PATCH v3 1/4] clk: s2mps11: merge two for loops in one Andi Shyti
2016-01-21  0:20   ` Krzysztof Kozlowski
2016-01-30  0:34   ` Stephen Boyd
2016-01-20 10:14 ` [PATCH v3 2/4] clk: s2mps11: allocate only one structure for clock init Andi Shyti
2016-01-21  0:23   ` Krzysztof Kozlowski
2016-01-30  0:34   ` Stephen Boyd
2016-01-20 10:14 ` [PATCH v3 3/4] clk: s2mps11: remove redundant static variables declaration Andi Shyti
2016-01-21  0:29   ` Krzysztof Kozlowski
2016-01-30  0:34   ` Stephen Boyd
2016-01-20 10:14 ` [PATCH v3 4/4] clk: s2mps11: remove redundant code Andi Shyti
2016-01-21  0:29   ` Krzysztof Kozlowski
2016-01-30  0:34   ` Stephen Boyd
2016-01-21  0:18 ` [PATCH v3 0/4] s2mps11 clock driver refactoring Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).