aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-11-02 19:05:33 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-28 12:02:51 -0500
commitd7b0364bfc71c4abc97dfc47f85bb32363266e4e (patch)
tree063158e0ecdb2c4acd9ade051e21f10ff93d6eee /drivers/pcmcia
parent0bdf9b3dd3cfa5cbd5d55172c19f5dd166208e17 (diff)
pcmcia: move some window-related code to pcmcia_ioctl.c
pcmcia_get_window() and pcmcia_get_mem_page() were only called from pcmcia_ioctl.c. Therefore, move these functions to that file, and remove the useless EXPORTs. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/cs_internal.h6
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c55
-rw-r--r--drivers/pcmcia/pcmcia_resource.c57
3 files changed, 55 insertions, 63 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 6df41de39d16..3bc02d53a3a3 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -148,10 +148,6 @@ extern struct rw_semaphore pcmcia_socket_list_rwsem;
148extern struct list_head pcmcia_socket_list; 148extern struct list_head pcmcia_socket_list;
149extern struct class pcmcia_socket_class; 149extern struct class pcmcia_socket_class;
150 150
151int pcmcia_get_window(struct pcmcia_socket *s,
152 window_handle_t *wh_out,
153 window_handle_t wh,
154 win_req_t *req);
155int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); 151int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
156struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); 152struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);
157 153
@@ -227,8 +223,6 @@ extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
227 223
228struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, 224struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
229 unsigned int function); 225 unsigned int function);
230int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t win,
231 memreq_t *req);
232 226
233/* pcmcia_ioctl.c */ 227/* pcmcia_ioctl.c */
234extern void __init pcmcia_setup_ioctl(void); 228extern void __init pcmcia_setup_ioctl(void);
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 6245fde02b79..38b3a26a3ff3 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -218,6 +218,61 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
218 return (ret); 218 return (ret);
219} 219}
220 220
221
222/** pcmcia_get_window
223 */
224static int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out,
225 window_handle_t wh, win_req_t *req)
226{
227 window_t *win;
228 window_handle_t w;
229
230 wh--;
231 if (!s || !(s->state & SOCKET_PRESENT))
232 return -ENODEV;
233 if (wh >= MAX_WIN)
234 return -EINVAL;
235 for (w = wh; w < MAX_WIN; w++)
236 if (s->state & SOCKET_WIN_REQ(w))
237 break;
238 if (w == MAX_WIN)
239 return -EINVAL;
240 win = &s->win[w];
241 req->Base = win->ctl.res->start;
242 req->Size = win->ctl.res->end - win->ctl.res->start + 1;
243 req->AccessSpeed = win->ctl.speed;
244 req->Attributes = 0;
245 if (win->ctl.flags & MAP_ATTRIB)
246 req->Attributes |= WIN_MEMORY_TYPE_AM;
247 if (win->ctl.flags & MAP_ACTIVE)
248 req->Attributes |= WIN_ENABLE;
249 if (win->ctl.flags & MAP_16BIT)
250 req->Attributes |= WIN_DATA_WIDTH_16;
251 if (win->ctl.flags & MAP_USE_WAIT)
252 req->Attributes |= WIN_USE_WAIT;
253
254 *wh_out = w + 1;
255 return 0;
256} /* pcmcia_get_window */
257
258
259/** pcmcia_get_mem_page
260 *
261 * Change the card address of an already open memory window.
262 */
263static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh,
264 memreq_t *req)
265{
266 wh--;
267 if (wh >= MAX_WIN)
268 return -EINVAL;
269
270 req->Page = 0;
271 req->CardOffset = skt->win[wh].ctl.card_start;
272 return 0;
273} /* pcmcia_get_mem_page */
274
275
221/** pccard_get_status 276/** pccard_get_status
222 * 277 *
223 * Get the current socket state bits. We don't support the latched 278 * Get the current socket state bits. We don't support the latched
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index ae6abc7833d4..ae68b26a7050 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -185,63 +185,6 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
185EXPORT_SYMBOL(pcmcia_access_configuration_register); 185EXPORT_SYMBOL(pcmcia_access_configuration_register);
186 186
187 187
188/** pcmcia_get_window
189 */
190int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out,
191 window_handle_t wh, win_req_t *req)
192{
193 window_t *win;
194 window_handle_t w;
195
196 if (!s || !(s->state & SOCKET_PRESENT))
197 return -ENODEV;
198
199 wh--;
200 if (wh >= MAX_WIN)
201 return -EINVAL;
202 for (w = wh; w < MAX_WIN; w++)
203 if (s->state & SOCKET_WIN_REQ(w))
204 break;
205 if (w == MAX_WIN)
206 return -EINVAL;
207 win = &s->win[w];
208 req->Base = win->ctl.res->start;
209 req->Size = win->ctl.res->end - win->ctl.res->start + 1;
210 req->AccessSpeed = win->ctl.speed;
211 req->Attributes = 0;
212 if (win->ctl.flags & MAP_ATTRIB)
213 req->Attributes |= WIN_MEMORY_TYPE_AM;
214 if (win->ctl.flags & MAP_ACTIVE)
215 req->Attributes |= WIN_ENABLE;
216 if (win->ctl.flags & MAP_16BIT)
217 req->Attributes |= WIN_DATA_WIDTH_16;
218 if (win->ctl.flags & MAP_USE_WAIT)
219 req->Attributes |= WIN_USE_WAIT;
220
221 *wh_out = w++;
222 return 0;
223} /* pcmcia_get_window */
224EXPORT_SYMBOL(pcmcia_get_window);
225
226
227/** pcmcia_get_mem_page
228 *
229 * Change the card address of an already open memory window.
230 */
231int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh,
232 memreq_t *req)
233{
234 wh--;
235 if (wh >= MAX_WIN)
236 return -EINVAL;
237
238 req->Page = 0;
239 req->CardOffset = skt->win[wh].ctl.card_start;
240 return 0;
241} /* pcmcia_get_mem_page */
242EXPORT_SYMBOL(pcmcia_get_mem_page);
243
244
245int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, 188int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
246 memreq_t *req) 189 memreq_t *req)
247{ 190{