Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * rsrc_mgr.c -- Resource management routines and/or wrappers
 4 *
 
 
 
 
 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
12#include <linux/slab.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15
16#include <pcmcia/ss.h>
17#include <pcmcia/cistpl.h>
18#include "cs_internal.h"
19
20int static_init(struct pcmcia_socket *s)
21{
22	/* the good thing about SS_CAP_STATIC_MAP sockets is
23	 * that they don't need a resource database */
24
25	s->resource_setup_done = 1;
26
27	return 0;
28}
29
30struct resource *pcmcia_make_resource(resource_size_t start,
31					resource_size_t end,
32					unsigned long flags, const char *name)
33{
34	struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
35
36	if (res) {
37		res->name = name;
38		res->start = start;
39		res->end = start + end - 1;
40		res->flags = flags;
41	}
42	return res;
43}
44
45static int static_find_io(struct pcmcia_socket *s, unsigned int attr,
46			unsigned int *base, unsigned int num,
47			unsigned int align, struct resource **parent)
48{
49	if (!s->io_offset)
50		return -EINVAL;
51	*base = s->io_offset | (*base & 0x0fff);
52	*parent = NULL;
53
54	return 0;
55}
56
57
58struct pccard_resource_ops pccard_static_ops = {
59	.validate_mem = NULL,
60	.find_io = static_find_io,
61	.find_mem = NULL,
62	.init = static_init,
63	.exit = NULL,
64};
65EXPORT_SYMBOL(pccard_static_ops);
66
67
68MODULE_AUTHOR("David A. Hinds, Dominik Brodowski");
69MODULE_DESCRIPTION("PCMCIA resource management routines");
70MODULE_LICENSE("GPL");
71MODULE_ALIAS("rsrc_nonstatic");
v4.17
 
 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
15#include <linux/slab.h>
16#include <linux/module.h>
17#include <linux/kernel.h>
18
19#include <pcmcia/ss.h>
20#include <pcmcia/cistpl.h>
21#include "cs_internal.h"
22
23int static_init(struct pcmcia_socket *s)
24{
25	/* the good thing about SS_CAP_STATIC_MAP sockets is
26	 * that they don't need a resource database */
27
28	s->resource_setup_done = 1;
29
30	return 0;
31}
32
33struct resource *pcmcia_make_resource(resource_size_t start,
34					resource_size_t end,
35					unsigned long flags, const char *name)
36{
37	struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
38
39	if (res) {
40		res->name = name;
41		res->start = start;
42		res->end = start + end - 1;
43		res->flags = flags;
44	}
45	return res;
46}
47
48static int static_find_io(struct pcmcia_socket *s, unsigned int attr,
49			unsigned int *base, unsigned int num,
50			unsigned int align, struct resource **parent)
51{
52	if (!s->io_offset)
53		return -EINVAL;
54	*base = s->io_offset | (*base & 0x0fff);
55	*parent = NULL;
56
57	return 0;
58}
59
60
61struct pccard_resource_ops pccard_static_ops = {
62	.validate_mem = NULL,
63	.find_io = static_find_io,
64	.find_mem = NULL,
65	.init = static_init,
66	.exit = NULL,
67};
68EXPORT_SYMBOL(pccard_static_ops);
69
70
71MODULE_AUTHOR("David A. Hinds, Dominik Brodowski");
 
72MODULE_LICENSE("GPL");
73MODULE_ALIAS("rsrc_nonstatic");