From patchwork Tue Apr 3 14:24:12 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: 10321289 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 048A060390 for ; Tue, 3 Apr 2018 14:25:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA6C0283B0 for ; Tue, 3 Apr 2018 14:25:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCF1428426; Tue, 3 Apr 2018 14:25:06 +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 14E3F283B0 for ; Tue, 3 Apr 2018 14:25:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6F862226085C6; Tue, 3 Apr 2018 07:25:04 -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:c01::243; helo=mail-pl0-x243.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (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 B20EA226085BC for ; Tue, 3 Apr 2018 07:25:02 -0700 (PDT) Received: by mail-pl0-x243.google.com with SMTP id b6-v6so7037784pla.11 for ; Tue, 03 Apr 2018 07:25:02 -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=qygwAvXny23WYgkqqj8oa0GwvusKEkWHuSir6sZaqJHZxQxtAY++9H+eUi0LZDJaby OJbRicpKNilLoyflcbMkUyt8iTvxtiEMgli7/nNwL6leS7ANLuhTcHCUjFS9JATQufOD VVn4MMLOe0qko1Rhy/xaBS0tmOBQsCQrk2FAuWIuNNjicOemYeqZOkPU9sckwRzyvzqI eHR7ft9HVCsfHUxFkuK8fV2EM/QPC/7bUWwYUbqakjLX/07mh5dlIRBywmywsDIy2luc jp93k8qlWqniQ6zskyTiZwTI+swhcdQwBp9WUItJAWCQqH431dIhooULvfr6+jqV9VQS oJYw== 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=BAEEfqyWAY7q570va+4xYjkdvgYChEJjq56+Yn8OjYkUjTmjrO9hTa7/Mdv/Egs4j2 ju9moLRqKsj8YSB6BhHfQezX218w/FqNYoJhopAwgUxnRZk/OJho1zEDGxwo7dQ61kT/ JXMPPnu3rU3aU+tWSJxrngd0ndt3BTTWHVqveLy6MrSAJR8x+zNLX/xeyc6rIgeJCQ14 QNbJyn06E4gutfJXkp20ahMN9zPKZjCJxehLfIahQJO60a5sq6gdTRhAs60QLp/p5aTB UArFf6ifDFi7TANStyQSm9IUFlGPsikV1kKG4wvs2ZdvvL9L02HU7B8TJNNoMHTdKNyP Lr8A== X-Gm-Message-State: AElRT7HURPpifd6KfSMB3VXisv7qX46OJ5/UI1MWM8L4TC+gVAkIqZgh 0mqqsQo/hk8C0bgU1eBWOCQ= X-Google-Smtp-Source: AIpwx4+NAsCn64jDgMxtF8hgVUPhq+QxpG+ZXQFdyh37Cn9OuOCV8EqXa6svzYs1ur9/8aEAULM7AQ== X-Received: by 2002:a17:902:d681:: with SMTP id v1-v6mr13199844ply.284.1522765502390; Tue, 03 Apr 2018 07:25:02 -0700 (PDT) Received: from localhost.localdomain ([61.68.80.171]) by smtp.gmail.com with ESMTPSA id j83sm6987587pfe.178.2018.04.03.07.25.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 07:25:01 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [RESEND v2 1/4] libnvdimm: Add of_node to region and bus descriptors Date: Wed, 4 Apr 2018 00:24:12 +1000 Message-Id: <20180403142415.30083-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 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;