From 6f37d9efd9183ff06e65438e349ac2341d459290 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 28 Jan 2019 22:55:33 -0800 Subject: commands: Move /dev/mem driver to drivers/misc With all other code gone from commands/mem.c, move it into driver/misc, where it fits better. While at it, expose it directly via a Kconfig options instead of relying on CONFIG_COMPILE_MEMORY Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/Kconfig | 17 +++++------- commands/Makefile | 1 - commands/mem.c | 77 ------------------------------------------------------- 3 files changed, 6 insertions(+), 89 deletions(-) delete mode 100644 commands/mem.c (limited to 'commands') diff --git a/commands/Kconfig b/commands/Kconfig index 1de4b9d604..c14332c9d7 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -14,11 +14,6 @@ config COMPILE_HASH help Turns on compilation of digest.c -config COMPILE_MEMORY - bool - help - Turns on compilation of mem.c - menu "Commands" @@ -1493,7 +1488,7 @@ config CMD_CRC_CMP config CMD_MD tristate default y - select COMPILE_MEMORY + select DEV_MEM prompt "md" help Memory display @@ -1517,7 +1512,7 @@ config CMD_MD config CMD_MEMCMP tristate default y - select COMPILE_MEMORY + select DEV_MEM prompt "memcmp" help Memory compare @@ -1539,7 +1534,7 @@ config CMD_MEMCMP config CMD_MEMCPY tristate default y - select COMPILE_MEMORY + select DEV_MEM prompt "memcpy" help Memory copy @@ -1558,7 +1553,7 @@ config CMD_MEMCPY config CMD_MEMSET tristate default y - select COMPILE_MEMORY + select DEV_MEM prompt "memset" help Memory fill @@ -1591,7 +1586,7 @@ config CMD_MEMTEST config CMD_MM tristate - select COMPILE_MEMORY + select DEV_MEM prompt "memory modify (mm)" help Memory modify with mask @@ -1609,7 +1604,7 @@ config CMD_MM config CMD_MW tristate default y - select COMPILE_MEMORY + select DEV_MEM prompt "mw" help Memory write diff --git a/commands/Makefile b/commands/Makefile index eb4796389e..358671bb5b 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_STDDEV) += stddev.o obj-$(CONFIG_CMD_DIGEST) += digest.o obj-$(CONFIG_COMPILE_HASH) += hashsum.o -obj-$(CONFIG_COMPILE_MEMORY) += mem.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_UIMAGE) += uimage.o obj-$(CONFIG_CMD_LINUX16) += linux16.o diff --git a/commands/mem.c b/commands/mem.c deleted file mode 100644 index 8a47e1fe1b..0000000000 --- a/commands/mem.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2011 Sascha Hauer , Pengutronix - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * 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. - * - */ - -/* - * Memory Functions - * - * Copied from FADS ROM, Dan Malek (dmalek@jlc.net) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CMD_MEM_DEBUG -#define PRINTF(fmt,args...) printf (fmt ,##args) -#else -#define PRINTF(fmt,args...) -#endif - -static struct cdev_operations memops = { - .read = mem_read, - .write = mem_write, - .memmap = generic_memmap_rw, - .lseek = dev_lseek_default, -}; - -static int mem_probe(struct device_d *dev) -{ - struct cdev *cdev; - - cdev = xzalloc(sizeof (*cdev)); - dev->priv = cdev; - - cdev->name = (char*)dev->resource[0].name; - cdev->size = min_t(unsigned long long, resource_size(&dev->resource[0]), - S64_MAX); - cdev->ops = &memops; - cdev->dev = dev; - - devfs_create(cdev); - - return 0; -} - -static struct driver_d mem_drv = { - .name = "mem", - .probe = mem_probe, -}; - -static int mem_init(void) -{ - add_mem_device("mem", 0, ~0, IORESOURCE_MEM_WRITEABLE); - return platform_driver_register(&mem_drv); -} -device_initcall(mem_init); -- cgit v1.2.3