[PATCH] ide-cs: housekeeping

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

 



* remove needless includes
* remove stale comments
* remove struct ide_info_t
* remove legacy dev_dbg() debugging
* inline ide_{config,release}()

Compile-tested only.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
 drivers/ide/ide-cs.c |   83 
+++++++--------------------------------------------
 1 file changed, 12 insertions(+), 71 deletions(-)

Index: b/drivers/ide/ide-cs.c
===================================================================
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -32,13 +32,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/ioport.h>
 #include <linux/ide.h>
-#include <linux/major.h>
 #include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/system.h>
@@ -50,58 +44,10 @@
 
 #define DRV_NAME "ide-cs"
 
-/*====================================================================*/
-
-/* Module parameters */
-
 MODULE_AUTHOR("David Hinds <dahinds@xxxxxxxxxxxxxxxxxxxxx>");
 MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver");
 MODULE_LICENSE("Dual MPL/GPL");
 
-/*====================================================================*/
-
-typedef struct ide_info_t {
-	struct pcmcia_device	*p_dev;
-	struct ide_host		*host;
-	int			ndev;
-} ide_info_t;
-
-static void ide_release(struct pcmcia_device *);
-static int ide_config(struct pcmcia_device *);
-
-static void ide_detach(struct pcmcia_device *p_dev);
-
-static int ide_probe(struct pcmcia_device *link)
-{
-    ide_info_t *info;
-
-    dev_dbg(&link->dev, "ide_attach()\n");
-
-    /* Create new ide device */
-    info = kzalloc(sizeof(*info), GFP_KERNEL);
-    if (!info)
-	return -ENOMEM;
-
-    info->p_dev = link;
-    link->priv = info;
-
-    link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO |
-	    CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
-
-    return ide_config(link);
-} /* ide_attach */
-
-static void ide_detach(struct pcmcia_device *link)
-{
-    ide_info_t *info = link->priv;
-
-    dev_dbg(&link->dev, "ide_detach(0x%p)\n", link);
-
-    ide_release(link);
-
-    kfree(info);
-} /* ide_detach */
-
 static const struct ide_port_ops idecs_port_ops = {
 	.quirkproc		= ide_undecoded_slave,
 };
@@ -186,14 +132,14 @@ static int pcmcia_check_one_config(struc
 	return pcmcia_request_io(pdev);
 }
 
-static int ide_config(struct pcmcia_device *link)
+static int ide_probe(struct pcmcia_device *link)
 {
-    ide_info_t *info = link->priv;
     int ret = 0, is_kme = 0;
     unsigned long io_base, ctl_base;
     struct ide_host *host;
 
-    dev_dbg(&link->dev, "ide_config(0x%p)\n", link);
+    link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO |
+	    CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
 
     is_kme = ((link->manf_id == MANFID_KME) &&
 	      ((link->card_id == PRODID_KME_KXLC005_A) ||
@@ -234,8 +180,7 @@ static int ide_config(struct pcmcia_devi
     if (host == NULL)
 	goto failed;
 
-    info->ndev = 1;
-    info->host = host;
+    link->priv = host;
     dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n",
 	    'a' + host->ports[0]->index * 2,
 	    link->vpp / 10, link->vpp % 10);
@@ -243,18 +188,15 @@ static int ide_config(struct pcmcia_devi
     return 0;
 
 failed:
-    ide_release(link);
+    pcmcia_disable_device(link);
     return -ENODEV;
-} /* ide_config */
+}
 
-static void ide_release(struct pcmcia_device *link)
+static void ide_detach(struct pcmcia_device *link)
 {
-    ide_info_t *info = link->priv;
-    struct ide_host *host = info->host;
+    struct ide_host *host = link->priv;
 
-    dev_dbg(&link->dev, "ide_release(0x%p)\n", link);
-
-    if (info->ndev) {
+    if (host) {
 	ide_hwif_t *hwif = host->ports[0];
 	unsigned long data_addr, ctl_addr;
 
@@ -262,15 +204,14 @@ static void ide_release(struct pcmcia_de
 	ctl_addr = hwif->io_ports.ctl_addr;
 
 	ide_host_remove(host);
-	info->ndev = 0;
+	link->priv = NULL;
 
 	release_region(ctl_addr, 1);
 	release_region(data_addr, 8);
     }
 
     pcmcia_disable_device(link);
-} /* ide_release */
-
+}
 
 static struct pcmcia_device_id ide_ids[] = {
 	PCMCIA_DEVICE_FUNC_ID(4),
@@ -344,7 +285,7 @@ MODULE_DEVICE_TABLE(pcmcia, ide_ids);
 
 static struct pcmcia_driver ide_cs_driver = {
 	.owner		= THIS_MODULE,
-	.name		= "ide-cs",
+	.name		= DRV_NAME,
 	.probe		= ide_probe,
 	.remove		= ide_detach,
 	.id_table       = ide_ids,
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux