Re: [PATCH 04/12] libata-hp-prep: update ata_scsi_find_dev() and friends

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

 



Tejun Heo wrote:
Jeff Garzik wrote:
Tejun Heo wrote:
+static struct ata_device * ata_find_dev(struct ata_port *ap, int id)
+{
+ if (likely(id == 0 || (id == 1 && ap->flags & ATA_FLAG_SLAVE_POSS)))
+        return &ap->device[id];
+    return NULL;

 static struct ata_device *
ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
 {
-    struct ata_device *dev;
-
-    /* skip commands not addressed to targets we simulate */
-    if (likely(scsidev->id < ATA_MAX_DEVICES))
-        dev = &ap->device[scsidev->id];
-    else
-        return NULL;


You replace a '<' test with a more complex test, which must then be modified when we start supporting Port Multipliers.

It is more simple, and easier, to keep the 'id < ATA_MAX_DEVICES' test AFAICS.

The change is to catch user warm plug request for impossible devices. I think it's worth to change it two times as it makes user visible interface consistent.

Warm plug isn't a fast path, but this is... I would rather filter out bad IDs elsewhere; and the code itself will catch bad IDs anyway, eventually.

	Jeff



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

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux