* [PATCH] ata: ahci_ceva: Fix sparse warning in ceva_ahci_read_id()
2021-12-02 8:37 [PATCH 0/4] Cleanup ATA sysfs attribute show functions Damien Le Moal
@ 2021-12-02 8:37 ` Damien Le Moal
2021-12-02 8:37 ` [PATCH 1/4] ata: libata-sata: use sysfs_emit() Damien Le Moal
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-12-02 8:37 UTC (permalink / raw)
To: linux-ide
Fix the following sparse warning:
drivers/ata/ahci_ceva.c:107:33: warning: invalid assignment: &=
drivers/ata/ahci_ceva.c:107:33: left side has type unsigned short
drivers/ata/ahci_ceva.c:107:33: right side has type restricted __le16
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/ahci_ceva.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c
index 50b56cd0039d..e9c7c07fd84c 100644
--- a/drivers/ata/ahci_ceva.c
+++ b/drivers/ata/ahci_ceva.c
@@ -94,6 +94,7 @@ struct ceva_ahci_priv {
static unsigned int ceva_ahci_read_id(struct ata_device *dev,
struct ata_taskfile *tf, u16 *id)
{
+ __le16 *__id = (__le16 *)id;
u32 err_mask;
err_mask = ata_do_dev_read_id(dev, tf, id);
@@ -103,7 +104,7 @@ static unsigned int ceva_ahci_read_id(struct ata_device *dev,
* Since CEVA controller does not support device sleep feature, we
* need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data.
*/
- id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8));
+ __id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8));
return 0;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/4] ata: libata-sata: use sysfs_emit()
2021-12-02 8:37 [PATCH 0/4] Cleanup ATA sysfs attribute show functions Damien Le Moal
2021-12-02 8:37 ` [PATCH] ata: ahci_ceva: Fix sparse warning in ceva_ahci_read_id() Damien Le Moal
@ 2021-12-02 8:37 ` Damien Le Moal
2021-12-02 8:37 ` [PATCH 2/4] ata: libata-scsi: " Damien Le Moal
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-12-02 8:37 UTC (permalink / raw)
To: linux-ide
Use sysfs_emit() instead of snprintf() in sysfs attibute show()
functions.
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/libata-sata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index b9c77885b872..eddd33a3cb5f 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -876,7 +876,7 @@ static ssize_t ata_ncq_prio_enable_show(struct device *device,
ncq_prio_enable = dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE;
spin_unlock_irq(ap->lock);
- return rc ? rc : snprintf(buf, 20, "%u\n", ncq_prio_enable);
+ return rc ? rc : sysfs_emit(buf, "%u\n", ncq_prio_enable);
}
static ssize_t ata_ncq_prio_enable_store(struct device *device,
@@ -972,7 +972,7 @@ ata_scsi_em_message_type_show(struct device *dev, struct device_attribute *attr,
struct Scsi_Host *shost = class_to_shost(dev);
struct ata_port *ap = ata_shost_to_port(shost);
- return snprintf(buf, 23, "%d\n", ap->em_message_type);
+ return sysfs_emit(buf, "%d\n", ap->em_message_type);
}
DEVICE_ATTR(em_message_type, S_IRUGO,
ata_scsi_em_message_type_show, NULL);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] ata: libata-scsi: use sysfs_emit()
2021-12-02 8:37 [PATCH 0/4] Cleanup ATA sysfs attribute show functions Damien Le Moal
2021-12-02 8:37 ` [PATCH] ata: ahci_ceva: Fix sparse warning in ceva_ahci_read_id() Damien Le Moal
2021-12-02 8:37 ` [PATCH 1/4] ata: libata-sata: use sysfs_emit() Damien Le Moal
@ 2021-12-02 8:37 ` Damien Le Moal
2021-12-02 8:37 ` [PATCH 3/4] ata: ahci: " Damien Le Moal
2021-12-02 8:37 ` [PATCH 4/4] ata: sata_fsl: " Damien Le Moal
4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-12-02 8:37 UTC (permalink / raw)
To: linux-ide
Use sysfs_emit() instead of snprintf() in ata_scsi_park_show().
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/libata-scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1b84d5526d77..0fc47b2e0c41 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -121,7 +121,7 @@ static ssize_t ata_scsi_park_show(struct device *device,
unlock:
spin_unlock_irq(ap->lock);
- return rc ? rc : snprintf(buf, 20, "%u\n", msecs);
+ return rc ? rc : sysfs_emit(buf, "%u\n", msecs);
}
static ssize_t ata_scsi_park_store(struct device *device,
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] ata: ahci: use sysfs_emit()
2021-12-02 8:37 [PATCH 0/4] Cleanup ATA sysfs attribute show functions Damien Le Moal
` (2 preceding siblings ...)
2021-12-02 8:37 ` [PATCH 2/4] ata: libata-scsi: " Damien Le Moal
@ 2021-12-02 8:37 ` Damien Le Moal
2021-12-02 8:37 ` [PATCH 4/4] ata: sata_fsl: " Damien Le Moal
4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-12-02 8:37 UTC (permalink / raw)
To: linux-ide
Use sysfs_emit() instead of sprintf in remapped_nvme_show().
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/ahci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 1e1167e725a4..98d04a780458 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1657,7 +1657,7 @@ static ssize_t remapped_nvme_show(struct device *dev,
struct ata_host *host = dev_get_drvdata(dev);
struct ahci_host_priv *hpriv = host->private_data;
- return sprintf(buf, "%u\n", hpriv->remapped_nvme);
+ return sysfs_emit(buf, "%u\n", hpriv->remapped_nvme);
}
static DEVICE_ATTR_RO(remapped_nvme);
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] ata: sata_fsl: use sysfs_emit()
2021-12-02 8:37 [PATCH 0/4] Cleanup ATA sysfs attribute show functions Damien Le Moal
` (3 preceding siblings ...)
2021-12-02 8:37 ` [PATCH 3/4] ata: ahci: " Damien Le Moal
@ 2021-12-02 8:37 ` Damien Le Moal
4 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2021-12-02 8:37 UTC (permalink / raw)
To: linux-ide
Use sysfs_emit() instead of sprintf() in fsl_sata_intr_coalescing_show()
and fsl_sata_rx_watermark_show().
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
drivers/ata/sata_fsl.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index c5a2c1e9ed6b..ec52511ae60f 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -322,7 +322,7 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host,
static ssize_t fsl_sata_intr_coalescing_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return sprintf(buf, "%d %d\n",
+ return sysfs_emit(buf, "%d %d\n",
intr_coalescing_count, intr_coalescing_ticks);
}
@@ -357,9 +357,9 @@ static ssize_t fsl_sata_rx_watermark_show(struct device *dev,
spin_lock_irqsave(&host->lock, flags);
rx_watermark = ioread32(csr_base + TRANSCFG);
rx_watermark &= 0x1f;
-
spin_unlock_irqrestore(&host->lock, flags);
- return sprintf(buf, "%d\n", rx_watermark);
+
+ return sysfs_emit(buf, "%d\n", rx_watermark);
}
static ssize_t fsl_sata_rx_watermark_store(struct device *dev,
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread