diff options
author | William Breathitt Gray <vilhelm.gray@gmail.com> | 2016-05-01 18:44:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-02 12:32:04 -0400 |
commit | 9c2cfc19e64a513a1b9e55f78e38661a1b97b91e (patch) | |
tree | a4f99fe4bad5ea50c9897f22c9ea9eff8cd7057a /drivers/iio | |
parent | 136c9568457d7747f63c23f9acb01a0e831f351a (diff) |
iio: stx104: Utilize the module_isa_driver and max_num_isa_dev macros
The Apex Embedded Systems STX104 DAC drivers does not do anything
special in module init/exit. This patch eliminates the module init/exit
boilerplate code by utilizing the module_isa_driver macro.
Additionally, the max_num_isa_dev macro is utilized to simplify the
determination of maximum possible STX104 devices in the system.
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/dac/stx104.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/iio/dac/stx104.c b/drivers/iio/dac/stx104.c index 174f4b75ceed..27941220872f 100644 --- a/drivers/iio/dac/stx104.c +++ b/drivers/iio/dac/stx104.c | |||
@@ -33,16 +33,9 @@ | |||
33 | } | 33 | } |
34 | 34 | ||
35 | #define STX104_EXTENT 16 | 35 | #define STX104_EXTENT 16 |
36 | /** | ||
37 | * The highest base address possible for an ISA device is 0x3FF; this results in | ||
38 | * 1024 possible base addresses. Dividing the number of possible base addresses | ||
39 | * by the address extent taken by each device results in the maximum number of | ||
40 | * devices on a system. | ||
41 | */ | ||
42 | #define MAX_NUM_STX104 (1024 / STX104_EXTENT) | ||
43 | 36 | ||
44 | static unsigned base[MAX_NUM_STX104]; | 37 | static unsigned int base[max_num_isa_dev(STX104_EXTENT)]; |
45 | static unsigned num_stx104; | 38 | static unsigned int num_stx104; |
46 | module_param_array(base, uint, &num_stx104, 0); | 39 | module_param_array(base, uint, &num_stx104, 0); |
47 | MODULE_PARM_DESC(base, "Apex Embedded Systems STX104 base addresses"); | 40 | MODULE_PARM_DESC(base, "Apex Embedded Systems STX104 base addresses"); |
48 | 41 | ||
@@ -134,18 +127,7 @@ static struct isa_driver stx104_driver = { | |||
134 | } | 127 | } |
135 | }; | 128 | }; |
136 | 129 | ||
137 | static void __exit stx104_exit(void) | 130 | module_isa_driver(stx104_driver, num_stx104); |
138 | { | ||
139 | isa_unregister_driver(&stx104_driver); | ||
140 | } | ||
141 | |||
142 | static int __init stx104_init(void) | ||
143 | { | ||
144 | return isa_register_driver(&stx104_driver, num_stx104); | ||
145 | } | ||
146 | |||
147 | module_init(stx104_init); | ||
148 | module_exit(stx104_exit); | ||
149 | 131 | ||
150 | MODULE_AUTHOR("William Breathitt Gray <vilhelm.gray@gmail.com>"); | 132 | MODULE_AUTHOR("William Breathitt Gray <vilhelm.gray@gmail.com>"); |
151 | MODULE_DESCRIPTION("Apex Embedded Systems STX104 DAC driver"); | 133 | MODULE_DESCRIPTION("Apex Embedded Systems STX104 DAC driver"); |