From patchwork Tue Sep 12 00:56:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 13380485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91A6FCA0EC8 for ; Tue, 12 Sep 2023 02:07:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236200AbjILCHr (ORCPT ); Mon, 11 Sep 2023 22:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237212AbjILCCC (ORCPT ); Mon, 11 Sep 2023 22:02:02 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E26D1A5314; Mon, 11 Sep 2023 18:32:26 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17E3FC3279F; Tue, 12 Sep 2023 00:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694480247; bh=UkSDNVnPQ7nwSIXNpb1Ao231W+LFpzXKNtCJu20pubM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4TdvnWxvNqQru2ZcIyMW7u1OD1FScSYGxrJ8M0M2RnsapU+N9ZzXQacLOs5/GVw9 QGwAbMx97cUX8vi1nh8EfiWo3lFs97wpfLQxf+LmyjWb0/9bFzHmzXvB2+yGu8zzEN kFhNVID6mvoS5QPzANcsFYRZaLRijp3WgLGCdRMvVu39BKGhyWPavAEtgxu3vo2hcf ZX42Z9cZeD23Gn00p6WbFyfT20Clm5VFQNEZp6117V2b9maGBGZ9mZLq7LMj9gEsGq mmaLeTLE+4un0yqgzUH1YeMTz4NFXCqJoYafRkas9C5na5s7VxQV9jh4QeBOnhrIQS GA/LToXyVz4tQ== From: Damien Le Moal To: linux-ide@vger.kernel.org Cc: linux-scsi@vger.kernel.org, "Martin K . Petersen" , John Garry , Rodrigo Vivi , Paul Ausbeck , Kai-Heng Feng , Joe Breuer Subject: [PATCH v2 20/21] ata: libata-eh: Reduce "disable device" message verbosity Date: Tue, 12 Sep 2023 09:56:54 +0900 Message-ID: <20230912005655.368075-21-dlemoal@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230912005655.368075-1-dlemoal@kernel.org> References: <20230912005655.368075-1-dlemoal@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org There is no point in warning about a device being disabled when we expect it to be, that is, on suspend, shutdown or when detaching the device. Suppress the message "disable device" for these cases by introducing the EH static function ata_eh_dev_disable() and by using it in ata_eh_unload() and ata_eh_detach_dev(). ata_dev_disable() code is modified to call this new function after printing the "disable device" message. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- drivers/ata/libata-eh.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 2b933e7a357a..9cad16bcbebc 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -494,6 +494,18 @@ void ata_eh_release(struct ata_port *ap) mutex_unlock(&ap->host->eh_mutex); } +static void ata_eh_dev_disable(struct ata_device *dev) +{ + ata_acpi_on_disable(dev); + ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET); + dev->class++; + + /* From now till the next successful probe, ering is used to + * track probe failures. Clear accumulated device error info. + */ + ata_ering_clear(&dev->ering); +} + static void ata_eh_unload(struct ata_port *ap) { struct ata_link *link; @@ -517,8 +529,8 @@ static void ata_eh_unload(struct ata_port *ap) */ ata_for_each_link(link, ap, PMP_FIRST) { sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); - ata_for_each_dev(dev, link, ALL) - ata_dev_disable(dev); + ata_for_each_dev(dev, link, ENABLED) + ata_eh_dev_disable(dev); } /* freeze and set UNLOADED */ @@ -1211,14 +1223,8 @@ void ata_dev_disable(struct ata_device *dev) return; ata_dev_warn(dev, "disable device\n"); - ata_acpi_on_disable(dev); - ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET); - dev->class++; - /* From now till the next successful probe, ering is used to - * track probe failures. Clear accumulated device error info. - */ - ata_ering_clear(&dev->ering); + ata_eh_dev_disable(dev); } EXPORT_SYMBOL_GPL(ata_dev_disable); @@ -1240,12 +1246,12 @@ void ata_eh_detach_dev(struct ata_device *dev) /* * If the device is still enabled, transition it to standby power mode - * (i.e. spin down HDDs). + * (i.e. spin down HDDs) and disable it. */ - if (ata_dev_enabled(dev)) + if (ata_dev_enabled(dev)) { ata_dev_power_set_standby(dev); - - ata_dev_disable(dev); + ata_eh_dev_disable(dev); + } spin_lock_irqsave(ap->lock, flags);