Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c1eb385 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: adq12b: remove devpriv macro



This macro relies on a local variable having a specific name.

Also, remove the kfree in the detach. The comedi core handles
the kfree of dev->private.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 22d4b56f
Loading
Loading
Loading
Loading
+11 −12
Original line number Original line Diff line number Diff line
@@ -133,8 +133,6 @@ struct adq12b_private {
	unsigned int digital_state;
	unsigned int digital_state;
};
};


#define devpriv ((struct adq12b_private *)dev->private)

/*
/*
 * "instructions" read/write data in "one-shot" or "software-triggered"
 * "instructions" read/write data in "one-shot" or "software-triggered"
 * mode.
 * mode.
@@ -144,6 +142,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev,
			   struct comedi_subdevice *s, struct comedi_insn *insn,
			   struct comedi_subdevice *s, struct comedi_insn *insn,
			   unsigned int *data)
			   unsigned int *data)
{
{
	struct adq12b_private *devpriv = dev->private;
	int n, i;
	int n, i;
	int range, channel;
	int range, channel;
	unsigned char hi, lo, status;
	unsigned char hi, lo, status;
@@ -200,6 +199,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev,
			       struct comedi_subdevice *s,
			       struct comedi_subdevice *s,
			       struct comedi_insn *insn, unsigned int *data)
			       struct comedi_insn *insn, unsigned int *data)
{
{
	struct adq12b_private *devpriv = dev->private;
	int channel;
	int channel;


	for (channel = 0; channel < 8; channel++)
	for (channel = 0; channel < 8; channel++)
@@ -221,6 +221,7 @@ static int adq12b_do_insn_bits(struct comedi_device *dev,
static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
{
	const struct adq12b_board *board = comedi_board(dev);
	const struct adq12b_board *board = comedi_board(dev);
	struct adq12b_private *devpriv;
	struct comedi_subdevice *s;
	struct comedi_subdevice *s;
	unsigned long iobase;
	unsigned long iobase;
	int unipolar, differential;
	int unipolar, differential;
@@ -252,19 +253,18 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)


	dev->board_name = board->name;
	dev->board_name = board->name;


/*
	ret = alloc_private(dev, sizeof(*devpriv));
 * Allocate the private structure area.  alloc_private() is a
	if (ret)
 * convenient macro defined in comedidev.h.
		return ret;
 */
	devpriv = dev->private;
	if (alloc_private(dev, sizeof(struct adq12b_private)) < 0)
		return -ENOMEM;


/* fill in devpriv structure */
	devpriv->unipolar = unipolar;
	devpriv->unipolar = unipolar;
	devpriv->differential = differential;
	devpriv->differential = differential;
	devpriv->digital_state = 0;
	devpriv->digital_state = 0;
/* initialize channel and range to -1 so we make sure we always write
	/*
   at least once to the CTREG in the instruction */
	 * initialize channel and range to -1 so we make sure we
	 * always write at least once to the CTREG in the instruction
	 */
	devpriv->last_channel = -1;
	devpriv->last_channel = -1;
	devpriv->last_range = -1;
	devpriv->last_range = -1;


@@ -321,7 +321,6 @@ static void adq12b_detach(struct comedi_device *dev)
{
{
	if (dev->iobase)
	if (dev->iobase)
		release_region(dev->iobase, ADQ12B_SIZE);
		release_region(dev->iobase, ADQ12B_SIZE);
	kfree(devpriv);
}
}


static const struct adq12b_board adq12b_boards[] = {
static const struct adq12b_board adq12b_boards[] = {