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] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025020311-elderly-struck-1d26@gregkh>
Date: Mon, 3 Feb 2025 11:02:27 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Lyude Paul <lyude@...hat.com>, rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	MaĆ­ra Canal <mairacanal@...eup.net>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Zijun Hu <quic_zijuhu@...cinc.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Robin Murphy <robin.murphy@....com>,
	Alexander Lobakin <aleksander.lobakin@...el.com>,
	Lukas Wunner <lukas@...ner.de>, Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [RFC] driver core: add a virtual bus for use when a simple
 device/bus is needed

On Mon, Feb 03, 2025 at 10:39:58AM +0100, Greg Kroah-Hartman wrote:
> --- a/drivers/regulator/dummy.c
> +++ b/drivers/regulator/dummy.c
> @@ -13,7 +13,7 @@
>  
>  #include <linux/err.h>
>  #include <linux/export.h>
> -#include <linux/platform_device.h>
> +#include <linux/device/virtual.h>
>  #include <linux/regulator/driver.h>
>  #include <linux/regulator/machine.h>
>  
> @@ -37,15 +37,15 @@ static const struct regulator_desc dummy_desc = {
>  	.ops = &dummy_ops,
>  };
>  
> -static int dummy_regulator_probe(struct platform_device *pdev)
> +static int dummy_regulator_probe(struct virtual_device *vdev)
>  {
>  	struct regulator_config config = { };
>  	int ret;
>  
> -	config.dev = &pdev->dev;
> +	config.dev = &vdev->dev;
>  	config.init_data = &dummy_initdata;
>  
> -	dummy_regulator_rdev = devm_regulator_register(&pdev->dev, &dummy_desc,
> +	dummy_regulator_rdev = devm_regulator_register(&vdev->dev, &dummy_desc,
>  						       &config);
>  	if (IS_ERR(dummy_regulator_rdev)) {
>  		ret = PTR_ERR(dummy_regulator_rdev);
> @@ -56,36 +56,17 @@ static int dummy_regulator_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static struct platform_driver dummy_regulator_driver = {
> +struct virtual_driver_ops dummy_regulator_driver = {
>  	.probe		= dummy_regulator_probe,
> -	.driver		= {
> -		.name		= "reg-dummy",
> -		.probe_type	= PROBE_PREFER_ASYNCHRONOUS,
> -	},
>  };
>  
> -static struct platform_device *dummy_pdev;
> +static struct virtual_device *dummy_vdev;
>  
>  void __init regulator_dummy_init(void)
>  {
> -	int ret;
> -
> -	dummy_pdev = platform_device_alloc("reg-dummy", -1);
> -	if (!dummy_pdev) {
> +	dummy_vdev = virtual_device_create(&dummy_regulator_driver, "reg-dummy");
> +	if (!dummy_vdev) {

I originally was thinking that many platform_device_alloc() calls could
be replaced with this, but in looking further, I think we can get rid of
almost all calls to platform_device_register_simple() with this api
instead, including most of the use of that in the drm tree where all
that is being used is the device structure and not the platform one at
all.

I'll dig into that later today...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ