Re: 2.6.15-mm3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 11, 2006 at 05:47:30PM -0500, Brice Goglin wrote:
> Dominik Brodowski wrote:
> 
> >Exactly. Could you pass the parameter pc_debug=9 to the "pcmcia" module,
> >please, and send me the resulting dmesg? I can't reproduce it here,
> >unfortunately...
> >  
> >
> Here you are (I had to enable CONFIG_PCMCIA_DEBUG).

Many thanks... Could you try out this patch instead of the other one,
please? get_pcmcia_device() seems to be the buggiest function I've ever
written, sorry about that...

Thanks,
	Dominik

diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index c4f7dfb..be08bc9 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -69,25 +69,26 @@ extern int ds_pc_debug;
 #define ds_dbg(lvl, fmt, arg...) do { } while (0)
 #endif
 
-static struct pcmcia_device * get_pcmcia_device (struct pcmcia_socket *s,
-						 unsigned int function)
+static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s,
+						unsigned int function)
 {
 	struct pcmcia_device *p_dev = NULL;
-
 	unsigned long flags;
+
 	spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
-        list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
+	list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
 		if (p_dev->func == function) {
-			p_dev = pcmcia_get_dev(p_dev);
-			break;
+			spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+			return pcmcia_get_dev(p_dev);
 		}
 	}
-	return p_dev;
+	spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
+	return NULL;
 }
 
 /* backwards-compatible accessing of driver --- by name! */
 
-static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info)
+static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info)
 {
 	struct device_driver *drv;
 	struct pcmcia_driver *p_drv;
@@ -625,15 +626,15 @@ static int ds_ioctl(struct inode * inode
 	ret = pccard_reset_card(s);
 	break;
     case DS_GET_STATUS:
-	if (buf->status.Function &&
-	   (buf->status.Function >= s->functions))
-	    ret = CS_BAD_ARGS;
-	else {
-	    struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
-	    ret = pccard_get_status(s, p_dev, &buf->status);
-	    pcmcia_put_dev(p_dev);
-	}
-	break;
+	    if (buf->status.Function &&
+		(buf->status.Function >= s->functions))
+		    ret = CS_BAD_ARGS;
+	    else {
+		    struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
+		    ret = pccard_get_status(s, p_dev, &buf->status);
+		    pcmcia_put_dev(p_dev);
+	    }
+	    break;
     case DS_VALIDATE_CIS:
 	mutex_lock(&s->skt_mutex);
 	pcmcia_validate_mem(s);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux