forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpio/gpio-janz-ttl.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Janz MODULbus VMOD-TTL GPIO Driver
34 *
45 * Copyright (c) 2010 Ira W. Snyder <iws@ovro.caltech.edu>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the
8
- * Free Software Foundation; either version 2 of the License, or (at your
9
- * option) any later version.
106 */
117
128 #include <linux/kernel.h>
....@@ -144,19 +140,17 @@
144140 static int ttl_probe(struct platform_device *pdev)
145141 {
146142 struct janz_platform_data *pdata;
147
- struct device *dev = &pdev->dev;
148143 struct ttl_module *mod;
149144 struct gpio_chip *gpio;
150
- struct resource *res;
151145 int ret;
152146
153147 pdata = dev_get_platdata(&pdev->dev);
154148 if (!pdata) {
155
- dev_err(dev, "no platform data\n");
149
+ dev_err(&pdev->dev, "no platform data\n");
156150 return -ENXIO;
157151 }
158152
159
- mod = devm_kzalloc(dev, sizeof(*mod), GFP_KERNEL);
153
+ mod = devm_kzalloc(&pdev->dev, sizeof(*mod), GFP_KERNEL);
160154 if (!mod)
161155 return -ENOMEM;
162156
....@@ -164,8 +158,7 @@
164158 spin_lock_init(&mod->lock);
165159
166160 /* get access to the MODULbus registers for this module */
167
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
168
- mod->regs = devm_ioremap_resource(dev, res);
161
+ mod->regs = devm_platform_ioremap_resource(pdev, 0);
169162 if (IS_ERR(mod->regs))
170163 return PTR_ERR(mod->regs);
171164
....@@ -183,9 +176,9 @@
183176 gpio->base = -1;
184177 gpio->ngpio = 20;
185178
186
- ret = devm_gpiochip_add_data(dev, gpio, NULL);
179
+ ret = devm_gpiochip_add_data(&pdev->dev, gpio, NULL);
187180 if (ret) {
188
- dev_err(dev, "unable to add GPIO chip\n");
181
+ dev_err(&pdev->dev, "unable to add GPIO chip\n");
189182 return ret;
190183 }
191184