[PATCH 30/39] pcmcia: deprecate CS_IN_USE

Larry Finger Larry.Finger at lwfinger.net
Wed Aug 20 15:46:58 EDT 2008


Dominik Brodowski wrote:
> If a resource is already in use, mark it with -EBUSY. Same for cards already
> asleep.
> 
> Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
> ---
>  drivers/pcmcia/cs.c              |    6 ++--
>  drivers/pcmcia/pcmcia_resource.c |   39 +++++++++++++++++++++++++------------
>  include/pcmcia/cs.h              |    2 +-
>  3 files changed, 30 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
> index 30d7b49..940c9aa 100644
> --- a/drivers/pcmcia/cs.c
> +++ b/drivers/pcmcia/cs.c
> @@ -534,7 +534,7 @@ static int socket_insert(struct pcmcia_socket *skt)
>  static int socket_suspend(struct pcmcia_socket *skt)
>  {
>  	if (skt->state & SOCKET_SUSPEND)
> -		return CS_IN_USE;
> +		return -EBUSY;
>  
>  	send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
>  	skt->socket = dead_socket;
> @@ -556,7 +556,7 @@ static int socket_resume(struct pcmcia_socket *skt)
>  	int ret;
>  
>  	if (!(skt->state & SOCKET_SUSPEND))
> -		return CS_IN_USE;
> +		return -EBUSY;
>  
>  	skt->socket = dead_socket;
>  	skt->ops->init(skt);
> @@ -765,7 +765,7 @@ int pccard_reset_card(struct pcmcia_socket *skt)
>  			break;
>  		}
>  		if (skt->state & SOCKET_SUSPEND) {
> -			ret = CS_IN_USE;
> +			ret = -EBUSY;
>  			break;
>  		}
>  		if (skt->state & SOCKET_CARDBUS) {
> diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
> index 14949fc..049e29f 100644
> --- a/drivers/pcmcia/pcmcia_resource.c
> +++ b/drivers/pcmcia/pcmcia_resource.c
> @@ -609,23 +609,29 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
>  	c = p_dev->function_config;
>  	if (c->state & CONFIG_LOCKED)
>  		return -EACCES;
> -	if (c->state & CONFIG_IO_REQ)
> -		return CS_IN_USE;
> +	if (c->state & CONFIG_IO_REQ) {
> +		ds_dbg(s, 0, "IO already configured\n");
> +		return -EBUSY;
> +	}
>  	if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))
>  		return CS_BAD_ATTRIBUTE;
>  	if ((req->NumPorts2 > 0) &&
>  	    (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)))
>  		return CS_BAD_ATTRIBUTE;
>  
> +	ds_dbg(s, 1, "trying to allocate resource 1\n");
>  	if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
>  			   req->NumPorts1, req->IOAddrLines))
> -		return CS_IN_USE;
> +		ds_dbg(s, 0, "allocation of resource 1 failed\n");
> +		return -EBUSY;

The if statement above needs braces to include both the ds_dbg 
statement and the return when debugging is enabled. This one broke 
ide_cs for me.

Larry




More information about the linux-pcmcia mailing list