}
};
-/*
- * Useful for shorthand access to the particular board structure
- */
-#define thisboard ((const struct board_struct *)dev->board_ptr)
-
/*
* this structure is for data unique to this hardware driver. If
* several hardware drivers keep similar information in this structure,
};
-/*
- * most drivers define the following macro to make it easy to
- * access the private structure.
- */
-#define devpriv ((struct board_private_struct *)dev->private)
-
static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
*/
static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
+ const struct board_struct *thisboard;
+ struct board_private_struct *devpriv;
struct comedi_subdevice *s;
int err;
-/*
- * Allocate the private structure area. alloc_private() is a
- * convenient macro defined in comedidev.h.
- * if this function fails (returns negative) then the private area is
- * kfree'd by comedi
- */
- if (alloc_private(dev, sizeof(struct board_private_struct)) < 0)
- return -ENOMEM;
+ err = alloc_private(dev, sizeof(*devpriv));
+ if (err)
+ return err;
+ devpriv = dev->private;
/*
* If you can probe the device to determine what device in a series
err = probe(dev, it);
if (err)
return err;
+ thisboard = comedi_board(dev);
/* Output some info */
printk("comedi%d: %s: ", dev->minor, thisboard->name);
static void detach(struct comedi_device *dev)
{
+ struct board_private_struct *devpriv = dev->private;
+
if (devpriv) {
if (dev->subdevices && devpriv->attached_to_8255) {
subdev_8255_cleanup(dev, dev->subdevices + 2);
static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct board_private_struct *devpriv = dev->private;
int i;
int chan = CR_CHAN(insn->chanspec);
unsigned long offset = devpriv->registers + chan * 2;
static int ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct board_private_struct *devpriv = dev->private;
int i;
int chan = CR_CHAN(insn->chanspec);
*/
static int probe(struct comedi_device *dev, const struct comedi_devconfig *it)
{
+ const struct board_struct *thisboard;
+ struct board_private_struct *devpriv = dev->private;
struct pci_dev *pcidev = NULL;
int index;
unsigned long registers;
devpriv->pci_dev = pcidev;
dev->board_ptr = boards + index;
+ thisboard = comedi_board(dev);
if (comedi_pci_enable(pcidev, thisboard->name)) {
printk
("cb_pcimdda: Failed to enable PCI device and request regions\n");