On Tuesday, March 19, 2013 6:09 PM, H Hartley Sweeten wrote:
>
> The subdev_8255_init() function can fail. Check for failure and
> return the errno.
>
> Consolidate the mmio/ioport calls to subdev_8255_init(). The callback
> function can be added with a simple ? : test and the cast of the iobase
> is not necessary.
>
> Signed-off-by: H Hartley Sweeten <[email protected]>
> Cc: Ian Abbott <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/staging/comedi/drivers/ni_labpc.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/ni_labpc.c
> b/drivers/staging/comedi/drivers/ni_labpc.c
> index 3173557..926ebc6 100644
> --- a/drivers/staging/comedi/drivers/ni_labpc.c
> +++ b/drivers/staging/comedi/drivers/ni_labpc.c
> @@ -1290,8 +1290,7 @@ static int labpc_ao_insn_read(struct comedi_device *dev,
> return 1;
> }
>
> -static int labpc_dio_mem_callback(int dir, int port, int data,
> - unsigned long iobase)
> +static int labpc_8255_mmio(int dir, int port, int data, unsigned long iobase)
> {
> if (dir) {
> writeb(data, (void __iomem *)(iobase + port));
> @@ -1652,10 +1651,11 @@ int labpc_common_attach(struct comedi_device *dev,
> /* 8255 dio */
> s = &dev->subdevices[subdev++];
> if (thisboard->has_mmio)
Gah... I just noticed I left this line in.
I'll fix this, and address any comments, then post a v2 tomorrow.
Regards,
Hartley
> - subdev_8255_init(dev, s, labpc_dio_mem_callback,
> - (unsigned long)(dev->iobase + DIO_BASE_REG));
> - else
> - subdev_8255_init(dev, s, NULL, dev->iobase + DIO_BASE_REG);
> + ret = subdev_8255_init(dev, s,
> + (thisboard->has_mmio) ? labpc_8255_mmio : NULL,
> + dev->iobase + DIO_BASE_REG);
> + if (ret)
> + return ret;
>
> if (thisboard->register_layout == labpc_1200_layout) {
> /* calibration subdevice */
> --
> 1.8.1.4
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel