This patch makes dev->flags persistent, defines ATA_DFLAG_INIT_MASK as lower 16 bits of device flags and clear them in ata_dev_init(). So, device flags in bits [0:15] are cleared over hotplugging while flags from bit 16 upward are maintained. Signed-off-by: Tejun Heo <htejun@xxxxxxxxx> --- drivers/scsi/libata-core.c | 2 ++ include/linux/libata.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletions(-) 3a7b8630e4c5cc409562164a941b40bc2b6b8728 diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 09e82f9..930f387 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -1444,6 +1444,8 @@ err_out_nosup: */ static void ata_dev_init(struct ata_port *ap, struct ata_device *dev) { + dev->flags &= ~ATA_DFLAG_INIT_MASK; + memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0, sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET); dev->pio_mask = UINT_MAX; diff --git a/include/linux/libata.h b/include/linux/libata.h index 809f3b9..33ce8a4 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -128,6 +128,7 @@ enum { ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */ ATA_DFLAG_FAILED = (1 << 9), /* device has failed */ + ATA_DFLAG_INIT_MASK = (1 << 16) - 1, ATA_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_ATA = 1, /* ATA device */ @@ -396,9 +397,9 @@ struct ata_ering { struct ata_device { unsigned int devno; /* 0 or 1 */ + unsigned long flags; /* ATA_DFLAG_xxx */ /* fields above n_sectors are not cleared across device init */ u64 n_sectors; /* size of device, if ATA */ - unsigned long flags; /* ATA_DFLAG_xxx */ unsigned int class; /* ATA_DEV_xxx */ u16 *id; /* IDENTIFY xxx DEVICE data */ u8 pio_mode; -- 1.2.4 - : 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