From nobody Mon Dec 15 18:31:46 2025 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 2A3E8C38A2D for ; Mon, 24 Oct 2022 12:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232746AbiJXMKQ (ORCPT ); Mon, 24 Oct 2022 08:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbiJXMIw (ORCPT ); Mon, 24 Oct 2022 08:08:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8E7A7E812; Mon, 24 Oct 2022 04:52:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A6F3B811A5; Mon, 24 Oct 2022 11:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68B3DC433D6; Mon, 24 Oct 2022 11:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612265; bh=XoV/HGYuQ9mhk0KvT/OiLA1uLDSd1NUz6zNz71T1NOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsMPEJVrhCtPqEa+EUbCH9+8Mf66huYhYPcUYAwd3MsiysuUoGymoI0X/B6Osckql ZupcGQfUt6j5kApAgM4ci0tzF1abDZ4v/6O1tXBn2vedlmi5K2+FtEhr594r550OU/ Te5hjeMDO3xFtWIeiUuTgzFekYqPGkY3NTnjta2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.14 131/210] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:48 +0200 Message-Id: <20221024113001.238323526@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niklas Cassel [ Upstream commit 9c6e09a434e1317e09b78b3b69cd384022ec9a03 ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: 65fe1f0f66a5 ("ahci: implement aggressive SATA device sleep support") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index 90a4c166c0fa..c2beacc9e522 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -579,6 +579,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] !=3D 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] !=3D 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2))) +#define ata_id_has_devslp(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] !=3D 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] !=3D 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -591,7 +595,6 @@ struct ata_bmdma_prd { =20 #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) =3D=3D 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) #define ata_id_has_ncq_autosense(id) \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) =20 --=20 2.35.1