Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * rsrc_mgr.c -- Resource management routines and/or wrappers
0004  *
0005  * The initial developer of the original code is David A. Hinds
0006  * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
0007  * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
0008  *
0009  * (C) 1999     David A. Hinds
0010  */
0011 
0012 #include <linux/slab.h>
0013 #include <linux/module.h>
0014 #include <linux/kernel.h>
0015 
0016 #include <pcmcia/ss.h>
0017 #include <pcmcia/cistpl.h>
0018 #include "cs_internal.h"
0019 
0020 int static_init(struct pcmcia_socket *s)
0021 {
0022     /* the good thing about SS_CAP_STATIC_MAP sockets is
0023      * that they don't need a resource database */
0024 
0025     s->resource_setup_done = 1;
0026 
0027     return 0;
0028 }
0029 
0030 struct resource *pcmcia_make_resource(resource_size_t start,
0031                     resource_size_t end,
0032                     unsigned long flags, const char *name)
0033 {
0034     struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
0035 
0036     if (res) {
0037         res->name = name;
0038         res->start = start;
0039         res->end = start + end - 1;
0040         res->flags = flags;
0041     }
0042     return res;
0043 }
0044 
0045 static int static_find_io(struct pcmcia_socket *s, unsigned int attr,
0046             unsigned int *base, unsigned int num,
0047             unsigned int align, struct resource **parent)
0048 {
0049     if (!s->io_offset)
0050         return -EINVAL;
0051     *base = s->io_offset | (*base & 0x0fff);
0052     *parent = NULL;
0053 
0054     return 0;
0055 }
0056 
0057 
0058 struct pccard_resource_ops pccard_static_ops = {
0059     .validate_mem = NULL,
0060     .find_io = static_find_io,
0061     .find_mem = NULL,
0062     .init = static_init,
0063     .exit = NULL,
0064 };
0065 EXPORT_SYMBOL(pccard_static_ops);
0066 
0067 
0068 MODULE_AUTHOR("David A. Hinds, Dominik Brodowski");
0069 MODULE_LICENSE("GPL");
0070 MODULE_ALIAS("rsrc_nonstatic");