Skip to contentSkip to conversation

regmap: Switch to use fwnode instead of OF one

PATCH In review Andy Shevchenko 3 participants 13 messages Jul 8, 2020 – Jul 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: Switch to use fwnode instead of OF one

Make regmap firmware node type agnostic by switching it to use fwnode.

---
 drivers/base/regmap/regmap.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)
drivers/base/regmap/regmap.c +13 -18
index aa4c8f5dc6e5..e93700af7e6e 100644
@@ -11,7 +11,7 @@
 #include <linux/export.h>
 #include <linux/mutex.h>
 #include <linux/err.h>
-#include <linux/of.h>
+#include <linux/property.h>
 #include <linux/rbtree.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
@@ -631,7 +631,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
 					 const struct regmap_bus *bus,
 					 const struct regmap_config *config)
 {
-	struct device_node *np;
+	struct fwnode_handle *fwnode = dev ? dev_fwnode(dev) : NULL;
 	enum regmap_endian endian;
 
 	/* Retrieve the endianness specification from the regmap config */
@@ -641,22 +641,17 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
 	if (endian != REGMAP_ENDIAN_DEFAULT)
 		return endian;
 
-	/* If the dev and dev->of_node exist try to get endianness from DT */
-	if (dev && dev->of_node) {
-		np = dev->of_node;
-
-		/* Parse the device's DT node for an endianness specification */
-		if (of_property_read_bool(np, "big-endian"))
-			endian = REGMAP_ENDIAN_BIG;
-		else if (of_property_read_bool(np, "little-endian"))
-			endian = REGMAP_ENDIAN_LITTLE;
-		else if (of_property_read_bool(np, "native-endian"))
-			endian = REGMAP_ENDIAN_NATIVE;
-
-		/* If the endianness was specified in DT, use that */
-		if (endian != REGMAP_ENDIAN_DEFAULT)
-			return endian;
-	}
+	/* If the firmware node exist try to get endianness from it */
+	if (fwnode_property_read_bool(fwnode, "big-endian"))
+		endian = REGMAP_ENDIAN_BIG;
+	else if (fwnode_property_read_bool(fwnode, "little-endian"))
+		endian = REGMAP_ENDIAN_LITTLE;
+	else if (fwnode_property_read_bool(fwnode, "native-endian"))
+		endian = REGMAP_ENDIAN_NATIVE;
+
+	/* If the endianness was specified in fwnode, use that */
+	if (endian != REGMAP_ENDIAN_DEFAULT)
+		return endian;
 
 	/* Retrieve the endianness specification from the bus config */
 	if (bus && bus->val_format_endian_default)
Signature · 1 line
2.27.0
#2 lore raw
Quoted 6 lines · Mark Brown
Quoted 3 lines · Andy Shevchenko

Make regmap firmware node type agnostic by switching it to use fwnode.

This is a duplicate of a patch already applied.

Hmm... Can you point out to where is it? I have rebased my branches on top of Linux Next daily and my patch still valid.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#3 lore raw
Quoted 2 lines · Andy Shevchenko

Hmm... Can you point out to where is it? I have rebased my branches on top of Linux Next daily and my patch still valid.

It's in the regmap tree, -next only gets built once per day so you might not see something in there for two days.

#4 lore raw
Quoted 7 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko

Hmm... Can you point out to where is it? I have rebased my branches on top of Linux Next daily and my patch still valid.

It's in the regmap tree, -next only gets built once per day so you might not see something in there for two days.

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#5 lore raw
Quoted 2 lines · Andy Shevchenko

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

5cc2013bfeee756a1ee6da9bfbe42e52b4695035

maintainer
#6 lore raw
Quoted 6 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

5cc2013bfeee756a1ee6da9bfbe42e52b4695035

Oh, I see your patch covered a different bit of code without covering the stuff in regmap-irq (which I'd just handled when your patch came in) for some reason so the changelog made it sound like the same code, and at the time you submitted it the patch was incomplete.

#7 lore raw
Quoted 7 lines · Mark Brown
Quoted 4 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

Quoted 6 lines
Quoted 1 line

5cc2013bfeee756a1ee6da9bfbe42e52b4695035

Oh, I see your patch covered a different bit of code without covering the stuff in regmap-irq (which I'd just handled when your patch came in) for some reason so the changelog made it sound like the same code, and at the time you submitted it the patch was incomplete.

Should I do anything to improve it?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Mark Brown
Quoted 4 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

5cc2013bfeee756a1ee6da9bfbe42e52b4695035

Oh, I see your patch covered a different bit of code without covering the stuff in regmap-irq (which I'd just handled when your patch came in) for some reason so the changelog made it sound like the same code, and at the time you submitted it the patch was incomplete.

Should I do anything to improve it?

Actually I think we can completely get rid of fwnode by switching to device properties.
I'll send v2 soon.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw
Quoted 18 lines · Andy Shevchenko
Quoted 16 lines · Andy Shevchenko
Quoted 13 lines · Mark Brown
Quoted 6 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

5cc2013bfeee756a1ee6da9bfbe42e52b4695035

Oh, I see your patch covered a different bit of code without covering the stuff in regmap-irq (which I'd just handled when your patch came in) for some reason so the changelog made it sound like the same code, and at the time you submitted it the patch was incomplete.

Quoted 5 lines
Quoted 1 line

Should I do anything to improve it?

Actually I think we can completely get rid of fwnode by switching to device properties.
I'll send v2 soon.

Oops, I have looked into this and see that either way we would need an additional conditional and fwnode approach looks better. So, if you agree with v1, please apply.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#10 lore raw
In reply to Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
Quoted 4 lines · Mark Brown

Oh, I see your patch covered a different bit of code without covering the stuff in regmap-irq (which I'd just handled when your patch came in) for some reason so the changelog made it sound like the same code, and at the time you submitted it the patch was incomplete.

Should I do anything to improve it?

Ideally the changelog should have been more clear that it was a partial conversion (and which bits of the code it was covering), that'd have made it more obvious that it was covering more/different stuff to the other patch.

#11 lore raw
In reply to Mark Brown
Quoted 7 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko

You mean it's being synchronised with git.kernel.org, but not yet contains that patch? Okay, I will monitor the regmap tree (as of now I didn't see any update).

5cc2013bfeee756a1ee6da9bfbe42e52b4695035

And how is it the same as the proposed patch?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#12 lore raw
In reply to Andy Shevchenko
Quoted 1 line · Andy Shevchenko

Make regmap firmware node type agnostic by switching it to use fwnode.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: Switch to use fwnode instead of OF one

      commit: c916d6ef53aa6cf0187d33dfab51a2917d4117b7

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark