linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chase Southwood <chase.southwood@gmail.com>
To: gregkh@linuxfoundation.org
Cc: abbotti@mev.co.uk, hsweeten@visionengravers.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Chase Southwood <chase.southwood@gmail.com>
Subject: [PATCH 2/4] staging: comedi: addi_apci_1564: don't allocate unused subdevices
Date: Sat,  3 May 2014 02:56:27 -0500	[thread overview]
Message-ID: <1399103787-15547-1-git-send-email-chase.southwood@gmail.com> (raw)
In-Reply-To: <1399103661-14853-1-git-send-email-chase.southwood@gmail.com>

The addi-data common code always allocates 7 subdevices.  This driver
cannot or will not use the ones we are currently allocating for analog
input and output or EEPROM, so just don't allocate these subdevices at
all.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
---
 drivers/staging/comedi/drivers/addi_apci_1564.c | 27 +++++--------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 25149b2..31b687c 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -47,7 +47,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	const struct addi_board *this_board = comedi_board(dev);
 	struct addi_private *devpriv;
 	struct comedi_subdevice *s;
-	int ret, n_subdevices;
+	int ret;
 
 	dev->board_name = this_board->pc_DriverName;
 
@@ -69,21 +69,12 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 			dev->irq = pcidev->irq;
 	}
 
-	n_subdevices = 7;
-	ret = comedi_alloc_subdevices(dev, n_subdevices);
+	ret = comedi_alloc_subdevices(dev, 3);
 	if (ret)
 		return ret;
 
-	/*  Allocate and Initialise AI Subdevice Structures */
-	s = &dev->subdevices[0];
-	s->type = COMEDI_SUBD_UNUSED;
-
-	/*  Allocate and Initialise AO Subdevice Structures */
-	s = &dev->subdevices[1];
-	s->type = COMEDI_SUBD_UNUSED;
-
 	/*  Allocate and Initialise DI Subdevice Structures */
-	s = &dev->subdevices[2];
+	s = &dev->subdevices[0];
 	s->type = COMEDI_SUBD_DI;
 	s->subdev_flags = SDF_READABLE;
 	s->n_chan = 32;
@@ -94,7 +85,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	s->insn_bits = apci1564_di_insn_bits;
 
 	/*  Allocate and Initialise DO Subdevice Structures */
-	s = &dev->subdevices[3];
+	s = &dev->subdevices[1];
 	s->type = COMEDI_SUBD_DO;
 	s->subdev_flags = SDF_WRITEABLE;
 	s->n_chan = 32;
@@ -106,7 +97,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 	s->insn_read = apci1564_do_read;
 
 	/*  Allocate and Initialise Timer Subdevice Structures */
-	s = &dev->subdevices[4];
+	s = &dev->subdevices[2];
 	if (this_board->i_Timer) {
 		s->type = COMEDI_SUBD_TIMER;
 		s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
@@ -123,14 +114,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
 		s->type = COMEDI_SUBD_UNUSED;
 	}
 
-	/*  Allocate and Initialise TTL */
-	s = &dev->subdevices[5];
-	s->type = COMEDI_SUBD_UNUSED;
-
-	/* EEPROM */
-	s = &dev->subdevices[6];
-	s->type = COMEDI_SUBD_UNUSED;
-
 	i_ADDI_Reset(dev);
 	return 0;
 }
-- 
1.9.0


  parent reply	other threads:[~2014-05-03  7:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-03  7:54 [PATCH 0/4] staging: comedi: addi_apci_1564: Further cleanups Chase Southwood
2014-05-03  7:55 ` [PATCH 1/4] staging: comedi: addi_apci_1564: board has 32 digital outputs Chase Southwood
2014-05-03  7:56 ` Chase Southwood [this message]
2014-05-03  7:57 ` [PATCH 3/4] staging: comedi: addi_apci_1564: absorb apci1564_reset() Chase Southwood
2014-05-03  7:57 ` [PATCH 4/4] staging: comedi: addi_apci_1564: call apci1564_interrupt() directly Chase Southwood
2014-05-05 16:46 ` [PATCH 0/4] staging: comedi: addi_apci_1564: Further cleanups Hartley Sweeten
2014-05-06  9:19 ` Ian Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399103787-15547-1-git-send-email-chase.southwood@gmail.com \
    --to=chase.southwood@gmail.com \
    --cc=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).