From 21208519d42404150fef42283a20192ffe08b0af Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 18 Apr 2013 14:33:22 -0700 Subject: [PATCH] staging: comedi: drivers: use comedi_legacy_detach() in simple drivers 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/acl7225b.c | 10 +--------- drivers/staging/comedi/drivers/adq12b.c | 8 +------- drivers/staging/comedi/drivers/aio_iiro_16.c | 8 +------- drivers/staging/comedi/drivers/amplc_pc263.c | 8 +------- drivers/staging/comedi/drivers/dt2801.c | 8 +------- drivers/staging/comedi/drivers/dt2815.c | 8 +------- drivers/staging/comedi/drivers/dt2817.c | 8 +------- drivers/staging/comedi/drivers/fl512.c | 8 +------- drivers/staging/comedi/drivers/mpc624.c | 8 +------- drivers/staging/comedi/drivers/multiq3.c | 8 +------- drivers/staging/comedi/drivers/ni_at_ao.c | 8 +------- drivers/staging/comedi/drivers/pcl725.c | 8 +------- drivers/staging/comedi/drivers/pcl730.c | 10 +--------- drivers/staging/comedi/drivers/pcm3730.c | 8 +------- drivers/staging/comedi/drivers/pcmda12.c | 8 +------- drivers/staging/comedi/drivers/poc.c | 10 +--------- drivers/staging/comedi/drivers/rti800.c | 8 +------- drivers/staging/comedi/drivers/rti802.c | 8 +------- drivers/staging/comedi/drivers/s526.c | 8 +------- 19 files changed, 19 insertions(+), 139 deletions(-) diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index 69d9fd71081c..9e2c7aeea535 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -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), diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c index 44e8f0e2d601..71142e36e7fb 100644 --- a/drivers/staging/comedi/drivers/adq12b.c +++ b/drivers/staging/comedi/drivers/adq12b.c @@ -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); diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c b/drivers/staging/comedi/drivers/aio_iiro_16.c index 440f47a73835..126854c05093 100644 --- a/drivers/staging/comedi/drivers/aio_iiro_16.c +++ b/drivers/staging/comedi/drivers/aio_iiro_16.c @@ -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); diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 1ffe37991792..94a752d852bb 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c @@ -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), diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index b5814401a798..8f5006d70daf 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -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); diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c index c0eb2e226715..b24e87681fe3 100644 --- a/drivers/staging/comedi/drivers/dt2815.c +++ b/drivers/staging/comedi/drivers/dt2815.c @@ -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); diff --git a/drivers/staging/comedi/drivers/dt2817.c b/drivers/staging/comedi/drivers/dt2817.c index 92b461e73ef7..b5c8e8213faf 100644 --- a/drivers/staging/comedi/drivers/dt2817.c +++ b/drivers/staging/comedi/drivers/dt2817.c @@ -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); diff --git a/drivers/staging/comedi/drivers/fl512.c b/drivers/staging/comedi/drivers/fl512.c index bf1c12b8ceb9..ff6f0bd7c863 100644 --- a/drivers/staging/comedi/drivers/fl512.c +++ b/drivers/staging/comedi/drivers/fl512.c @@ -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); diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 8d4527e6d31e..4717be4ad268 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -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); diff --git a/drivers/staging/comedi/drivers/multiq3.c b/drivers/staging/comedi/drivers/multiq3.c index b6bc2dabbcc7..7a8292086e18 100644 --- a/drivers/staging/comedi/drivers/multiq3.c +++ b/drivers/staging/comedi/drivers/multiq3.c @@ -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); diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 4a6eddfbdfd0..7e5783a4f4e7 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -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), diff --git a/drivers/staging/comedi/drivers/pcl725.c b/drivers/staging/comedi/drivers/pcl725.c index 5a2bc6733f60..6b02f0631b4c 100644 --- a/drivers/staging/comedi/drivers/pcl725.c +++ b/drivers/staging/comedi/drivers/pcl725.c @@ -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); diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index 50cc3ac54960..2879db75da3e 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -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), diff --git a/drivers/staging/comedi/drivers/pcm3730.c b/drivers/staging/comedi/drivers/pcm3730.c index f82a356a938b..3a3ce2c769a2 100644 --- a/drivers/staging/comedi/drivers/pcm3730.c +++ b/drivers/staging/comedi/drivers/pcm3730.c @@ -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); diff --git a/drivers/staging/comedi/drivers/pcmda12.c b/drivers/staging/comedi/drivers/pcmda12.c index 1e337b717a72..61e7fd14a1e8 100644 --- a/drivers/staging/comedi/drivers/pcmda12.c +++ b/drivers/staging/comedi/drivers/pcmda12.c @@ -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); diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index e80674e7db9e..b55a16baeb14 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -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]), diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index 44bab88b679e..f4163fd35a00 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -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), diff --git a/drivers/staging/comedi/drivers/rti802.c b/drivers/staging/comedi/drivers/rti802.c index 8569712dd4b4..46dbbe6cdd76 100644 --- a/drivers/staging/comedi/drivers/rti802.c +++ b/drivers/staging/comedi/drivers/rti802.c @@ -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); diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index 0fd4ba1939bd..d240ce87bd68 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -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); -- 2.39.5