• Damien Le Moal's avatar
    scsi: libsas: Fix declaration of ncq priority attributes · 0ff10cb7
    Damien Le Moal authored
    Commit b4d3ddd2 ("scsi: libsas: Define NCQ Priority sysfs attributes
    for SATA devices") introduced support for ATA NCQ priority control for ATA
    devices managed by libsas. This commit introduces the ncq_prio_supported
    and ncq_prio_enable sysfs device attributes to discover and control the use
    of this features, similarly to libata.  However, libata publicly declares
    these device attributes and export them for use in ATA low level
    drivers. This leads to a compilation error when libsas and libata are
    built-in due to the double definition:
    
    ld: drivers/ata/libata-sata.o:/home/Linux/scsi/drivers/ata/libata-sata.c:900:
    multiple definition of `dev_attr_ncq_prio_supported';
    drivers/scsi/libsas/sas_ata.o:/home/Linux/scsi/drivers/scsi/libsas/sas_ata.c:984:
    first defined here
    ld: drivers/ata/libata-sata.o:/home/Linux/scsi/drivers/ata/libata-sata.c:1026:
    multiple definition of `dev_attr_ncq_prio_enable';
    drivers/scsi/libsas/sas_ata.o:/home/Linux/scsi/drivers/scsi/libsas/sas_ata.c:1022:
    first defined here
    
    Resolve this problem by directly declaring the libsas attributes instead of
    using the DEVICE_ATTR() macro. And for good measure, the device attribute
    variables are also renamed.
    Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    Fixes: b4d3ddd2 ("scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices")
    Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
    Link: https://lore.kernel.org/r/20240327020122.439424-1-dlemoal@kernel.orgReviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    0ff10cb7
sas_ata.c 26.2 KB