* [PATCH 0/8] Fix the remaining sloppy timeout typing in libata
@ 2023-06-16 19:45 Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 1/8] ata: libata: fix parameter type of ata_deadline() Sergey Shtylyov
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:45 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
Here are 8 patches against the 'for-next' branch of Damien's 'libata.git' repo.
The libata code still often uses the 'unsigned long' type for the millisecond
timeouts, while the kernel functions like msecs_to_jiffies() or msleep() only
take 'unsigned int' parameters for those. I've started fixing the timeout types
from ata_exec_internal[_sg]() that tripped the Svace static analyzer and posted
couple patches, promising to post a large continuation series somewhat later...
in my worst nightmare I couldn't imagine that this would take a whole year! :-(
Sergey Shtylyov (8):
ata: libata: fix parameter type of ata_deadline()
ata: libata-core: fix parameter types of ata_wait_register()
ata: libata-eh: fix reset timeout type
ata: fix debounce timings type
ata: libata-scsi: fix timeout type in ata_scsi_park_store()
ata: libahci: fix parameter type of ahci_exec_polled_cmd()
ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
drivers/ata/ahci.c | 2 +-
drivers/ata/ahci_qoriq.c | 2 +-
drivers/ata/ahci_xgene.c | 7 +++----
drivers/ata/libahci.c | 7 ++++---
drivers/ata/libata-core.c | 6 +++---
drivers/ata/libata-eh.c | 6 +++---
drivers/ata/libata-sata.c | 16 ++++++++--------
drivers/ata/libata-scsi.c | 4 ++--
drivers/ata/libata-sff.c | 2 +-
drivers/ata/sata_highbank.c | 2 +-
drivers/ata/sata_inic162x.c | 2 +-
drivers/ata/sata_mv.c | 2 +-
drivers/ata/sata_nv.c | 2 +-
drivers/ata/sata_sil24.c | 4 ++--
include/linux/libata.h | 24 ++++++++++++------------
15 files changed, 44 insertions(+), 44 deletions(-)
--
2.26.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/8] ata: libata: fix parameter type of ata_deadline()
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 2/8] ata: libata-core: fix parameter types of ata_wait_register() Sergey Shtylyov
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
ata_deadline() passes its 'unsigned long timeout_msecs' parameter verbatim
to msecs_to_jiffies() which takes just 'unsigned int' -- eliminate unneeded
implicit cast...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
include/linux/libata.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bc756f8586f3..1cf727632970 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1860,7 +1860,7 @@ static inline int ata_check_ready(u8 status)
}
static inline unsigned long ata_deadline(unsigned long from_jiffies,
- unsigned long timeout_msecs)
+ unsigned int timeout_msecs)
{
return from_jiffies + msecs_to_jiffies(timeout_msecs);
}
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/8] ata: libata-core: fix parameter types of ata_wait_register()
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 1/8] ata: libata: fix parameter type of ata_deadline() Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 3/8] ata: libata-eh: fix reset timeout type Sergey Shtylyov
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
ata_wait_register() passes its 'unsigned long {interval|timeout}' params
verbatim to ata_{msleep|deadline}() that just take 'unsigned int' param
for the time intervals in ms -- eliminate unneeded implicit casts...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/libata-core.c | 2 +-
include/linux/libata.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8796ef51641c..e40785246634 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6487,7 +6487,7 @@ EXPORT_SYMBOL_GPL(ata_msleep);
* The final register value.
*/
u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val,
- unsigned long interval, unsigned long timeout)
+ unsigned int interval, unsigned int timeout)
{
unsigned long deadline;
u32 tmp;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1cf727632970..059fe8386118 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1105,7 +1105,7 @@ static inline void ata_sas_port_resume(struct ata_port *ap)
extern int ata_ratelimit(void);
extern void ata_msleep(struct ata_port *ap, unsigned int msecs);
extern u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask,
- u32 val, unsigned long interval, unsigned long timeout);
+ u32 val, unsigned int interval, unsigned int timeout);
extern int atapi_cmd_type(u8 opcode);
extern unsigned int ata_pack_xfermask(unsigned int pio_mask,
unsigned int mwdma_mask,
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/8] ata: libata-eh: fix reset timeout type
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 1/8] ata: libata: fix parameter type of ata_deadline() Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 2/8] ata: libata-core: fix parameter types of ata_wait_register() Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 4/8] ata: fix debounce timings type Sergey Shtylyov
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
ata_eh_reset_timeouts[] stores 'unsigned long' timeouts in ms, while
ata_eh_reset() passes these values to ata_deadline() that takes just
'unsigned int timeout_msecs' parameter. Change the reset timeout table
element's type to 'unsigned int' -- all timeouts fit into 'unsigned int'
but we have to change ULONG_MAX to UINT_MAX...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/libata-eh.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index b80e68000dd3..3a70a1fbfa9e 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -78,12 +78,12 @@ enum {
* are mostly for error handling, hotplug and those outlier devices that
* take an exceptionally long time to recover from reset.
*/
-static const unsigned long ata_eh_reset_timeouts[] = {
+static const unsigned int ata_eh_reset_timeouts[] = {
10000, /* most drives spin up by 10sec */
10000, /* > 99% working drives spin up before 20sec */
35000, /* give > 30 secs of idleness for outlier devices */
5000, /* and sweet one last chance */
- ULONG_MAX, /* > 1 min has elapsed, give up */
+ UINT_MAX, /* > 1 min has elapsed, give up */
};
static const unsigned int ata_eh_identify_timeouts[] = {
@@ -2466,7 +2466,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
/*
* Prepare to reset
*/
- while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX)
+ while (ata_eh_reset_timeouts[max_tries] != UINT_MAX)
max_tries++;
if (link->flags & ATA_LFLAG_RST_ONCE)
max_tries = 1;
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/8] ata: fix debounce timings type
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (2 preceding siblings ...)
2023-06-16 19:46 ` [PATCH 3/8] ata: libata-eh: fix reset timeout type Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 5/8] ata: libata-scsi: fix timeout type in ata_scsi_park_store() Sergey Shtylyov
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
sata_deb_timing_{hotplug|long|normal}[] store 'unsigned long' debounce
timeouts in ms, while sata_link_debounce() eventually uses those timeouts
by calling ata_{deadline|msleep}( which take just 'unsigned int'. Change
the debounce timeout table element's type to 'unsigned int' -- all these
timeouts happily fit into 'unsigned int'...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/ahci.c | 2 +-
drivers/ata/ahci_qoriq.c | 2 +-
drivers/ata/ahci_xgene.c | 2 +-
drivers/ata/libahci.c | 2 +-
drivers/ata/libata-core.c | 4 ++--
drivers/ata/libata-sata.c | 16 ++++++++--------
drivers/ata/libata-sff.c | 2 +-
drivers/ata/sata_highbank.c | 2 +-
drivers/ata/sata_inic162x.c | 2 +-
drivers/ata/sata_mv.c | 2 +-
drivers/ata/sata_nv.c | 2 +-
include/linux/libata.h | 20 ++++++++++----------
12 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index addba109406b..02503e903e4a 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -807,7 +807,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
- const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+ const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context);
struct ata_port *ap = link->ap;
struct ahci_port_priv *pp = ap->private_data;
struct ahci_host_priv *hpriv = ap->host->private_data;
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index 3d01b118c9a1..fa99c1870d74 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -90,7 +90,7 @@ MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match);
static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
- const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+ const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context);
void __iomem *port_mmio = ahci_port_base(link->ap);
u32 px_cmd, px_is, px_val;
struct ata_port *ap = link->ap;
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index eb773f2e28fc..674dd01c73f6 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -350,7 +350,7 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel)
static int xgene_ahci_do_hardreset(struct ata_link *link,
unsigned long deadline, bool *online)
{
- const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+ const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context);
struct ata_port *ap = link->ap;
struct ahci_host_priv *hpriv = ap->host->private_data;
struct xgene_ahci_context *ctx = hpriv->plat_data;
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 06aec35f88f2..ad2bfcbff3bc 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1587,7 +1587,7 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline, bool *online)
{
- const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+ const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context);
struct ata_port *ap = link->ap;
struct ahci_port_priv *pp = ap->private_data;
struct ahci_host_priv *hpriv = ap->host->private_data;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e40785246634..b7a65226f724 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3617,7 +3617,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
{
struct ata_port *ap = link->ap;
struct ata_eh_context *ehc = &link->eh_context;
- const unsigned long *timing = sata_ehc_deb_timing(ehc);
+ const unsigned int *timing = sata_ehc_deb_timing(ehc);
int rc;
/* if we're about to do hardreset, nothing more to do */
@@ -3659,7 +3659,7 @@ EXPORT_SYMBOL_GPL(ata_std_prereset);
int sata_std_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
- const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+ const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context);
bool online;
int rc;
diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 6c07025011ed..335299db15da 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -17,11 +17,11 @@
#include "libata-transport.h"
/* debounce timing parameters in msecs { interval, duration, timeout } */
-const unsigned long sata_deb_timing_normal[] = { 5, 100, 2000 };
+const unsigned int sata_deb_timing_normal[] = { 5, 100, 2000 };
EXPORT_SYMBOL_GPL(sata_deb_timing_normal);
-const unsigned long sata_deb_timing_hotplug[] = { 25, 500, 2000 };
+const unsigned int sata_deb_timing_hotplug[] = { 25, 500, 2000 };
EXPORT_SYMBOL_GPL(sata_deb_timing_hotplug);
-const unsigned long sata_deb_timing_long[] = { 100, 2000, 5000 };
+const unsigned int sata_deb_timing_long[] = { 100, 2000, 5000 };
EXPORT_SYMBOL_GPL(sata_deb_timing_long);
/**
@@ -230,11 +230,11 @@ EXPORT_SYMBOL_GPL(ata_tf_from_fis);
* RETURNS:
* 0 on success, -errno on failure.
*/
-int sata_link_debounce(struct ata_link *link, const unsigned long *params,
+int sata_link_debounce(struct ata_link *link, const unsigned int *params,
unsigned long deadline)
{
- unsigned long interval = params[0];
- unsigned long duration = params[1];
+ unsigned int interval = params[0];
+ unsigned int duration = params[1];
unsigned long last_jiffies, t;
u32 last, cur;
int rc;
@@ -293,7 +293,7 @@ EXPORT_SYMBOL_GPL(sata_link_debounce);
* RETURNS:
* 0 on success, -errno on failure.
*/
-int sata_link_resume(struct ata_link *link, const unsigned long *params,
+int sata_link_resume(struct ata_link *link, const unsigned int *params,
unsigned long deadline)
{
int tries = ATA_LINK_RESUME_TRIES;
@@ -526,7 +526,7 @@ EXPORT_SYMBOL_GPL(sata_set_spd);
* RETURNS:
* 0 on success, -errno otherwise.
*/
-int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
+int sata_link_hardreset(struct ata_link *link, const unsigned int *timing,
unsigned long deadline,
bool *online, int (*check_ready)(struct ata_link *))
{
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 9d28badfe41d..ac55dfc2d85f 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1971,7 +1971,7 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
struct ata_eh_context *ehc = &link->eh_context;
- const unsigned long *timing = sata_ehc_deb_timing(ehc);
+ const unsigned int *timing = sata_ehc_deb_timing(ehc);
bool online;
int rc;
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index d6b324d03e59..f6d8ab512d7d 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -385,7 +385,7 @@ static int highbank_initialize_phys(struct device *dev, void __iomem *addr)
static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
unsigned long deadline)
{
- static const unsigned long timing[] = { 5, 100, 500};
+ static const unsigned int timing[] = { 5, 100, 500};
struct ata_port *ap = link->ap;
struct ahci_port_priv *pp = ap->private_data;
struct ahci_host_priv *hpriv = ap->host->private_data;
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 2c8c78ed86c1..db9c255dc9f2 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -619,7 +619,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,
struct ata_port *ap = link->ap;
void __iomem *port_base = inic_port_base(ap);
void __iomem *idma_ctl = port_base + PORT_IDMA_CTL;
- const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
+ const unsigned int *timing = sata_ehc_deb_timing(&link->eh_context);
int rc;
/* hammer it into sane state */
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index d404e631d152..41c107e15c40 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -3633,7 +3633,7 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class,
/* Workaround for errata FEr SATA#10 (part 2) */
do {
- const unsigned long *timing =
+ const unsigned int *timing =
sata_ehc_deb_timing(&link->eh_context);
rc = sata_link_hardreset(link, timing, deadline + extra,
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index abf5651c87ab..0a0cee755bde 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1529,7 +1529,7 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
NULL, NULL);
else {
- const unsigned long *timing = sata_ehc_deb_timing(ehc);
+ const unsigned int *timing = sata_ehc_deb_timing(ehc);
int rc;
if (!(ehc->i.flags & ATA_EHI_QUIET))
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 059fe8386118..2deb76b2ff53 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1155,11 +1155,11 @@ extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *
* SATA specific code - drivers/ata/libata-sata.c
*/
#ifdef CONFIG_SATA_HOST
-extern const unsigned long sata_deb_timing_normal[];
-extern const unsigned long sata_deb_timing_hotplug[];
-extern const unsigned long sata_deb_timing_long[];
+extern const unsigned int sata_deb_timing_normal[];
+extern const unsigned int sata_deb_timing_hotplug[];
+extern const unsigned int sata_deb_timing_long[];
-static inline const unsigned long *
+static inline const unsigned int *
sata_ehc_deb_timing(struct ata_eh_context *ehc)
{
if (ehc->i.flags & ATA_EHI_HOTPLUGGED)
@@ -1174,13 +1174,13 @@ extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
extern int sata_set_spd(struct ata_link *link);
extern int sata_link_hardreset(struct ata_link *link,
- const unsigned long *timing, unsigned long deadline,
+ const unsigned int *timing, unsigned long deadline,
bool *online, int (*check_ready)(struct ata_link *));
-extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
+extern int sata_link_resume(struct ata_link *link, const unsigned int *params,
unsigned long deadline);
extern void ata_eh_analyze_ncq_error(struct ata_link *link);
#else
-static inline const unsigned long *
+static inline const unsigned int *
sata_ehc_deb_timing(struct ata_eh_context *ehc)
{
return NULL;
@@ -1200,7 +1200,7 @@ static inline int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
}
static inline int sata_set_spd(struct ata_link *link) { return -EOPNOTSUPP; }
static inline int sata_link_hardreset(struct ata_link *link,
- const unsigned long *timing,
+ const unsigned int *timing,
unsigned long deadline,
bool *online,
int (*check_ready)(struct ata_link *))
@@ -1210,7 +1210,7 @@ static inline int sata_link_hardreset(struct ata_link *link,
return -EOPNOTSUPP;
}
static inline int sata_link_resume(struct ata_link *link,
- const unsigned long *params,
+ const unsigned int *params,
unsigned long deadline)
{
return -EOPNOTSUPP;
@@ -1218,7 +1218,7 @@ static inline int sata_link_resume(struct ata_link *link,
static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { }
#endif
extern int sata_link_debounce(struct ata_link *link,
- const unsigned long *params, unsigned long deadline);
+ const unsigned int *params, unsigned long deadline);
extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
bool spm_wakeup);
extern int ata_slave_link_init(struct ata_port *ap);
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/8] ata: libata-scsi: fix timeout type in ata_scsi_park_store()
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (3 preceding siblings ...)
2023-06-16 19:46 ` [PATCH 4/8] ata: fix debounce timings type Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 6/8] ata: libahci: fix parameter type of ahci_exec_polled_cmd() Sergey Shtylyov
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
ata_scsi_park_store() passes its 'long input' variable (if it's >= 0) to
ata_deadline() that now takes 'unsigned int' -- eliminate unneeded implicit
cast...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/libata-scsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9e79998e3958..16f574a8958f 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -131,11 +131,11 @@ static ssize_t ata_scsi_park_store(struct device *device,
struct scsi_device *sdev = to_scsi_device(device);
struct ata_port *ap;
struct ata_device *dev;
- long int input;
+ int input;
unsigned long flags;
int rc;
- rc = kstrtol(buf, 10, &input);
+ rc = kstrtoint(buf, 10, &input);
if (rc)
return rc;
if (input < -2)
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/8] ata: libahci: fix parameter type of ahci_exec_polled_cmd()
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (4 preceding siblings ...)
2023-06-16 19:46 ` [PATCH 5/8] ata: libata-scsi: fix timeout type in ata_scsi_park_store() Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 7/8] ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val() Sergey Shtylyov
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
ahci_exec_polled_cmd() passes its 'unsigned long timeout_msec' parameter
to ata_wait_register() that now takes 'unsigned int' -- eliminate unneeded
implicit casts, not forgetting about ahci_do_softreset()...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/libahci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index ad2bfcbff3bc..e2bacedf28ef 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1403,7 +1403,7 @@ EXPORT_SYMBOL_GPL(ahci_kick_engine);
static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,
struct ata_taskfile *tf, int is_cmd, u16 flags,
- unsigned long timeout_msec)
+ unsigned int timeout_msec)
{
const u32 cmd_fis_len = 5; /* five dwords */
struct ahci_port_priv *pp = ap->private_data;
@@ -1448,7 +1448,8 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
struct ahci_host_priv *hpriv = ap->host->private_data;
struct ahci_port_priv *pp = ap->private_data;
const char *reason = NULL;
- unsigned long now, msecs;
+ unsigned long now;
+ unsigned int msecs;
struct ata_taskfile tf;
bool fbs_disabled = false;
int rc;
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 7/8] ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (5 preceding siblings ...)
2023-06-16 19:46 ` [PATCH 6/8] ata: libahci: fix parameter type of ahci_exec_polled_cmd() Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 8/8] ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd() Sergey Shtylyov
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
xgene_ahci_poll_reg_val() passes its 'unsigned long {interval|timeout}'
params verbatim to ata_{msleep|deadline}() that just take 'unsigned int'
param for the time intervals in ms -- eliminate unneeded implicit cast...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/ahci_xgene.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 674dd01c73f6..ecf5a33796be 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -110,9 +110,8 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx)
* @timeout : timeout for achieving the value.
*/
static int xgene_ahci_poll_reg_val(struct ata_port *ap,
- void __iomem *reg, unsigned
- int val, unsigned long interval,
- unsigned long timeout)
+ void __iomem *reg, unsigned int val,
+ unsigned int interval, unsigned int timeout)
{
unsigned long deadline;
unsigned int tmp;
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 8/8] ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (6 preceding siblings ...)
2023-06-16 19:46 ` [PATCH 7/8] ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val() Sergey Shtylyov
@ 2023-06-16 19:46 ` Sergey Shtylyov
2023-06-22 23:49 ` [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Damien Le Moal
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-06-16 19:46 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
sil24_exec_polled_cmd() passes its 'unsigned long timeout_msec' parameter
to ata_wait_register() that now takes 'unsigned int' -- eliminate unneeded
implicit casts, not forgetting about sil24_do_softreset()...
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
drivers/ata/sata_sil24.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index e72a0257990d..142e70bfc498 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -597,7 +597,7 @@ static int sil24_init_port(struct ata_port *ap)
static int sil24_exec_polled_cmd(struct ata_port *ap, int pmp,
const struct ata_taskfile *tf,
int is_cmd, u32 ctrl,
- unsigned long timeout_msec)
+ unsigned int timeout_msec)
{
void __iomem *port = sil24_port_base(ap);
struct sil24_port_priv *pp = ap->private_data;
@@ -651,7 +651,7 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
{
struct ata_port *ap = link->ap;
int pmp = sata_srst_pmp(link);
- unsigned long timeout_msec = 0;
+ unsigned int timeout_msec = 0;
struct ata_taskfile tf;
const char *reason;
int rc;
--
2.26.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] Fix the remaining sloppy timeout typing in libata
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (7 preceding siblings ...)
2023-06-16 19:46 ` [PATCH 8/8] ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd() Sergey Shtylyov
@ 2023-06-22 23:49 ` Damien Le Moal
2023-07-06 20:31 ` Sergey Shtylyov
2023-07-17 0:51 ` Damien Le Moal
2023-07-25 23:36 ` Damien Le Moal
10 siblings, 1 reply; 14+ messages in thread
From: Damien Le Moal @ 2023-06-22 23:49 UTC (permalink / raw)
To: Sergey Shtylyov, linux-ide
On 6/17/23 04:45, Sergey Shtylyov wrote:
> Here are 8 patches against the 'for-next' branch of Damien's 'libata.git' repo.
>
> The libata code still often uses the 'unsigned long' type for the millisecond
> timeouts, while the kernel functions like msecs_to_jiffies() or msleep() only
> take 'unsigned int' parameters for those. I've started fixing the timeout types
> from ata_exec_internal[_sg]() that tripped the Svace static analyzer and posted
> couple patches, promising to post a large continuation series somewhat later...
> in my worst nightmare I couldn't imagine that this would take a whole year! :-(
>
> Sergey Shtylyov (8):
> ata: libata: fix parameter type of ata_deadline()
> ata: libata-core: fix parameter types of ata_wait_register()
> ata: libata-eh: fix reset timeout type
> ata: fix debounce timings type
> ata: libata-scsi: fix timeout type in ata_scsi_park_store()
> ata: libahci: fix parameter type of ahci_exec_polled_cmd()
> ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
> ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
We could merge patches 1-5 together as core updates, followed by driver patches.
Anyway, looks all OK to me but we are a little too close to the merge window. So
I will apply this once we have 6.5-rc1.
>
> drivers/ata/ahci.c | 2 +-
> drivers/ata/ahci_qoriq.c | 2 +-
> drivers/ata/ahci_xgene.c | 7 +++----
> drivers/ata/libahci.c | 7 ++++---
> drivers/ata/libata-core.c | 6 +++---
> drivers/ata/libata-eh.c | 6 +++---
> drivers/ata/libata-sata.c | 16 ++++++++--------
> drivers/ata/libata-scsi.c | 4 ++--
> drivers/ata/libata-sff.c | 2 +-
> drivers/ata/sata_highbank.c | 2 +-
> drivers/ata/sata_inic162x.c | 2 +-
> drivers/ata/sata_mv.c | 2 +-
> drivers/ata/sata_nv.c | 2 +-
> drivers/ata/sata_sil24.c | 4 ++--
> include/linux/libata.h | 24 ++++++++++++------------
> 15 files changed, 44 insertions(+), 44 deletions(-)
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] Fix the remaining sloppy timeout typing in libata
2023-06-22 23:49 ` [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Damien Le Moal
@ 2023-07-06 20:31 ` Sergey Shtylyov
0 siblings, 0 replies; 14+ messages in thread
From: Sergey Shtylyov @ 2023-07-06 20:31 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
On 6/23/23 2:49 AM, Damien Le Moal wrote:
>> Here are 8 patches against the 'for-next' branch of Damien's 'libata.git' repo.
>>
>> The libata code still often uses the 'unsigned long' type for the millisecond
>> timeouts, while the kernel functions like msecs_to_jiffies() or msleep() only
>> take 'unsigned int' parameters for those. I've started fixing the timeout types
>> from ata_exec_internal[_sg]() that tripped the Svace static analyzer and posted
>> couple patches, promising to post a large continuation series somewhat later...
>> in my worst nightmare I couldn't imagine that this would take a whole year! :-(
>>
>> Sergey Shtylyov (8):
>> ata: libata: fix parameter type of ata_deadline()
>> ata: libata-core: fix parameter types of ata_wait_register()
>> ata: libata-eh: fix reset timeout type
>> ata: fix debounce timings type
>> ata: libata-scsi: fix timeout type in ata_scsi_park_store()
>> ata: libahci: fix parameter type of ahci_exec_polled_cmd()
>> ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
>> ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
>
> We could merge patches 1-5 together as core updates, followed by driver patches.
I'd like to avoid that. Please! :-)
> Anyway, looks all OK to me but we are a little too close to the merge window. So
> I will apply this once we have 6.5-rc1.
Sigh, even more delaying...
/me blames his stupidly long illness on December tho...
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] Fix the remaining sloppy timeout typing in libata
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (8 preceding siblings ...)
2023-06-22 23:49 ` [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Damien Le Moal
@ 2023-07-17 0:51 ` Damien Le Moal
2023-07-25 23:36 ` Damien Le Moal
10 siblings, 0 replies; 14+ messages in thread
From: Damien Le Moal @ 2023-07-17 0:51 UTC (permalink / raw)
To: Sergey Shtylyov, linux-ide
On 6/17/23 04:45, Sergey Shtylyov wrote:
> Here are 8 patches against the 'for-next' branch of Damien's 'libata.git' repo.
>
> The libata code still often uses the 'unsigned long' type for the millisecond
> timeouts, while the kernel functions like msecs_to_jiffies() or msleep() only
> take 'unsigned int' parameters for those. I've started fixing the timeout types
> from ata_exec_internal[_sg]() that tripped the Svace static analyzer and posted
> couple patches, promising to post a large continuation series somewhat later...
> in my worst nightmare I couldn't imagine that this would take a whole year! :-(
>
> Sergey Shtylyov (8):
> ata: libata: fix parameter type of ata_deadline()
> ata: libata-core: fix parameter types of ata_wait_register()
> ata: libata-eh: fix reset timeout type
> ata: fix debounce timings type
> ata: libata-scsi: fix timeout type in ata_scsi_park_store()
> ata: libahci: fix parameter type of ahci_exec_polled_cmd()
> ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
> ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
Sergey,
This does not apply cleanly to for-6.6 branch. Could you rebase and resend please ?
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] Fix the remaining sloppy timeout typing in libata
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
` (9 preceding siblings ...)
2023-07-17 0:51 ` Damien Le Moal
@ 2023-07-25 23:36 ` Damien Le Moal
2023-07-26 8:41 ` Sergei Shtylyov
10 siblings, 1 reply; 14+ messages in thread
From: Damien Le Moal @ 2023-07-25 23:36 UTC (permalink / raw)
To: Sergey Shtylyov, linux-ide
On 6/17/23 04:45, Sergey Shtylyov wrote:
> Here are 8 patches against the 'for-next' branch of Damien's 'libata.git' repo.
>
> The libata code still often uses the 'unsigned long' type for the millisecond
> timeouts, while the kernel functions like msecs_to_jiffies() or msleep() only
> take 'unsigned int' parameters for those. I've started fixing the timeout types
> from ata_exec_internal[_sg]() that tripped the Svace static analyzer and posted
> couple patches, promising to post a large continuation series somewhat later...
> in my worst nightmare I couldn't imagine that this would take a whole year! :-(
Sergey,
Ping ? Are you resending this ?
Need a rebase as this does not apply cleanly.
>
> Sergey Shtylyov (8):
> ata: libata: fix parameter type of ata_deadline()
> ata: libata-core: fix parameter types of ata_wait_register()
> ata: libata-eh: fix reset timeout type
> ata: fix debounce timings type
> ata: libata-scsi: fix timeout type in ata_scsi_park_store()
> ata: libahci: fix parameter type of ahci_exec_polled_cmd()
> ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
> ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
>
> drivers/ata/ahci.c | 2 +-
> drivers/ata/ahci_qoriq.c | 2 +-
> drivers/ata/ahci_xgene.c | 7 +++----
> drivers/ata/libahci.c | 7 ++++---
> drivers/ata/libata-core.c | 6 +++---
> drivers/ata/libata-eh.c | 6 +++---
> drivers/ata/libata-sata.c | 16 ++++++++--------
> drivers/ata/libata-scsi.c | 4 ++--
> drivers/ata/libata-sff.c | 2 +-
> drivers/ata/sata_highbank.c | 2 +-
> drivers/ata/sata_inic162x.c | 2 +-
> drivers/ata/sata_mv.c | 2 +-
> drivers/ata/sata_nv.c | 2 +-
> drivers/ata/sata_sil24.c | 4 ++--
> include/linux/libata.h | 24 ++++++++++++------------
> 15 files changed, 44 insertions(+), 44 deletions(-)
>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/8] Fix the remaining sloppy timeout typing in libata
2023-07-25 23:36 ` Damien Le Moal
@ 2023-07-26 8:41 ` Sergei Shtylyov
0 siblings, 0 replies; 14+ messages in thread
From: Sergei Shtylyov @ 2023-07-26 8:41 UTC (permalink / raw)
To: Damien Le Moal, Sergey Shtylyov, linux-ide
On 7/26/23 2:36 AM, Damien Le Moal wrote:
[...]
>> Here are 8 patches against the 'for-next' branch of Damien's 'libata.git' repo.
>>
>> The libata code still often uses the 'unsigned long' type for the millisecond
>> timeouts, while the kernel functions like msecs_to_jiffies() or msleep() only
>> take 'unsigned int' parameters for those. I've started fixing the timeout types
>> from ata_exec_internal[_sg]() that tripped the Svace static analyzer and posted
>> couple patches, promising to post a large continuation series somewhat later...
>> in my worst nightmare I couldn't imagine that this would take a whole year! :-(
>
> Sergey,
>
> Ping ? Are you resending this ?
> Need a rebase as this does not apply cleanly.
I need to find the time for doing this...
>>
>> Sergey Shtylyov (8):
>> ata: libata: fix parameter type of ata_deadline()
>> ata: libata-core: fix parameter types of ata_wait_register()
>> ata: libata-eh: fix reset timeout type
>> ata: fix debounce timings type
>> ata: libata-scsi: fix timeout type in ata_scsi_park_store()
>> ata: libahci: fix parameter type of ahci_exec_polled_cmd()
>> ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val()
>> ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd()
>>
>> drivers/ata/ahci.c | 2 +-
>> drivers/ata/ahci_qoriq.c | 2 +-
>> drivers/ata/ahci_xgene.c | 7 +++----
>> drivers/ata/libahci.c | 7 ++++---
>> drivers/ata/libata-core.c | 6 +++---
>> drivers/ata/libata-eh.c | 6 +++---
>> drivers/ata/libata-sata.c | 16 ++++++++--------
>> drivers/ata/libata-scsi.c | 4 ++--
>> drivers/ata/libata-sff.c | 2 +-
>> drivers/ata/sata_highbank.c | 2 +-
>> drivers/ata/sata_inic162x.c | 2 +-
>> drivers/ata/sata_mv.c | 2 +-
>> drivers/ata/sata_nv.c | 2 +-
>> drivers/ata/sata_sil24.c | 4 ++--
>> include/linux/libata.h | 24 ++++++++++++------------
>> 15 files changed, 44 insertions(+), 44 deletions(-)
MBR, Sergey
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-07-26 8:48 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16 19:45 [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 1/8] ata: libata: fix parameter type of ata_deadline() Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 2/8] ata: libata-core: fix parameter types of ata_wait_register() Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 3/8] ata: libata-eh: fix reset timeout type Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 4/8] ata: fix debounce timings type Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 5/8] ata: libata-scsi: fix timeout type in ata_scsi_park_store() Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 6/8] ata: libahci: fix parameter type of ahci_exec_polled_cmd() Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 7/8] ata: ahci_xgene: fix parameter types of xgene_ahci_poll_reg_val() Sergey Shtylyov
2023-06-16 19:46 ` [PATCH 8/8] ata: sata_sil24: fix parameter type of sil24_exec_polled_cmd() Sergey Shtylyov
2023-06-22 23:49 ` [PATCH 0/8] Fix the remaining sloppy timeout typing in libata Damien Le Moal
2023-07-06 20:31 ` Sergey Shtylyov
2023-07-17 0:51 ` Damien Le Moal
2023-07-25 23:36 ` Damien Le Moal
2023-07-26 8:41 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox