Commit 5c57b1cc authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

comedi: comedi_8255: Rework subdevice initialization functions



Comedi drivers can initialize an 8255 subdevice in I/O space by calling
`subdev_8255_init()`, or in memory-mapped I/O space by calling
`subdev_8255_mm_init()`, or by supplying a call-back function pointer
and context to either of those functions.  Change it so that a new
function `subdev_8255_cb_init()` shall be called instead when supplying
a callback function and context, and remove the call-back function
parameter from `subdev_8255_init()` and `subdev_8255_mm_init()`.

Also rename `subdev_8255_init()` to `subdev_8255_io_init()`.  The
parameters are changing, so might as well rename it at the same time.

Also rename the `regbase` member of `struct subdev_8255_private` to
`context` since this holds the context for the call-back function call.

Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20230913170712.111719-7-abbotti@mev.co.uk


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ccb86a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ static int dev_8255_attach(struct comedi_device *dev,
		if (ret) {
			s->type = COMEDI_SUBD_UNUSED;
		} else {
			ret = subdev_8255_init(dev, s, NULL, iobase);
			ret = subdev_8255_io_init(dev, s, iobase);
			if (ret) {
				/*
				 * Release the I/O port region here, as the
+2 −2
Original line number Diff line number Diff line
@@ -242,9 +242,9 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
	for (i = 0; i < board->n_8255; i++) {
		s = &dev->subdevices[i];
		if (dev->mmio)
			ret = subdev_8255_mm_init(dev, s, NULL, i * I8255_SIZE);
			ret = subdev_8255_mm_init(dev, s, i * I8255_SIZE);
		else
			ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
			ret = subdev_8255_io_init(dev, s, i * I8255_SIZE);
		if (ret)
			return ret;
	}
+2 −2
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev,

		for (j = 0; j < d->chans; j++) {
			s = &dev->subdevices[subdev++];
			ret = subdev_8255_init(dev, s, NULL,
			ret = subdev_8255_io_init(dev, s,
						  d->addr + j * I8255_SIZE);
			if (ret)
				return ret;
+1 −1
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,

	/* Digital I/O subdevice (8255) */
	s = &dev->subdevices[2];
	ret = subdev_8255_init(dev, s, NULL, AIO12_8_8255_BASE_REG);
	ret = subdev_8255_io_init(dev, s, AIO12_8_8255_BASE_REG);
	if (ret)
		return ret;

+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ int amplc_pc236_common_attach(struct comedi_device *dev, unsigned long iobase,

	s = &dev->subdevices[0];
	/* digital i/o subdevice (8255) */
	ret = subdev_8255_init(dev, s, NULL, 0x00);
	ret = subdev_8255_io_init(dev, s, 0x00);
	if (ret)
		return ret;

Loading