mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
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>
This commit is contained in:
parent
0bdf9b3dd3
commit
d7b0364bfc
3 changed files with 55 additions and 63 deletions
|
@ -148,10 +148,6 @@ extern struct rw_semaphore pcmcia_socket_list_rwsem;
|
|||
extern struct list_head pcmcia_socket_list;
|
||||
extern struct class pcmcia_socket_class;
|
||||
|
||||
int pcmcia_get_window(struct pcmcia_socket *s,
|
||||
window_handle_t *wh_out,
|
||||
window_handle_t wh,
|
||||
win_req_t *req);
|
||||
int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
|
||||
struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);
|
||||
|
||||
|
@ -227,8 +223,6 @@ extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
|
|||
|
||||
struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
|
||||
unsigned int function);
|
||||
int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t win,
|
||||
memreq_t *req);
|
||||
|
||||
/* pcmcia_ioctl.c */
|
||||
extern void __init pcmcia_setup_ioctl(void);
|
||||
|
|
|
@ -218,6 +218,61 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
|
|||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/** pcmcia_get_window
|
||||
*/
|
||||
static int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out,
|
||||
window_handle_t wh, win_req_t *req)
|
||||
{
|
||||
window_t *win;
|
||||
window_handle_t w;
|
||||
|
||||
wh--;
|
||||
if (!s || !(s->state & SOCKET_PRESENT))
|
||||
return -ENODEV;
|
||||
if (wh >= MAX_WIN)
|
||||
return -EINVAL;
|
||||
for (w = wh; w < MAX_WIN; w++)
|
||||
if (s->state & SOCKET_WIN_REQ(w))
|
||||
break;
|
||||
if (w == MAX_WIN)
|
||||
return -EINVAL;
|
||||
win = &s->win[w];
|
||||
req->Base = win->ctl.res->start;
|
||||
req->Size = win->ctl.res->end - win->ctl.res->start + 1;
|
||||
req->AccessSpeed = win->ctl.speed;
|
||||
req->Attributes = 0;
|
||||
if (win->ctl.flags & MAP_ATTRIB)
|
||||
req->Attributes |= WIN_MEMORY_TYPE_AM;
|
||||
if (win->ctl.flags & MAP_ACTIVE)
|
||||
req->Attributes |= WIN_ENABLE;
|
||||
if (win->ctl.flags & MAP_16BIT)
|
||||
req->Attributes |= WIN_DATA_WIDTH_16;
|
||||
if (win->ctl.flags & MAP_USE_WAIT)
|
||||
req->Attributes |= WIN_USE_WAIT;
|
||||
|
||||
*wh_out = w + 1;
|
||||
return 0;
|
||||
} /* pcmcia_get_window */
|
||||
|
||||
|
||||
/** pcmcia_get_mem_page
|
||||
*
|
||||
* Change the card address of an already open memory window.
|
||||
*/
|
||||
static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh,
|
||||
memreq_t *req)
|
||||
{
|
||||
wh--;
|
||||
if (wh >= MAX_WIN)
|
||||
return -EINVAL;
|
||||
|
||||
req->Page = 0;
|
||||
req->CardOffset = skt->win[wh].ctl.card_start;
|
||||
return 0;
|
||||
} /* pcmcia_get_mem_page */
|
||||
|
||||
|
||||
/** pccard_get_status
|
||||
*
|
||||
* Get the current socket state bits. We don't support the latched
|
||||
|
|
|
@ -185,63 +185,6 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
|
|||
EXPORT_SYMBOL(pcmcia_access_configuration_register);
|
||||
|
||||
|
||||
/** pcmcia_get_window
|
||||
*/
|
||||
int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *wh_out,
|
||||
window_handle_t wh, win_req_t *req)
|
||||
{
|
||||
window_t *win;
|
||||
window_handle_t w;
|
||||
|
||||
if (!s || !(s->state & SOCKET_PRESENT))
|
||||
return -ENODEV;
|
||||
|
||||
wh--;
|
||||
if (wh >= MAX_WIN)
|
||||
return -EINVAL;
|
||||
for (w = wh; w < MAX_WIN; w++)
|
||||
if (s->state & SOCKET_WIN_REQ(w))
|
||||
break;
|
||||
if (w == MAX_WIN)
|
||||
return -EINVAL;
|
||||
win = &s->win[w];
|
||||
req->Base = win->ctl.res->start;
|
||||
req->Size = win->ctl.res->end - win->ctl.res->start + 1;
|
||||
req->AccessSpeed = win->ctl.speed;
|
||||
req->Attributes = 0;
|
||||
if (win->ctl.flags & MAP_ATTRIB)
|
||||
req->Attributes |= WIN_MEMORY_TYPE_AM;
|
||||
if (win->ctl.flags & MAP_ACTIVE)
|
||||
req->Attributes |= WIN_ENABLE;
|
||||
if (win->ctl.flags & MAP_16BIT)
|
||||
req->Attributes |= WIN_DATA_WIDTH_16;
|
||||
if (win->ctl.flags & MAP_USE_WAIT)
|
||||
req->Attributes |= WIN_USE_WAIT;
|
||||
|
||||
*wh_out = w++;
|
||||
return 0;
|
||||
} /* pcmcia_get_window */
|
||||
EXPORT_SYMBOL(pcmcia_get_window);
|
||||
|
||||
|
||||
/** pcmcia_get_mem_page
|
||||
*
|
||||
* Change the card address of an already open memory window.
|
||||
*/
|
||||
int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh,
|
||||
memreq_t *req)
|
||||
{
|
||||
wh--;
|
||||
if (wh >= MAX_WIN)
|
||||
return -EINVAL;
|
||||
|
||||
req->Page = 0;
|
||||
req->CardOffset = skt->win[wh].ctl.card_start;
|
||||
return 0;
|
||||
} /* pcmcia_get_mem_page */
|
||||
EXPORT_SYMBOL(pcmcia_get_mem_page);
|
||||
|
||||
|
||||
int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh,
|
||||
memreq_t *req)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue