From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 C7A8A209605AD for ; Tue, 3 Jul 2018 07:55:13 -0700 (PDT) Date: Tue, 3 Jul 2018 22:55:03 +0800 From: Baoquan He Subject: Re: [PATCH v5 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public Message-ID: <20180703145503.GA1225@MiWiFi-R3L-srv> References: <20180612032831.29747-1-bhe@redhat.com> <20180612032831.29747-2-bhe@redhat.com> <20180612093812.GC1820@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Andy Shevchenko Cc: Nicolas Pitre , brijesh.singh@amd.com, devicetree , David Airlie , linux-pci@vger.kernel.org, richard.weiyang@gmail.com, Max Filippov , Paul Mackerras , baiyaowei@cmss.chinamobile.com, KY Srinivasan , Frank Rowand , Lorenzo Pieralisi , Stephen Hemminger , linux-nvdimm@lists.01.org, Michael Ellerman , Patrik Jakobsson , linux-input , Gustavo Padovan , Borislav Petkov , Dave Young , Tom Lendacky , Haiyang Zhang , Maarten Lankhorst , Josh Triplett , =?iso-8859-1?B?Suly9G1l?= Glisse , Rob Herring , Sean Paul , Bjorn Helgaas , Thomas Gleixner , Yinghai Lu , Jon Derrick , Chris Zankel , Michal Simek , linux-parisc@vger.kernel.org, Greg Kroah-Hartman , Dmitry Torokhov , kexec@lists.infradead.org, Linux Kernel Mailing List , Benjamin Herrenschmidt , Eric Biederman , devel@linuxdriverproject.org, Andrew Morton , kbuild test robot , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" , "David S. Miller" List-ID: Hi Andy, On 06/12/18 at 05:24pm, Andy Shevchenko wrote: > On Tue, Jun 12, 2018 at 5:20 PM, Andy Shevchenko > wrote: > >> Hmm, I just copied it from arch/powerpc/kernel/pci-common.c. The > >> function interface expects an integer returned value, not sure what a > >> real error codes look like, could you give more hints? Will change > >> accordingly. > > > > I briefly looked at the code and error codes we have, so, my proposal > > is one of the following > > > - use -ECANCELED (not the best choice for first occurrence here, > > though I can't find better) > > Actually -ENOTSUPP might suit the first case (although the actual > would be something like -EOVERLAP, which we don't have) Sorry for late reply, and many thanks for your great suggestion. I am fine to use -ENOTSUPP as the first returned value, and -ECANCELED for the 2nd one. Or define an enum as you suggested inside the function or in header file. Or use -EBUSY for the first case because existing resource is overlapping but not fully contained by 'res'; and -EINVAL for the 2nd case since didn't find any one resources which is contained by 'res', means we passed in a invalid resource. All is fine to me, I can repost with each of them. Thanks Baoquan > > > - use positive integers (or enum), like > > #define RES_REPARENTED 0 > > #define RES_OVERLAPPED 1 > > #define RES_NOCONFLICT 2 > > > > > >>> > + if (firstpp == NULL) > >>> > + firstpp = pp; > >>> > + } > >>> > >>> > + if (firstpp == NULL) > >>> > + return -1; /* didn't find any conflicting entries? */ > >>> > >>> Ditto. > > > > Ditto. > > > >>> > >>> > +} > >>> > +EXPORT_SYMBOL(reparent_resources); > > > > -- > > With Best Regards, > > Andy Shevchenko > > > > -- > With Best Regards, > Andy Shevchenko _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm