From d1db2a4134bb486b28f943baac175e3edcc51053 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 25 Jan 2013 14:59:17 -0700 Subject: [PATCH] staging: comedi: quatech_daqp_cs: remove forward declarations Move some of the functions to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 120 ++++++++++------------- 1 file changed, 52 insertions(+), 68 deletions(-) diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index c4a03eb..748aa6a 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -180,19 +180,6 @@ static const struct comedi_lrange range_daqp_ai = { 4, { static const struct comedi_lrange range_daqp_ao = { 1, {BIP_RANGE(5)} }; -/*====================================================================*/ - -/* comedi interface code */ - -static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it); -static void daqp_detach(struct comedi_device *dev); -static struct comedi_driver driver_daqp = { - .driver_name = "quatech_daqp_cs", - .module = THIS_MODULE, - .attach = daqp_attach, - .detach = daqp_detach, -}; - #ifdef DAQP_DEBUG static void daqp_dump(struct comedi_device *dev) @@ -889,6 +876,13 @@ static void daqp_detach(struct comedi_device *dev) /* Nothing to cleanup */ } +static struct comedi_driver driver_daqp = { + .driver_name = "quatech_daqp_cs", + .module = THIS_MODULE, + .attach = daqp_attach, + .detach = daqp_detach, +}; + /*==================================================================== PCMCIA interface code @@ -924,55 +918,29 @@ static void daqp_detach(struct comedi_device *dev) ======================================================================*/ -static void daqp_cs_config(struct pcmcia_device *link); -static void daqp_cs_release(struct pcmcia_device *link); -static int daqp_cs_suspend(struct pcmcia_device *p_dev); -static int daqp_cs_resume(struct pcmcia_device *p_dev); - -static int daqp_cs_attach(struct pcmcia_device *); -static void daqp_cs_detach(struct pcmcia_device *); - -static int daqp_cs_attach(struct pcmcia_device *link) +static int daqp_cs_suspend(struct pcmcia_device *link) { - struct local_info_t *local; - int i; - - dev_dbg(&link->dev, "daqp_cs_attach()\n"); - - for (i = 0; i < MAX_DEV; i++) - if (dev_table[i] == NULL) - break; - if (i == MAX_DEV) { - dev_notice(&link->dev, "no devices available\n"); - return -ENODEV; - } + struct local_info_t *local = link->priv; - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; + /* Mark the device as stopped, to block IO until later */ + local->stop = 1; + return 0; +} - local->table_index = i; - dev_table[i] = local; - local->link = link; - link->priv = local; +static int daqp_cs_resume(struct pcmcia_device *link) +{ + struct local_info_t *local = link->priv; - daqp_cs_config(link); + local->stop = 0; return 0; -} /* daqp_cs_attach */ +} -static void daqp_cs_detach(struct pcmcia_device *link) +static void daqp_cs_release(struct pcmcia_device *link) { - struct local_info_t *dev = link->priv; - - dev->stop = 1; - daqp_cs_release(link); - - /* Unlink device structure, and free it */ - dev_table[dev->table_index] = NULL; - kfree(dev); + dev_dbg(&link->dev, "daqp_cs_release\n"); + pcmcia_disable_device(link); } static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) @@ -1009,32 +977,48 @@ static void daqp_cs_config(struct pcmcia_device *link) failed: daqp_cs_release(link); +} -} /* daqp_cs_config */ - -static void daqp_cs_release(struct pcmcia_device *link) +static int daqp_cs_attach(struct pcmcia_device *link) { - dev_dbg(&link->dev, "daqp_cs_release\n"); + struct local_info_t *local; + int i; - pcmcia_disable_device(link); -} /* daqp_cs_release */ + dev_dbg(&link->dev, "daqp_cs_attach()\n"); -static int daqp_cs_suspend(struct pcmcia_device *link) -{ - struct local_info_t *local = link->priv; + for (i = 0; i < MAX_DEV; i++) + if (dev_table[i] == NULL) + break; + if (i == MAX_DEV) { + dev_notice(&link->dev, "no devices available\n"); + return -ENODEV; + } + + /* Allocate space for private device-specific data */ + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); + if (!local) + return -ENOMEM; + + local->table_index = i; + dev_table[i] = local; + local->link = link; + link->priv = local; + + daqp_cs_config(link); - /* Mark the device as stopped, to block IO until later */ - local->stop = 1; return 0; } -static int daqp_cs_resume(struct pcmcia_device *link) +static void daqp_cs_detach(struct pcmcia_device *link) { - struct local_info_t *local = link->priv; + struct local_info_t *dev = link->priv; - local->stop = 0; + dev->stop = 1; + daqp_cs_release(link); - return 0; + /* Unlink device structure, and free it */ + dev_table[dev->table_index] = NULL; + kfree(dev); } /*====================================================================*/ -- 2.7.4