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