From patchwork Mon Oct 24 11:30:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419799wru; Mon, 24 Oct 2022 05:16:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CvHyywZyedgdyAkDocvi1ue2/qBf//LTQ3A3tMtEoPRjTjI1UHzEk71Y2tWs9sQzaEOD8 X-Received: by 2002:a05:6a00:1bc3:b0:562:ab5f:af2 with SMTP id o3-20020a056a001bc300b00562ab5f0af2mr33738188pfw.58.1666613819087; Mon, 24 Oct 2022 05:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613819; cv=none; d=google.com; s=arc-20160816; b=x6x77unjbddaxkW9pgSi96od7YJodTorDv5vOSuv80dJKIRBXPf+R8HEkxg+nNNTWJ h+xLZtXOhd6edDZ6h2ooRRsmPjRXE2IlKVH1IzaZHS0MppwZ7vcggASsW2zVCm2PUl9/ Zqw+qAiaE0M3NRcSnBKJ8uZJ1aOGT3wLFcYvnVwhMTog/L8LvuS2QnXqgZLnXkHtJjKs 83oqyaQAiI83xou+k+gplglITsYwVYaBAWb91nCEPK9gUsLZa5kpMYuc7vZ42D9EMttw u2bUmE5X0vz6lXudaZzc2/+HZFOkKU1BUUQURjxPLxUGrJStEafxJIYTyONblgvFVCzQ bCeA== 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=bLpqXTH/8JdiZsHHIoZJtYkzCnNHMsc9jPaV/ZXH32I=; b=ejv9EGY127CiB0nvY7swkWrUfWF/UJdrjAiE2/lJ6mLfK8vF8aA3tSmmTOR7GAs9iK lCVK4/6JhjqQlE2v1zZZXKn/CR6RLL8Pji+MSpnjtX6vq8HP9rRGzqS5545Ts7ct+74x 112S8GM8ZLfxqYlttXv8rNsyY43YKgxgZg1CtSIBMyax162ZWKfDyWtnNWJcZMCA+l6A RETGPwK5pOozV/KqzIPqn29nChgG7ySk2WpM8wUSGP/a6F5c/DKODDeEXAMnwBpQZTsc xGO21cY4uwFA4nMxFesfGetghodCnyljb9W/91ExvwkCB7gMB1hN+6XgVKA+O5iXc+m+ 2XIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PsMPEJVr; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902d48300b00186a592183fsi4210050plg.365.2022.10.24.05.16.46; Mon, 24 Oct 2022 05:16:59 -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=PsMPEJVr; 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 S232740AbiJXMKP (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:15 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571252126174124?= X-GMAIL-MSGID: =?utf-8?q?1747571252126174124?= 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] != 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) \ @@ -591,7 +595,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))