* [PATCH] drivers/ata: Improve performance and readability
@ 2023-04-21 12:54 Yahu Gao
2023-04-21 22:07 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Yahu Gao @ 2023-04-21 12:54 UTC (permalink / raw)
To: dlemoal; +Cc: linux-ide, linux-kernel, yahu.gao, Yahu Gao, Jiwei Sun
From: Yahu Gao <gaoyh12@lenovo.com>
Replace conditions of avoid issuing [P]IDENTIFY to PMP.
Reviewed-by: Jiwei Sun <sunjw10@lenovo.com>
Signed-off-by: Yahu Gao <gaoyh12@lenovo.com>
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 14c17c3bda4e..53f65d751189 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3802,11 +3802,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
return -ENODEV;
/* fail early if !ATA && !ATAPI to avoid issuing [P]IDENTIFY to PMP */
- if (ata_class_enabled(new_class) &&
- new_class != ATA_DEV_ATA &&
- new_class != ATA_DEV_ATAPI &&
- new_class != ATA_DEV_ZAC &&
- new_class != ATA_DEV_SEMB) {
+ if (new_class == ATA_DEV_PMP) {
ata_dev_info(dev, "class mismatch %u != %u\n",
dev->class, new_class);
rc = -ENODEV;
--
2.39.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/ata: Improve performance and readability
2023-04-21 12:54 [PATCH] drivers/ata: Improve performance and readability Yahu Gao
@ 2023-04-21 22:07 ` Damien Le Moal
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2023-04-21 22:07 UTC (permalink / raw)
To: Yahu Gao; +Cc: linux-ide, linux-kernel, Yahu Gao, Jiwei Sun
On 4/21/23 21:54, Yahu Gao wrote:
> From: Yahu Gao <gaoyh12@lenovo.com>
>
The patch title should start with:
ata: libata-core: ...
And let's be honest here: this is not the hot path and you are optimizing a
single "if" condition for a series of commands that will take 10s of ms to
execute. So this is *not* about performance. So update the patch title please.
> Replace conditions of avoid issuing [P]IDENTIFY to PMP.
>
> Reviewed-by: Jiwei Sun <sunjw10@lenovo.com>
> Signed-off-by: Yahu Gao <gaoyh12@lenovo.com>
>
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 14c17c3bda4e..53f65d751189 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -3802,11 +3802,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
> return -ENODEV;
>
> /* fail early if !ATA && !ATAPI to avoid issuing [P]IDENTIFY to PMP */
> - if (ata_class_enabled(new_class) &&
> - new_class != ATA_DEV_ATA &&
> - new_class != ATA_DEV_ATAPI &&
> - new_class != ATA_DEV_ZAC &&
> - new_class != ATA_DEV_SEMB) {
> + if (new_class == ATA_DEV_PMP) {
Using a switch-case here may actually make things even more readable.
> ata_dev_info(dev, "class mismatch %u != %u\n",
> dev->class, new_class);
> rc = -ENODEV;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-21 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 12:54 [PATCH] drivers/ata: Improve performance and readability Yahu Gao
2023-04-21 22:07 ` 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
all inboxes | Powered by JetHome®