[PATCH 06/15] staging: comedi: ni_daq_dio24: cleanup pcmcia probe/remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Absorb the code from dio24_config() into the probe function,
dio24_cs_attach() and properly return the error code when the
probe fails. This also gets rid of an unnecessary forward
declaration.

For aesthetic reasons, move the remove functio, dio24_cs_detach(),
so it's after the probe function.

Remove a number of dev_{level} noise messages in the probe/remove
functions.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_daq_dio24.c | 57 +++++++++------------------
 1 file changed, 19 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c
index 4cdf928..6cdf45e 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -184,45 +184,13 @@ static void dio24_detach(struct comedi_device *dev)
 		free_irq(dev->irq, dev);
 };
 
-static void dio24_config(struct pcmcia_device *link);
-
 struct local_info_t {
 	struct pcmcia_device *link;
 	struct bus_operations *bus;
 };
 
-static int dio24_cs_attach(struct pcmcia_device *link)
-{
-	struct local_info_t *local;
-
-	dev_info(&link->dev, "ni_daq_dio24: HOLA SOY YO - CS-attach!\n");
-
-	dev_dbg(&link->dev, "dio24_cs_attach()\n");
-
-	/* Allocate space for private device-specific data */
-	local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL);
-	if (!local)
-		return -ENOMEM;
-	local->link = link;
-	link->priv = local;
-
-	pcmcia_cur_dev = link;
-
-	dio24_config(link);
-
-	return 0;
-}				/* dio24_cs_attach */
-
-static void dio24_cs_detach(struct pcmcia_device *link)
-{
-	pcmcia_disable_device(link);
-
-	/* This points to the parent local_info_t struct */
-	kfree(link->priv);
-}
-
 static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
-				void *priv_data)
+				    void *priv_data)
 {
 	if (p_dev->config_index == 0)
 		return -EINVAL;
@@ -230,13 +198,18 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
 	return pcmcia_request_io(p_dev);
 }
 
-static void dio24_config(struct pcmcia_device *link)
+static int dio24_cs_attach(struct pcmcia_device *link)
 {
+	struct local_info_t *local;
 	int ret;
 
-	dev_info(&link->dev, "ni_daq_dio24: HOLA SOY YO! - config\n");
+	local = kzalloc(sizeof(*local), GFP_KERNEL);
+	if (!local)
+		return -ENOMEM;
+	local->link = link;
+	link->priv = local;
 
-	dev_dbg(&link->dev, "dio24_config\n");
+	pcmcia_cur_dev = link;
 
 	link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO |
 		CONF_AUTO_SET_IO;
@@ -254,11 +227,19 @@ static void dio24_config(struct pcmcia_device *link)
 	if (ret)
 		goto failed;
 
-	return;
+	return 0;
 
 failed:
-	dev_info(&link->dev, "Fallo");
 	pcmcia_disable_device(link);
+	return ret;
+}
+
+static void dio24_cs_detach(struct pcmcia_device *link)
+{
+	pcmcia_disable_device(link);
+
+	/* This points to the parent local_info_t struct */
+	kfree(link->priv);
 }
 
 static const struct pcmcia_device_id dio24_cs_ids[] = {
-- 
1.8.1.1.293.gfe73786

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux