[RESEND,30/37] nvmem: core: fix nvmem_layout_get_match_data()

Message ID 20230206102759.669838-31-srinivas.kandagatla@linaro.org
State New
Headers
Series nvmem: patches for 6.3 |

Commit Message

Srinivas Kandagatla Feb. 6, 2023, 10:27 a.m. UTC
  From: Rafał Miłecki <rafal@milecki.pl>

This function was trying to match wrong OF node (parent device's)
against an of_match_table. It was always returning NULL.

Make it match layout's OF node against layout's of_match_table.

Note: __maybe_unused is needed to avoid:
warning: variable 'layout_np' set but not used [-Wunused-but-set-variable]
(of_match_node() is no-op without CONFIG_OF).

Fixes: 61a093b4a0e0 ("nvmem: core: introduce NVMEM layouts")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/nvmem/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Greg KH Feb. 6, 2023, 12:04 p.m. UTC | #1
On Mon, Feb 06, 2023 at 10:27:52AM +0000, Srinivas Kandagatla wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This function was trying to match wrong OF node (parent device's)
> against an of_match_table. It was always returning NULL.
> 
> Make it match layout's OF node against layout's of_match_table.
> 
> Note: __maybe_unused is needed to avoid:
> warning: variable 'layout_np' set but not used [-Wunused-but-set-variable]
> (of_match_node() is no-op without CONFIG_OF).
> 
> Fixes: 61a093b4a0e0 ("nvmem: core: introduce NVMEM layouts")

Nit, how can you have a git commit id if you are sending me patches to
be applied to my tree?

That's never going to work, sorry.

greg k-h
  
Srinivas Kandagatla Feb. 6, 2023, 12:08 p.m. UTC | #2
On 06/02/2023 12:04, Greg KH wrote:
> On Mon, Feb 06, 2023 at 10:27:52AM +0000, Srinivas Kandagatla wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> This function was trying to match wrong OF node (parent device's)
>> against an of_match_table. It was always returning NULL.
>>
>> Make it match layout's OF node against layout's of_match_table.
>>
>> Note: __maybe_unused is needed to avoid:
>> warning: variable 'layout_np' set but not used [-Wunused-but-set-variable]
>> (of_match_node() is no-op without CONFIG_OF).
>>
>> Fixes: 61a093b4a0e0 ("nvmem: core: introduce NVMEM layouts")
> 
> Nit, how can you have a git commit id if you are sending me patches to
> be applied to my tree?
> 
How should I deal with this situation?
I apply patches to nvmem-next tree and developers fix issues on top of it.
On the other hand I send patches as list to you to go via char-misc, so 
the fixes tag is really not relevant to char-misc.

Should I drop those fixes tag before sending it out?

thanks,
Srini


> That's never going to work, sorry.
> 
> greg k-h
  
Rafał Miłecki Feb. 6, 2023, 12:09 p.m. UTC | #3
On 2023-02-06 13:04, Greg KH wrote:
> On Mon, Feb 06, 2023 at 10:27:52AM +0000, Srinivas Kandagatla wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>> 
>> This function was trying to match wrong OF node (parent device's)
>> against an of_match_table. It was always returning NULL.
>> 
>> Make it match layout's OF node against layout's of_match_table.
>> 
>> Note: __maybe_unused is needed to avoid:
>> warning: variable 'layout_np' set but not used 
>> [-Wunused-but-set-variable]
>> (of_match_node() is no-op without CONFIG_OF).
>> 
>> Fixes: 61a093b4a0e0 ("nvmem: core: introduce NVMEM layouts")
> 
> Nit, how can you have a git commit id if you are sending me patches to
> be applied to my tree?
> 
> That's never going to work, sorry.

That was commit I found in the:
https://git.kernel.org/pub/scm/linux/kernel/git/srini/nvmem.git/log/?h=for-next

With Srinivas sending patches and not merge request, it doesn't make
sense obviously.

Srinivas could you rebase your branch making my patch a fixup for the
commit 61a093b4a0e0?
  
Greg KH Feb. 6, 2023, 12:39 p.m. UTC | #4
On Mon, Feb 06, 2023 at 12:08:09PM +0000, Srinivas Kandagatla wrote:
> 
> 
> On 06/02/2023 12:04, Greg KH wrote:
> > On Mon, Feb 06, 2023 at 10:27:52AM +0000, Srinivas Kandagatla wrote:
> > > From: Rafał Miłecki <rafal@milecki.pl>
> > > 
> > > This function was trying to match wrong OF node (parent device's)
> > > against an of_match_table. It was always returning NULL.
> > > 
> > > Make it match layout's OF node against layout's of_match_table.
> > > 
> > > Note: __maybe_unused is needed to avoid:
> > > warning: variable 'layout_np' set but not used [-Wunused-but-set-variable]
> > > (of_match_node() is no-op without CONFIG_OF).
> > > 
> > > Fixes: 61a093b4a0e0 ("nvmem: core: introduce NVMEM layouts")
> > 
> > Nit, how can you have a git commit id if you are sending me patches to
> > be applied to my tree?
> > 
> How should I deal with this situation?
> I apply patches to nvmem-next tree and developers fix issues on top of it.
> On the other hand I send patches as list to you to go via char-misc, so the
> fixes tag is really not relevant to char-misc.
> 
> Should I drop those fixes tag before sending it out?

Probably as the git commit id makes no sense anymore.

thanks,

greg k-h
  

Patch

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 30057b0094a2..38a5728bc65c 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -824,9 +824,11 @@  EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container);
 const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem,
 					struct nvmem_layout *layout)
 {
+	struct device_node __maybe_unused *layout_np;
 	const struct of_device_id *match;
 
-	match = of_match_node(layout->of_match_table, nvmem->dev.of_node);
+	layout_np = of_nvmem_layout_get_container(nvmem);
+	match = of_match_node(layout->of_match_table, layout_np);
 
 	return match ? match->data : NULL;
 }