Re: [RFC 1/4] libnvdimm: add to_{nvdimm,nd_region}_dev()
From: Dan Williams <hidden>
Date: 2017-07-11 07:36:27
Also in:
nvdimm
On Mon, Jul 10, 2017 at 9:38 PM, Oliver [off-list ref] wrote:
On Tue, Jul 11, 2017 at 9:53 AM, Dan Williams [off-list ref] wrote:quoted
On Tue, Jun 27, 2017 at 3:28 AM, Oliver O'Halloran [off-list ref] wrote:quoted
struct device contains the ->of_node pointer so that devices can be assoicated with the device-tree node that created them on DT platforms. libnvdimm hides the struct device for regions and nvdimm devices inside of an opaque structure so this patch adds accessors for each to allow the of_nvdimm driver to set the of_node pointer.I'd rather go the other way and pass in the of_node to the bus and dimm registration routines. It's a generic property of the device so we should handle it like other generic device properties that get set at initialization time like 'attr_groups' in nvdimm_bus_descriptor, or a new parameter to nvdimm_create().Sure. I just figured it would be preferable to keep firmware specific details inside the firmware driver rather than adding #ifdef CONFIG_OF around the place. Do you have any objections to making nvdimm_create() take a descriptor structure rather than adding a parameter?
I don't see why we need "#ifdef CONFIG_OF". It's just a "struct of_node *" pointer that can be forward declared as "struct of_node;" we don't need the full definition. Yes, I'm fine with converting nvdimm_create() to a take a descriptor,