* [PATCH] ata: libata-eh: fix sloppy result type of ata_internal_cmd_timeout()
@ 2022-06-18 20:38 Sergey Shtylyov
2022-06-18 20:55 ` Sergey Shtylyov
2022-06-19 23:24 ` Damien Le Moal
0 siblings, 2 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2022-06-18 20:38 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
ata_internal_cmd_timeout() returns *unsigned long* timeout in ms, however
ata_exec_internal_sg() passes that timeout to msecs_to_jiffies() that takes
just *unsigned int*. Change ata_internal_cmd_timeout()'s result type to
*unsigned int* as well, also updating the *struct* ata_eh_cmd_timeout_ent
and the command timeout tables -- 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>
---
This patch is against the 'for-next' branch of Damien's 'libata.git' repo.
drivers/ata/libata-eh.c | 22 +++++++++++-----------
drivers/ata/libata.h | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
Index: libata/drivers/ata/libata-eh.c
===================================================================
--- libata.orig/drivers/ata/libata-eh.c
+++ libata/drivers/ata/libata-eh.c
@@ -86,36 +86,36 @@ static const unsigned long ata_eh_reset_
ULONG_MAX, /* > 1 min has elapsed, give up */
};
-static const unsigned long ata_eh_identify_timeouts[] = {
+static const unsigned int ata_eh_identify_timeouts[] = {
5000, /* covers > 99% of successes and not too boring on failures */
10000, /* combined time till here is enough even for media access */
30000, /* for true idiots */
- ULONG_MAX,
+ UINT_MAX,
};
-static const unsigned long ata_eh_revalidate_timeouts[] = {
+static const unsigned int ata_eh_revalidate_timeouts[] = {
15000, /* Some drives are slow to read log pages when waking-up */
15000, /* combined time till here is enough even for media access */
- ULONG_MAX,
+ UINT_MAX,
};
-static const unsigned long ata_eh_flush_timeouts[] = {
+static const unsigned int ata_eh_flush_timeouts[] = {
15000, /* be generous with flush */
15000, /* ditto */
30000, /* and even more generous */
- ULONG_MAX,
+ UINT_MAX,
};
-static const unsigned long ata_eh_other_timeouts[] = {
+static const unsigned int ata_eh_other_timeouts[] = {
5000, /* same rationale as identify timeout */
10000, /* ditto */
/* but no merciful 30sec for other commands, it just isn't worth it */
- ULONG_MAX,
+ UINT_MAX,
};
struct ata_eh_cmd_timeout_ent {
const u8 *commands;
- const unsigned long *timeouts;
+ const unsigned int *timeouts;
};
/* The following table determines timeouts to use for EH internal
@@ -326,7 +326,7 @@ static int ata_lookup_timeout_table(u8 c
* RETURNS:
* Determined timeout.
*/
-unsigned long ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd)
+unsigned int ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd)
{
struct ata_eh_context *ehc = &dev->link->eh_context;
int ent = ata_lookup_timeout_table(cmd);
@@ -361,7 +361,7 @@ void ata_internal_cmd_timed_out(struct a
return;
idx = ehc->cmd_timeout_idx[dev->devno][ent];
- if (ata_eh_cmd_timeout_table[ent].timeouts[idx + 1] != ULONG_MAX)
+ if (ata_eh_cmd_timeout_table[ent].timeouts[idx + 1] != UINT_MAX)
ehc->cmd_timeout_idx[dev->devno][ent]++;
}
Index: libata/drivers/ata/libata.h
===================================================================
--- libata.orig/drivers/ata/libata.h
+++ libata/drivers/ata/libata.h
@@ -132,7 +132,7 @@ int ata_scsi_dev_config(struct scsi_devi
int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, struct ata_device *dev);
/* libata-eh.c */
-extern unsigned long ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd);
+extern unsigned int ata_internal_cmd_timeout(struct ata_device *dev, u8 cmd);
extern void ata_internal_cmd_timed_out(struct ata_device *dev, u8 cmd);
extern void ata_eh_acquire(struct ata_port *ap);
extern void ata_eh_release(struct ata_port *ap);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ata: libata-eh: fix sloppy result type of ata_internal_cmd_timeout()
2022-06-18 20:38 [PATCH] ata: libata-eh: fix sloppy result type of ata_internal_cmd_timeout() Sergey Shtylyov
@ 2022-06-18 20:55 ` Sergey Shtylyov
2022-06-19 23:24 ` Damien Le Moal
1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2022-06-18 20:55 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
On 6/18/22 11:38 PM, Sergey Shtylyov wrote:
> ata_internal_cmd_timeout() returns *unsigned long* timeout in ms, however
> ata_exec_internal_sg() passes that timeout to msecs_to_jiffies() that takes
> just *unsigned int*. Change ata_internal_cmd_timeout()'s result type to
> *unsigned int* as well, also updating the *struct* ata_eh_cmd_timeout_ent
> and the command timeout tables -- all timeouts fit into *unsigned int* but
> we have to change ULONG_MAX to UINT_MAX...
BTW, the patch saves 64 bytes of object code...
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ata: libata-eh: fix sloppy result type of ata_internal_cmd_timeout()
2022-06-18 20:38 [PATCH] ata: libata-eh: fix sloppy result type of ata_internal_cmd_timeout() Sergey Shtylyov
2022-06-18 20:55 ` Sergey Shtylyov
@ 2022-06-19 23:24 ` Damien Le Moal
1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2022-06-19 23:24 UTC (permalink / raw)
To: Sergey Shtylyov, linux-ide
On 6/19/22 05:38, Sergey Shtylyov wrote:
> ata_internal_cmd_timeout() returns *unsigned long* timeout in ms, however
> ata_exec_internal_sg() passes that timeout to msecs_to_jiffies() that takes
> just *unsigned int*. Change ata_internal_cmd_timeout()'s result type to
> *unsigned int* as well, also updating the *struct* ata_eh_cmd_timeout_ent
> and the command timeout tables -- 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>
Applied to for-5.20. Thanks !
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-19 23:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-18 20:38 [PATCH] ata: libata-eh: fix sloppy result type of ata_internal_cmd_timeout() Sergey Shtylyov
2022-06-18 20:55 ` Sergey Shtylyov
2022-06-19 23:24 ` Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox