• Damien Le Moal's avatar
    ata: libata: Print quirks applied to devices · 58157d60
    Damien Le Moal authored
    Introduce the function ata_dev_print_quirks() to print the quirk flags
    that will be applied to a scanned device. This new function is called
    from ata_dev_quirks() when a match on a device model or device model
    and revision is found for a device in the __ata_dev_quirks array.
    
    To implement this function, the ATA_QUIRK_ flags are redefined using
    the new enum ata_quirk which defines the bit shift for each quirk
    flag. The array of strings ata_quirk_names is used to define the name
    of each flag, which are printed by ata_dev_print_quirks().
    
    Example output for a device listed in the __ata_dev_quirks array and
    which has the ATA_QUIRK_DISABLE flag applied:
    
    [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
    [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
    [10193.469195] ata1.00: unsupported device, disabling
    [10193.481564] ata1.00: disable device
    
    enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
    last quirk flag defined. This value is used in ata_dev_quirks() to add a
    build time check that all quirk flags fit within the unsigned int
    (32-bits) quirks field of struct ata_device.
    Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
    Reviewed-by: default avatarIgor Pylypiv <ipylypiv@google.com>
    Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
    58157d60
libata-core.c 172 KB