hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/drivers/gpio/gpio-74xx-mmio.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * 74xx MMIO GPIO driver
34 *
45 * 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.
106 */
117
128 #include <linux/err.h>
....@@ -81,7 +77,10 @@
8177 {
8278 struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc);
8379
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;
8584 }
8685
8786 static int mmio_74xx_dir_in(struct gpio_chip *gc, unsigned int gpio)
....@@ -106,7 +105,6 @@
106105 static int mmio_74xx_gpio_probe(struct platform_device *pdev)
107106 {
108107 struct mmio_74xx_gpio_priv *priv;
109
- struct resource *res;
110108 void __iomem *dat;
111109 int err;
112110
....@@ -116,8 +114,7 @@
116114
117115 priv->flags = (uintptr_t)of_device_get_match_data(&pdev->dev);
118116
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);
121118 if (IS_ERR(dat))
122119 return PTR_ERR(dat);
123120