| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for Aeroflex Gaisler GRGPIO General Purpose I/O cores. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 12 | 13 | * See "Documentation/devicetree/bindings/gpio/gpio-grgpio.txt" for |
|---|
| 13 | 14 | * information on open firmware properties. |
|---|
| 14 | 15 | * |
|---|
| 15 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 16 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 17 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 18 | | - * option) any later version. |
|---|
| 19 | | - * |
|---|
| 20 | 16 | * Contributors: Andreas Larsson <andreas@gaisler.com> |
|---|
| 21 | 17 | */ |
|---|
| 22 | 18 | |
|---|
| .. | .. |
|---|
| 30 | 26 | #include <linux/gpio/driver.h> |
|---|
| 31 | 27 | #include <linux/slab.h> |
|---|
| 32 | 28 | #include <linux/err.h> |
|---|
| 33 | | -#include <linux/gpio/driver.h> |
|---|
| 34 | 29 | #include <linux/interrupt.h> |
|---|
| 35 | 30 | #include <linux/irq.h> |
|---|
| 36 | 31 | #include <linux/irqdomain.h> |
|---|
| .. | .. |
|---|
| 336 | 331 | void __iomem *regs; |
|---|
| 337 | 332 | struct gpio_chip *gc; |
|---|
| 338 | 333 | struct grgpio_priv *priv; |
|---|
| 339 | | - struct resource *res; |
|---|
| 340 | 334 | int err; |
|---|
| 341 | 335 | u32 prop; |
|---|
| 342 | 336 | s32 *irqmap; |
|---|
| .. | .. |
|---|
| 347 | 341 | if (!priv) |
|---|
| 348 | 342 | return -ENOMEM; |
|---|
| 349 | 343 | |
|---|
| 350 | | - res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); |
|---|
| 351 | | - regs = devm_ioremap_resource(&ofdev->dev, res); |
|---|
| 344 | + regs = devm_platform_ioremap_resource(ofdev, 0); |
|---|
| 352 | 345 | if (IS_ERR(regs)) |
|---|
| 353 | 346 | return PTR_ERR(regs); |
|---|
| 354 | 347 | |
|---|
| .. | .. |
|---|
| 417 | 410 | * Continue without irq functionality for that |
|---|
| 418 | 411 | * gpio line |
|---|
| 419 | 412 | */ |
|---|
| 420 | | - dev_err(priv->dev, |
|---|
| 421 | | - "Failed to get irq for offset %d\n", i); |
|---|
| 422 | 413 | continue; |
|---|
| 423 | 414 | } |
|---|
| 424 | 415 | priv->uirqs[lirq->index].uirq = ret; |
|---|
| .. | .. |
|---|
| 444 | 435 | static int grgpio_remove(struct platform_device *ofdev) |
|---|
| 445 | 436 | { |
|---|
| 446 | 437 | struct grgpio_priv *priv = platform_get_drvdata(ofdev); |
|---|
| 447 | | - unsigned long flags; |
|---|
| 448 | 438 | int i; |
|---|
| 449 | 439 | int ret = 0; |
|---|
| 450 | | - |
|---|
| 451 | | - spin_lock_irqsave(&priv->gc.bgpio_lock, flags); |
|---|
| 452 | 440 | |
|---|
| 453 | 441 | if (priv->domain) { |
|---|
| 454 | 442 | for (i = 0; i < GRGPIO_MAX_NGPIO; i++) { |
|---|
| .. | .. |
|---|
| 465 | 453 | irq_domain_remove(priv->domain); |
|---|
| 466 | 454 | |
|---|
| 467 | 455 | out: |
|---|
| 468 | | - spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags); |
|---|
| 469 | | - |
|---|
| 470 | 456 | return ret; |
|---|
| 471 | 457 | } |
|---|
| 472 | 458 | |
|---|