Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
1da177e4 LT |
2 | /* |
3 | * rsrc_mgr.c -- Resource management routines and/or wrappers | |
4 | * | |
1da177e4 LT |
5 | * The initial developer of the original code is David A. Hinds |
6 | * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds | |
7 | * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. | |
8 | * | |
9 | * (C) 1999 David A. Hinds | |
10 | */ | |
11 | ||
5a0e3ad6 | 12 | #include <linux/slab.h> |
1da177e4 LT |
13 | #include <linux/module.h> |
14 | #include <linux/kernel.h> | |
15 | ||
1da177e4 | 16 | #include <pcmcia/ss.h> |
91284224 | 17 | #include <pcmcia/cistpl.h> |
1da177e4 LT |
18 | #include "cs_internal.h" |
19 | ||
49b1153a | 20 | int static_init(struct pcmcia_socket *s) |
1da177e4 | 21 | { |
1da177e4 LT |
22 | /* the good thing about SS_CAP_STATIC_MAP sockets is |
23 | * that they don't need a resource database */ | |
24 | ||
1da177e4 | 25 | s->resource_setup_done = 1; |
1da177e4 LT |
26 | |
27 | return 0; | |
28 | } | |
29 | ||
a6c6193a AC |
30 | struct resource *pcmcia_make_resource(resource_size_t start, |
31 | resource_size_t end, | |
32 | unsigned long flags, const char *name) | |
3b27e942 DB |
33 | { |
34 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); | |
35 | ||
36 | if (res) { | |
37 | res->name = name; | |
49b1153a DB |
38 | res->start = start; |
39 | res->end = start + end - 1; | |
3b27e942 DB |
40 | res->flags = flags; |
41 | } | |
42 | return res; | |
43 | } | |
44 | ||
b19a7275 DB |
45 | static int static_find_io(struct pcmcia_socket *s, unsigned int attr, |
46 | unsigned int *base, unsigned int num, | |
ad0c7be2 | 47 | unsigned int align, struct resource **parent) |
b19a7275 DB |
48 | { |
49 | if (!s->io_offset) | |
50 | return -EINVAL; | |
51 | *base = s->io_offset | (*base & 0x0fff); | |
ad0c7be2 | 52 | *parent = NULL; |
b19a7275 DB |
53 | |
54 | return 0; | |
55 | } | |
56 | ||
3b27e942 | 57 | |
49b1153a | 58 | struct pccard_resource_ops pccard_static_ops = { |
3b27e942 | 59 | .validate_mem = NULL, |
b19a7275 | 60 | .find_io = static_find_io, |
3b27e942 | 61 | .find_mem = NULL, |
3b27e942 DB |
62 | .init = static_init, |
63 | .exit = NULL, | |
64 | }; | |
49b1153a DB |
65 | EXPORT_SYMBOL(pccard_static_ops); |
66 | ||
3b27e942 | 67 | |
49b1153a DB |
68 | MODULE_AUTHOR("David A. Hinds, Dominik Brodowski"); |
69 | MODULE_LICENSE("GPL"); | |
70 | MODULE_ALIAS("rsrc_nonstatic"); |