Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756143AbcJTDlF (ORCPT ); Wed, 19 Oct 2016 23:41:05 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:44922 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751118AbcJTDlC (ORCPT ); Wed, 19 Oct 2016 23:41:02 -0400 X-IronPort-AV: E=Sophos;i="5.31,517,1473091200"; d="scan'";a="26433517" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Adam.Manzanares@wdc.com; From: Adam Manzanares To: CC: , , Adam Manzanares , Adam Manzanares Subject: [PATCH] ata: set ncq_prio_enabled if device has support Date: Wed, 19 Oct 2016 20:40:19 -0700 Message-ID: <1476934819-3084-1-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: CY1PR21CA0067.namprd21.prod.outlook.com (10.163.250.163) To BLUPR0401MB1713.namprd04.prod.outlook.com (10.162.215.15) X-MS-Office365-Filtering-Correlation-Id: 453d07c5-8431-48c8-43e9-08d3f89ad92c X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1713;2:ZNKstRw2+RITdkUuoNH4ruILJ5TmblB/wfp7z1t7P2dXYnAWXiVjebDmf7TvTYgJEapAy7anxlUXvsfxbZkfHiK/L8nHqJOnGegJq+//JV4Od76MZHMHp23CpcCfGDgYEx2aaUKitXla7yHLv8eB/2AKRSXSCdmyJ+ouS0JVSTB35ted4xs1aHhyPcT2dxcPsGjSDK5LccyJgWEnxfae4A==;3:z8N+3Q/vPn4csry0hX1abrnsQM9wIRPDRxxZfQVG1Mzd4Nxd7qJeo/XFOMKmoW2ZTF3O8nRmL0zH7HT8XOIgKtaZdRKfc9Vke6bJ5JagLkB46t6bZKth6JlP7xTkl6mcPmgo1qxOP2l3kx0a+ES4Xw==;25:lVC8BUuhA4t9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GXUs2MxXiYT2tkpHiuTzB9xV4wo15Rh9x5Ry7G8lHB6d9z+Y5VbiNIYGtLixovbMLFjI5+i36/qRW4CrfWP4YkqxZDzCGX2umUyG1zyfG2VylFDgXdTzO86KZVlrmjV+wYzS0bDRZ1rXNHW195k8eSaHC7bv6CoDeHGZ0lyneLbFKROfruMlkyv95LyNa7xTHJB6C7Xy8qiKGK6mlsRaXh9wamYOQrhMpP8zAA158ztn/lUamwyK4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:BLUPR0401MB1713;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0401MB1713; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1713;4:uVLn06oINqjuUHo5lE3D/8zcNk1jbKBe1hrmwRqCpb5WXtkojFcMxKz7cLtHS4kOHobdcAjWBkhPn0tPJCjKw0YHXDVNvpE1JHG6IQVwe2Wc0Sc+EqHOTOyVm51TN1kvWjNM0bUiahxt5q29YP9Dmm324LwR/w6ecv1/SjuN/HNf0pUjI7ftdlFvpAxBf68BzqQiE0u8qONXKGSBSu7xcOpNFrYfy1/SZ0O7PR+z5NdlRnBh6DECNeJcdpveeguNzQtpMUbUvSTJgVKmm4UXOrxsTRlMgi95wtN9p2mg1pIDtBOu2l9moYkRlxbha65LZHR9mHtijOJCre54w6DLbndDm3sMUvXHKCxGo3A9evOSBWvjlV0NXJAzv+Eub3EwObEtgI9OvU3w3zpdO/sIjkJxpYot44BNTHC2akOFMxc= X-Forefront-PRVS: 01018CB5B3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(2906002)(4326007)(77096005)(92566002)(6666003)(5003940100001)(5660300001)(586003)(305945005)(36756003)(6116002)(42882006)(7736002)(110136003)(6916009)(7846002)(3846002)(19580405001)(66066001)(101416001)(189998001)(50466002)(47776003)(19580395003)(2351001)(50986999)(105586002)(68736007)(48376002)(97736004)(8676002)(42186005)(106356001)(33646002)(50226002)(81166006)(81156014)(229853001)(7099028);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0401MB1713;H:penguito.sanjose.hgst.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR0401MB1713;23:d8VVqz0dBUAw7vYxeMZaSwG1HU4u5BhPU7gxRCx?= =?us-ascii?Q?kTbQosQd/3FH50VyPdhzOsz6iL/IOCGGFn53LvN7iGGaBovgYMN4urxsNDpm?= =?us-ascii?Q?Trq9Gv3vzKOYjZ/5neVWlrMzopwbpl4Y4z4Kl4Blw3NCEhC/NpZp5y+eMwbe?= =?us-ascii?Q?FbQj+Ax/779eYJ5hGZDvOPH8YN+Y7Ea+rVRbdyLae2wlDy5FF+aTqfO7pD1Q?= =?us-ascii?Q?K6g5TYFQC7+joF9euIZChEAax48sUBeCK+0xjS/IyiPQV8SFZCPCaMAHRCTV?= =?us-ascii?Q?twGverHKkryujVmjVqet61mXKLBJ8/EIT8ppAoVSDsNEcSKtZz+EEb+Fa5Q8?= =?us-ascii?Q?9I5e9cW80SCADK3XDWkh06JqHDpVe/BdLNvRtRaAZvXkxA3PhS3Z//bduepS?= =?us-ascii?Q?kUDGDxD8QGDShBJixKYHCh9j1zpPNYdf5HD6FztQrEJgIHoIsZ8zrXHIxyFX?= =?us-ascii?Q?RQsC/MRv/Smh1iBjC6tXfmaB6r7TmfnIdg6SXDkrFIgif1yMfbH0OYXi4RLB?= =?us-ascii?Q?wamOakXT66Bxi5SSQJiRA0f/24X6wB1YxHqcxMIaPhxEhxRKstoDt+SPrzuf?= =?us-ascii?Q?4serX1nBQOkG9XzDdFSbaVhqbijPIynvVSX7ijk7A3WK94d4R2Z9tV/4tVUR?= =?us-ascii?Q?m4i3HbNo4nMi99OVcHNTrkv027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du7yButtVDV81vuzR4sIW3Mbstvts6FHxE=;24:zOo+ZYA2idNVRyRWkuCyEhyDd5TSnJZzjHSZmufbGvwxdZb26c5GyeUMWf2Y3gX+iiIffltZCAyO+xVqwKfn10X+j8gZpheOn+qTZXDmzNQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1713;7:w50mvyb/3OT0a077T0Wfa1MotIel5WwL6K+hYs6T5AMCQmF+8IWDUNXYscAiLsgS+J1SDE4OsGfs6X3FTubYJFaMe8tawx9Da1veNleFjs3XEcHIBrwwnHlQVjK7lzINe49rCgcEKVGxcq+kxAAfcZwdgvHZ7wJE8s7LMwwhZlloISPV9WqwvTsKiD0PRKSZ8HK8QfHS5xENvmq2noNU7duPdUYiqjBXRknslY1eSR5Ns3SjGfe8Z08xBDFThj79TUlDAeHmXcV/qkqf9GX4tvGD8BqH/F16vH+YGHuhLxTupFLND1nsRrz0fgK6Z5jF7N95oKDOPJM/NIdnEjCZZBCNxaUrPxchMv+Nct/KJio=;20:tCX3PyhG2LNAHYOPrQWmeOG+8qDBBHjlN4PUj0/SNXdOkLdp/WKMQyNmJrOIXknFdLLl0gGXpn1XWOUa1NZuTLSakrWleHhtFxbn+OBXa+S96QHo6X9OYke3d3rEU0eeYv9aEtV+lSGk509lNyUl7HbivInoReXWhODjzdwjk7htdMbuVtG6niyKmTzhWGo/dP0Fac55gmRNAZDDcQUIXNYc7VsRk8jv7t4wIiIWnAEKbUQQBsvnbuABUJ8cU6OP X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2016 03:40:33.5905 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0401MB1713 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1710 Lines: 53 We previously had a check to see if the device has support for prioritized ncq commands and a check to see if a device flag is set, through a sysfs variable, in order to send a prioritized command. This patch only allows the sysfs variable to be set if the device supports prioritized commands enabling one check in ata_build_rw_tf in order to determine whether or not to send a prioritized command. This patch depends on ata: ATA Command Priority Disabled By Default Signed-off-by: Adam Manzanares --- drivers/ata/libata-core.c | 3 +-- drivers/ata/libata-scsi.c | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b294339..43842fd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -787,8 +787,7 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, if (tf->flags & ATA_TFLAG_FUA) tf->device |= 1 << 7; - if ((dev->flags & ATA_DFLAG_NCQ_PRIO) && - (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE)) { + if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLE) { if (class == IOPRIO_CLASS_RT) tf->hob_nsect |= ATA_PRIO_HIGH << ATA_SHIFT_PRIO; diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 87597a3..831beea 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -323,8 +323,14 @@ static ssize_t ata_ncq_prio_enable_store(struct device *device, goto unlock; } - if (input) + if (input) { + if (!(dev->flags & ATA_DFLAG_NCQ_PRIO)) { + rc = -EOPNOTSUPP; + goto unlock; + } + dev->flags |= ATA_DFLAG_NCQ_PRIO_ENABLE; + } else dev->flags &= ~ATA_DFLAG_NCQ_PRIO_ENABLE; -- 2.1.4