Re: [PATCH 3/3] Add disk hotswap support to libata RESEND #5

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

 



On 9/28/05, Jeff Garzik <jgarzik@xxxxxxxxx> wrote:
> > +/* Mask hotplug interrupts for one channel (ap) */
> > +static inline void pdc_disable_channel_hotplug_interrupts(struct ata_port *ap)
<snip>
> > +/* Clear and unmask hotplug interrupts for one channel (ap) */
> > +static inline void pdc_enable_channel_hotplug_interrupts(struct ata_port *ap)

> Rather than two functions, I prefer one function that takes an 'enable'
> boolean argument, just like pci_intx()
>
> Also, the function names are way too long.

OK, I'll change that.

> > -     sata_phy_reset(ap);
> > +     if (ap->flags & ATA_FLAG_SATA_RESET) {
> > +             pdc_disable_channel_hotplug_interrupts(ap);
> > +             sata_phy_reset(ap);
> > +             pdc_enable_channel_hotplug_interrupts(ap);
> > +     } else
> > +             sata_phy_reset(ap);
>
> I don't see the point of this.  Might as well unconditionally disable
> hotplug interrupts.

Sure.

> > +     if (plugdata) {
> > +             writeb(plugdata, mmio_base + hotplug_offset);
> > +             for (i = 0; i < host_set->n_ports; ++i) {
> > +                     ap = host_set->ports[i];
> > +                     if (!(ap->flags & ATA_FLAG_SATA))
> > +                             continue;  //No PATA support here... yet
> > +                     // Check unplug flag
> > +                     if (plugdata & 0x1) {
> > +                             /* Do stuff related to unplugging a device */
> > +                             ata_hotplug_unplug(ap);
> > +                             handled = 1;
> > +                     } else if ((plugdata >> 4) & 0x1) {  //Check plug flag
> > +                             /* Do stuff related to plugging in a device */
> > +                             ata_hotplug_plug(ap);
> > +                             handled = 1;
>
> What happens if both bits are set?  Seems like that could happen, if a
> plug+unplug (cable blip?) occurs in rapid succession.

What IF both bits are set?  This is why we have a debounce timer to
take care of the problem :P

The way this is set up, unplugging will win out (plugging will come
first, unplugging will come and destroy 'plug's timer, and then the
unplug action will be performed on timer expiry).  Personally, I like
it this way, but I can reverse the order of these two to make plugging
the default action.  Which do you prefer?

> The rest seems OK to me.

Excellent.  I'll repost when the issues you point out have been addressed.

Luke
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux