enum vmk80xx_model model;
};
-static int vmk80xx_check_data_link(struct vmk80xx_private *devpriv)
+static int vmk80xx_check_data_link(struct comedi_device *dev)
{
+ struct vmk80xx_private *devpriv = dev->private;
struct usb_device *usb = devpriv->usb;
unsigned int tx_pipe;
unsigned int rx_pipe;
return (int)rx[1];
}
-static void vmk80xx_read_eeprom(struct vmk80xx_private *devpriv, int flag)
+static void vmk80xx_read_eeprom(struct comedi_device *dev, int flag)
{
+ struct vmk80xx_private *devpriv = dev->private;
struct usb_device *usb = devpriv->usb;
unsigned int tx_pipe;
unsigned int rx_pipe;
strncpy(devpriv->fw.ic6_vers, rx + 25, 24);
}
-static void vmk80xx_do_bulk_msg(struct vmk80xx_private *devpriv)
+static void vmk80xx_do_bulk_msg(struct comedi_device *dev)
{
+ struct vmk80xx_private *devpriv = dev->private;
struct usb_device *usb = devpriv->usb;
__u8 tx_addr;
__u8 rx_addr;
usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, size, NULL, HZ * 10);
}
-static int vmk80xx_read_packet(struct vmk80xx_private *devpriv)
+static int vmk80xx_read_packet(struct comedi_device *dev)
{
+ struct vmk80xx_private *devpriv = dev->private;
struct usb_device *usb;
struct usb_endpoint_descriptor *ep;
unsigned int pipe;
return -ENODEV;
if (devpriv->model == VMK8061_MODEL) {
- vmk80xx_do_bulk_msg(devpriv);
+ vmk80xx_do_bulk_msg(dev);
return 0;
}
HZ * 10);
}
-static int vmk80xx_write_packet(struct vmk80xx_private *devpriv, int cmd)
+static int vmk80xx_write_packet(struct comedi_device *dev, int cmd)
{
+ struct vmk80xx_private *devpriv = dev->private;
struct usb_device *usb;
struct usb_endpoint_descriptor *ep;
unsigned int pipe;
devpriv->usb_tx_buf[0] = cmd;
if (devpriv->model == VMK8061_MODEL) {
- vmk80xx_do_bulk_msg(devpriv);
+ vmk80xx_do_bulk_msg(dev);
return 0;
}
HZ * 10);
}
-static int vmk80xx_reset_device(struct vmk80xx_private *devpriv)
+static int vmk80xx_reset_device(struct comedi_device *dev)
{
+ struct vmk80xx_private *devpriv = dev->private;
size_t size;
int retval;
size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
memset(devpriv->usb_tx_buf, 0, size);
- retval = vmk80xx_write_packet(devpriv, VMK8055_CMD_RST);
+ retval = vmk80xx_write_packet(dev, VMK8055_CMD_RST);
if (retval)
return retval;
/* set outputs to known state as we cannot read them */
- return vmk80xx_write_packet(devpriv, VMK8055_CMD_WRT_AD);
+ return vmk80xx_write_packet(dev, VMK8055_CMD_WRT_AD);
}
static int vmk80xx_ai_insn_read(struct comedi_device *dev,
}
for (n = 0; n < insn->n; n++) {
- if (vmk80xx_read_packet(devpriv))
+ if (vmk80xx_read_packet(dev))
break;
if (devpriv->model == VMK8055_MODEL) {
for (n = 0; n < insn->n; n++) {
devpriv->usb_tx_buf[reg] = data[n];
- if (vmk80xx_write_packet(devpriv, cmd))
+ if (vmk80xx_write_packet(dev, cmd))
break;
}
devpriv->usb_tx_buf[0] = VMK8061_CMD_RD_AO;
for (n = 0; n < insn->n; n++) {
- if (vmk80xx_read_packet(devpriv))
+ if (vmk80xx_read_packet(dev))
break;
data[n] = devpriv->usb_rx_buf[reg + chan];
reg = VMK8055_DI_REG;
}
- retval = vmk80xx_read_packet(devpriv);
+ retval = vmk80xx_read_packet(dev);
if (!retval) {
if (devpriv->model == VMK8055_MODEL)
tx_buf[reg] &= ~data[0];
tx_buf[reg] |= (data[0] & data[1]);
- retval = vmk80xx_write_packet(devpriv, cmd);
+ retval = vmk80xx_write_packet(dev, cmd);
if (retval)
goto out;
if (devpriv->model == VMK8061_MODEL) {
tx_buf[0] = VMK8061_CMD_RD_DO;
- retval = vmk80xx_read_packet(devpriv);
+ retval = vmk80xx_read_packet(dev);
if (!retval) {
data[1] = rx_buf[reg];
}
for (n = 0; n < insn->n; n++) {
- if (vmk80xx_read_packet(devpriv))
+ if (vmk80xx_read_packet(dev))
break;
if (devpriv->model == VMK8055_MODEL)
}
for (n = 0; n < insn->n; n++)
- if (vmk80xx_write_packet(devpriv, cmd))
+ if (vmk80xx_write_packet(dev, cmd))
break;
up(&devpriv->limit_sem);
devpriv->usb_tx_buf[6 + chan] = val;
- if (vmk80xx_write_packet(devpriv, cmd))
+ if (vmk80xx_write_packet(dev, cmd))
break;
}
tx_buf[0] = VMK8061_CMD_RD_PWM;
for (n = 0; n < insn->n; n++) {
- if (vmk80xx_read_packet(devpriv))
+ if (vmk80xx_read_packet(dev))
break;
data[n] = rx_buf[reg[0]] + 4 * rx_buf[reg[1]];
tx_buf[reg[0]] = (unsigned char)(data[n] & 0x03);
tx_buf[reg[1]] = (unsigned char)(data[n] >> 2) & 0xff;
- if (vmk80xx_write_packet(devpriv, cmd))
+ if (vmk80xx_write_packet(dev, cmd))
break;
}
usb_set_intfdata(intf, devpriv);
if (devpriv->model == VMK8061_MODEL) {
- vmk80xx_read_eeprom(devpriv, IC3_VERSION);
+ vmk80xx_read_eeprom(dev, IC3_VERSION);
dev_info(&intf->dev, "%s\n", devpriv->fw.ic3_vers);
- if (vmk80xx_check_data_link(devpriv)) {
- vmk80xx_read_eeprom(devpriv, IC6_VERSION);
+ if (vmk80xx_check_data_link(dev)) {
+ vmk80xx_read_eeprom(dev, IC6_VERSION);
dev_info(&intf->dev, "%s\n", devpriv->fw.ic6_vers);
}
}
if (devpriv->model == VMK8055_MODEL)
- vmk80xx_reset_device(devpriv);
+ vmk80xx_reset_device(dev);
return vmk80xx_init_subdevices(dev);
}