staging: unisys: Eliminate visor_memregion_read()
[platform/kernel/linux-starfive.git] / drivers / staging / unisys / visorutil / memregion_direct.c
1 /* memregion_direct.c
2  *
3  * Copyright (C) 2010 - 2013 UNISYS CORPORATION
4  * All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or (at
9  * your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14  * NON INFRINGEMENT.  See the GNU General Public License for more
15  * details.
16  */
17
18 /*
19  *  This is an implementation of memory regions that can be used to read/write
20  *  channel memory (in main memory of the host system) from code running in
21  *  a virtual partition.
22  */
23 #include "timskmod.h"
24 #include "memregion.h"
25
26 #define MYDRVNAME "memregion"
27
28 int
29 visor_memregion_write(struct memregion *memregion, ulong offset, void *src,
30                       ulong nbytes)
31 {
32         if (offset + nbytes > memregion->nbytes)
33                 return -EIO;
34
35         memcpy_toio(memregion->mapped + offset, src, nbytes);
36         return 0;
37 }
38 EXPORT_SYMBOL_GPL(visor_memregion_write);