[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ylfj462lf6g3ej6d2cmsxadawsmajogbimi7cl4pjemb7df4h@snr73pd7vaid>
Date: Fri, 6 Dec 2024 08:21:01 +0100
From: Uwe Kleine-König <ukleinek@...nel.org>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
James Bottomley <James.Bottomley@...senpartnership.com>, Thomas Weißschuh <thomas@...ch.de>,
linux-kernel@...r.kernel.org, nvdimm@...ts.linux.dev, linux-sound@...r.kernel.org,
sparclinux@...r.kernel.org, linux-block@...r.kernel.org, linux-cxl@...r.kernel.org,
linux1394-devel@...ts.sourceforge.net, arm-scmi@...r.kernel.org, linux-efi@...r.kernel.org,
linux-gpio@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-mediatek@...ts.infradead.org, linux-hwmon@...r.kernel.org, linux-media@...r.kernel.org,
linux-pwm@...r.kernel.org, linux-remoteproc@...r.kernel.org, linux-scsi@...r.kernel.org,
open-iscsi@...glegroups.com, linux-usb@...r.kernel.org, linux-serial@...r.kernel.org,
netdev@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v3 04/11] driver core: Constify API device_find_child()
then adapt for various usages
Hello,
On Thu, Dec 05, 2024 at 08:10:13AM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
>
> Constify the following API:
> struct device *device_find_child(struct device *dev, void *data,
> int (*match)(struct device *dev, void *data));
> To :
> struct device *device_find_child(struct device *dev, const void *data,
> device_match_t match);
> typedef int (*device_match_t)(struct device *dev, const void *data);
> with the following reasons:
>
> - Protect caller's match data @*data which is for comparison and lookup
> and the API does not actually need to modify @*data.
>
> - Make the API's parameters (@match)() and @data have the same type as
> all of other device finding APIs (bus|class|driver)_find_device().
>
> - All kinds of existing device match functions can be directly taken
> as the API's argument, they were exported by driver core.
>
> Constify the API and adapt for various existing usages by simply making
> various match functions take 'const void *' as type of match data @data.
With the discussion that a new name would ease the conversion, maybe
consider device_find_child_device() to also align the name (somewhat) to
the above mentioned (bus|class|driver)_find_device()?
Do you have a merge plan already? I guess this patch will go through
Greg's driver core tree?
Best regards
Uwe
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists