| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 74xx MMIO GPIO driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 81 | 77 | { |
|---|
| 82 | 78 | struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc); |
|---|
| 83 | 79 | |
|---|
| 84 | | - return !(priv->flags & MMIO_74XX_DIR_OUT); |
|---|
| 80 | + if (priv->flags & MMIO_74XX_DIR_OUT) |
|---|
| 81 | + return GPIO_LINE_DIRECTION_OUT; |
|---|
| 82 | + |
|---|
| 83 | + return GPIO_LINE_DIRECTION_IN; |
|---|
| 85 | 84 | } |
|---|
| 86 | 85 | |
|---|
| 87 | 86 | static int mmio_74xx_dir_in(struct gpio_chip *gc, unsigned int gpio) |
|---|
| .. | .. |
|---|
| 106 | 105 | static int mmio_74xx_gpio_probe(struct platform_device *pdev) |
|---|
| 107 | 106 | { |
|---|
| 108 | 107 | struct mmio_74xx_gpio_priv *priv; |
|---|
| 109 | | - struct resource *res; |
|---|
| 110 | 108 | void __iomem *dat; |
|---|
| 111 | 109 | int err; |
|---|
| 112 | 110 | |
|---|
| .. | .. |
|---|
| 116 | 114 | |
|---|
| 117 | 115 | priv->flags = (uintptr_t)of_device_get_match_data(&pdev->dev); |
|---|
| 118 | 116 | |
|---|
| 119 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 120 | | - dat = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 117 | + dat = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 121 | 118 | if (IS_ERR(dat)) |
|---|
| 122 | 119 | return PTR_ERR(dat); |
|---|
| 123 | 120 | |
|---|