.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Janz MODULbus VMOD-TTL GPIO Driver |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/kernel.h> |
---|
.. | .. |
---|
144 | 140 | static int ttl_probe(struct platform_device *pdev) |
---|
145 | 141 | { |
---|
146 | 142 | struct janz_platform_data *pdata; |
---|
147 | | - struct device *dev = &pdev->dev; |
---|
148 | 143 | struct ttl_module *mod; |
---|
149 | 144 | struct gpio_chip *gpio; |
---|
150 | | - struct resource *res; |
---|
151 | 145 | int ret; |
---|
152 | 146 | |
---|
153 | 147 | pdata = dev_get_platdata(&pdev->dev); |
---|
154 | 148 | if (!pdata) { |
---|
155 | | - dev_err(dev, "no platform data\n"); |
---|
| 149 | + dev_err(&pdev->dev, "no platform data\n"); |
---|
156 | 150 | return -ENXIO; |
---|
157 | 151 | } |
---|
158 | 152 | |
---|
159 | | - mod = devm_kzalloc(dev, sizeof(*mod), GFP_KERNEL); |
---|
| 153 | + mod = devm_kzalloc(&pdev->dev, sizeof(*mod), GFP_KERNEL); |
---|
160 | 154 | if (!mod) |
---|
161 | 155 | return -ENOMEM; |
---|
162 | 156 | |
---|
.. | .. |
---|
164 | 158 | spin_lock_init(&mod->lock); |
---|
165 | 159 | |
---|
166 | 160 | /* 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); |
---|
169 | 162 | if (IS_ERR(mod->regs)) |
---|
170 | 163 | return PTR_ERR(mod->regs); |
---|
171 | 164 | |
---|
.. | .. |
---|
183 | 176 | gpio->base = -1; |
---|
184 | 177 | gpio->ngpio = 20; |
---|
185 | 178 | |
---|
186 | | - ret = devm_gpiochip_add_data(dev, gpio, NULL); |
---|
| 179 | + ret = devm_gpiochip_add_data(&pdev->dev, gpio, NULL); |
---|
187 | 180 | if (ret) { |
---|
188 | | - dev_err(dev, "unable to add GPIO chip\n"); |
---|
| 181 | + dev_err(&pdev->dev, "unable to add GPIO chip\n"); |
---|
189 | 182 | return ret; |
---|
190 | 183 | } |
---|
191 | 184 | |
---|