Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34b68400 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: drivers: set dev->board_name before attaching



The comedi (*attach) and (*auto_attach) functions are used to attach
legacy and PnP type devices to the comedi subsystem. If we can set the
dev->board_name before doing the attach, the drivers will not have to
worry about doing it.

Drivers that do additional probing can still change the dev->board_name
if necessary.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6013a9a5
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -383,6 +383,8 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	/* initialize dev->driver here so
	/* initialize dev->driver here so
	 * comedi_error() can be called from attach */
	 * comedi_error() can be called from attach */
	dev->driver = driv;
	dev->driver = driv;
	dev->board_name = dev->board_ptr ? *(const char **)dev->board_ptr
					 : dev->driver->driver_name;
	ret = driv->attach(dev, it);
	ret = driv->attach(dev, it);
	if (ret >= 0)
	if (ret >= 0)
		ret = comedi_device_postconfig(dev);
		ret = comedi_device_postconfig(dev);
@@ -423,6 +425,7 @@ int comedi_auto_config(struct device *hardware_device,
	/* Note: comedi_alloc_board_minor() locked dev->mutex. */
	/* Note: comedi_alloc_board_minor() locked dev->mutex. */


	dev->driver = driver;
	dev->driver = driver;
	dev->board_name = dev->driver->driver_name;
	ret = driver->auto_attach(dev, context);
	ret = driver->auto_attach(dev, context);
	if (ret >= 0)
	if (ret >= 0)
		ret = comedi_device_postconfig(dev);
		ret = comedi_device_postconfig(dev);