Commit b528e0d6 authored by Russell King's avatar Russell King

[PCMCIA] socket user operations should take pcmcia_socket

Patch from Dominik Brodowski, updated by Russell King.
 
The pcmcia_{suspend,resume,eject,insert}_card calls are only issued
by the userspace cardctl tool via ds.c. There's no need to verify the
caller (ds) has a valid "handle", as long as it knows the proper
struct pcmcia_socket.
parent 583f08b7
......@@ -1958,14 +1958,10 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req)
======================================================================*/
int pcmcia_suspend_card(client_handle_t handle, client_req_t *req)
int pcmcia_suspend_card(struct pcmcia_socket *skt)
{
struct pcmcia_socket *skt;
int ret;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
skt = SOCKET(handle);
cs_dbg(skt, 1, "suspending socket\n");
down(&skt->skt_sem);
......@@ -1985,14 +1981,10 @@ int pcmcia_suspend_card(client_handle_t handle, client_req_t *req)
return ret;
} /* suspend_card */
int pcmcia_resume_card(client_handle_t handle, client_req_t *req)
int pcmcia_resume_card(struct pcmcia_socket *skt)
{
struct pcmcia_socket *skt;
int ret;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
skt = SOCKET(handle);
cs_dbg(skt, 1, "waking up socket\n");
down(&skt->skt_sem);
......@@ -2018,14 +2010,10 @@ int pcmcia_resume_card(client_handle_t handle, client_req_t *req)
======================================================================*/
int pcmcia_eject_card(client_handle_t handle, client_req_t *req)
int pcmcia_eject_card(struct pcmcia_socket *skt)
{
struct pcmcia_socket *skt;
int ret;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
skt = SOCKET(handle);
cs_dbg(skt, 1, "user eject request\n");
down(&skt->skt_sem);
......@@ -2047,14 +2035,10 @@ int pcmcia_eject_card(client_handle_t handle, client_req_t *req)
return ret;
} /* eject_card */
int pcmcia_insert_card(client_handle_t handle, client_req_t *req)
int pcmcia_insert_card(struct pcmcia_socket *skt)
{
struct pcmcia_socket *skt;
int ret;
if (CHECK_HANDLE(handle))
return CS_BAD_HANDLE;
skt = SOCKET(handle);
cs_dbg(skt, 1, "user insert request\n");
down(&skt->skt_sem);
......
......@@ -964,16 +964,16 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret = pcmcia_validate_cis(s->handle, &buf.cisinfo);
break;
case DS_SUSPEND_CARD:
ret = pcmcia_suspend_card(s->handle, NULL);
ret = pcmcia_suspend_card(s->parent);
break;
case DS_RESUME_CARD:
ret = pcmcia_resume_card(s->handle, NULL);
ret = pcmcia_resume_card(s->parent);
break;
case DS_EJECT_CARD:
ret = pcmcia_eject_card(s->handle, NULL);
ret = pcmcia_eject_card(s->parent);
break;
case DS_INSERT_CARD:
ret = pcmcia_insert_card(s->handle, NULL);
ret = pcmcia_insert_card(s->parent);
break;
case DS_ACCESS_CONFIGURATION_REGISTER:
if ((buf.conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN))
......
......@@ -445,10 +445,10 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req);
int pcmcia_request_irq(client_handle_t handle, irq_req_t *req);
int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh);
int pcmcia_reset_card(client_handle_t handle, client_req_t *req);
int pcmcia_suspend_card(client_handle_t handle, client_req_t *req);
int pcmcia_resume_card(client_handle_t handle, client_req_t *req);
int pcmcia_eject_card(client_handle_t handle, client_req_t *req);
int pcmcia_insert_card(client_handle_t handle, client_req_t *req);
int pcmcia_suspend_card(struct pcmcia_socket *skt);
int pcmcia_resume_card(struct pcmcia_socket *skt);
int pcmcia_eject_card(struct pcmcia_socket *skt);
int pcmcia_insert_card(struct pcmcia_socket *skt);
int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask);
int pcmcia_report_error(client_handle_t handle, error_info_t *err);
struct pci_bus *pcmcia_lookup_bus(client_handle_t handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment