.. | .. |
---|
1 | | -/** |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
| 2 | +/* |
---|
2 | 3 | * Copyright (c) 2010-2012 Broadcom. All rights reserved. |
---|
3 | 4 | * Copyright (c) 2013 Lubomir Rintel |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or |
---|
6 | | - * modify it under the terms of the GNU General Public License ("GPL") |
---|
7 | | - * version 2, as published by the Free Software Foundation. |
---|
8 | 5 | */ |
---|
9 | 6 | |
---|
10 | 7 | #include <linux/hw_random.h> |
---|
.. | .. |
---|
142 | 139 | { |
---|
143 | 140 | const struct bcm2835_rng_of_data *of_data; |
---|
144 | 141 | struct device *dev = &pdev->dev; |
---|
145 | | - struct device_node *np = dev->of_node; |
---|
146 | 142 | const struct of_device_id *rng_id; |
---|
147 | 143 | struct bcm2835_rng_priv *priv; |
---|
148 | | - struct resource *r; |
---|
149 | 144 | int err; |
---|
150 | 145 | |
---|
151 | 146 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
---|
.. | .. |
---|
154 | 149 | |
---|
155 | 150 | platform_set_drvdata(pdev, priv); |
---|
156 | 151 | |
---|
157 | | - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
158 | | - |
---|
159 | 152 | /* map peripheral */ |
---|
160 | | - priv->base = devm_ioremap_resource(dev, r); |
---|
| 153 | + priv->base = devm_platform_ioremap_resource(pdev, 0); |
---|
161 | 154 | if (IS_ERR(priv->base)) |
---|
162 | 155 | return PTR_ERR(priv->base); |
---|
163 | 156 | |
---|
164 | 157 | /* Clock is optional on most platforms */ |
---|
165 | 158 | priv->clk = devm_clk_get(dev, NULL); |
---|
166 | | - if (IS_ERR(priv->clk) && PTR_ERR(priv->clk) == -EPROBE_DEFER) |
---|
| 159 | + if (PTR_ERR(priv->clk) == -EPROBE_DEFER) |
---|
167 | 160 | return -EPROBE_DEFER; |
---|
168 | 161 | |
---|
169 | 162 | priv->rng.name = pdev->name; |
---|
.. | .. |
---|
172 | 165 | priv->rng.cleanup = bcm2835_rng_cleanup; |
---|
173 | 166 | |
---|
174 | 167 | if (dev_of_node(dev)) { |
---|
175 | | - rng_id = of_match_node(bcm2835_rng_of_match, np); |
---|
| 168 | + rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node); |
---|
176 | 169 | if (!rng_id) |
---|
177 | 170 | return -EINVAL; |
---|
178 | 171 | |
---|
.. | .. |
---|
194 | 187 | |
---|
195 | 188 | MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match); |
---|
196 | 189 | |
---|
197 | | -static struct platform_device_id bcm2835_rng_devtype[] = { |
---|
| 190 | +static const struct platform_device_id bcm2835_rng_devtype[] = { |
---|
198 | 191 | { .name = "bcm2835-rng" }, |
---|
199 | 192 | { .name = "bcm63xx-rng" }, |
---|
200 | 193 | { /* sentinel */ } |
---|