lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6dc1e10e-9c40-4da3-b0e0-72bdc9daa827@xs4all.nl>
Date: Thu, 20 Feb 2025 11:31:50 +0100
From: Hans Verkuil <hverkuil@...all.nl>
To: Zijun Hu <zijun_hu@...oud.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Linus Walleij <linus.walleij@...aro.org>,
 Bartosz Golaszewski <brgl@...ev.pl>, Uwe Kleine-König
 <ukleinek@...nel.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, linux-usb@...r.kernel.org,
 linux-serial@...r.kernel.org, netdev@...r.kernel.org,
 Zijun Hu <quic_zijuhu@...cinc.com>,
 Alison Schofield <alison.schofield@...el.com>,
 Takashi Sakamoto <o-takashi@...amocchi.jp>
Subject: Re: [PATCH v5 04/12] driver core: Constify API device_find_child()
 and adapt for various usages

On 24/12/2024 14:05, 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.
> 
> BTW, various subsystem changes are squashed into this commit to meet
> 'git bisect' requirement, and this commit has the minimal and simplest
> changes to complement squashing shortcoming, and that may bring extra
> code improvement.
> 
> Reviewed-by: Alison Schofield <alison.schofield@...el.com>
> Reviewed-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
> Acked-by: Uwe Kleine-König <ukleinek@...nel.org> # for drivers/pwm
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>

<snip>

> diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c
> index bc63dc81bcae0d20924174be74b93a2139d5879f..697d50bedfe285d74c702efde61e510df87c1229 100644
> --- a/drivers/media/pci/mgb4/mgb4_core.c
> +++ b/drivers/media/pci/mgb4/mgb4_core.c
> @@ -123,7 +123,7 @@ static const struct hwmon_chip_info temp_chip_info = {
>  };
>  #endif
>  
> -static int match_i2c_adap(struct device *dev, void *data)
> +static int match_i2c_adap(struct device *dev, const void *data)
>  {
>  	return i2c_verify_adapter(dev) ? 1 : 0;
>  }
> @@ -139,7 +139,7 @@ static struct i2c_adapter *get_i2c_adap(struct platform_device *pdev)
>  	return dev ? to_i2c_adapter(dev) : NULL;
>  }
>  
> -static int match_spi_adap(struct device *dev, void *data)
> +static int match_spi_adap(struct device *dev, const void *data)
>  {
>  	return to_spi_device(dev) ? 1 : 0;
>  }

Reviewed-by: Hans Verkuil <hverkuil@...all.nl>

Regards,

	Hans

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ