From patchwork Fri Apr 6 05:21:13 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: 10325655 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 206DB60541 for ; Fri, 6 Apr 2018 05:21:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0635E293F6 for ; Fri, 6 Apr 2018 05:21:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE44229429; Fri, 6 Apr 2018 05:21:50 +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 9E79F293F6 for ; Fri, 6 Apr 2018 05:21:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0A635225264B7; Thu, 5 Apr 2018 22:21: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:c00::241; helo=mail-pf0-x241.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::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 A980C226FAA63 for ; Thu, 5 Apr 2018 22:21:48 -0700 (PDT) Received: by mail-pf0-x241.google.com with SMTP id f15so10157551pfn.0 for ; Thu, 05 Apr 2018 22:21:48 -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=pcV+3qswNtiVm4SweG64Ax72KUFWo7NVxHLsPwlbFC8=; b=fjsi3wTBT04NWC111wkOZri55qpg95iVt2HXN9ELezbOA5e0r0Ddm3j6+SOjx0Tfq9 cNoSYM1guau2Ajppm0VgAiKpEWAinjvCYNkRVC7paDG5A03By8f2plgyPWXZIncrxRsC 4ftsEi0nAiG/a7oe44LpNOKkWBH8sM1VF2UqQJFtzdR8jgd0EWWK4pLHD5FReIyI03dR xAks42SVtMW+kjdSSIqffLcqOuq3RMeXQR4+5cx6gGb69MDq4wIuhp20W+SIoKVZyVmk OQ4MjKzK/L24Vpvd2IOsVRMKTgLEPRIwY7t3+w/CT9sPgggvi+2Yar+6y82qNmJa7y30 YlRA== 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=pcV+3qswNtiVm4SweG64Ax72KUFWo7NVxHLsPwlbFC8=; b=nRnMqkNWyIFVoueC/Nl/S0xtNmDcCmvapZIznl0vp/Y817gKaq2RND+j2JXRrI5A/Z x5CcjlB8NNhWPrJHFNC2C7+NbFWDffb+Ahrxgl+wruXTgreNYrw9Jh+luBAU0jNg6wKs 6DeM9ZJuheKPyinIRU7pAkPaJHmMaiZdNsjAAuInUqvrm01g9SCtxawREFBXeApu+WXb Xov2qvTypRDPPWPY0+4SgQriJRd8A9I/Sr9uN71x2e+vAfm10WmH4t7zzrPUE25mI2IT Mg55r5w96fY90CsZAVwXtW9HUgIs+6dB0ZD1s/N/7CZPOAqJ5vPuJYw5m8xBcDDl19Zv kYKA== X-Gm-Message-State: AElRT7Ep7Dcz/5KaiogGkAT2xYLEIOdbYNP+TCiGpHlXAP5UohZ9h1Ul NJCIO/HcRHGc74Br2vB33IQ= X-Google-Smtp-Source: AIpwx4/R3EO4TnURCGXci5GyahOlDkOw4E+lwdScO3StUSsn8R59VtwCPr/yDtgMaGKVfCnsFdKeQQ== X-Received: by 10.99.149.21 with SMTP id p21mr16754750pgd.154.1522992108211; Thu, 05 Apr 2018 22:21:48 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id s63sm19748498pfe.6.2018.04.05.22.21.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 22:21:47 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3 1/4] libnvdimm: Add of_node to region and bus descriptors Date: Fri, 6 Apr 2018 15:21:13 +1000 Message-Id: <20180406052116.31483-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.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 1593e1806b16..30d5dc8b9bb2 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1014,6 +1014,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;