Skip to contentSkip to conversation

pcmcia: ensure correct logging in do_io_probe [v2]

PATCH In review Frans Pop 2 participants 3 messages Nov 7, 2008 – Nov 15, 2008 Pcmcia

lore
Share & tools
lore

Frans Pop

author
#0 lore raw

PATCH 1/1 pcmcia: ensure correct logging in do_io_probe [v2]

I've added parens around the conditions. Maybe not strictly needed, but better readable and consistent with similar usage in cs.c.

Cheers,
FJP

---
From: Frans Pop <[email protected]>

pcmcia: ensure correct logging in do_io_probe

During early probing of the parent PCI bridge I/O window no socket has been allocated yet.
In that case print &s->cb_dev->dev instead of &s->dev as device.

Also properly close previous dev_printk if kzalloc fails.

CC Dominik Brodowski <[email protected]>
(quoted diff) +0 -0

b/drivers/pcmcia/rsrc_nonstatic.c
index 17f4ecf..2a6a3d1 100644

drivers/pcmcia/rsrc_nonstatic.c +0 -0
@@ -200,14 +200,17 @@ static void do_io_probe(struct pcmcia_socket *s, 

unsigned int base,

     int any;
     u_char *b, hole, most;

- dev_printk(KERN_INFO, &s->dev, "cs: IO port probe %#x-%#x:",
- base, base+num-1);
+ dev_printk(KERN_INFO,
+ (s->state & SOCKET_PRESENT) ? &s->dev : &s->cb_dev->dev,
+ "cs: IO port probe %#x-%#x:", base, base+num-1);

     /* First, what does a floating port look like? */
     b = kzalloc(256, GFP_KERNEL);
     if (!b) {
-	    dev_printk(KERN_ERR, &s->dev,
-		   "do_io_probe: unable to kmalloc 256 bytes");
+	    printk("\n");
+	    dev_printk(KERN_ERR,
+		   (s->state & SOCKET_PRESENT) ? &s->dev : &s->cb_dev->dev,
+		   "cs: do_io_probe: unable to kmalloc 256 bytes");
             return;
     }
     for (i = base, most = 0; i < base+num; i += 8) {
#1 lore raw

Hi,

Quoted 10 lines · Frans Pop

I've added parens around the conditions. Maybe not strictly needed, but better readable and consistent with similar usage in cs.c.

From: Frans Pop <[email protected]>

pcmcia: ensure correct logging in do_io_probe

During early probing of the parent PCI bridge I/O window no socket has been allocated yet.
In that case print &s->cb_dev->dev instead of &s->dev as device.

similar to the other patch, this won't work: &skt->cb_dev is only available and set if the parent device is a PCI device; therefore, &skt->dev is the only thing we can use.

An alternative approach would be to move this initialization code only after we've set dev_name. Could you test whether this approach works for you, please?

Thanks,
Dominik

Quoted 1 line

From b1769450da0eeae2d95aae5496acbdf4c6ba89b2 Mon Sep 17 00:00:00 2001

From: Dominik Brodowski <[email protected]>
Date: Sun, 9 Nov 2008 21:47:47 +0100
Subject: [PATCH] pcmcia: ensure correct logging in do_io_probe

drivers/pcmcia/cs.c +6 -6
index 5d0e60e..0660ad1 100644
@@ -186,12 +186,6 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 
 	spin_lock_init(&socket->lock);
 
-	if (socket->resource_ops->init) {
-		ret = socket->resource_ops->init(socket);
-		if (ret)
-			return (ret);
-	}
-
 	/* try to obtain a socket number [yes, it gets ugly if we
 	 * register more than 2^sizeof(unsigned int) pcmcia
 	 * sockets... but the socket number is deprecated
@@ -239,6 +233,12 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 	mutex_init(&socket->skt_mutex);
 	spin_lock_init(&socket->thread_lock);
 
+	if (socket->resource_ops->init) {
+		ret = socket->resource_ops->init(socket);
+		if (ret)
+			goto err;
+	}
+
 	tsk = kthread_run(pccardd, socket, "pccardd");
 	if (IS_ERR(tsk)) {
 		ret = PTR_ERR(tsk);
author Tested-by
#2 lore raw
Quoted 8 lines · Dominik Brodowski
Quoted 3 lines · Frans Pop

During early probing of the parent PCI bridge I/O window no socket has been allocated yet.
In that case print &s->cb_dev->dev instead of &s->dev as device.

similar to the other patch, this won't work: &skt->cb_dev is only available and set if the parent device is a PCI device; therefore, &skt->dev is the only thing we can use.

OK.

I still feel I'm missing something in the debug logging. Shouldn't there be a line saying something like the following?
yenta_cardbus 0000:02:06.0: Assigned pcmcia socket 0

Quoted 3 lines

An alternative approach would be to move this initialization code only after we've set dev_name. Could you test whether this approach works for you, please?

Tested on two different systems: Toshiba Satellite A40 running i386 (with atheros wlan card already inserted during boot) and HP 2510p running x86_64 (with same card inserted after boot).
Both with patch applied against current mainline git. I've not seen any problems and wireless worked in both cases.

There are some differences in the logs (see attachments). I only see the IO probes on the Toshiba, not on the HP. I'd guess that's expected.

This does leave one minor issue from my previous patch. Please consider applying the attached patch.

Cheers,
FJP

From: Frans Pop <[email protected]>

pcmcia: properly close previous dev_printk if kzalloc fails in do_io_probe

drivers/pcmcia/rsrc_nonstatic.c +1 -0
index 17f4ecf..da95252 100644
@@ -206,6 +206,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
     /* First, what does a floating port look like? */
     b = kzalloc(256, GFP_KERNEL);
     if (!b) {
+	    printk("\n");
 	    dev_printk(KERN_ERR, &s->dev,
 		   "do_io_probe: unable to kmalloc 256 bytes");
             return;

yenta_cardbus 0000:02:06.0: CardBus bridge found [103c:30c9]
yenta_cardbus 0000:02:06.0: ISA IRQ mask 0x0cb8, PCI irq 18
yenta_cardbus 0000:02:06.0: Socket status: 30000006
pci_bus 0000:02: Raising subordinate bus# of parent bus (#02) from #03 to #06 yenta_cardbus 0000:02:06.0: pcmcia: parent PCI bridge I/O window: 0x3000 - 0x3fff yenta_cardbus 0000:02:06.0: pcmcia: parent PCI bridge Memory window: 0xe0100000 - 0xe03fffff yenta_cardbus 0000:02:06.0: pcmcia: parent PCI bridge Memory window: 0x80000000 - 0x83ffffff pcmcia_socket pcmcia_socket0: pccard: CardBus card inserted into slot 0

yenta_cardbus 0000:01:0b.0: CardBus bridge found [1179:0001]
yenta_cardbus 0000:01:0b.0: ISA IRQ mask 0x0c38, PCI irq 18
yenta_cardbus 0000:01:0b.0: Socket status: 30000020
yenta_cardbus 0000:01:0b.0: pcmcia: parent PCI bridge I/O window: 0xc000 - 0xcfff pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc000-0xcfff: clean. yenta_cardbus 0000:01:0b.0: pcmcia: parent PCI bridge Memory window: 0xcff00000 - 0xcfffffff yenta_cardbus 0000:01:0b.0: pcmcia: parent PCI bridge Memory window: 0x28000000 - 0x2bffffff pcmcia_socket pcmcia_socket0: pccard: CardBus card inserted into slot 0 pcmcia_socket pcmcia_socket0: cs: IO port probe 0x100-0x3af: clean. pcmcia_socket pcmcia_socket0: cs: IO port probe 0x3e0-0x4ff: clean. pcmcia_socket pcmcia_socket0: cs: IO port probe 0x820-0x8ff: clean. pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc00-0xcf7: clean. pcmcia_socket pcmcia_socket0: cs: IO port probe 0xa00-0xaff: clean.