[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c9348be9-7b9e-ebf8-b787-e6b3e0724b4a@kernel.org>
Date: Sat, 22 Apr 2023 07:07:41 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Yahu Gao <yahu.gao@...look.com>
Cc: linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org,
Yahu Gao <gaoyh12@...ovo.com>, Jiwei Sun <sunjw10@...ovo.com>
Subject: Re: [PATCH] drivers/ata: Improve performance and readability
On 4/21/23 21:54, Yahu Gao wrote:
> From: Yahu Gao <gaoyh12@...ovo.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@...ovo.com>
> Signed-off-by: Yahu Gao <gaoyh12@...ovo.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;
Powered by blists - more mailing lists