summaryrefslogtreecommitdiffstats
path: root/drivers/misc/sram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sram.c')
-rw-r--r--drivers/misc/sram.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index 053b35150c..2ebd82436e 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -1,15 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* drivers/misc/sram.c - generic memory mapped SRAM driver
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <common.h>
@@ -31,28 +22,21 @@ static struct cdev_operations memops = {
.memmap = generic_memmap_rw,
};
-static int sram_probe(struct device_d *dev)
+static int sram_probe(struct device *dev)
{
struct resource *iores;
struct sram *sram;
- struct resource *res;
- void __iomem *base;
int ret;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
- base = IOMEM(iores->start);
sram = xzalloc(sizeof(*sram));
sram->cdev.name = basprintf("sram%d", cdev_find_free_index("sram"));
- res = dev_get_resource(dev, IORESOURCE_MEM, 0);
- if (IS_ERR(res))
- return PTR_ERR(res);
-
- sram->cdev.size = (unsigned long)resource_size(res);
+ sram->cdev.size = (unsigned long)resource_size(iores);
sram->cdev.ops = &memops;
sram->cdev.dev = dev;
@@ -69,8 +53,9 @@ static __maybe_unused struct of_device_id sram_dt_ids[] = {
}, {
},
};
+MODULE_DEVICE_TABLE(of, sram_dt_ids);
-static struct driver_d sram_driver = {
+static struct driver sram_driver = {
.name = "mmio-sram",
.probe = sram_probe,
.of_compatible = sram_dt_ids,