All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: libsas: Fix declaration of ncq priority attributes
@ 2024-03-27  2:01 Damien Le Moal
  2024-03-27  2:13 ` Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Damien Le Moal @ 2024-03-27  2:01 UTC (permalink / raw)
  To: Martin K . Petersen, linux-scsi; +Cc: Geert Uytterhoeven, Igor Pylypiv

Commit b4d3ddd2df7 ("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: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: b4d3ddd2df7 ("scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/scsi/libsas/sas_ata.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index b57c041a5544..4c69fc63c119 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -981,7 +981,8 @@ static ssize_t sas_ncq_prio_supported_show(struct device *device,
 	return sysfs_emit(buf, "%d\n", supported);
 }
 
-DEVICE_ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL);
+static struct device_attribute dev_attr_sas_ncq_prio_supported =
+	__ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL);
 
 static ssize_t sas_ncq_prio_enable_show(struct device *device,
 					struct device_attribute *attr,
@@ -1019,12 +1020,13 @@ static ssize_t sas_ncq_prio_enable_store(struct device *device,
 	return len;
 }
 
-DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
-	    sas_ncq_prio_enable_show, sas_ncq_prio_enable_store);
+static struct device_attribute dev_attr_sas_ncq_prio_enable =
+	__ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
+	       sas_ncq_prio_enable_show, sas_ncq_prio_enable_store);
 
 static struct attribute *sas_ata_sdev_attrs[] = {
-	&dev_attr_ncq_prio_supported.attr,
-	&dev_attr_ncq_prio_enable.attr,
+	&dev_attr_sas_ncq_prio_supported.attr,
+	&dev_attr_sas_ncq_prio_enable.attr,
 	NULL
 };
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: libsas: Fix declaration of ncq priority attributes
  2024-03-27  2:01 [PATCH] scsi: libsas: Fix declaration of ncq priority attributes Damien Le Moal
@ 2024-03-27  2:13 ` Damien Le Moal
  2024-03-27 14:30   ` John Garry
  2024-03-28  0:17 ` Martin K. Petersen
  2024-04-02  1:10 ` Martin K. Petersen
  2 siblings, 1 reply; 5+ messages in thread
From: Damien Le Moal @ 2024-03-27  2:13 UTC (permalink / raw)
  To: Martin K . Petersen, linux-scsi
  Cc: Geert Uytterhoeven, Igor Pylypiv, John Garry

On 3/27/24 11:01, Damien Le Moal wrote:
> Commit b4d3ddd2df7 ("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: Geert Uytterhoeven <geert@linux-m68k.org>
> Fixes: b4d3ddd2df7 ("scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices")
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Forgot to add John to the distribution list...

> ---
>  drivers/scsi/libsas/sas_ata.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index b57c041a5544..4c69fc63c119 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -981,7 +981,8 @@ static ssize_t sas_ncq_prio_supported_show(struct device *device,
>  	return sysfs_emit(buf, "%d\n", supported);
>  }
>  
> -DEVICE_ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL);
> +static struct device_attribute dev_attr_sas_ncq_prio_supported =
> +	__ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL);
>  
>  static ssize_t sas_ncq_prio_enable_show(struct device *device,
>  					struct device_attribute *attr,
> @@ -1019,12 +1020,13 @@ static ssize_t sas_ncq_prio_enable_store(struct device *device,
>  	return len;
>  }
>  
> -DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
> -	    sas_ncq_prio_enable_show, sas_ncq_prio_enable_store);
> +static struct device_attribute dev_attr_sas_ncq_prio_enable =
> +	__ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
> +	       sas_ncq_prio_enable_show, sas_ncq_prio_enable_store);
>  
>  static struct attribute *sas_ata_sdev_attrs[] = {
> -	&dev_attr_ncq_prio_supported.attr,
> -	&dev_attr_ncq_prio_enable.attr,
> +	&dev_attr_sas_ncq_prio_supported.attr,
> +	&dev_attr_sas_ncq_prio_enable.attr,
>  	NULL
>  };
>  

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: libsas: Fix declaration of ncq priority attributes
  2024-03-27  2:13 ` Damien Le Moal
@ 2024-03-27 14:30   ` John Garry
  0 siblings, 0 replies; 5+ messages in thread
From: John Garry @ 2024-03-27 14:30 UTC (permalink / raw)
  To: Damien Le Moal, Martin K . Petersen, linux-scsi
  Cc: Geert Uytterhoeven, Igor Pylypiv

On 27/03/2024 02:13, Damien Le Moal wrote:

- old address

> On 3/27/24 11:01, Damien Le Moal wrote:
>> Commit b4d3ddd2df7 ("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

nit: /s/This commit introduces the/That commit introduced 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: Geert Uytterhoeven <geert@linux-m68k.org>
>> Fixes: b4d3ddd2df7 ("scsi: libsas: Define NCQ Priority sysfs attributes for SATA devices")
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: John Garry <john.g.garry@oracle.com>

> 
> Forgot to add John to the distribution list...
> 
>> ---
>>   drivers/scsi/libsas/sas_ata.c | 12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
>> index b57c041a5544..4c69fc63c119 100644
>> --- a/drivers/scsi/libsas/sas_ata.c
>> +++ b/drivers/scsi/libsas/sas_ata.c
>> @@ -981,7 +981,8 @@ static ssize_t sas_ncq_prio_supported_show(struct device *device,
>>   	return sysfs_emit(buf, "%d\n", supported);
>>   }
>>   
>> -DEVICE_ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL);
>> +static struct device_attribute dev_attr_sas_ncq_prio_supported =
>> +	__ATTR(ncq_prio_supported, S_IRUGO, sas_ncq_prio_supported_show, NULL);
>>   
>>   static ssize_t sas_ncq_prio_enable_show(struct device *device,
>>   					struct device_attribute *attr,
>> @@ -1019,12 +1020,13 @@ static ssize_t sas_ncq_prio_enable_store(struct device *device,
>>   	return len;
>>   }
>>   
>> -DEVICE_ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
>> -	    sas_ncq_prio_enable_show, sas_ncq_prio_enable_store);
>> +static struct device_attribute dev_attr_sas_ncq_prio_enable =
>> +	__ATTR(ncq_prio_enable, S_IRUGO | S_IWUSR,
>> +	       sas_ncq_prio_enable_show, sas_ncq_prio_enable_store);
>>   
>>   static struct attribute *sas_ata_sdev_attrs[] = {
>> -	&dev_attr_ncq_prio_supported.attr,
>> -	&dev_attr_ncq_prio_enable.attr,
>> +	&dev_attr_sas_ncq_prio_supported.attr,
>> +	&dev_attr_sas_ncq_prio_enable.attr,
>>   	NULL
>>   };
>>   
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: libsas: Fix declaration of ncq priority attributes
  2024-03-27  2:01 [PATCH] scsi: libsas: Fix declaration of ncq priority attributes Damien Le Moal
  2024-03-27  2:13 ` Damien Le Moal
@ 2024-03-28  0:17 ` Martin K. Petersen
  2024-04-02  1:10 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-03-28  0:17 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Martin K . Petersen, linux-scsi, Geert Uytterhoeven, Igor Pylypiv


Damien,

> Commit b4d3ddd2df7 ("scsi: libsas: Define NCQ Priority sysfs
> attributes for SATA devices") introduced support for ATA NCQ priority
> control for ATA devices managed by libsas.

Applied to 6.10/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: libsas: Fix declaration of ncq priority attributes
  2024-03-27  2:01 [PATCH] scsi: libsas: Fix declaration of ncq priority attributes Damien Le Moal
  2024-03-27  2:13 ` Damien Le Moal
  2024-03-28  0:17 ` Martin K. Petersen
@ 2024-04-02  1:10 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2024-04-02  1:10 UTC (permalink / raw)
  To: linux-scsi, Damien Le Moal
  Cc: Martin K . Petersen, Geert Uytterhoeven, Igor Pylypiv

On Wed, 27 Mar 2024 11:01:22 +0900, Damien Le Moal wrote:

> Commit b4d3ddd2df7 ("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:
> 
> [...]

Applied to 6.10/scsi-queue, thanks!

[1/1] scsi: libsas: Fix declaration of ncq priority attributes
      https://git.kernel.org/mkp/scsi/c/0ff10cb7f818

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-02  1:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-27  2:01 [PATCH] scsi: libsas: Fix declaration of ncq priority attributes Damien Le Moal
2024-03-27  2:13 ` Damien Le Moal
2024-03-27 14:30   ` John Garry
2024-03-28  0:17 ` Martin K. Petersen
2024-04-02  1:10 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.