diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2013-11-26 05:10:40 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-12-12 18:00:56 -0500 |
commit | 15cc324aca0a78e5882228e7e2eedf57e732d8f5 (patch) | |
tree | ba0b3f9dda92b9e4887a029af76ffc58c315cb6d /arch/arm/mach-sa1100 | |
parent | d8eec82c176a87aebc823ceed2b7656e43f88b49 (diff) |
ARM: 7901/1: sa1100: h3600: refactor IrDA GPIO handling
Use gpio_request_array/gpio_free_array to request all GPIOs at once.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r-- | arch/arm/mach-sa1100/h3600.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c index 559c2a0a40d9..a663e7230141 100644 --- a/arch/arm/mach-sa1100/h3600.c +++ b/arch/arm/mach-sa1100/h3600.c | |||
@@ -97,6 +97,11 @@ static void __init h3600_map_io(void) | |||
97 | /* | 97 | /* |
98 | * This turns the IRDA power on or off on the Compaq H3600 | 98 | * This turns the IRDA power on or off on the Compaq H3600 |
99 | */ | 99 | */ |
100 | static struct gpio h3600_irda_gpio[] = { | ||
101 | { H3600_EGPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" }, | ||
102 | { H3600_EGPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" }, | ||
103 | }; | ||
104 | |||
100 | static int h3600_irda_set_power(struct device *dev, unsigned int state) | 105 | static int h3600_irda_set_power(struct device *dev, unsigned int state) |
101 | { | 106 | { |
102 | gpio_set_value(H3600_EGPIO_IR_ON, state); | 107 | gpio_set_value(H3600_EGPIO_IR_ON, state); |
@@ -110,29 +115,12 @@ static void h3600_irda_set_speed(struct device *dev, unsigned int speed) | |||
110 | 115 | ||
111 | static int h3600_irda_startup(struct device *dev) | 116 | static int h3600_irda_startup(struct device *dev) |
112 | { | 117 | { |
113 | int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power"); | 118 | return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio)); |
114 | if (err) | ||
115 | goto err1; | ||
116 | err = gpio_direction_output(H3600_EGPIO_IR_ON, 0); | ||
117 | if (err) | ||
118 | goto err2; | ||
119 | err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel"); | ||
120 | if (err) | ||
121 | goto err2; | ||
122 | err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0); | ||
123 | if (err) | ||
124 | goto err3; | ||
125 | return 0; | ||
126 | |||
127 | err3: gpio_free(H3600_EGPIO_IR_FSEL); | ||
128 | err2: gpio_free(H3600_EGPIO_IR_ON); | ||
129 | err1: return err; | ||
130 | } | 119 | } |
131 | 120 | ||
132 | static void h3600_irda_shutdown(struct device *dev) | 121 | static void h3600_irda_shutdown(struct device *dev) |
133 | { | 122 | { |
134 | gpio_free(H3600_EGPIO_IR_ON); | 123 | return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio)); |
135 | gpio_free(H3600_EGPIO_IR_FSEL); | ||
136 | } | 124 | } |
137 | 125 | ||
138 | static struct irda_platform_data h3600_irda_data = { | 126 | static struct irda_platform_data h3600_irda_data = { |