From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 28315212B7DBA for ; Tue, 6 Aug 2019 23:02:49 -0700 (PDT) Subject: Re: [PATCH] nvdimm/of_pmem: Provide a unique name for bus provider References: <20190807040029.11344-1-aneesh.kumar@linux.ibm.com> From: "Aneesh Kumar K.V" Message-ID: <9c397eca-9152-9da7-fcde-8aa424c8fede@linux.ibm.com> Date: Wed, 7 Aug 2019 11:30:05 +0530 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Dan Williams Cc: linuxppc-dev , linux-nvdimm List-ID: On 8/7/19 10:22 AM, Dan Williams wrote: > On Tue, Aug 6, 2019 at 9:17 PM Aneesh Kumar K.V > wrote: >> >> On 8/7/19 9:43 AM, Dan Williams wrote: >>> On Tue, Aug 6, 2019 at 9:00 PM Aneesh Kumar K.V >>> wrote: >>>> >>>> ndctl utility requires the ndbus to have unique names. If not while >>>> enumerating the bus in userspace it drops bus with similar names. >>>> This results in us not listing devices beneath the bus. >>> >>> It does? >>> >>>> >>>> Signed-off-by: Aneesh Kumar K.V >>>> --- >>>> drivers/nvdimm/of_pmem.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c >>>> index a0c8dcfa0bf9..97187d6c0bdb 100644 >>>> --- a/drivers/nvdimm/of_pmem.c >>>> +++ b/drivers/nvdimm/of_pmem.c >>>> @@ -42,7 +42,7 @@ static int of_pmem_region_probe(struct platform_device *pdev) >>>> return -ENOMEM; >>>> >>>> priv->bus_desc.attr_groups = bus_attr_groups; >>>> - priv->bus_desc.provider_name = "of_pmem"; >>>> + priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL); >>> >>> This looks ok to me to address support for older ndctl binaries, but >>> I'd like to also fix the ndctl bug that makes non-unique provider >>> names fail. >>> >> >> 0462269ab121d323a016874ebdd42217f2911ee7 (ndctl: provide a method to >> invalidate the bus list) >> >> This hunk does the filtering. >> >> @@ -928,6 +929,14 @@ static int add_bus(void *parent, int id, const char >> *ctl_base) >> goto err_read; >> bus->buf_len = strlen(bus->bus_path) + 50; >> >> + ndctl_bus_foreach(ctx, bus_dup) >> + if (strcmp(ndctl_bus_get_provider(bus_dup), >> + ndctl_bus_get_provider(bus)) == 0) { >> + free_bus(bus, NULL); >> + free(path); >> + return 1; >> + } >> + > > Yup, that's broken, does this incremental fix work? > > diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c > index 4d9cc7e29c6b..6596f94edef8 100644 > --- a/ndctl/lib/libndctl.c > +++ b/ndctl/lib/libndctl.c > @@ -889,7 +889,9 @@ static void *add_bus(void *parent, int id, const > char *ctl_base) > > ndctl_bus_foreach(ctx, bus_dup) > if (strcmp(ndctl_bus_get_provider(bus_dup), > - ndctl_bus_get_provider(bus)) == 0) { > + ndctl_bus_get_provider(bus)) == 0 > + && strcmp(ndctl_bus_get_devname(bus_dup), > + ndctl_bus_get_devname(bus)) == 0) { > free_bus(bus, NULL); > free(path); > return bus_dup; > That worked. -aneesh _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm