diff options
Diffstat (limited to 'drivers/pcmcia/cs_internal.h')
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 89 |
1 files changed, 27 insertions, 62 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 3bc02d53a3a3..f95864c2191e 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -87,37 +87,11 @@ struct pccard_resource_ops { | |||
87 | #define SOCKET_CARDBUS 0x8000 | 87 | #define SOCKET_CARDBUS 0x8000 |
88 | #define SOCKET_CARDBUS_CONFIG 0x10000 | 88 | #define SOCKET_CARDBUS_CONFIG 0x10000 |
89 | 89 | ||
90 | static inline int cs_socket_get(struct pcmcia_socket *skt) | ||
91 | { | ||
92 | int ret; | ||
93 | |||
94 | WARN_ON(skt->state & SOCKET_INUSE); | ||
95 | |||
96 | ret = try_module_get(skt->owner); | ||
97 | if (ret) | ||
98 | skt->state |= SOCKET_INUSE; | ||
99 | return ret; | ||
100 | } | ||
101 | |||
102 | static inline void cs_socket_put(struct pcmcia_socket *skt) | ||
103 | { | ||
104 | if (skt->state & SOCKET_INUSE) { | ||
105 | skt->state &= ~SOCKET_INUSE; | ||
106 | module_put(skt->owner); | ||
107 | } | ||
108 | } | ||
109 | |||
110 | 90 | ||
111 | /* | 91 | /* |
112 | * Stuff internal to module "pcmcia_core": | 92 | * Stuff internal to module "pcmcia_core": |
113 | */ | 93 | */ |
114 | 94 | ||
115 | /* cistpl.c */ | ||
116 | int verify_cis_cache(struct pcmcia_socket *s); | ||
117 | |||
118 | /* rsrc_mgr.c */ | ||
119 | void release_resource_db(struct pcmcia_socket *s); | ||
120 | |||
121 | /* socket_sysfs.c */ | 95 | /* socket_sysfs.c */ |
122 | extern int pccard_sysfs_add_socket(struct device *dev); | 96 | extern int pccard_sysfs_add_socket(struct device *dev); |
123 | extern void pccard_sysfs_remove_socket(struct device *dev); | 97 | extern void pccard_sysfs_remove_socket(struct device *dev); |
@@ -125,8 +99,6 @@ extern void pccard_sysfs_remove_socket(struct device *dev); | |||
125 | /* cardbus.c */ | 99 | /* cardbus.c */ |
126 | int cb_alloc(struct pcmcia_socket *s); | 100 | int cb_alloc(struct pcmcia_socket *s); |
127 | void cb_free(struct pcmcia_socket *s); | 101 | void cb_free(struct pcmcia_socket *s); |
128 | int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, | ||
129 | void *ptr); | ||
130 | 102 | ||
131 | 103 | ||
132 | 104 | ||
@@ -138,7 +110,8 @@ struct pcmcia_callback{ | |||
138 | struct module *owner; | 110 | struct module *owner; |
139 | int (*event) (struct pcmcia_socket *s, | 111 | int (*event) (struct pcmcia_socket *s, |
140 | event_t event, int priority); | 112 | event_t event, int priority); |
141 | void (*requery) (struct pcmcia_socket *s, int new_cis); | 113 | void (*requery) (struct pcmcia_socket *s); |
114 | int (*validate) (struct pcmcia_socket *s, unsigned int *i); | ||
142 | int (*suspend) (struct pcmcia_socket *s); | 115 | int (*suspend) (struct pcmcia_socket *s); |
143 | int (*resume) (struct pcmcia_socket *s); | 116 | int (*resume) (struct pcmcia_socket *s); |
144 | }; | 117 | }; |
@@ -151,16 +124,35 @@ extern struct class pcmcia_socket_class; | |||
151 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | 124 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); |
152 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); | 125 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); |
153 | 126 | ||
154 | int pcmcia_suspend_card(struct pcmcia_socket *skt); | 127 | void pcmcia_parse_uevents(struct pcmcia_socket *socket, unsigned int events); |
155 | int pcmcia_resume_card(struct pcmcia_socket *skt); | 128 | #define PCMCIA_UEVENT_EJECT 0x0001 |
156 | 129 | #define PCMCIA_UEVENT_INSERT 0x0002 | |
157 | int pcmcia_eject_card(struct pcmcia_socket *skt); | 130 | #define PCMCIA_UEVENT_SUSPEND 0x0004 |
158 | int pcmcia_insert_card(struct pcmcia_socket *skt); | 131 | #define PCMCIA_UEVENT_RESUME 0x0008 |
132 | #define PCMCIA_UEVENT_REQUERY 0x0010 | ||
159 | 133 | ||
160 | struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt); | 134 | struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt); |
161 | void pcmcia_put_socket(struct pcmcia_socket *skt); | 135 | void pcmcia_put_socket(struct pcmcia_socket *skt); |
162 | 136 | ||
137 | /* | ||
138 | * Stuff internal to module "pcmcia". | ||
139 | */ | ||
140 | /* ds.c */ | ||
141 | extern struct bus_type pcmcia_bus_type; | ||
142 | |||
143 | /* pcmcia_resource.c */ | ||
144 | extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); | ||
145 | extern int pcmcia_validate_mem(struct pcmcia_socket *s); | ||
146 | extern struct resource *pcmcia_find_mem_region(u_long base, | ||
147 | u_long num, | ||
148 | u_long align, | ||
149 | int low, | ||
150 | struct pcmcia_socket *s); | ||
151 | |||
152 | |||
163 | /* cistpl.c */ | 153 | /* cistpl.c */ |
154 | extern struct bin_attribute pccard_cis_attr; | ||
155 | |||
164 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, | 156 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, |
165 | u_int addr, u_int len, void *ptr); | 157 | u_int addr, u_int len, void *ptr); |
166 | void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, | 158 | void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, |
@@ -172,8 +164,8 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, | |||
172 | int pcmcia_replace_cis(struct pcmcia_socket *s, | 164 | int pcmcia_replace_cis(struct pcmcia_socket *s, |
173 | const u8 *data, const size_t len); | 165 | const u8 *data, const size_t len); |
174 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); | 166 | int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); |
167 | int verify_cis_cache(struct pcmcia_socket *s); | ||
175 | 168 | ||
176 | /* loop over CIS entries */ | ||
177 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, | 169 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, |
178 | cisdata_t code, cisparse_t *parse, void *priv_data, | 170 | cisdata_t code, cisparse_t *parse, void *priv_data, |
179 | int (*loop_tuple) (tuple_t *tuple, | 171 | int (*loop_tuple) (tuple_t *tuple, |
@@ -189,35 +181,8 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, | |||
189 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); | 181 | int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); |
190 | 182 | ||
191 | 183 | ||
192 | /* rsrc_mgr.c */ | ||
193 | int pcmcia_validate_mem(struct pcmcia_socket *s); | ||
194 | struct resource *pcmcia_find_io_region(unsigned long base, | ||
195 | int num, | ||
196 | unsigned long align, | ||
197 | struct pcmcia_socket *s); | ||
198 | int pcmcia_adjust_io_region(struct resource *res, | ||
199 | unsigned long r_start, | ||
200 | unsigned long r_end, | ||
201 | struct pcmcia_socket *s); | ||
202 | struct resource *pcmcia_find_mem_region(u_long base, | ||
203 | u_long num, | ||
204 | u_long align, | ||
205 | int low, | ||
206 | struct pcmcia_socket *s); | ||
207 | |||
208 | /* | ||
209 | * Stuff internal to module "pcmcia". | ||
210 | */ | ||
211 | /* ds.c */ | ||
212 | extern struct bus_type pcmcia_bus_type; | ||
213 | |||
214 | /* pcmcia_resource.c */ | ||
215 | extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); | ||
216 | |||
217 | #ifdef CONFIG_PCMCIA_IOCTL | 184 | #ifdef CONFIG_PCMCIA_IOCTL |
218 | /* ds.c */ | 185 | /* ds.c */ |
219 | extern spinlock_t pcmcia_dev_list_lock; | ||
220 | |||
221 | extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev); | 186 | extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev); |
222 | extern void pcmcia_put_dev(struct pcmcia_device *p_dev); | 187 | extern void pcmcia_put_dev(struct pcmcia_device *p_dev); |
223 | 188 | ||