From patchwork Thu Jul 7 01:43:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9217701 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 E965760752 for ; Thu, 7 Jul 2016 01:43:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA64E285F7 for ; Thu, 7 Jul 2016 01:43:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEF15285F9; Thu, 7 Jul 2016 01:43:46 +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 8BFEC285F7 for ; Thu, 7 Jul 2016 01:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756062AbcGGBnp (ORCPT ); Wed, 6 Jul 2016 21:43:45 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:35134 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754511AbcGGBno (ORCPT ); Wed, 6 Jul 2016 21:43:44 -0400 Received: by mail-pa0-f65.google.com with SMTP id dx3so379188pab.2; Wed, 06 Jul 2016 18:43:44 -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:in-reply-to:references; bh=fcFGhijFaryh9bvCJ7SoRz3Zt/kqwB/OIP7WrH83DNs=; b=Z/Hn7qJkqKY6iv/WpxIwY209kRhCXG5wK+QbNVpwiiAm3bK8ZgXiloieUHK1N76+VG CpGFovRaGy3lEWcELNDrqZ6tA01SvOVupKmAuvv8Bmpk5v31FPovbC/OnrnBiH0E7QiO zy+YKBrsnPLsotKnHY+uxP3y5Ad659XxXtXPbsMkw0AmWkI7W9jUPKmHIEvHyoSSmVh8 si4ajuKtvixRruHYpm55nNkWs0DFmZzvKYQcCenJ0DIz6rdsVM520ZBJlQdz3kEs+BHf +qchVYWkyTFh61VFIlHmX4VS6KZDFuQ9MMMXJEA0J2ISG6kSgTAJ6IZNACwQ95OL2cCD E+BA== 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:in-reply-to :references; bh=fcFGhijFaryh9bvCJ7SoRz3Zt/kqwB/OIP7WrH83DNs=; b=iicMXr+4/6QCi4/Uma3PdBcuFCHmsEmejR0kHw/ubXHME2LinbM0md/tmChBc976jW 9fFxD+VlntzHt605LrmOrXdxN+6euyed5f5Hf9ZkUzVzwWLjF5Neb+1Ue/8PCPBVYWu6 Mvj9DsYy99VjcCJBTfxpfMIVdyylChc3AtbwPNTlHiLaG2uPzclkYdEiod+x9ecEKJi6 wTcAqflnFCNMEyN0+HpBArL6epRgMnlA6cqefvqPCHXCmJQmgCawgDqwuYQolmBgcA9v DtohpmekDAJVC9CS+/XE7bL5UBt8OQOwPspva1weXE8HaHjEEMTsymNtHBdDLnZCAs9N qzww== X-Gm-Message-State: ALyK8tKaogZlfvpInTMltwgi8+FA6uV/lzdkQItSUUDZF2BizB21IDFGVmuVmWv8CsRR2Q== X-Received: by 10.67.13.230 with SMTP id fb6mr32399376pad.83.1467855823798; Wed, 06 Jul 2016 18:43:43 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id f10sm238507pfc.79.2016.07.06.18.43.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 18:43:43 -0700 (PDT) Message-ID: <577db3cf.0a6a620a.c3774.1508@mx.google.com> X-Google-Original-Message-ID: <20160707014334.1031-2-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Tom Yan Subject: [PATCH 2/2] libata-scsi: better style in ata_msense_caching() Date: Thu, 7 Jul 2016 09:43:34 +0800 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160707014334.1031-1-me> References: <20160707014334.1031-1-me> 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 Signed-off-by: Tom Yan diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index bfec66f..e3f5751 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2424,10 +2424,12 @@ static void modecpy(u8 *dest, const u8 *src, int n, bool changeable) static unsigned int ata_msense_caching(u16 *id, u8 *buf, bool changeable) { modecpy(buf, def_cache_mpage, sizeof(def_cache_mpage), changeable); - if (changeable || ata_id_wcache_enabled(id)) - buf[2] |= (1 << 2); /* write cache enable */ - if (!changeable && !ata_id_rahead_enabled(id)) - buf[12] |= (1 << 5); /* disable read ahead */ + if (changeable) + buf[2] |= (1 << 2); /* ata_mselect_caching() */ + else { + buf[2] |= (ata_id_wcache_enabled(id) << 2); /* write cache enable */ + buf[12] |= (!ata_id_rahead_enabled(id) << 5); /* disable read ahead */ + } return sizeof(def_cache_mpage); }