From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSfl2-0002aL-CQ for kexec@lists.infradead.org; Tue, 12 Jun 2018 09:38:33 +0000 Date: Tue, 12 Jun 2018 17:38:12 +0800 From: Baoquan He Subject: Re: [PATCH v5 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public Message-ID: <20180612093812.GC1820@MiWiFi-R3L-srv> References: <20180612032831.29747-1-bhe@redhat.com> <20180612032831.29747-2-bhe@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Andy Shevchenko Cc: Nicolas Pitre , brijesh.singh@amd.com, devicetree , David Airlie , linux-pci@vger.kernel.org, richard.weiyang@gmail.com, Keith Busch , Max Filippov , Paul Mackerras , baiyaowei@cmss.chinamobile.com, KY Srinivasan , Frank Rowand , Dan Williams , Lorenzo Pieralisi , Stephen Hemminger , linux-nvdimm@lists.01.org, Michael Ellerman , Patrik Jakobsson , linux-input , Gustavo Padovan , Borislav Petkov , Dave Young , Vivek Goyal , 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" On 06/12/18 at 11:29am, Andy Shevchenko wrote: > On Tue, Jun 12, 2018 at 6:28 AM, Baoquan He wrote: > > reparent_resources() is duplicated in arch/microblaze/pci/pci-common.c > > and arch/powerpc/kernel/pci-common.c, so move it to kernel/resource.c > > so that it's shared. Later its code also need be updated using list_head > > to replace singly linked list. > > While this is a good deduplication of the code, some requirements for > public functions would be good to satisfy. > > > +/* > > + * Reparent resource children of pr that conflict with res > > + * under res, and make res replace those children. > > + */ > > kernel doc format, though... > > > +static int reparent_resources(struct resource *parent, > > + struct resource *res) > > ...is it really public with static keyword?! Thanks for looking into this. This is a code bug, I copied and changed, but forgot merging the changing to local commit. And the error reported by test robot in patch 2 was changed too locally, forgot merging it to patch. Will repost to address this. > > > > > +{ > > > + for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) { > > + if (p->end < res->start) > > + continue; > > + if (res->end < p->start) > > + break; > > > + if (p->start < res->start || p->end > res->end) > > + return -1; /* not completely contained */ > > Usually we are expecting real eeror codes. 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. > > > + if (firstpp == NULL) > > + firstpp = pp; > > + } > > > + if (firstpp == NULL) > > + return -1; /* didn't find any conflicting entries? */ > > Ditto. > > > +} > > +EXPORT_SYMBOL(reparent_resources); > > -- > With Best Regards, > Andy Shevchenko _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec