Skip to contentSkip to conversation

GPIO: SAMSUNG: Consolidate GPIO library for SAMSUNG SoC

PATCH New Chanwoo Choi 1 participant 1 message Jul 4, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GPIO: SAMSUNG: Consolidate GPIO library for SAMSUNG SoC

This patch consolidates duplicate GPIO library for SAMSUNG SoC to control GPIO on the whole SAMSUNG SoC(S3C series, S5P series) through consolidated GPIO library file.

---
 arch/arm/mach-s3c64xx/gpiolib.c                |   27 +---
 arch/arm/mach-s5p64x0/gpiolib.c                |    2 +-
 arch/arm/plat-s3c24xx/gpiolib.c                |    2 +-
 arch/arm/plat-samsung/Makefile                 |    1 -
 arch/arm/plat-samsung/gpio.c                   |  167 ----------------------
 arch/arm/plat-samsung/include/plat/gpio-core.h |   18 +--
 drivers/gpio/gpio-plat-samsung.c               |  182 +++++++++++++++++++++++-
 7 files changed, 183 insertions(+), 216 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/gpio.c
arch/arm/mach-s3c64xx/gpiolib.c +3 -24
index 92b0908..75f32f6 100644
@@ -257,32 +257,11 @@ static struct s3c_gpio_chip gpio_2bit[] = {
 	},
 };
 
-static __init void s3c64xx_gpiolib_add_2bit(struct s3c_gpio_chip *chip)
-{
-	chip->pm = __gpio_pm(&s3c_gpio_pm_2bit);
-}
-
-static __init void s3c64xx_gpiolib_add(struct s3c_gpio_chip *chips,
-				       int nr_chips,
-				       void (*fn)(struct s3c_gpio_chip *))
-{
-	for (; nr_chips > 0; nr_chips--, chips++) {
-		if (fn)
-			(fn)(chips);
-		s3c_gpiolib_add(chips);
-	}
-}
-
 static __init int s3c64xx_gpiolib_init(void)
 {
-	s3c64xx_gpiolib_add(gpio_4bit, ARRAY_SIZE(gpio_4bit),
-			    samsung_gpiolib_add_4bit);
-
-	s3c64xx_gpiolib_add(gpio_4bit2, ARRAY_SIZE(gpio_4bit2),
-			    samsung_gpiolib_add_4bit2);
-
-	s3c64xx_gpiolib_add(gpio_2bit, ARRAY_SIZE(gpio_2bit),
-			    s3c64xx_gpiolib_add_2bit);
+	samsung_gpiolib_add_4bit_chips(gpio_4bit, ARRAY_SIZE(gpio_4bit));
+	samsung_gpiolib_add_4bit2_chips(gpio_4bit2, ARRAY_SIZE(gpio_4bit2));
+	samsung_gpiolib_add_2bit_chips(gpio_2bit, ARRAY_SIZE(gpio_2bit));
 
 	return 0;
 }
arch/arm/mach-s5p64x0/gpiolib.c +1 -1
index e7fb3b0..a770735 100644
@@ -467,7 +467,7 @@ static void __init s5p64x0_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip,
 		chip->chip.direction_input = s5p64x0_gpiolib_rbank_4bit2_input;
 		chip->chip.direction_output =
 					s5p64x0_gpiolib_rbank_4bit2_output;
-		s3c_gpiolib_add(chip);
+		samsung_gpiolib_add_chips(chip);
 	}
 }
 
arch/arm/plat-s3c24xx/gpiolib.c +1 -1
index 243b641..de2b4e2 100644
@@ -220,7 +220,7 @@ static __init int s3c24xx_gpiolib_init(void)
 		if (!chip->config)
 			chip->config = &s3c24xx_gpiocfg_default;
 
-		s3c_gpiolib_add(chip);
+		samsung_gpiolib_add_2bit_chips(chip, ARRAY_SIZE(chip));
 	}
 
 	return 0;
arch/arm/plat-samsung/Makefile +0 -1
index 53eb15b..b9deba4 100644
@@ -15,7 +15,6 @@ obj-y				+= init.o
 obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET)   += time.o
 obj-y				+= clock.o
 obj-y				+= pwm-clock.o
-obj-y				+= gpio.o
 obj-y				+= gpio-config.o
 obj-y				+= dev-asocdma.o
 
arch/arm/plat-samsung/gpio.c deleted +0 -167

167 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/gpio-core.h +3 -15
index 8cad4cf..f76c3e3 100644
@@ -78,16 +78,6 @@ static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc)
 	return container_of(gpc, struct s3c_gpio_chip, chip);
 }
 
-/** s3c_gpiolib_add() - add the s3c specific version of a gpio_chip.
- * @chip: The chip to register
- *
- * This is a wrapper to gpiochip_add() that takes our specific gpio chip
- * information and makes the necessary alterations for the platform and
- * notes the information for use with the configuration systems and any
- * other parts of the system.
- */
-extern void s3c_gpiolib_add(struct s3c_gpio_chip *chip);
-
 /* CONFIG_S3C_GPIO_TRACK enables the tracking of the s3c specific gpios
  * for use with the configuration calls, and other parts of the s3c gpiolib
  * support code.
@@ -120,10 +110,8 @@ extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
 					    int nr_chips);
 extern void samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip,
 					   int nr_chips);
-
-extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
-extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
-
+extern void samsung_gpiolib_add_chips(struct s3c_gpio_chip *chip,
+					   int nr_chips);
 
 /**
  * samsung_gpiolib_to_irq - convert gpio pin to irq number
@@ -150,7 +138,7 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int chip)
 
 #include <mach/gpio-track.h>
 
-static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { }
+static inline void samsung_gpiolib_track(struct s3c_gpio_chip *chip) { }
 #endif
 
 #ifdef CONFIG_PM
drivers/gpio/gpio-plat-samsung.c +175 -7

226 lines not on this page · raw message