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: <2025020518-outcome-harbor-6281@gregkh>
Date: Wed, 5 Feb 2025 06:53:09 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Lyude Paul <lyude@...hat.com>
Cc: linux-kernel@...r.kernel.org, "Rafael J. Wysocki" <rafael@...nel.org>,
	Danilo Krummrich <dakr@...nel.org>,
	Alexander Lobakin <aleksander.lobakin@...el.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Liam Girdwood <lgirdwood@...il.com>, Lukas Wunner <lukas@...ner.de>,
	Mark Brown <broonie@...nel.org>,
	MaĆ­ra Canal <mairacanal@...eup.net>,
	Robin Murphy <robin.murphy@....com>,
	Simona Vetter <simona.vetter@...ll.ch>,
	Zijun Hu <quic_zijuhu@...cinc.com>, linux-usb@...r.kernel.org,
	rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 1/5] driver core: add a faux bus for use when a simple
 device/bus is needed

On Tue, Feb 04, 2025 at 06:10:36PM -0500, Lyude Paul wrote:
> OK I definitely should have waited to write the actual bindings before review
> - sorry! There was one other small thing I ended up noticing:
> 
> On Tue, 2025-02-04 at 12:09 +0100, Greg Kroah-Hartman wrote:
> > diff --git a/include/linux/device/faux.h b/include/linux/device/faux.h
> > new file mode 100644
> > index 000000000000..2c8ae5bd7ae8
> > --- /dev/null
> > +++ b/include/linux/device/faux.h
> > @@ -0,0 +1,31 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/*
> > + * Copyright (c) 2025 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > + * Copyright (c) 2025 The Linux Foundation
> > + *
> > + * A "simple" faux bus that allows devices to be created and added
> > + * automatically to it.  This is to be used whenever you need to create a
> > + * device that is not associated with any "real" system resources, and do
> > + * not want to have to deal with a bus/driver binding logic.  It is
> > + * intended to be very simple, with only a create and a destroy function
> > + * available.
> > + */
> > +#ifndef _FAUX_DEVICE_H_
> > +#define _FAUX_DEVICE_H_
> > +
> > +#include <linux/device.h>
> > +
> > +struct faux_device {
> > +	struct device dev;
> > +};
> > +#define to_faux_device(x) container_of_const((x), struct faux_device, dev)
> > +
> > +struct faux_driver_ops {
> > +	int (*probe)(struct faux_device *faux_dev);
> > +	void (*remove)(struct faux_device *faux_dev);
> > +};
> > +
> > +struct faux_device *faux_device_create(const char *name, struct faux_driver_ops *faux_ops);
> > +void faux_device_destroy(struct faux_device *faux_dev);
> 
> Should we add faux_get_drvdata()/faux_set_drvdata() since we've got a
> probe/remove function? Doesn't really look like the platform driver equivalent
> does mcuh, but I assume just having an inline function for this would make
> things a little less confusing for users.

You already have a reference counted object returned to you, why do you
need to increment/decrement it again?  All of the users I've found in
the kernel so far didn't need that, do you have a specific example where
it would be useful?

I'll be glad to add it, I just didn't think anyone would ever call it.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ