From patchwork Fri Mar 23 08:12:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 10302895 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 9F31F600F6 for ; Fri, 23 Mar 2018 08:12:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 917C328C84 for ; Fri, 23 Mar 2018 08:12:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 867C728C88; Fri, 23 Mar 2018 08:12:24 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4B0AE28C84 for ; Fri, 23 Mar 2018 08:12:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AFC9F223E0BB8; Fri, 23 Mar 2018 01:05:50 -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=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 67354223E0BB4 for ; Fri, 23 Mar 2018 01:05:49 -0700 (PDT) Received: by mail-pg0-x241.google.com with SMTP id v26so1796717pge.11 for ; Fri, 23 Mar 2018 01:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=osit9TNON2pNfGB1uxXl9hQDhYDjUtzCLZVDhqiSqfA=; b=tK5kMXzj01xoYu1/SsSqraHhdXEq0diDLr/uyE64QuRL0MKgtHcNGXrZUK7HCm087k JbVz1YUF0/8CQS0AfS+da9f99ipF6U6zJgmaA3usx8aJwS5SCmmUcnnt2aPOinuAf7Qx Ei8xDTwNAl4Iz5rAqSBA5+/YmjNT13A5IBJe5kTAAPqNEDCBBm2uFw4n4ElNwJlNRG2d 4Jij9xsHksgKzWGgmHUVKb1xVe9TyDDu9QbRRq0Pt7qTLFAi97vyGv72Gb0B5vzrEMsI VVW+wxP+8KDfETOhsQks/nrmpNHjf0WGz5I4h+ClI+7xYPwh2RQ6E2D+Q03Rfg4EJGlK QHxw== 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; bh=osit9TNON2pNfGB1uxXl9hQDhYDjUtzCLZVDhqiSqfA=; b=FYovLzp26k9BNyAlQQRUzwNGkdO7WS6lXwUVZCGUqChhH8AHeeCBoqW5DBjDECpGG7 Syt300mooiSvvD9IbhbUK394F1BHjcmIxltxnfa5Y9ejvDS2mL+Im8zndKOSuQ7n+v/Z +2Rlpj5jpKn0mbfr2GlFeQnRc+E7RCqJHucdekKnAbawbUGwh3B6Czl9nhPZsCDCgoTq Jb15dMHJ7a7bqndFv1V/e0tLSR4dS33R5clj6TDWNKed6/rBY9hjDuADMYxygoNEN8XN O4OM/tVqM02wdOiI9znnL8JXUVCuZwL24V+gbYGUY0nLUFk60dmsQxXwijmzbDF8qits Gmtw== X-Gm-Message-State: AElRT7Hb7xRBWtsu7Z54kyYJJpi21eaPEkrnMorJ7AEBcFHU2A0P+Yh7 hPhnqQ2z9rjyckEUzlm0nTb4lQ== X-Google-Smtp-Source: AG47ELtwRLO6bG1flt5ZHh2bxBJLB8l93TfHx7mdHFnxsB9FH9lS6f5jeNQ004HHS9KgG7qqwcHVMw== X-Received: by 10.99.170.70 with SMTP id x6mr18190158pgo.114.1521792741563; Fri, 23 Mar 2018 01:12:21 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:20 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 1/6] libnvdimm: Add of_node to region and bus descriptors Date: Fri, 23 Mar 2018 19:12:04 +1100 Message-Id: <20180323081209.31387-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP We want to be able to cross reference the region and bus devices with the device tree node that they were spawned from. libNVDIMM handles creating the actual devices for these internally, so we need to pass in a pointer to the relevant node in the descriptor. Signed-off-by: Oliver O'Halloran Acked-by: Dan Williams Acked-by: Balbir Singh --- drivers/nvdimm/bus.c | 1 + drivers/nvdimm/region_devs.c | 1 + include/linux/libnvdimm.h | 3 +++ 3 files changed, 5 insertions(+) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 78eabc3a1ab1..c6106914f396 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -358,6 +358,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent, nvdimm_bus->dev.release = nvdimm_bus_release; nvdimm_bus->dev.groups = nd_desc->attr_groups; nvdimm_bus->dev.bus = &nvdimm_bus_type; + nvdimm_bus->dev.of_node = nd_desc->of_node; dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id); rc = device_register(&nvdimm_bus->dev); if (rc) { diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index e6d01911e092..2f1d5771100e 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1005,6 +1005,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, dev->parent = &nvdimm_bus->dev; dev->type = dev_type; dev->groups = ndr_desc->attr_groups; + dev->of_node = ndr_desc->of_node; nd_region->ndr_size = resource_size(ndr_desc->res); nd_region->ndr_start = ndr_desc->res->start; nd_device_register(dev); diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index ff855ed965fb..f61cb5050297 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -76,12 +76,14 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc); +struct device_node; struct nvdimm_bus_descriptor { const struct attribute_group **attr_groups; unsigned long bus_dsm_mask; unsigned long cmd_mask; struct module *module; char *provider_name; + struct device_node *of_node; ndctl_fn ndctl; int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc); int (*clear_to_send)(struct nvdimm_bus_descriptor *nd_desc, @@ -123,6 +125,7 @@ struct nd_region_desc { int num_lanes; int numa_node; unsigned long flags; + struct device_node *of_node; }; struct device;