Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp3166694qtb; Mon, 24 Oct 2022 07:13:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CW9hPvnAzfLGJ8bjhC0MJMrP4zxQwZXWqM9SALbEW6S20OKmuCoEtRYtRbJzlZ5CmRiWF X-Received: by 2002:a17:907:9811:b0:79a:a1fe:8be6 with SMTP id ji17-20020a170907981100b0079aa1fe8be6mr15248020ejc.480.1666620825107; Mon, 24 Oct 2022 07:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666620825; cv=none; d=google.com; s=arc-20160816; b=Xjjm5jkMpYgmaLsLpuvuWdfED/6SANVCf34FSFIivDQrL9fa+yfiV30cheoYZ1DwyG efbqkJrDgNv2E/V0+njc9t0M+PHrFJXtWnfpY7MNgXmU13bRtMp83GEdHIwVeXDuEHzR rUspZrlASLXZi1mi6OKf7HQ3rVu1uPajeD8fuP6LErrjNt3MBXARh+es9jMz9/XbqZgv lxjVhg/7F2je30kh/pCBxIGrpcnVazvxqOUWNKnZ7wVJZaA+hvKeav/afv58Lyc/3C+4 808sLVlLMpqo07qer0ZpWn1DDIdsoMKpCrv+QSrrxbOV9dCiEkSZ+IJl4/ABV85Di3fK A39g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EisKrlAqyhqX3dhC2b/CF+PptlWYgIH9AnH4fRFuwBI=; b=wwRHBQWwfk6gUp5KmVYhnRRGepPH69+2E51yTbCfNErGilMBRjLtbBnLmGq3jBGEPP DTtohiIsyNgEgLh8y+kidJkMgumqCgNM9H0pIW8HwU7fsmmgGv8D2ugrsLmc8g8IKdKA IAVZtVPV3Gdm+MmRxjOAgcGFs13vW+IUdlUaEfCv1JVLWruLMHWtVmIVpyTIRqH4IBGg 1cWZJ+aL/tnOJDo4LExjFMc+8s3BbLymA7lmxngM9MhWcGW/fJYzgF9uqG5C9P7dwKXx 7ACHuwZ/NsAQ9j79FFYwLiSJdfjhsaSvGAUNLg5kK/25zSxyRw27MgGzRbtpSPS2x9/U 47DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n+HzZk5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a05640251c700b0045d523bee48si26392138edd.178.2022.10.24.07.13.19; Mon, 24 Oct 2022 07:13:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n+HzZk5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234708AbiJXMyi (ORCPT + 99 others); Mon, 24 Oct 2022 08:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234875AbiJXMyM (ORCPT ); Mon, 24 Oct 2022 08:54:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA2E62F000; Mon, 24 Oct 2022 05:14:31 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 631076129B; Mon, 24 Oct 2022 12:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7691AC433C1; Mon, 24 Oct 2022 12:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612835; bh=ThUNefmVX7EPWeUHan2db69m+nsFLLtPDI0WYoWFkvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n+HzZk5A6t+K+8n7NBjyas9Hd+1HWVrXrvAcseAef5F0x9/0dF+AscZEe0TiZkZun KMgZwNvGTytktizga0C33gEt3tLPwYdzajGZMWVZe+D+J86fzv1qrkSZ+TFiFSS5yN 1WNeLMR4htrpmsQXQo9TroeGIVBPRZRZhFki7dFk= 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.19 137/229] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024113003.443723005@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 351e58312e7d..e9d24a23c0aa 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -581,6 +581,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2))) +#define ata_id_has_devslp(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 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) \ @@ -593,7 +597,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 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)) -- 2.35.1