linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] regmap: Switch to use fwnode instead of OF one
@ 2020-07-08 16:12 Andy Shevchenko
  2020-07-08 16:21 ` Mark Brown
  2020-07-10 15:40 ` Mark Brown
  0 siblings, 2 replies; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-08 16:12 UTC (permalink / raw)
  To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Andy Shevchenko

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

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/regmap/regmap.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index aa4c8f5dc6e5..e93700af7e6e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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)
-- 
2.27.0


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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-08 16:12 [PATCH v1] regmap: Switch to use fwnode instead of OF one Andy Shevchenko
@ 2020-07-08 16:21 ` Mark Brown
  2020-07-10 10:05   ` Andy Shevchenko
  2020-07-10 15:40 ` Mark Brown
  1 sibling, 1 reply; 13+ messages in thread
From: Mark Brown @ 2020-07-08 16:21 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

On Wed, Jul 08, 2020 at 07:12:32PM +0300, Andy Shevchenko wrote:
> Make regmap firmware node type agnostic by switching it to use fwnode.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This is a duplicate of a patch already applied.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-08 16:21 ` Mark Brown
@ 2020-07-10 10:05   ` Andy Shevchenko
  2020-07-10 11:01     ` Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-10 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

On Wed, Jul 08, 2020 at 05:21:17PM +0100, Mark Brown wrote:
> On Wed, Jul 08, 2020 at 07:12:32PM +0300, Andy Shevchenko wrote:
> > Make regmap firmware node type agnostic by switching it to use fwnode.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> 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.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 10:05   ` Andy Shevchenko
@ 2020-07-10 11:01     ` Mark Brown
  2020-07-10 11:46       ` Andy Shevchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2020-07-10 11:01 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

On Fri, Jul 10, 2020 at 01:05:58PM +0300, Andy Shevchenko wrote:

> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 11:01     ` Mark Brown
@ 2020-07-10 11:46       ` Andy Shevchenko
  2020-07-10 12:08         ` Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-10 11:46 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

On Fri, Jul 10, 2020 at 12:01:32PM +0100, Mark Brown wrote:
> On Fri, Jul 10, 2020 at 01:05:58PM +0300, Andy Shevchenko wrote:
> 
> > 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).

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 11:46       ` Andy Shevchenko
@ 2020-07-10 12:08         ` Mark Brown
  2020-07-10 13:32           ` Mark Brown
  2020-07-10 14:11           ` Andy Shevchenko
  0 siblings, 2 replies; 13+ messages in thread
From: Mark Brown @ 2020-07-10 12:08 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

On Fri, Jul 10, 2020 at 02:46:22PM +0300, Andy Shevchenko wrote:

> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 12:08         ` Mark Brown
@ 2020-07-10 13:32           ` Mark Brown
  2020-07-10 14:13             ` Andy Shevchenko
  2020-07-10 14:11           ` Andy Shevchenko
  1 sibling, 1 reply; 13+ messages in thread
From: Mark Brown @ 2020-07-10 13:32 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

On Fri, Jul 10, 2020 at 01:08:56PM +0100, Mark Brown wrote:
> On Fri, Jul 10, 2020 at 02:46:22PM +0300, Andy Shevchenko wrote:

> > 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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 12:08         ` Mark Brown
  2020-07-10 13:32           ` Mark Brown
@ 2020-07-10 14:11           ` Andy Shevchenko
  1 sibling, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-10 14:11 UTC (permalink / raw)
  To: Mark Brown
  Cc: Andy Shevchenko, Linux Kernel Mailing List, Greg Kroah-Hartman,
	Rafael J. Wysocki

On Fri, Jul 10, 2020 at 3:11 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Jul 10, 2020 at 02:46:22PM +0300, Andy Shevchenko wrote:
>
> > 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?


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 13:32           ` Mark Brown
@ 2020-07-10 14:13             ` Andy Shevchenko
  2020-07-10 14:15               ` Andy Shevchenko
  2020-07-10 16:22               ` Mark Brown
  0 siblings, 2 replies; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-10 14:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: Andy Shevchenko, Linux Kernel Mailing List, Greg Kroah-Hartman,
	Rafael J. Wysocki

On Fri, Jul 10, 2020 at 4:36 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Jul 10, 2020 at 01:08:56PM +0100, Mark Brown wrote:
> > On Fri, Jul 10, 2020 at 02:46:22PM +0300, Andy Shevchenko wrote:
>
> > > 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.

Should I do anything to improve it?


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 14:13             ` Andy Shevchenko
@ 2020-07-10 14:15               ` Andy Shevchenko
  2020-07-10 14:35                 ` Andy Shevchenko
  2020-07-10 16:22               ` Mark Brown
  1 sibling, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-10 14:15 UTC (permalink / raw)
  To: Mark Brown
  Cc: Andy Shevchenko, Linux Kernel Mailing List, Greg Kroah-Hartman,
	Rafael J. Wysocki

On Fri, Jul 10, 2020 at 5:13 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Fri, Jul 10, 2020 at 4:36 PM Mark Brown <broonie@kernel.org> wrote:
> >
> > On Fri, Jul 10, 2020 at 01:08:56PM +0100, Mark Brown wrote:
> > > On Fri, Jul 10, 2020 at 02:46:22PM +0300, Andy Shevchenko wrote:
> >
> > > > 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.
>
> 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.


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 14:15               ` Andy Shevchenko
@ 2020-07-10 14:35                 ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2020-07-10 14:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linux Kernel Mailing List, Greg Kroah-Hartman, Rafael J. Wysocki

On Fri, Jul 10, 2020 at 05:15:27PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 10, 2020 at 5:13 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> > On Fri, Jul 10, 2020 at 4:36 PM Mark Brown <broonie@kernel.org> wrote:
> > >
> > > On Fri, Jul 10, 2020 at 01:08:56PM +0100, Mark Brown wrote:
> > > > On Fri, Jul 10, 2020 at 02:46:22PM +0300, Andy Shevchenko wrote:
> > >
> > > > > 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.
> >
> > 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.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-08 16:12 [PATCH v1] regmap: Switch to use fwnode instead of OF one Andy Shevchenko
  2020-07-08 16:21 ` Mark Brown
@ 2020-07-10 15:40 ` Mark Brown
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Brown @ 2020-07-10 15:40 UTC (permalink / raw)
  To: linux-kernel, Andy Shevchenko, Rafael J. Wysocki, Greg Kroah-Hartman

On Wed, 8 Jul 2020 19:12:32 +0300, Andy Shevchenko wrote:
> 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

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

* Re: [PATCH v1] regmap: Switch to use fwnode instead of OF one
  2020-07-10 14:13             ` Andy Shevchenko
  2020-07-10 14:15               ` Andy Shevchenko
@ 2020-07-10 16:22               ` Mark Brown
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Brown @ 2020-07-10 16:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Linux Kernel Mailing List, Greg Kroah-Hartman,
	Rafael J. Wysocki

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

On Fri, Jul 10, 2020 at 05:13:06PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 10, 2020 at 4:36 PM Mark Brown <broonie@kernel.org> wrote:

> > 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-07-10 16:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08 16:12 [PATCH v1] regmap: Switch to use fwnode instead of OF one Andy Shevchenko
2020-07-08 16:21 ` Mark Brown
2020-07-10 10:05   ` Andy Shevchenko
2020-07-10 11:01     ` Mark Brown
2020-07-10 11:46       ` Andy Shevchenko
2020-07-10 12:08         ` Mark Brown
2020-07-10 13:32           ` Mark Brown
2020-07-10 14:13             ` Andy Shevchenko
2020-07-10 14:15               ` Andy Shevchenko
2020-07-10 14:35                 ` Andy Shevchenko
2020-07-10 16:22               ` Mark Brown
2020-07-10 14:11           ` Andy Shevchenko
2020-07-10 15:40 ` Mark Brown

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).