| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for Mediatek Hardware Random Number Generator |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2017 Sean Wang <sean.wang@mediatek.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 8 | | - * published by the Free Software Foundation; either version 2 of |
|---|
| 9 | | - * the License, or (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | #define MTK_RNG_DEV KBUILD_MODNAME |
|---|
| 17 | 8 | |
|---|
| .. | .. |
|---|
| 114 | 105 | |
|---|
| 115 | 106 | static int mtk_rng_probe(struct platform_device *pdev) |
|---|
| 116 | 107 | { |
|---|
| 117 | | - struct resource *res; |
|---|
| 118 | 108 | int ret; |
|---|
| 119 | 109 | struct mtk_rng *priv; |
|---|
| 120 | | - |
|---|
| 121 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 122 | | - if (!res) { |
|---|
| 123 | | - dev_err(&pdev->dev, "no iomem resource\n"); |
|---|
| 124 | | - return -ENXIO; |
|---|
| 125 | | - } |
|---|
| 126 | 110 | |
|---|
| 127 | 111 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
|---|
| 128 | 112 | if (!priv) |
|---|
| .. | .. |
|---|
| 144 | 128 | return ret; |
|---|
| 145 | 129 | } |
|---|
| 146 | 130 | |
|---|
| 147 | | - priv->base = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 131 | + priv->base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 148 | 132 | if (IS_ERR(priv->base)) |
|---|
| 149 | 133 | return PTR_ERR(priv->base); |
|---|
| 150 | 134 | |
|---|