From patchwork Sat Sep 23 00:29:28 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: 13396459 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 44316CE7A89 for ; Sat, 23 Sep 2023 00:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbjIWAbO (ORCPT ); Fri, 22 Sep 2023 20:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230500AbjIWAaY (ORCPT ); Fri, 22 Sep 2023 20:30:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29828100; Fri, 22 Sep 2023 17:30:04 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8887DC433CA; Sat, 23 Sep 2023 00:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695429003; bh=R1tYu+zCjKRGxXsPNNRChzgkkzMhM2utM9Va0s9nexk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j7Wx735FpPuC6iNZRsycLaS4THuALzrj5qhaqJTiwx+T2iaoIkTv+nDHwX5pbaHDp Kol5VqS+kfHaDcRbjEi6EX0qnitsZCbejDBNXSbVph4GdvLGH9eDl+8Qzu5MRoiGmn 3aNhYj8IJRE8Y8UVcOMvlNwbXds/bvMQ/NlUkE+tTSvxNZQnxrf/hPEJm7RMH3/M1K 77zYWpae0L2oHfE7Fj9PabcG/a4RmuXaUJyEFFbaWS/+xYGiQ3PvJyGbVroWke3oER kuno2zrQUSCBKuXo91wnm1/6HyaSdGIMhMFP4uHl7X88HuGRY0eqUqzZF5TOvluTsx R8QKH3lSrRzvw== 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 , Geert Uytterhoeven , Chia-Lin Kao Subject: [PATCH v6 19/23] ata: libata-core: Do not resume runtime suspended ports Date: Sat, 23 Sep 2023 09:29:28 +0900 Message-ID: <20230923002932.1082348-20-dlemoal@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230923002932.1082348-1-dlemoal@kernel.org> References: <20230923002932.1082348-1-dlemoal@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The scsi disk driver does not resume disks that have been runtime suspended by the user. To be consistent with this behavior, do the same for ata ports and skip the PM request in ata_port_pm_resume() if the port was already runtime suspended. With this change, it is no longer necessary to force the PM state of the port to ACTIVE as the PM core code will take care of that when handling runtime resume. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Tested-by: Chia-Lin Kao (AceLan) Tested-by: Geert Uytterhoeven Reviewed-by: Martin K. Petersen --- drivers/ata/libata-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index df6ed386e6fc..58f03031a259 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5230,10 +5230,8 @@ static void ata_port_resume(struct ata_port *ap, pm_message_t mesg, static int ata_port_pm_resume(struct device *dev) { - ata_port_resume(to_ata_port(dev), PMSG_RESUME, true); - pm_runtime_disable(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); + if (!pm_runtime_suspended(dev)) + ata_port_resume(to_ata_port(dev), PMSG_RESUME, true); return 0; }