Skip to content

Commit 5c57b1c

Browse files
ian-abbottgregkh
authored andcommitted
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: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20230913170712.111719-7-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0ccb86a commit 5c57b1c

24 files changed

+92
-100
lines changed

drivers/comedi/drivers/8255.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int dev_8255_attach(struct comedi_device *dev,
8080
if (ret) {
8181
s->type = COMEDI_SUBD_UNUSED;
8282
} else {
83-
ret = subdev_8255_init(dev, s, NULL, iobase);
83+
ret = subdev_8255_io_init(dev, s, iobase);
8484
if (ret) {
8585
/*
8686
* Release the I/O port region here, as the

drivers/comedi/drivers/8255_pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
242242
for (i = 0; i < board->n_8255; i++) {
243243
s = &dev->subdevices[i];
244244
if (dev->mmio)
245-
ret = subdev_8255_mm_init(dev, s, NULL, i * I8255_SIZE);
245+
ret = subdev_8255_mm_init(dev, s, i * I8255_SIZE);
246246
else
247-
ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
247+
ret = subdev_8255_io_init(dev, s, i * I8255_SIZE);
248248
if (ret)
249249
return ret;
250250
}

drivers/comedi/drivers/adv_pci_dio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
642642

643643
for (j = 0; j < d->chans; j++) {
644644
s = &dev->subdevices[subdev++];
645-
ret = subdev_8255_init(dev, s, NULL,
646-
d->addr + j * I8255_SIZE);
645+
ret = subdev_8255_io_init(dev, s,
646+
d->addr + j * I8255_SIZE);
647647
if (ret)
648648
return ret;
649649
}

drivers/comedi/drivers/aio_aio12_8.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
247247

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

drivers/comedi/drivers/amplc_pc236_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ int amplc_pc236_common_attach(struct comedi_device *dev, unsigned long iobase,
147147

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

drivers/comedi/drivers/amplc_pci230.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ static int pci230_auto_attach(struct comedi_device *dev,
25292529
s = &dev->subdevices[2];
25302530
/* digital i/o subdevice */
25312531
if (board->have_dio) {
2532-
rc = subdev_8255_init(dev, s, NULL, PCI230_PPI_X_BASE);
2532+
rc = subdev_8255_io_init(dev, s, PCI230_PPI_X_BASE);
25332533
if (rc)
25342534
return rc;
25352535
} else {

drivers/comedi/drivers/cb_pcidas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
13521352

13531353
/* 8255 */
13541354
s = &dev->subdevices[2];
1355-
ret = subdev_8255_init(dev, s, NULL, PCIDAS_8255_BASE);
1355+
ret = subdev_8255_io_init(dev, s, PCIDAS_8255_BASE);
13561356
if (ret)
13571357
return ret;
13581358

drivers/comedi/drivers/cb_pcidas64.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,11 +3877,10 @@ static int setup_subdevices(struct comedi_device *dev)
38773877
s = &dev->subdevices[4];
38783878
if (board->has_8255) {
38793879
if (board->layout == LAYOUT_4020) {
3880-
ret = subdev_8255_init(dev, s, dio_callback_4020,
3881-
I8255_4020_REG);
3880+
ret = subdev_8255_cb_init(dev, s, dio_callback_4020,
3881+
I8255_4020_REG);
38823882
} else {
3883-
ret = subdev_8255_mm_init(dev, s, NULL,
3884-
DIO_8255_OFFSET);
3883+
ret = subdev_8255_mm_init(dev, s, DIO_8255_OFFSET);
38853884
}
38863885
if (ret)
38873886
return ret;

drivers/comedi/drivers/cb_pcidda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,
365365
/* two 8255 digital io subdevices */
366366
for (i = 0; i < 2; i++) {
367367
s = &dev->subdevices[1 + i];
368-
ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
368+
ret = subdev_8255_io_init(dev, s, i * I8255_SIZE);
369369
if (ret)
370370
return ret;
371371
}

drivers/comedi/drivers/cb_pcimdas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
405405

406406
/* Digital I/O subdevice */
407407
s = &dev->subdevices[2];
408-
ret = subdev_8255_init(dev, s, NULL, PCIMDAS_8255_BASE);
408+
ret = subdev_8255_io_init(dev, s, PCIMDAS_8255_BASE);
409409
if (ret)
410410
return ret;
411411

0 commit comments

Comments
 (0)