aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-s3c24xx/gpiolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-s3c24xx/gpiolib.c')
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 3caec6bad3eb..b07c2d0dd533 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -161,8 +161,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
161 .ngpio = 24, 161 .ngpio = 24,
162 .direction_input = s3c24xx_gpiolib_banka_input, 162 .direction_input = s3c24xx_gpiolib_banka_input,
163 .direction_output = s3c24xx_gpiolib_banka_output, 163 .direction_output = s3c24xx_gpiolib_banka_output,
164 .set = s3c24xx_gpiolib_set,
165 .get = s3c24xx_gpiolib_get,
166 }, 164 },
167 }, 165 },
168 [1] = { 166 [1] = {
@@ -172,10 +170,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
172 .owner = THIS_MODULE, 170 .owner = THIS_MODULE,
173 .label = "GPIOB", 171 .label = "GPIOB",
174 .ngpio = 16, 172 .ngpio = 16,
175 .direction_input = s3c24xx_gpiolib_input,
176 .direction_output = s3c24xx_gpiolib_output,
177 .set = s3c24xx_gpiolib_set,
178 .get = s3c24xx_gpiolib_get,
179 }, 173 },
180 }, 174 },
181 [2] = { 175 [2] = {
@@ -185,10 +179,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
185 .owner = THIS_MODULE, 179 .owner = THIS_MODULE,
186 .label = "GPIOC", 180 .label = "GPIOC",
187 .ngpio = 16, 181 .ngpio = 16,
188 .direction_input = s3c24xx_gpiolib_input,
189 .direction_output = s3c24xx_gpiolib_output,
190 .set = s3c24xx_gpiolib_set,
191 .get = s3c24xx_gpiolib_get,
192 }, 182 },
193 }, 183 },
194 [3] = { 184 [3] = {
@@ -198,10 +188,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
198 .owner = THIS_MODULE, 188 .owner = THIS_MODULE,
199 .label = "GPIOD", 189 .label = "GPIOD",
200 .ngpio = 16, 190 .ngpio = 16,
201 .direction_input = s3c24xx_gpiolib_input,
202 .direction_output = s3c24xx_gpiolib_output,
203 .set = s3c24xx_gpiolib_set,
204 .get = s3c24xx_gpiolib_get,
205 }, 191 },
206 }, 192 },
207 [4] = { 193 [4] = {
@@ -211,10 +197,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
211 .label = "GPIOE", 197 .label = "GPIOE",
212 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
213 .ngpio = 16, 199 .ngpio = 16,
214 .direction_input = s3c24xx_gpiolib_input,
215 .direction_output = s3c24xx_gpiolib_output,
216 .set = s3c24xx_gpiolib_set,
217 .get = s3c24xx_gpiolib_get,
218 }, 200 },
219 }, 201 },
220 [5] = { 202 [5] = {
@@ -224,10 +206,6 @@ static struct s3c24xx_gpio_chip gpios[] = {
224 .owner = THIS_MODULE, 206 .owner = THIS_MODULE,
225 .label = "GPIOF", 207 .label = "GPIOF",
226 .ngpio = 8, 208 .ngpio = 8,
227 .direction_input = s3c24xx_gpiolib_input,
228 .direction_output = s3c24xx_gpiolib_output,
229 .set = s3c24xx_gpiolib_set,
230 .get = s3c24xx_gpiolib_get,
231 }, 209 },
232 }, 210 },
233 [6] = { 211 [6] = {
@@ -237,21 +215,38 @@ static struct s3c24xx_gpio_chip gpios[] = {
237 .owner = THIS_MODULE, 215 .owner = THIS_MODULE,
238 .label = "GPIOG", 216 .label = "GPIOG",
239 .ngpio = 10, 217 .ngpio = 10,
240 .direction_input = s3c24xx_gpiolib_input,
241 .direction_output = s3c24xx_gpiolib_output,
242 .set = s3c24xx_gpiolib_set,
243 .get = s3c24xx_gpiolib_get,
244 }, 218 },
245 }, 219 },
246}; 220};
247 221
222static __init void s3c24xx_gpiolib_add(struct s3c24xx_gpio_chip *chip)
223{
224 struct gpio_chip *gc = &chip->chip;
225
226 BUG_ON(!chip->base);
227 BUG_ON(!gc->label);
228 BUG_ON(!gc->ngpio);
229
230 if (!gc->direction_input)
231 gc->direction_input = s3c24xx_gpiolib_input;
232 if (!gc->direction_output)
233 gc->direction_output = s3c24xx_gpiolib_output;
234 if (!gc->set)
235 gc->set = s3c24xx_gpiolib_set;
236 if (!gc->get)
237 gc->get = s3c24xx_gpiolib_get;
238
239 /* gpiochip_add() prints own failure message on error. */
240 gpiochip_add(gc);
241}
242
248static __init int s3c24xx_gpiolib_init(void) 243static __init int s3c24xx_gpiolib_init(void)
249{ 244{
250 struct s3c24xx_gpio_chip *chip = gpios; 245 struct s3c24xx_gpio_chip *chip = gpios;
251 int gpn; 246 int gpn;
252 247
253 for (gpn = 0; gpn < ARRAY_SIZE(gpios); gpn++, chip++) 248 for (gpn = 0; gpn < ARRAY_SIZE(gpios); gpn++, chip++)
254 gpiochip_add(&chip->chip); 249 s3c24xx_gpiolib_add(chip);
255 250
256 return 0; 251 return 0;
257} 252}