Commit 862ff640 authored by Benoit Cousson's avatar Benoit Cousson

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: default avatarBenoit Cousson <b-cousson@ti.com>
Acked-by: default avatarTarun Kanti DebBarma <tarun.kanti@ti.com>
parent e4e449e8
...@@ -50,7 +50,6 @@ struct gpio_regs { ...@@ -50,7 +50,6 @@ struct gpio_regs {
struct gpio_bank { struct gpio_bank {
struct list_head node; struct list_head node;
unsigned long pbase;
void __iomem *base; void __iomem *base;
u16 irq; u16 irq;
u16 virtual_irq_start; u16 virtual_irq_start;
...@@ -77,7 +76,6 @@ struct gpio_bank { ...@@ -77,7 +76,6 @@ struct gpio_bank {
int stride; int stride;
u32 width; u32 width;
int context_loss_count; int context_loss_count;
u16 id;
int power_mode; int power_mode;
bool workaround_enabled; bool workaround_enabled;
...@@ -155,7 +153,7 @@ static inline void _gpio_rmw(void __iomem *base, u32 reg, u32 mask, bool set) ...@@ -155,7 +153,7 @@ static inline void _gpio_rmw(void __iomem *base, u32 reg, u32 mask, bool set)
{ {
int l = __raw_readl(base + reg); int l = __raw_readl(base + reg);
if (set) if (set)
l |= mask; l |= mask;
else else
l &= ~mask; l &= ~mask;
...@@ -495,7 +493,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) ...@@ -495,7 +493,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
unsigned long flags; unsigned long flags;
if (bank->non_wakeup_gpios & gpio_bit) { if (bank->non_wakeup_gpios & gpio_bit) {
dev_err(bank->dev, dev_err(bank->dev,
"Unable to modify wakeup on non-wakeup GPIO%d\n", gpio); "Unable to modify wakeup on non-wakeup GPIO%d\n", gpio);
return -EINVAL; return -EINVAL;
} }
...@@ -1048,37 +1046,36 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank) ...@@ -1048,37 +1046,36 @@ static void __devinit omap_gpio_chip_init(struct gpio_bank *bank)
static int __devinit omap_gpio_probe(struct platform_device *pdev) static int __devinit omap_gpio_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct omap_gpio_platform_data *pdata; struct omap_gpio_platform_data *pdata;
struct resource *res; struct resource *res;
struct gpio_bank *bank; struct gpio_bank *bank;
int ret = 0; int ret = 0;
if (!pdev->dev.platform_data) { if (!dev->platform_data) {
ret = -EINVAL; ret = -EINVAL;
goto err_exit; goto err_exit;
} }
bank = kzalloc(sizeof(struct gpio_bank), GFP_KERNEL); bank = kzalloc(sizeof(struct gpio_bank), GFP_KERNEL);
if (!bank) { if (!bank) {
dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n"); dev_err(dev, "Memory alloc failed\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_exit; goto err_exit;
} }
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (unlikely(!res)) { if (unlikely(!res)) {
dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n", dev_err(dev, "Invalid IRQ resource\n");
pdev->id);
ret = -ENODEV; ret = -ENODEV;
goto err_free; goto err_free;
} }
bank->irq = res->start; bank->irq = res->start;
bank->id = pdev->id;
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
bank->virtual_irq_start = pdata->virtual_irq_start; bank->virtual_irq_start = pdata->virtual_irq_start;
bank->dev = &pdev->dev; bank->dev = dev;
bank->dbck_flag = pdata->dbck_flag; bank->dbck_flag = pdata->dbck_flag;
bank->stride = pdata->bank_stride; bank->stride = pdata->bank_stride;
bank->width = pdata->bank_width; bank->width = pdata->bank_width;
...@@ -1098,16 +1095,14 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) ...@@ -1098,16 +1095,14 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
/* Static mapping, never released */ /* Static mapping, never released */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(!res)) { if (unlikely(!res)) {
dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n", dev_err(dev, "Invalid mem resource\n");
pdev->id);
ret = -ENODEV; ret = -ENODEV;
goto err_free; goto err_free;
} }
bank->base = ioremap(res->start, resource_size(res)); bank->base = ioremap(res->start, resource_size(res));
if (!bank->base) { if (!bank->base) {
dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", dev_err(dev, "Could not ioremap\n");
pdev->id);
ret = -ENOMEM; ret = -ENOMEM;
goto err_free; goto err_free;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment