]> Pileus Git - ~andy/linux/blobdiff - drivers/staging/comedi/drivers/usbduxsigma.c
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
[~andy/linux] / drivers / staging / comedi / drivers / usbduxsigma.c
index a5363ded3668329f60353b0462487195e842ff8f..88c60b6020c48b971682f2d31700dd549ecdd1af 100644 (file)
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/usb.h>
 #include <linux/fcntl.h>
 #include <linux/compiler.h>
+#include <asm/unaligned.h>
 
 #include "comedi_fc.h"
 #include "../comedidev.h"
@@ -793,7 +793,8 @@ static int usbduxsigma_ai_insn_read(struct comedi_device *dev,
                }
 
                /* 32 bits big endian from the A/D converter */
-               val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf) + 1)));
+               val = be32_to_cpu(get_unaligned((uint32_t
+                                                *)(devpriv->insn_buf + 1)));
                val &= 0x00ffffff;      /* strip status byte */
                val ^= 0x00800000;      /* convert to unsigned */
 
@@ -1358,7 +1359,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device *dev, int chan)
                return ret;
 
        /* 32 bits big endian from the A/D converter */
-       val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf)+1)));
+       val = be32_to_cpu(get_unaligned((uint32_t *)(devpriv->insn_buf + 1)));
        val &= 0x00ffffff;      /* strip status byte */
        val ^= 0x00800000;      /* convert to unsigned */
 
@@ -1656,11 +1657,13 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev,
        }
 
        offset = usbduxsigma_getstatusinfo(dev, 0);
-       if (offset < 0)
+       if (offset < 0) {
                dev_err(dev->class_dev,
-                       "Communication to USBDUXSIGMA failed! Check firmware and cabling\n");
+                       "Communication to USBDUXSIGMA failed! Check firmware and cabling.\n");
+               return offset;
+       }
 
-       dev_info(dev->class_dev, "attached, ADC_zero = %x\n", offset);
+       dev_info(dev->class_dev, "ADC_zero = %x\n", offset);
 
        return 0;
 }