Re: [KERNEL 2.6.26-rc4] bugreport : pata_pcmcia with Sandisk ExtremeIII 8GB

From: Tejun Heo
Date: Mon Jun 16 2008 - 09:25:21 EST


Komuro wrote:
> Hi,
>
> Here is the log (your patch is applied).
> Unfortunately, no message that you added appears.
>
> It seems this device is detected as pcmcia0.0 first
> but later it is detected as pcmcia0.1.

Hmmm... strange. Can you please try the attached patch?

--
tejun
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 3d39f9d..0eb4f77 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -176,9 +176,14 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)

struct ata_port_operations *ops = &pcmcia_port_ops;

+ dev_printk(KERN_INFO, &pdev->dev, "XXX ENTER\n");
+ dump_stack();
+
info = kzalloc(sizeof(*info), GFP_KERNEL);
- if (info == NULL)
+ if (info == NULL) {
+ printk("XXX info alloc failed\n");
return -ENOMEM;
+ }

/* Glue stuff together. FIXME: We may be able to get rid of info with care */
info->pdev = pdev;
@@ -196,8 +201,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
/* Allocate resoure probing structures */

stk = kzalloc(sizeof(*stk), GFP_KERNEL);
- if (!stk)
+ if (!stk) {
+ printk("XXX stk alloc failed\n");
goto out1;
+ }

cfg = &stk->parse.cftable_entry;

@@ -290,8 +297,11 @@ next_entry:
ret = -ENOMEM;
io_addr = devm_ioport_map(&pdev->dev, io_base, 8);
ctl_addr = devm_ioport_map(&pdev->dev, ctl_base, 1);
- if (!io_addr || !ctl_addr)
+ if (!io_addr || !ctl_addr) {
+ printk("XXX ioport_map failed io_addr=%p ctl_addr=%p\n",
+ io_addr, ctl_addr);
goto failed;
+ }

/* Success. Disable the IRQ nIEN line, do quirks */
iowrite8(0x02, ctl_addr);
@@ -311,8 +321,10 @@ next_entry:
*/
ret = -ENOMEM;
host = ata_host_alloc(&pdev->dev, n_ports);
- if (!host)
+ if (!host) {
+ printk("XXX host alloc failed\n");
goto failed;
+ }

for (p = 0; p < n_ports; p++) {
ap = host->ports[p];
@@ -331,11 +343,14 @@ next_entry:
/* activate */
ret = ata_host_activate(host, pdev->irq.AssignedIRQ, ata_sff_interrupt,
IRQF_SHARED, &pcmcia_sht);
- if (ret)
+ if (ret) {
+ printk("XXX host activate failed ret=%d\n", ret);
goto failed;
+ }

info->ndev = 1;
kfree(stk);
+ dev_printk(KERN_INFO, &pdev->dev, "XXX LEAVE 0\n");
return 0;

cs_failed:
@@ -345,6 +360,7 @@ failed:
info->ndev = 0;
pcmcia_disable_device(pdev);
out1:
+ dev_printk(KERN_INFO, &pdev->dev, "XXX LEAVE %d\n", ret);
kfree(info);
return ret;
}