Re: [PATCH v2] ata: New PATA driver for Altera CompactFlash.

From: Alan Cox
Date: Thu Oct 08 2009 - 09:12:17 EST


On Thu, 8 Oct 2009 12:22:22 +0100
Ian Abbott <abbotti@xxxxxxxxx> wrote:

> On 08/10/09 10:55, Alan Cox wrote:
> > On Thu, 8 Oct 2009 09:58:30 +0800
> > Thomas Chou <thomas@xxxxxxxxxxxxx> wrote:
> >
> >> This patch adds a new PATA driver to support the Altera SOPC Builder
> >> CompactFlash component as a PATA device with support for insertion
> >> and removal of CF cards. It uses the platform driver model.
> >
> > Can you explain why you remove the interface rather than the device on
> > the interface when you detect a card removal ?
>
> As the originator of the driver, the only answer I have is "I don't know
> how." I was hoping for inspiration from some of the other PATA CF
> drivers, but alas, I couldn't find it. I admit that removing the whole
> ATA host is a bit on the extreme side.

I think the bit you want is something like:

struct ata_eh_info *ehi = &ap->link->eh_info;
if (mumblemumble & whatever) {
ata_ehi_clear_desc(ehi);
ata_ehi_hotplugged(ehi);
ata_ehi_push_desc(ehi, "CF connection changed");
ata_port_freeze(ap);
}

The core code also assumes your freeze method will mask any further
connection change reports until the port is unfrozen (so you don't get
multiple parallel "in/out/in/out" events at once)

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/