aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/cs_internal.h')
-rw-r--r--drivers/pcmcia/cs_internal.h89
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
90static 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
102static 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 */
116int verify_cis_cache(struct pcmcia_socket *s);
117
118/* rsrc_mgr.c */
119void release_resource_db(struct pcmcia_socket *s);
120
121/* socket_sysfs.c */ 95/* socket_sysfs.c */
122extern int pccard_sysfs_add_socket(struct device *dev); 96extern int pccard_sysfs_add_socket(struct device *dev);
123extern void pccard_sysfs_remove_socket(struct device *dev); 97extern 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 */
126int cb_alloc(struct pcmcia_socket *s); 100int cb_alloc(struct pcmcia_socket *s);
127void cb_free(struct pcmcia_socket *s); 101void cb_free(struct pcmcia_socket *s);
128int 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;
151int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); 124int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
152struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); 125struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);
153 126
154int pcmcia_suspend_card(struct pcmcia_socket *skt); 127void pcmcia_parse_uevents(struct pcmcia_socket *socket, unsigned int events);
155int pcmcia_resume_card(struct pcmcia_socket *skt); 128#define PCMCIA_UEVENT_EJECT 0x0001
156 129#define PCMCIA_UEVENT_INSERT 0x0002
157int pcmcia_eject_card(struct pcmcia_socket *skt); 130#define PCMCIA_UEVENT_SUSPEND 0x0004
158int pcmcia_insert_card(struct pcmcia_socket *skt); 131#define PCMCIA_UEVENT_RESUME 0x0008
132#define PCMCIA_UEVENT_REQUERY 0x0010
159 133
160struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt); 134struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt);
161void pcmcia_put_socket(struct pcmcia_socket *skt); 135void pcmcia_put_socket(struct pcmcia_socket *skt);
162 136
137/*
138 * Stuff internal to module "pcmcia".
139 */
140/* ds.c */
141extern struct bus_type pcmcia_bus_type;
142
143/* pcmcia_resource.c */
144extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
145extern int pcmcia_validate_mem(struct pcmcia_socket *s);
146extern 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 */
154extern struct bin_attribute pccard_cis_attr;
155
164int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, 156int 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);
166void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, 158void 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,
172int pcmcia_replace_cis(struct pcmcia_socket *s, 164int pcmcia_replace_cis(struct pcmcia_socket *s,
173 const u8 *data, const size_t len); 165 const u8 *data, const size_t len);
174int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); 166int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count);
167int verify_cis_cache(struct pcmcia_socket *s);
175 168
176/* loop over CIS entries */
177int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, 169int 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,
189int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); 181int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
190 182
191 183
192/* rsrc_mgr.c */
193int pcmcia_validate_mem(struct pcmcia_socket *s);
194struct resource *pcmcia_find_io_region(unsigned long base,
195 int num,
196 unsigned long align,
197 struct pcmcia_socket *s);
198int pcmcia_adjust_io_region(struct resource *res,
199 unsigned long r_start,
200 unsigned long r_end,
201 struct pcmcia_socket *s);
202struct 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 */
212extern struct bus_type pcmcia_bus_type;
213
214/* pcmcia_resource.c */
215extern 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 */
219extern spinlock_t pcmcia_dev_list_lock;
220
221extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev); 186extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev);
222extern void pcmcia_put_dev(struct pcmcia_device *p_dev); 187extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
223 188