From patchwork Tue Jul 12 17:35:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9225817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C30A060868 for ; Tue, 12 Jul 2016 17:36:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABF4C27165 for ; Tue, 12 Jul 2016 17:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A06EE27D85; Tue, 12 Jul 2016 17:36:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CF7327C14 for ; Tue, 12 Jul 2016 17:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753583AbcGLRgO (ORCPT ); Tue, 12 Jul 2016 13:36:14 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33291 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbcGLRgN (ORCPT ); Tue, 12 Jul 2016 13:36:13 -0400 Received: by mail-pf0-f194.google.com with SMTP id i6so1157024pfe.0; Tue, 12 Jul 2016 10:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=owt4oFeLhITwyEbY1GHEP8LnbtGTQT36QEjGD8bIxhw=; b=d6HxENXnURTQrhHY7UqBqXmULKzF1yfU8NlPtuGgNETV7eJvnAe9qoCl2P9Ejtkns6 ZItgazFAYKVi70RCMh2SEqDcUqstJMJQ/budov34zNmR8vqR+lSIXR5JHvPMfaSjLpZU KEKXvGfEdmRbDDL7cNbA7LtTVi/f0bGx8XG9mWTwFqkPAqO2aGBvv8dSJOmk3l5gnr1Q RECY9br8gNKyMahlYc4qcEg6DnUVjX2+9g7vfVnph9Y9xp5g9vajkkcucOo+kQo657RA fVX3xeuwQTq0rmHHFk/tRhFkmd6RRWUSKs6/WrUAnfog5HUoFJzfHw3/8kcB8NH8YC7v PKkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=owt4oFeLhITwyEbY1GHEP8LnbtGTQT36QEjGD8bIxhw=; b=lnret8y4l48koypxEZVz8NOfstX2RlvhuEpwnxz2mbhrYHQ8r1i0NqszrFVUt1WWKS FqHdZmENuS3zj9Thf4LICha1nDoVPWhWOrki5Kyh78R1fhe/pTkfDSbix5m82vVAvhgO LJ3OKPaoQHpP7BntE146beBNwvOoXrW42429OOfnIA2CsnRwargqNF6zfpeAeS1kOmHr p86+1PfVsHIuZPn8ohzwDI4zG/8Xksx9LRuICS+61Tz8EPG4IsHe9fk5n1yQPhUBQupC raPXzapf/1xNBR0lv+sgVdrsIkTLFNH/hYoMv53/GghDs8A4mrDUzOgiWxfW6Xsb1Q6N 1etw== X-Gm-Message-State: ALyK8tJglKtdqeL1M6UuSh3Qd0PJx4Klk7Xhum5CPVsaBVYgVNOIb/qVxz0Cl8KLL4buOw== X-Received: by 10.98.52.3 with SMTP id b3mr46671935pfa.40.1468344967231; Tue, 12 Jul 2016 10:36:07 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id o6sm6663397pab.11.2016.07.12.10.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 10:36:06 -0700 (PDT) Message-ID: <57852a86.460b420a.faeba.0b28@mx.google.com> X-Google-Original-Message-ID: <20160712173558.4025-1-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org, hare@suse.de Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Tom Yan Subject: [PATCH] libata-scsi: fix D_SENSE bit relection in control mode page Date: Wed, 13 Jul 2016 01:35:58 +0800 X-Mailer: git-send-email 2.9.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan The bit should always be set to 1 when the requested version of page is "changeable" because we've made it so in ata_mselect_control(). Also, it should always be set to 1 if ATA_DFLAG_D_SENSE is set (when the requested version of page is "current" or "default"). Signed-off-by: Tom Yan diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index bfec66f..7e24f0a 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2446,7 +2446,7 @@ static unsigned int ata_msense_ctl_mode(struct ata_device *dev, u8 *buf, bool changeable) { modecpy(buf, def_control_mpage, sizeof(def_control_mpage), changeable); - if (changeable && (dev->flags & ATA_DFLAG_D_SENSE)) + if (changeable || (dev->flags & ATA_DFLAG_D_SENSE)) buf[2] |= (1 << 2); /* Descriptor sense requested */ return sizeof(def_control_mpage); }