From patchwork Wed Feb 21 09:26:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 10231647 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 2773D60392 for ; Wed, 21 Feb 2018 09:30:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F6E028AA6 for ; Wed, 21 Feb 2018 09:30:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2481528AAA; Wed, 21 Feb 2018 09:30:30 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 B50DC28AA6 for ; Wed, 21 Feb 2018 09:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753340AbeBUJ1V (ORCPT ); Wed, 21 Feb 2018 04:27:21 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36999 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753268AbeBUJ1O (ORCPT ); Wed, 21 Feb 2018 04:27:14 -0500 Received: by mail-wr0-f194.google.com with SMTP id z12so2446563wrg.4 for ; Wed, 21 Feb 2018 01:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mYclzxop0BtbAW40M8TRBAGoaTVlU7/VejBA0Oo8/9Q=; b=oSdgY4/2FlukZ3F99nD+YzLrJPaLVV3yhmJUXKY08WAlE5OqFuxvcXXNMgB5MGIKaI zGdM6PDsE88Bq/GJnHlYeESVGn0A3XCMObqESZxqPdiJQhgJhSQUygYlXMLuJ04mwt7y RYssTBCFb3MwI7CeWGFJLpCs6bUYbycNxRVY0kHei9ni9+e9E+kz5lgdo1R8tIYJxWMu +7X3gevGLiNUMXWAiyM8g/rn4Erls2SyaHIPbXPq6WdAJ9ckPpR9LIAqcPOmUXFNAUKl 8fgW1S3S2qUzODAwFuJHOd9dHDkuXPy0GJwEm/CquwEzQBuIo3aMbPvasa0TAfSoWvis jzMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mYclzxop0BtbAW40M8TRBAGoaTVlU7/VejBA0Oo8/9Q=; b=VfHxHBf5RLt6oZbQ49LWfIqaKE2L/NJTrOPPNNkzlf/4HgLuv75l4zNSggfxrFauc7 TR6yegd71fMZSSSS96XfkSgbDIEAAZwIWnPdPMkyUbjaGgH1mlCjIU3Q1bT5cKq5eHln Sk99zAQ4ndOYQ0FrVdIUw5952WNn4I9p5l8K984Vao4XxE6NMRPTfu95f3vPwHAgWLt8 9rPWJu/T7NvLClztIMT7hS1yYS0OtKhOouVOXLtb8b2z9X8TUspYLQr8fL1SkOR3h47C pVHNthPwup8NcUYAXqTuE6WxvyxR+gIHbzLX9kv5ptySODI+O3fPidMxfi9vVXHwEPdi KMDQ== X-Gm-Message-State: APf1xPAgaiagJp6F8XUdnn942cTTE51ZW8Mxh33osIZr3HLNpOl1ekYe 00F3r91OFNJoOez8b7Kv8ZmW/A== X-Google-Smtp-Source: AH8x226t1zBjzePFpXd9C5GIJm9ZD5wRgokqD+CnGoPfbvM3p8wQdip6lMymPGnHshcUsvbCrfBrBg== X-Received: by 10.80.170.131 with SMTP id q3mr4175249edc.43.1519205232938; Wed, 21 Feb 2018 01:27:12 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id a17sm3389955eda.42.2018.02.21.01.27.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 01:27:12 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 03/20] lightnvm: fix capabilities for 2.0 sysfs Date: Wed, 21 Feb 2018 10:26:41 +0100 Message-Id: <1519205218-26994-4-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> References: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both 1.2 and 2.0 specs define a field for media and controller capabilities. Also, 1.2 defines a separate field dedicated to device capabilities. In 2.0 sysfs, this values have been mixed. Revert them to the right value. Signed-off-by: Javier González --- drivers/nvme/host/lightnvm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 969bb874850c..598abba66f52 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -914,8 +914,8 @@ static ssize_t nvm_dev_attr_show(struct device *dev, if (strcmp(attr->name, "version") == 0) { return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->ver_id); - } else if (strcmp(attr->name, "capabilities") == 0) { - return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap); + } else if (strcmp(attr->name, "media_capabilities") == 0) { + return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap); } else if (strcmp(attr->name, "read_typ") == 0) { return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt); } else if (strcmp(attr->name, "read_max") == 0) { @@ -993,8 +993,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev, return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem); } else if (strcmp(attr->name, "multiplane_modes") == 0) { return scnprintf(page, PAGE_SIZE, "0x%08x\n", dev_geo->c.mpos); - } else if (strcmp(attr->name, "media_capabilities") == 0) { - return scnprintf(page, PAGE_SIZE, "0x%08x\n", dev_geo->c.mccap); + } else if (strcmp(attr->name, "capabilities") == 0) { + return scnprintf(page, PAGE_SIZE, "0x%08x\n", dev_geo->c.cap); } else if (strcmp(attr->name, "max_phys_secs") == 0) { return scnprintf(page, PAGE_SIZE, "%u\n", NVM_MAX_VLBA); } else { @@ -1055,7 +1055,7 @@ static ssize_t nvm_dev_attr_show_20(struct device *dev, /* general attributes */ static NVM_DEV_ATTR_RO(version); -static NVM_DEV_ATTR_RO(capabilities); +static NVM_DEV_ATTR_RO(media_capabilities); static NVM_DEV_ATTR_RO(read_typ); static NVM_DEV_ATTR_RO(read_max); @@ -1080,12 +1080,12 @@ static NVM_DEV_ATTR_12_RO(prog_max); static NVM_DEV_ATTR_12_RO(erase_typ); static NVM_DEV_ATTR_12_RO(erase_max); static NVM_DEV_ATTR_12_RO(multiplane_modes); -static NVM_DEV_ATTR_12_RO(media_capabilities); +static NVM_DEV_ATTR_12_RO(capabilities); static NVM_DEV_ATTR_12_RO(max_phys_secs); static struct attribute *nvm_dev_attrs_12[] = { &dev_attr_version.attr, - &dev_attr_capabilities.attr, + &dev_attr_media_capabilities.attr, &dev_attr_vendor_opcode.attr, &dev_attr_device_mode.attr, @@ -1108,7 +1108,7 @@ static struct attribute *nvm_dev_attrs_12[] = { &dev_attr_erase_typ.attr, &dev_attr_erase_max.attr, &dev_attr_multiplane_modes.attr, - &dev_attr_media_capabilities.attr, + &dev_attr_capabilities.attr, &dev_attr_max_phys_secs.attr, NULL, @@ -1134,7 +1134,7 @@ static NVM_DEV_ATTR_20_RO(reset_max); static struct attribute *nvm_dev_attrs_20[] = { &dev_attr_version.attr, - &dev_attr_capabilities.attr, + &dev_attr_media_capabilities.attr, &dev_attr_groups.attr, &dev_attr_punits.attr,