staging: comedi: drivers: use comedi_legacy_detach() in simple drivers
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 18 Apr 2013 21:33:22 +0000 (14:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2013 18:19:53 +0000 (11:19 -0700)
Use the new comedi_legacy_detach() helper in the (*detach) to release
the I/O region requested by these drivers.

Since the (*detach) for these drivers only releases the region, remove
the private (*detach) functions and use comedi_legacy_detach() directly
for the (*detach).

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>
19 files changed:
drivers/staging/comedi/drivers/acl7225b.c
drivers/staging/comedi/drivers/adq12b.c
drivers/staging/comedi/drivers/aio_iiro_16.c
drivers/staging/comedi/drivers/amplc_pc263.c
drivers/staging/comedi/drivers/dt2801.c
drivers/staging/comedi/drivers/dt2815.c
drivers/staging/comedi/drivers/dt2817.c
drivers/staging/comedi/drivers/fl512.c
drivers/staging/comedi/drivers/mpc624.c
drivers/staging/comedi/drivers/multiq3.c
drivers/staging/comedi/drivers/ni_at_ao.c
drivers/staging/comedi/drivers/pcl725.c
drivers/staging/comedi/drivers/pcl730.c
drivers/staging/comedi/drivers/pcm3730.c
drivers/staging/comedi/drivers/pcmda12.c
drivers/staging/comedi/drivers/poc.c
drivers/staging/comedi/drivers/rti800.c
drivers/staging/comedi/drivers/rti802.c
drivers/staging/comedi/drivers/s526.c

index 69d9fd71081c4b22506e7fbf28967db5a11b212a..9e2c7aeea535844bfc464a7c1339e725f7d51a82 100644 (file)
@@ -120,19 +120,11 @@ static int acl7225b_attach(struct comedi_device *dev,
        return 0;
 }
 
-static void acl7225b_detach(struct comedi_device *dev)
-{
-       const struct acl7225b_boardinfo *board = comedi_board(dev);
-
-       if (dev->iobase)
-               release_region(dev->iobase, board->io_range);
-}
-
 static struct comedi_driver acl7225b_driver = {
        .driver_name    = "acl7225b",
        .module         = THIS_MODULE,
        .attach         = acl7225b_attach,
-       .detach         = acl7225b_detach,
+       .detach         = comedi_legacy_detach,
        .board_name     = &acl7225b_boards[0].name,
        .num_names      = ARRAY_SIZE(acl7225b_boards),
        .offset         = sizeof(struct acl7225b_boardinfo),
index 44e8f0e2d601aa267fc33527e0e29806d652d55d..71142e36e7fb66445cd683f38e33ee85f0ea322e 100644 (file)
@@ -281,17 +281,11 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void adq12b_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, ADQ12B_SIZE);
-}
-
 static struct comedi_driver adq12b_driver = {
        .driver_name    = "adq12b",
        .module         = THIS_MODULE,
        .attach         = adq12b_attach,
-       .detach         = adq12b_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(adq12b_driver);
 
index 440f47a7383512c8a2bff8e0b70e5d04701f3f8d..126854c0509322e67799f3bf9587010410c5ce87 100644 (file)
@@ -107,17 +107,11 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
        return 1;
 }
 
-static void aio_iiro_16_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, AIO_IIRO_16_SIZE);
-}
-
 static struct comedi_driver aio_iiro_16_driver = {
        .driver_name    = "aio_iiro_16",
        .module         = THIS_MODULE,
        .attach         = aio_iiro_16_attach,
-       .detach         = aio_iiro_16_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(aio_iiro_16_driver);
 
index 1ffe3799179227605815067c9365a5f2b0836a69..94a752d852bb061e5fd0885e559db65b00fdc919 100644 (file)
@@ -104,17 +104,11 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void pc263_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, PC263_IO_SIZE);
-}
-
 static struct comedi_driver amplc_pc263_driver = {
        .driver_name = PC263_DRIVER_NAME,
        .module = THIS_MODULE,
        .attach = pc263_attach,
-       .detach = pc263_detach,
+       .detach = comedi_legacy_detach,
        .board_name = &pc263_boards[0].name,
        .offset = sizeof(struct pc263_board),
        .num_names = ARRAY_SIZE(pc263_boards),
index b5814401a798bdab2dafea1bb95142c0701f4cc8..8f5006d70dafd479b60d8271cfff2c4e611fb4ee 100644 (file)
@@ -687,17 +687,11 @@ out:
        return ret;
 }
 
-static void dt2801_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, DT2801_IOSIZE);
-}
-
 static struct comedi_driver dt2801_driver = {
        .driver_name    = "dt2801",
        .module         = THIS_MODULE,
        .attach         = dt2801_attach,
-       .detach         = dt2801_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(dt2801_driver);
 
index c0eb2e2267153e58c9d79e310ed702bc3ce1eee1..b24e87681fe3c25efef5e6ef4edc177bebd951a4 100644 (file)
@@ -220,17 +220,11 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void dt2815_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, DT2815_SIZE);
-}
-
 static struct comedi_driver dt2815_driver = {
        .driver_name    = "dt2815",
        .module         = THIS_MODULE,
        .attach         = dt2815_attach,
-       .detach         = dt2815_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(dt2815_driver);
 
index 92b461e73ef7de4368255dd87171775f81f9e241..b5c8e8213faf71da172632604293997230db94f5 100644 (file)
@@ -151,17 +151,11 @@ static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void dt2817_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, DT2817_SIZE);
-}
-
 static struct comedi_driver dt2817_driver = {
        .driver_name    = "dt2817",
        .module         = THIS_MODULE,
        .attach         = dt2817_attach,
-       .detach         = dt2817_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(dt2817_driver);
 
index bf1c12b8ceb9d7a1a8dc56ae3b8d88c6f04ddd21..ff6f0bd7c8637a130e143ddb03afd95d7d45f78e 100644 (file)
@@ -165,17 +165,11 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 1;
 }
 
-static void fl512_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, FL512_SIZE);
-}
-
 static struct comedi_driver fl512_driver = {
        .driver_name    = "fl512",
        .module         = THIS_MODULE,
        .attach         = fl512_attach,
-       .detach         = fl512_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(fl512_driver);
 
index 8d4527e6d31e80714ba67b6b334491cc813a08a6..4717be4ad26829bff589fa73157ae73d8f14b52f 100644 (file)
@@ -357,17 +357,11 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 1;
 }
 
-static void mpc624_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, MPC624_SIZE);
-}
-
 static struct comedi_driver mpc624_driver = {
        .driver_name    = "mpc624",
        .module         = THIS_MODULE,
        .attach         = mpc624_attach,
-       .detach         = mpc624_detach
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(mpc624_driver);
 
index b6bc2dabbcc77e826e9178ae7715ed457fcc535b..7a8292086e1818a67894c21c23349fde32fa51f1 100644 (file)
@@ -294,17 +294,11 @@ static int multiq3_attach(struct comedi_device *dev,
        return 0;
 }
 
-static void multiq3_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, MULTIQ3_SIZE);
-}
-
 static struct comedi_driver multiq3_driver = {
        .driver_name    = "multiq3",
        .module         = THIS_MODULE,
        .attach         = multiq3_attach,
-       .detach         = multiq3_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(multiq3_driver);
 
index 4a6eddfbdfd0c660e5faa3bef5fe88678174bdeb..7e5783a4f4e707efc0e626aa7c23a5005a6ff6b2 100644 (file)
@@ -399,12 +399,6 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void atao_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, ATAO_SIZE);
-}
-
 static const struct atao_board atao_boards[] = {
        {
                .name           = "ai-ao-6",
@@ -419,7 +413,7 @@ static struct comedi_driver ni_at_ao_driver = {
        .driver_name    = "ni_at_ao",
        .module         = THIS_MODULE,
        .attach         = atao_attach,
-       .detach         = atao_detach,
+       .detach         = comedi_legacy_detach,
        .board_name     = &atao_boards[0].name,
        .offset         = sizeof(struct atao_board),
        .num_names      = ARRAY_SIZE(atao_boards),
index 5a2bc6733f60effe826c8dfaa024992c339d5592..6b02f0631b4c9070959562ef2727e4e5d6e47d33 100644 (file)
@@ -78,17 +78,11 @@ static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void pcl725_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, PCL725_SIZE);
-}
-
 static struct comedi_driver pcl725_driver = {
        .driver_name    = "pcl725",
        .module         = THIS_MODULE,
        .attach         = pcl725_attach,
-       .detach         = pcl725_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(pcl725_driver);
 
index 50cc3ac549606bd56a1faea6d6535337b3883e24..2879db75da3e9280433d6bed161c76120663fd43 100644 (file)
@@ -119,14 +119,6 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void pcl730_detach(struct comedi_device *dev)
-{
-       const struct pcl730_board *board = comedi_board(dev);
-
-       if (dev->iobase)
-               release_region(dev->iobase, board->io_range);
-}
-
 static const struct pcl730_board boardtypes[] = {
        { "pcl730", PCL730_SIZE, },
        { "iso730", PCL730_SIZE, },
@@ -137,7 +129,7 @@ static struct comedi_driver pcl730_driver = {
        .driver_name    = "pcl730",
        .module         = THIS_MODULE,
        .attach         = pcl730_attach,
-       .detach         = pcl730_detach,
+       .detach         = comedi_legacy_detach,
        .board_name     = &boardtypes[0].name,
        .num_names      = ARRAY_SIZE(boardtypes),
        .offset         = sizeof(struct pcl730_board),
index f82a356a938b5fb6ed05b3858a91870e1c3633f1..3a3ce2c769a26a502dbb9a514e48d0765c304aff 100644 (file)
@@ -123,17 +123,11 @@ static int pcm3730_attach(struct comedi_device *dev,
        return 0;
 }
 
-static void pcm3730_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, PCM3730_SIZE);
-}
-
 static struct comedi_driver pcm3730_driver = {
        .driver_name    = "pcm3730",
        .module         = THIS_MODULE,
        .attach         = pcm3730_attach,
-       .detach         = pcm3730_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(pcm3730_driver);
 
index 1e337b717a72f11408f781e89453ed0ba1e85ae3..61e7fd14a1e804274863d64cbdedf42a41291d88 100644 (file)
@@ -186,17 +186,11 @@ static int pcmda12_attach(struct comedi_device *dev,
        return 1;
 }
 
-static void pcmda12_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, IOSIZE);
-}
-
 static struct comedi_driver pcmda12_driver = {
        .driver_name    = "pcmda12",
        .module         = THIS_MODULE,
        .attach         = pcmda12_attach,
-       .detach         = pcmda12_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(pcmda12_driver);
 
index e80674e7db9e0e1f9d5887fc0ddbb68354292b17..b55a16baeb144fc92ed206293eb2118448cdef33 100644 (file)
@@ -169,14 +169,6 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void poc_detach(struct comedi_device *dev)
-{
-       const struct boarddef_struct *board = comedi_board(dev);
-
-       if (dev->iobase)
-               release_region(dev->iobase, board->iosize);
-}
-
 static const struct boarddef_struct boards[] = {
        {
                .name           = "dac02",
@@ -211,7 +203,7 @@ static struct comedi_driver poc_driver = {
        .driver_name    = "poc",
        .module         = THIS_MODULE,
        .attach         = poc_attach,
-       .detach         = poc_detach,
+       .detach         = comedi_legacy_detach,
        .board_name     = &boards[0].name,
        .num_names      = ARRAY_SIZE(boards),
        .offset         = sizeof(boards[0]),
index 44bab88b679e093b914e7b68e074d7a33449026b..f4163fd35a00b706968d03fc9aa5aba565d2851f 100644 (file)
@@ -376,17 +376,11 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void rti800_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, RTI800_IOSIZE);
-}
-
 static struct comedi_driver rti800_driver = {
        .driver_name    = "rti800",
        .module         = THIS_MODULE,
        .attach         = rti800_attach,
-       .detach         = rti800_detach,
+       .detach         = comedi_legacy_detach,
        .num_names      = ARRAY_SIZE(rti800_boardtypes),
        .board_name     = &rti800_boardtypes[0].name,
        .offset         = sizeof(struct rti800_board),
index 8569712dd4b40ed7739c75c0bf70c793faa3a93a..46dbbe6cdd76593333079f4c4fb67885e799c7a8 100644 (file)
@@ -128,17 +128,11 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 0;
 }
 
-static void rti802_detach(struct comedi_device *dev)
-{
-       if (dev->iobase)
-               release_region(dev->iobase, RTI802_SIZE);
-}
-
 static struct comedi_driver rti802_driver = {
        .driver_name    = "rti802",
        .module         = THIS_MODULE,
        .attach         = rti802_attach,
-       .detach         = rti802_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(rti802_driver);
 
index 0fd4ba1939bdcdaa34c66181c2dc719f5e004957..d240ce87bd68a75a2d470aaa2591e73cd40db914 100644 (file)
@@ -613,17 +613,11 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        return 1;
 }
 
-static void s526_detach(struct comedi_device *dev)
-{
-       if (dev->iobase > 0)
-               release_region(dev->iobase, S526_IOSIZE);
-}
-
 static struct comedi_driver s526_driver = {
        .driver_name    = "s526",
        .module         = THIS_MODULE,
        .attach         = s526_attach,
-       .detach         = s526_detach,
+       .detach         = comedi_legacy_detach,
 };
 module_comedi_driver(s526_driver);