aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/74x164.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2011-05-27 19:35:59 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-06-03 14:14:16 -0400
commita3cc68c37897f0656489a0d853d6e342fc6f076b (patch)
tree0ac029941fa3326b563579b37ab589b3b2a7889a /drivers/gpio/74x164.c
parent1fa7b6a29c61358cc2ca6f64cef4aa0e1a7ca74c (diff)
gpio/74x164: remove unnecessary defines and prototype
Remove the #define GEN_74X164_GPIO_COUNT since it's only used in one place and it's meaning is obvious. Also remove the #define GEN_74X164_DRIVER_NAME and use spi->modalias to set the gpio chip's label and the string "74x164" for the driver name. Reorder the code slightly to remove the need to prototype gen_74x164_set_value. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/gpio/74x164.c')
-rw-r--r--drivers/gpio/74x164.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/gpio/74x164.c b/drivers/gpio/74x164.c
index 84e070219839..7fb60b6bf523 100644
--- a/drivers/gpio/74x164.c
+++ b/drivers/gpio/74x164.c
@@ -16,9 +16,6 @@
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18 18
19#define GEN_74X164_GPIO_COUNT 8
20
21
22struct gen_74x164_chip { 19struct gen_74x164_chip {
23 struct spi_device *spi; 20 struct spi_device *spi;
24 struct gpio_chip gpio_chip; 21 struct gpio_chip gpio_chip;
@@ -26,8 +23,6 @@ struct gen_74x164_chip {
26 u8 port_config; 23 u8 port_config;
27}; 24};
28 25
29static void gen_74x164_set_value(struct gpio_chip *, unsigned, int);
30
31static struct gen_74x164_chip *gpio_to_chip(struct gpio_chip *gc) 26static struct gen_74x164_chip *gpio_to_chip(struct gpio_chip *gc)
32{ 27{
33 return container_of(gc, struct gen_74x164_chip, gpio_chip); 28 return container_of(gc, struct gen_74x164_chip, gpio_chip);
@@ -39,13 +34,6 @@ static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
39 &chip->port_config, sizeof(chip->port_config)); 34 &chip->port_config, sizeof(chip->port_config));
40} 35}
41 36
42static int gen_74x164_direction_output(struct gpio_chip *gc,
43 unsigned offset, int val)
44{
45 gen_74x164_set_value(gc, offset, val);
46 return 0;
47}
48
49static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) 37static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset)
50{ 38{
51 struct gen_74x164_chip *chip = gpio_to_chip(gc); 39 struct gen_74x164_chip *chip = gpio_to_chip(gc);
@@ -73,6 +61,13 @@ static void gen_74x164_set_value(struct gpio_chip *gc,
73 mutex_unlock(&chip->lock); 61 mutex_unlock(&chip->lock);
74} 62}
75 63
64static int gen_74x164_direction_output(struct gpio_chip *gc,
65 unsigned offset, int val)
66{
67 gen_74x164_set_value(gc, offset, val);
68 return 0;
69}
70
76static int __devinit gen_74x164_probe(struct spi_device *spi) 71static int __devinit gen_74x164_probe(struct spi_device *spi)
77{ 72{
78 struct gen_74x164_chip *chip; 73 struct gen_74x164_chip *chip;
@@ -104,12 +99,12 @@ static int __devinit gen_74x164_probe(struct spi_device *spi)
104 99
105 chip->spi = spi; 100 chip->spi = spi;
106 101
107 chip->gpio_chip.label = GEN_74X164_DRIVER_NAME, 102 chip->gpio_chip.label = spi->modalias;
108 chip->gpio_chip.direction_output = gen_74x164_direction_output; 103 chip->gpio_chip.direction_output = gen_74x164_direction_output;
109 chip->gpio_chip.get = gen_74x164_get_value; 104 chip->gpio_chip.get = gen_74x164_get_value;
110 chip->gpio_chip.set = gen_74x164_set_value; 105 chip->gpio_chip.set = gen_74x164_set_value;
111 chip->gpio_chip.base = pdata->base; 106 chip->gpio_chip.base = pdata->base;
112 chip->gpio_chip.ngpio = GEN_74X164_GPIO_COUNT; 107 chip->gpio_chip.ngpio = 8;
113 chip->gpio_chip.can_sleep = 1; 108 chip->gpio_chip.can_sleep = 1;
114 chip->gpio_chip.dev = &spi->dev; 109 chip->gpio_chip.dev = &spi->dev;
115 chip->gpio_chip.owner = THIS_MODULE; 110 chip->gpio_chip.owner = THIS_MODULE;
@@ -157,7 +152,7 @@ static int __devexit gen_74x164_remove(struct spi_device *spi)
157 152
158static struct spi_driver gen_74x164_driver = { 153static struct spi_driver gen_74x164_driver = {
159 .driver = { 154 .driver = {
160 .name = GEN_74X164_DRIVER_NAME, 155 .name = "74x164",
161 .owner = THIS_MODULE, 156 .owner = THIS_MODULE,
162 }, 157 },
163 .probe = gen_74x164_probe, 158 .probe = gen_74x164_probe,