From patchwork Wed Sep 4 01:08:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 11129113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7834112C for ; Wed, 4 Sep 2019 01:08:34 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C2BC021883 for ; Wed, 4 Sep 2019 01:08:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2BC021883 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9E48F21A07096; Tue, 3 Sep 2019 18:09:44 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1F524202110C5 for ; Tue, 3 Sep 2019 18:09:42 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 18:08:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,465,1559545200"; d="scan'208";a="198904454" Received: from vverma7-desk1.lm.intel.com ([10.232.112.185]) by fmsmga001.fm.intel.com with ESMTP; 03 Sep 2019 18:08:31 -0700 From: Vishal Verma To: Subject: [ndctl PATCH 1/2] libdaxctl: fix the system-ram capability check Date: Tue, 3 Sep 2019 19:08:18 -0600 Message-Id: <20190904010819.11012-1-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dave Hansen , Brice Goglin Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" When checking a daxctl device for system-ram capability, we needn't look at the symlink resolution for /sys/bus/dax.../driver/module since the driver in question may not always have an associated module, and could be builtin instead. Change the symlink we resolve to simply '/sys/bus/dax.../driver' and since that too resolves to '.../kmem' in the system-ram case, the rest of the check remains unchanged. This is a pre-requisite to making daxctl-reconfigure-device work correctly when the target mode's driver might be builtin. Cc: Dan Williams Signed-off-by: Vishal Verma Reviewed-by: Dan Williams --- daxctl/lib/libdaxctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daxctl/lib/libdaxctl.c b/daxctl/lib/libdaxctl.c index c0a859c..d9f2c33 100644 --- a/daxctl/lib/libdaxctl.c +++ b/daxctl/lib/libdaxctl.c @@ -406,7 +406,7 @@ static int dev_is_system_ram_capable(struct daxctl_dev *dev) if (!daxctl_dev_is_enabled(dev)) return false; - if (snprintf(path, len, "%s/driver/module", dev->dev_path) >= len) { + if (snprintf(path, len, "%s/driver", dev->dev_path) >= len) { err(ctx, "%s: buffer too small!\n", devname); return false; }