Skip to contentSkip to conversation

clk: cdce9xx: Convert .of_xlate to .request

PATCH Superseded Sean Anderson 3 participants 7 messages Dec 1, 2021 – Dec 15, 2021 Common clk

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 clk: cdce9xx: Convert .of_xlate to .request

This xlate function just performs some checking. We can do this in request() instead and use the default xlate.

---

 drivers/clk/clk-cdce9xx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/clk/clk-cdce9xx.c +3 -9
index 6634b7b799..c15e9f210e 100644
@@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
 	return ret;
 }
 
-static int cdce9xx_clk_of_xlate(struct clk *clk,
-				struct ofnode_phandle_args *args)
+static int cdce9xx_clk_of_request(struct clk *clk)
 {
 	struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
 
-	if (args->args_count != 1)
+	if (clk->id > data->chip->num_outputs)
 		return -EINVAL;
 
-	if (args->args[0] > data->chip->num_outputs)
-		return -EINVAL;
-
-	clk->id = args->args[0];
-
 	return 0;
 }
 
@@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
 };
 
 static const struct clk_ops cdce9xx_clk_ops = {
-	.of_xlate = cdce9xx_clk_of_xlate,
+	.request = cdce9xx_clk_request,
 	.get_rate = cdce9xx_clk_get_rate,
 	.set_rate = cdce9xx_clk_set_rate,
 };
Signature · 1 line
2.33.0
#1 lore raw

PATCH 2/2 clk: cdce9xxx: Add maintainer

This adds an entry in MAINTAINERS for the cdce9xx driver, since it was not added when the driver was submitted.

---
Tero, if you don't want to maintain this I'll resubmit this patch with the orphaned status. Alternatively, perhaps Tom wants to maintain this driver since it is used exclusively by boards he maintains.

 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 6db5354322..2946a96c04 100644
@@ -658,6 +658,12 @@ M:	Simon Glass <[email protected]>
 S:	Maintained
 F:	tools/buildman/
 
+CDCE9XX CLOCK:
+M:	Tero Kristo <[email protected]>
+S:	Maintained
+F:	doc/device-tree-bindings/clock/ti,cdce9xx.txt
+F:	drivers/clk/clk-cdce9xx.c
+
 CFI FLASH
 M:	Stefan Roese <[email protected]>
 S:	Maintained
Signature · 1 line
2.33.0
#2 lore raw

Re: [PATCH 2/2] clk: cdce9xxx: Add maintainer

Quoted 8 lines · Sean Anderson

This adds an entry in MAINTAINERS for the cdce9xx driver, since it was not added when the driver was submitted.

---
Tero, if you don't want to maintain this I'll resubmit this patch with the orphaned status. Alternatively, perhaps Tom wants to maintain this driver since it is used exclusively by boards he maintains.

Well, it looks like Tero's email bounced, so it will have to be either Tom or orphaned.

--Sean

#3 lore raw
In reply to Sean Anderson
Quoted 36 lines · Sean Anderson

This xlate function just performs some checking. We can do this in request() instead and use the default xlate.

---

 drivers/clk/clk-cdce9xx.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/clk/clk-cdce9xx.c +2 -8
index 6634b7b799..c15e9f210e 100644
@@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
 	return ret;
 }
 
-static int cdce9xx_clk_of_xlate(struct clk *clk,
-				struct ofnode_phandle_args *args)
+static int cdce9xx_clk_of_request(struct clk *clk)
 {
 	struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
 
-	if (args->args_count != 1)
+	if (clk->id > data->chip->num_outputs)
 		return -EINVAL;
 
-	if (args->args[0] > data->chip->num_outputs)
-		return -EINVAL;
-
-	clk->id = args->args[0];
-
 	return 0;
 }
 

drivers/clk/clk-cdce9xx.c static const struct udevice_id cdce9xx_clk_of_match[] = { · line 241

Quoted 8 lines
drivers/clk/clk-cdce9xx.c +1 -1
@@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
 };
 
 static const struct clk_ops cdce9xx_clk_ops = {
-	.of_xlate = cdce9xx_clk_of_xlate,
+	.request = cdce9xx_clk_request,
 	.get_rate = cdce9xx_clk_get_rate,
 	.set_rate = cdce9xx_clk_set_rate,
 };

Adding Tero...

Signature · 1 line
Tom
#4 lore raw
Quoted 40 lines · Tom Rini
Quoted 38 lines · Sean Anderson

This xlate function just performs some checking. We can do this in request() instead and use the default xlate.

---

  drivers/clk/clk-cdce9xx.c | 12 +++---------
  1 file changed, 3 insertions(+), 9 deletions(-)
drivers/clk/clk-cdce9xx.c +2 -8
index 6634b7b799..c15e9f210e 100644
@@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
  	return ret;
  }
 
-static int cdce9xx_clk_of_xlate(struct clk *clk,
-				struct ofnode_phandle_args *args)
+static int cdce9xx_clk_of_request(struct clk *clk)
  {
  	struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
 
-	if (args->args_count != 1)
+	if (clk->id > data->chip->num_outputs)
  		return -EINVAL;
 
-	if (args->args[0] > data->chip->num_outputs)
-		return -EINVAL;
-
-	clk->id = args->args[0];
-
  	return 0;
  }
 
@@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
  };
 
Quoted 9 lines

drivers/clk/clk-cdce9xx.c static const struct udevice_id cdce9xx_clk_of_match[] = { · line 241

Quoted 6 lines
drivers/clk/clk-cdce9xx.c +1 -1
  static const struct clk_ops cdce9xx_clk_ops = {
-	.of_xlate = cdce9xx_clk_of_xlate,
+	.request = cdce9xx_clk_request,
  	.get_rate = cdce9xx_clk_get_rate,
  	.set_rate = cdce9xx_clk_set_rate,
  };

Adding Tero...

Thanks. Perhaps .mailmap should be updated?

--Sean

#5 lore raw
Quoted 7 lines · Sean Anderson
Quoted 6 lines · Tom Rini
Quoted 4 lines · Sean Anderson

This xlate function just performs some checking. We can do this in request() instead and use the default xlate.

Hi Sean,

Did you compile this? I see...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

---

  drivers/clk/clk-cdce9xx.c | 12 +++---------

  1 file changed, 3 insertions(+), 9 deletions(-)
Quoted 11 lines
Quoted 11 lines

drivers/clk/clk-cdce9xx.c static int cdce9xx_reg_write(struct udevice *dev, · line 89

Quoted 11 lines
drivers/clk/clk-cdce9xx.c +1 -2
index 6634b7b799..c15e9f210e 100644
@@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, 
 u8 addr, u8 val)
       return ret;
   }
-static int cdce9xx_clk_of_xlate(struct clk *clk,
-                struct ofnode_phandle_args *args)
+static int cdce9xx_clk_of_request(struct clk *clk)

cdce9xx_clk_of_request here...

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/clk/clk-cdce9xx.c +1 -6
   {
       struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
-    if (args->args_count != 1)
+    if (clk->id > data->chip->num_outputs)
           return -EINVAL;
-    if (args->args[0] > data->chip->num_outputs)
-        return -EINVAL;
-
-    clk->id = args->args[0];
-
Quoted 8 lines
Quoted 8 lines

drivers/clk/clk-cdce9xx.c static const struct udevice_id · line 238

Quoted 8 lines
drivers/clk/clk-cdce9xx.c +1 -1
       return 0;
   }
@@ -241,7 +235,7 @@ static const struct udevice_id 
 cdce9xx_clk_of_match[] = {
   };
   static const struct clk_ops cdce9xx_clk_ops = {
-    .of_xlate = cdce9xx_clk_of_xlate,
+    .request = cdce9xx_clk_request,

but cdce9xx_clk_request here.

Other than that, looks fine to me.

-Tero

Quoted 10 lines
Quoted 6 lines

drivers/clk/clk-cdce9xx.c static const struct udevice_id cdce9xx_clk_of_match[] = { · line 241

Quoted 3 lines
drivers/clk/clk-cdce9xx.c +0 -0
       .get_rate = cdce9xx_clk_get_rate,
       .set_rate = cdce9xx_clk_set_rate,
   };

Adding Tero...

Thanks. Perhaps .mailmap should be updated?

--Sean

#6 lore raw
Quoted 51 lines · Tero Kristo
Quoted 7 lines · Sean Anderson
Quoted 6 lines · Tom Rini
Quoted 4 lines · Sean Anderson

This xlate function just performs some checking. We can do this in request() instead and use the default xlate.

Hi Sean,

Did you compile this? I see...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

---

  drivers/clk/clk-cdce9xx.c | 12 +++---------

  1 file changed, 3 insertions(+), 9 deletions(-)
Quoted 10 lines
Quoted 10 lines

drivers/clk/clk-cdce9xx.c static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val) · line 88

Quoted 10 lines
drivers/clk/clk-cdce9xx.c +1 -2
index 6634b7b799..c15e9f210e 100644
@@ -86,19 +86,13 @@ static int cdce9xx_reg_write(struct udevice *dev, u8 addr, u8 val)
       return ret;
   }
-static int cdce9xx_clk_of_xlate(struct clk *clk,
-                struct ofnode_phandle_args *args)
+static int cdce9xx_clk_of_request(struct clk *clk)

cdce9xx_clk_of_request here...

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/clk/clk-cdce9xx.c +1 -5
   {
       struct cdce9xx_clk_data *data = dev_get_priv(clk->dev);
-    if (args->args_count != 1)
+    if (clk->id > data->chip->num_outputs)
           return -EINVAL;
-    if (args->args[0] > data->chip->num_outputs)
-        return -EINVAL;
-
-    clk->id = args->args[0];
Quoted 8 lines
Quoted 8 lines

drivers/clk/clk-cdce9xx.c static const struct udevice_id cdce9xx_clk_of_match[] = { · line 237

Quoted 8 lines
drivers/clk/clk-cdce9xx.c +1 -2
-
       return 0;
   }
@@ -241,7 +235,7 @@ static const struct udevice_id cdce9xx_clk_of_match[] = {
   };
   static const struct clk_ops cdce9xx_clk_ops = {
-    .of_xlate = cdce9xx_clk_of_xlate,
+    .request = cdce9xx_clk_request,

but cdce9xx_clk_request here.

Quoted 1 line

Other than that, looks fine to me.

Oops. Thanks for catching that.

Resubmitted after compile-testing :)

--Sean