aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-omap.c
diff options
context:
space:
mode:
authorBenoit Cousson <b-cousson@ti.com>2012-02-01 09:58:56 -0500
committerBenoit Cousson <b-cousson@ti.com>2012-03-05 17:02:51 -0500
commit862ff64011e606582cec80cc3fa4fcd3e585d76f (patch)
tree960417c31113f992bec6e3817b97a21628e38bdb /drivers/gpio/gpio-omap.c
parente4e449e82871c53ef3b22bd3a50fceabc0638926 (diff)
gpio/omap: Remove bank->id information and misc cleanup
The driver does not need anymore any id to identify the GPIO instance. Remove every occurence of the bank->id inside the driver. Remove two trailing spaces. Add a dev variable for better readability in probe. Remove unused variable bank->pbase. Signed-off-by: Benoit Cousson <b-cousson@ti.com> Acked-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r--drivers/gpio/gpio-omap.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index f49bd6f47a50..a0c3e03a1d1e 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -50,7 +50,6 @@ struct gpio_regs {
50 50
51struct gpio_bank { 51struct gpio_bank {
52 struct list_head node; 52 struct list_head node;
53 unsigned long pbase;
54 void __iomem *base; 53 void __iomem *base;
55 u16 irq; 54 u16 irq;
56 u16 virtual_irq_start; 55 u16 virtual_irq_start;
@@ -77,7 +76,6 @@ struct gpio_bank {
77 int stride; 76 int stride;
78 u32 width; 77 u32 width;
79 int context_loss_count; 78 int context_loss_count;
80 u16 id;
81 int power_mode; 79 int power_mode;
82 bool workaround_enabled; 80 bool workaround_enabled;
83 81
@@ -155,7 +153,7 @@ static inline void _gpio_rmw(void __iomem *base, u32 reg, u32 mask, bool set)
155{ 153{
156 int l = __raw_readl(base + reg); 154 int l = __raw_readl(base + reg);
157 155
158 if (set) 156 if (set)
159 l |= mask; 157 l |= mask;
160 else 158 else
161 l &= ~mask; 159 l &= ~mask;
@@ -495,7 +493,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
495 unsigned long flags; 493 unsigned long flags;
496 494
497 if (bank->non_wakeup_gpios & gpio_bit) { 495 if (bank->non_wakeup_gpios & gpio_bit) {
498 dev_err(bank->dev, 496 dev_err(bank->dev,
499 "Unable to modify wakeup on non-wakeup GPIO%d\n", gpio); 497 "Unable to modify wakeup on non-wakeup GPIO%d\n", gpio);
500 return -EINVAL; 498 return -EINVAL;
501 } 499 }
@@ -1048,37 +1046,36 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
1048 1046
1049static int __devinit omap_gpio_probe(struct platform_device *pdev) 1047static int __devinit omap_gpio_probe(struct platform_device *pdev)
1050{ 1048{
1049 struct device *dev = &pdev->dev;
1051 struct omap_gpio_platform_data *pdata; 1050 struct omap_gpio_platform_data *pdata;
1052 struct resource *res; 1051 struct resource *res;
1053 struct gpio_bank *bank; 1052 struct gpio_bank *bank;
1054 int ret = 0; 1053 int ret = 0;
1055 1054
1056 if (!pdev->dev.platform_data) { 1055 if (!dev->platform_data) {
1057 ret = -EINVAL; 1056 ret = -EINVAL;
1058 goto err_exit; 1057 goto err_exit;
1059 } 1058 }
1060 1059
1061 bank = kzalloc(sizeof(struct gpio_bank), GFP_KERNEL); 1060 bank = kzalloc(sizeof(struct gpio_bank), GFP_KERNEL);
1062 if (!bank) { 1061 if (!bank) {
1063 dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n"); 1062 dev_err(dev, "Memory alloc failed\n");
1064 ret = -ENOMEM; 1063 ret = -ENOMEM;
1065 goto err_exit; 1064 goto err_exit;
1066 } 1065 }
1067 1066
1068 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1067 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1069 if (unlikely(!res)) { 1068 if (unlikely(!res)) {
1070 dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n", 1069 dev_err(dev, "Invalid IRQ resource\n");
1071 pdev->id);
1072 ret = -ENODEV; 1070 ret = -ENODEV;
1073 goto err_free; 1071 goto err_free;
1074 } 1072 }
1075 1073
1076 bank->irq = res->start; 1074 bank->irq = res->start;
1077 bank->id = pdev->id;
1078 1075
1079 pdata = pdev->dev.platform_data; 1076 pdata = pdev->dev.platform_data;
1080 bank->virtual_irq_start = pdata->virtual_irq_start; 1077 bank->virtual_irq_start = pdata->virtual_irq_start;
1081 bank->dev = &pdev->dev; 1078 bank->dev = dev;
1082 bank->dbck_flag = pdata->dbck_flag; 1079 bank->dbck_flag = pdata->dbck_flag;
1083 bank->stride = pdata->bank_stride; 1080 bank->stride = pdata->bank_stride;
1084 bank->width = pdata->bank_width; 1081 bank->width = pdata->bank_width;
@@ -1098,16 +1095,14 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1098 /* Static mapping, never released */ 1095 /* Static mapping, never released */
1099 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1096 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1100 if (unlikely(!res)) { 1097 if (unlikely(!res)) {
1101 dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n", 1098 dev_err(dev, "Invalid mem resource\n");
1102 pdev->id);
1103 ret = -ENODEV; 1099 ret = -ENODEV;
1104 goto err_free; 1100 goto err_free;
1105 } 1101 }
1106 1102
1107 bank->base = ioremap(res->start, resource_size(res)); 1103 bank->base = ioremap(res->start, resource_size(res));
1108 if (!bank->base) { 1104 if (!bank->base) {
1109 dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", 1105 dev_err(dev, "Could not ioremap\n");
1110 pdev->id);
1111 ret = -ENOMEM; 1106 ret = -ENOMEM;
1112 goto err_free; 1107 goto err_free;
1113 } 1108 }