Skip to content

Commit cf8f446

Browse files
mosescbbrgl
authored andcommitted
gpio: zevio: drop of_gpio.h header
Remove of_gpio.h header file, replace of_* functions and structs with appropriate alternatives. Signed-off-by: Moses Christopher Bollavarapu <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 86bfb91 commit cf8f446

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

drivers/gpio/gpio-zevio.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/bitops.h>
1212
#include <linux/io.h>
1313
#include <linux/of_device.h>
14-
#include <linux/of_gpio.h>
1514
#include <linux/slab.h>
1615
#include <linux/gpio/driver.h>
1716

@@ -53,22 +52,23 @@
5352
#define ZEVIO_GPIO_BIT(gpio) (gpio&7)
5453

5554
struct zevio_gpio {
55+
struct gpio_chip chip;
5656
spinlock_t lock;
57-
struct of_mm_gpio_chip chip;
57+
void __iomem *regs;
5858
};
5959

6060
static inline u32 zevio_gpio_port_get(struct zevio_gpio *c, unsigned pin,
6161
unsigned port_offset)
6262
{
6363
unsigned section_offset = ((pin >> 3) & 3)*ZEVIO_GPIO_SECTION_SIZE;
64-
return readl(IOMEM(c->chip.regs + section_offset + port_offset));
64+
return readl(IOMEM(c->regs + section_offset + port_offset));
6565
}
6666

6767
static inline void zevio_gpio_port_set(struct zevio_gpio *c, unsigned pin,
6868
unsigned port_offset, u32 val)
6969
{
7070
unsigned section_offset = ((pin >> 3) & 3)*ZEVIO_GPIO_SECTION_SIZE;
71-
writel(val, IOMEM(c->chip.regs + section_offset + port_offset));
71+
writel(val, IOMEM(c->regs + section_offset + port_offset));
7272
}
7373

7474
/* Functions for struct gpio_chip */
@@ -178,12 +178,15 @@ static int zevio_gpio_probe(struct platform_device *pdev)
178178
platform_set_drvdata(pdev, controller);
179179

180180
/* Copy our reference */
181-
controller->chip.gc = zevio_gpio_chip;
182-
controller->chip.gc.parent = &pdev->dev;
181+
controller->chip = zevio_gpio_chip;
182+
controller->chip.parent = &pdev->dev;
183183

184-
status = of_mm_gpiochip_add_data(pdev->dev.of_node,
185-
&(controller->chip),
186-
controller);
184+
controller->regs = devm_platform_ioremap_resource(pdev, 0);
185+
if (IS_ERR(controller->regs))
186+
return dev_err_probe(&pdev->dev, PTR_ERR(controller->regs),
187+
"failed to ioremap memory resource\n");
188+
189+
status = devm_gpiochip_add_data(&pdev->dev, &controller->chip, controller);
187190
if (status) {
188191
dev_err(&pdev->dev, "failed to add gpiochip: %d\n", status);
189192
return status;
@@ -192,10 +195,10 @@ static int zevio_gpio_probe(struct platform_device *pdev)
192195
spin_lock_init(&controller->lock);
193196

194197
/* Disable interrupts, they only cause errors */
195-
for (i = 0; i < controller->chip.gc.ngpio; i += 8)
198+
for (i = 0; i < controller->chip.ngpio; i += 8)
196199
zevio_gpio_port_set(controller, i, ZEVIO_GPIO_INT_MASK, 0xFF);
197200

198-
dev_dbg(controller->chip.gc.parent, "ZEVIO GPIO controller set up!\n");
201+
dev_dbg(controller->chip.parent, "ZEVIO GPIO controller set up!\n");
199202

200203
return 0;
201204
}

0 commit comments

Comments
 (0)