diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/dt9812.c')
-rw-r--r-- | drivers/staging/comedi/drivers/dt9812.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index 6c60949d9193..b5e6f33dc217 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c @@ -39,10 +39,9 @@ for my needs. */ #include <linux/kernel.h> +#include <linux/module.h> #include <linux/errno.h> #include <linux/init.h> -#include <linux/slab.h> -#include <linux/module.h> #include <linux/uaccess.h> #include <linux/usb.h> @@ -188,8 +187,8 @@ enum { }; struct dt9812_flash_data { - u16 numbytes; - u16 address; + __le16 numbytes; + __le16 address; }; #define DT9812_MAX_NUM_MULTI_BYTE_RDS \ @@ -230,7 +229,7 @@ struct dt9812_rmw_multi { }; struct dt9812_usb_cmd { - u32 cmd; + __le32 cmd; union { struct dt9812_flash_data flash_data_info; struct dt9812_read_multi read_multi_info; @@ -707,8 +706,9 @@ static int dt9812_reset_device(struct comedi_device *dev) u32 serial; u16 vendor; u16 product; - u16 tmp16; u8 tmp8; + __le16 tmp16; + __le32 tmp32; int ret; int i; @@ -731,19 +731,19 @@ static int dt9812_reset_device(struct comedi_device *dev) } } - ret = dt9812_read_info(dev, 1, &vendor, sizeof(vendor)); + ret = dt9812_read_info(dev, 1, &tmp16, sizeof(tmp16)); if (ret) { dev_err(dev->class_dev, "failed to read vendor id\n"); return ret; } - vendor = le16_to_cpu(vendor); + vendor = le16_to_cpu(tmp16); - ret = dt9812_read_info(dev, 3, &product, sizeof(product)); + ret = dt9812_read_info(dev, 3, &tmp16, sizeof(tmp16)); if (ret) { dev_err(dev->class_dev, "failed to read product id\n"); return ret; } - product = le16_to_cpu(product); + product = le16_to_cpu(tmp16); ret = dt9812_read_info(dev, 5, &tmp16, sizeof(tmp16)); if (ret) { @@ -752,12 +752,12 @@ static int dt9812_reset_device(struct comedi_device *dev) } devpriv->device = le16_to_cpu(tmp16); - ret = dt9812_read_info(dev, 7, &serial, sizeof(serial)); + ret = dt9812_read_info(dev, 7, &tmp32, sizeof(tmp32)); if (ret) { dev_err(dev->class_dev, "failed to read serial number\n"); return ret; } - serial = le32_to_cpu(serial); + serial = le32_to_cpu(tmp32); /* let the user know what node this device is now attached to */ dev_info(dev->class_dev, "USB DT9812 (%4.4x.%4.4x.%4.4x) #0x%8.8x\n", @@ -781,10 +781,9 @@ static int dt9812_auto_attach(struct comedi_device *dev, bool is_unipolar; int ret; - devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL); + devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); if (!devpriv) return -ENOMEM; - dev->private = devpriv; sema_init(&devpriv->sem, 1); usb_set_intfdata(intf, devpriv); |