lkml.org 
[lkml]   [2022]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 03/10] base: swnode: use fwnode_get_match_data()
Le Mon, 21 Feb 2022 19:48:00 +0200,
Andy Shevchenko <andriy.shevchenko@linux.intel.com> a écrit :

> On Mon, Feb 21, 2022 at 05:26:45PM +0100, Clément Léger wrote:
> > In order to allow matching devices with software node with
> > device_get_match_data(), use fwnode_get_match_data() for
> > .device_get_match_data operation.
>
> ...
>
> > + .device_get_match_data = fwnode_get_match_data,
>
> Huh? It should be other way around, no?
> I mean that each of the resource providers may (or may not) provide a
> method for the specific fwnode abstraction.
>

Indeed, it should be the other way. But since this function is generic
and uses only fwnode API I guessed it would be more convenient to
define it in the fwnode generic part and use it for specific
implementation. I could have modified device_get_match_data to call it
if there was no .device_get_match_data operation like this:

const void *device_get_match_data(struct device *dev)
{
if (!fwnode_has_op(fwnode, device_get_match_data)
return fwnode_get_match_data(dev);
return fwnode_call_ptr_op(dev_fwnode(dev),device_get_match_data, dev);
}

But I thought it was more convenient to do it by setting the
.device_get_match_data field of software_node operations.

--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

\
 
 \ /
  Last update: 2022-02-22 09:44    [W:0.178 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site