| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * i2c_pca_platform.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (C) 2008 Pengutronix |
|---|
| 7 | 8 | * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 9 | |
|---|
| 12 | 10 | */ |
|---|
| 13 | 11 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 142 | 140 | int ret = 0; |
|---|
| 143 | 141 | int irq; |
|---|
| 144 | 142 | |
|---|
| 145 | | - irq = platform_get_irq(pdev, 0); |
|---|
| 143 | + irq = platform_get_irq_optional(pdev, 0); |
|---|
| 146 | 144 | /* If irq is 0, we do polling. */ |
|---|
| 147 | 145 | if (irq < 0) |
|---|
| 148 | 146 | irq = 0; |
|---|
| .. | .. |
|---|
| 151 | 149 | if (!i2c) |
|---|
| 152 | 150 | return -ENOMEM; |
|---|
| 153 | 151 | |
|---|
| 154 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 155 | | - i2c->reg_base = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 152 | + i2c->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); |
|---|
| 156 | 153 | if (IS_ERR(i2c->reg_base)) |
|---|
| 157 | 154 | return PTR_ERR(i2c->reg_base); |
|---|
| 158 | 155 | |
|---|