summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-07-29 15:01:37 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-30 16:55:15 -0700
commit3bb7c3abe34349a5f3615159d80aaee25c34e2a7 (patch)
treed614c67bd894d968b1d285402de544ab06b3a08a /drivers/staging/comedi
parent7a9e24eb4c40ea3afcd64269353c4f6c8139f0eb (diff)
downloadtalos-obmc-linux-3bb7c3abe34349a5f3615159d80aaee25c34e2a7.tar.gz
talos-obmc-linux-3bb7c3abe34349a5f3615159d80aaee25c34e2a7.zip
staging: comedi: mite: pass comedi_device to mite_setup()
For aesthetics, pass the comedi_device to mite_setup() and mite_setup2() so that the dev->class_dev can be used in the dev_{level} message to make the messages have consistancy with the other comedi drivers. Remove the extra dev_warn() noise in the drivers when mite_setup() fails. Rename the 'use_iodwbsr_1' parameter and change it to a bool. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/drivers/mite.c15
-rw-r--r--drivers/staging/comedi/drivers/mite.h7
-rw-r--r--drivers/staging/comedi/drivers/ni_660x.c6
-rw-r--r--drivers/staging/comedi/drivers/ni_pcidio.c6
-rw-r--r--drivers/staging/comedi/drivers/ni_pcimio.c6
5 files changed, 18 insertions, 22 deletions
diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c
index d90063bf0279..9041fd180381 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -94,7 +94,8 @@ static unsigned mite_fifo_size(struct mite_struct *mite, unsigned channel)
return empty_count + full_count;
}
-int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
+int mite_setup2(struct comedi_device *dev,
+ struct mite_struct *mite, bool use_win1)
{
unsigned long length;
int i;
@@ -105,7 +106,7 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
mite->mite_io_addr = pci_ioremap_bar(mite->pcidev, 0);
if (!mite->mite_io_addr) {
- dev_err(&mite->pcidev->dev,
+ dev_err(dev->class_dev,
"Failed to remap mite io memory address\n");
return -ENOMEM;
}
@@ -113,16 +114,16 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
mite->daq_io_addr = pci_ioremap_bar(mite->pcidev, 1);
if (!mite->daq_io_addr) {
- dev_err(&mite->pcidev->dev,
+ dev_err(dev->class_dev,
"Failed to remap daq io memory address\n");
return -ENOMEM;
}
mite->daq_phys_addr = pci_resource_start(mite->pcidev, 1);
length = pci_resource_len(mite->pcidev, 1);
- if (use_iodwbsr_1) {
+ if (use_win1) {
writel(0, mite->mite_io_addr + MITE_IODWBSR);
- dev_info(&mite->pcidev->dev,
+ dev_info(dev->class_dev,
"using I/O Window Base Size register 1\n");
writel(mite->daq_phys_addr | WENAB |
MITE_IODWBSR_1_WSIZE_bits(length),
@@ -148,7 +149,7 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
csigr_bits = readl(mite->mite_io_addr + MITE_CSIGR);
mite->num_channels = mite_csigr_dmac(csigr_bits);
if (mite->num_channels > MAX_MITE_DMA_CHANNELS) {
- dev_warn(&mite->pcidev->dev,
+ dev_warn(dev->class_dev,
"mite: bug? chip claims to have %i dma channels. Setting to %i.\n",
mite->num_channels, MAX_MITE_DMA_CHANNELS);
mite->num_channels = MAX_MITE_DMA_CHANNELS;
@@ -163,7 +164,7 @@ int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1)
mite->mite_io_addr + MITE_CHCR(i));
}
mite->fifo_size = mite_fifo_size(mite, 0);
- dev_info(&mite->pcidev->dev, "fifo size is %i.\n", mite->fifo_size);
+ dev_info(dev->class_dev, "fifo size is %i.\n", mite->fifo_size);
return 0;
}
EXPORT_SYMBOL_GPL(mite_setup2);
diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h
index 7c938b0452c5..b15c06671e87 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -65,11 +65,12 @@ struct mite_struct {
struct mite_struct *mite_alloc(struct pci_dev *pcidev);
-int mite_setup2(struct mite_struct *mite, unsigned use_iodwbsr_1);
+int mite_setup2(struct comedi_device *, struct mite_struct *, bool use_win1);
-static inline int mite_setup(struct mite_struct *mite)
+static inline int mite_setup(struct comedi_device *dev,
+ struct mite_struct *mite)
{
- return mite_setup2(mite, 0);
+ return mite_setup2(dev, mite, false);
}
void mite_detach(struct mite_struct *mite);
diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
index ef4a8f0fb29c..fa19a8e7627d 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -1078,11 +1078,9 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
if (!devpriv->mite)
return -ENOMEM;
- ret = mite_setup2(devpriv->mite, 1);
- if (ret < 0) {
- dev_warn(dev->class_dev, "error setting up mite\n");
+ ret = mite_setup2(dev, devpriv->mite, true);
+ if (ret < 0)
return ret;
- }
ret = ni_660x_alloc_mite_rings(dev);
if (ret < 0)
diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c
index 352c60fa58b6..002d27637135 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -968,11 +968,9 @@ static int nidio_auto_attach(struct comedi_device *dev,
if (!devpriv->mite)
return -ENOMEM;
- ret = mite_setup(devpriv->mite);
- if (ret < 0) {
- dev_warn(dev->class_dev, "error setting up mite\n");
+ ret = mite_setup(dev, devpriv->mite);
+ if (ret < 0)
return ret;
- }
devpriv->di_mite_ring = mite_alloc_ring(devpriv->mite);
if (devpriv->di_mite_ring == NULL)
diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index 22c0e95dc174..b95019b7205f 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1176,11 +1176,9 @@ static int pcimio_auto_attach(struct comedi_device *dev,
if (board->reg_type == ni_reg_6713)
devpriv->is_6713 = 1;
- ret = mite_setup(devpriv->mite);
- if (ret < 0) {
- dev_warn(dev->class_dev, "error setting up mite\n");
+ ret = mite_setup(dev, devpriv->mite);
+ if (ret < 0)
return ret;
- }
devpriv->ai_mite_ring = mite_alloc_ring(devpriv->mite);
if (devpriv->ai_mite_ring == NULL)
OpenPOWER on IntegriCloud