hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/char/hw_random/bcm2835-rng.c
....@@ -1,10 +1,7 @@
1
-/**
1
+// SPDX-License-Identifier: GPL-2.0
2
+/*
23 * Copyright (c) 2010-2012 Broadcom. All rights reserved.
34 * 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.
85 */
96
107 #include <linux/hw_random.h>
....@@ -142,10 +139,8 @@
142139 {
143140 const struct bcm2835_rng_of_data *of_data;
144141 struct device *dev = &pdev->dev;
145
- struct device_node *np = dev->of_node;
146142 const struct of_device_id *rng_id;
147143 struct bcm2835_rng_priv *priv;
148
- struct resource *r;
149144 int err;
150145
151146 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
....@@ -154,16 +149,14 @@
154149
155150 platform_set_drvdata(pdev, priv);
156151
157
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
158
-
159152 /* map peripheral */
160
- priv->base = devm_ioremap_resource(dev, r);
153
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
161154 if (IS_ERR(priv->base))
162155 return PTR_ERR(priv->base);
163156
164157 /* Clock is optional on most platforms */
165158 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)
167160 return -EPROBE_DEFER;
168161
169162 priv->rng.name = pdev->name;
....@@ -172,7 +165,7 @@
172165 priv->rng.cleanup = bcm2835_rng_cleanup;
173166
174167 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);
176169 if (!rng_id)
177170 return -EINVAL;
178171
....@@ -194,7 +187,7 @@
194187
195188 MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match);
196189
197
-static struct platform_device_id bcm2835_rng_devtype[] = {
190
+static const struct platform_device_id bcm2835_rng_devtype[] = {
198191 { .name = "bcm2835-rng" },
199192 { .name = "bcm63xx-rng" },
200193 { /* sentinel */ }