Re: [PATCH v2 1/3] resource: Use list_head to link sibling resource
On 04/08/18 at 01:55pm, kbuild test robot wrote: > Hi Baoquan, > > I love your patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [also build test ERROR on v4.16 next-20180406] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180408-110108 > config: sparc-defconfig (attached as .config) > compiler: sparc-linux-gcc (GCC) 7.2.0 > reproduce: > wget > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O > ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=sparc > > All errors (new ones prefixed by >>): > >arch/sparc/kernel/ioport.c: In function 'sparc_io_proc_show': > >> arch/sparc/kernel/ioport.c:672:9: error: incompatible types when assigning > >> to type 'struct resource *' from type 'struct list_head' > for (r = root->child; r != NULL; r = r->sibling) { > ^ >arch/sparc/kernel/ioport.c:672:37: error: incompatible types when > assigning to type 'struct resource *' from type 'struct list_head' > for (r = root->child; r != NULL; r = r->sibling) { > ^ Thanks, will change and repost. > > vim +672 arch/sparc/kernel/ioport.c > > ^1da177e4 Linus Torvalds 2005-04-16 666 > e7a088f93 Alexey Dobriyan2009-09-01 667 static int > sparc_io_proc_show(struct seq_file *m, void *v) > ^1da177e4 Linus Torvalds 2005-04-16 668 { > e7a088f93 Alexey Dobriyan2009-09-01 669 struct resource *root = > m->private, *r; > ^1da177e4 Linus Torvalds 2005-04-16 670 const char *nm; > ^1da177e4 Linus Torvalds 2005-04-16 671 > e7a088f93 Alexey Dobriyan2009-09-01 @672 for (r = root->child; r > != NULL; r = r->sibling) { > c31f76518 Sam Ravnborg 2014-04-21 673 if ((nm = > r->name) == NULL) nm = "???"; > e7a088f93 Alexey Dobriyan2009-09-01 674 seq_printf(m, > "%016llx-%016llx: %s\n", > 685143ac1 Greg Kroah-Hartman 2006-06-12 675 > (unsigned long long)r->start, > 685143ac1 Greg Kroah-Hartman 2006-06-12 676 > (unsigned long long)r->end, nm); > ^1da177e4 Linus Torvalds 2005-04-16 677 } > ^1da177e4 Linus Torvalds 2005-04-16 678 > e7a088f93 Alexey Dobriyan2009-09-01 679 return 0; > ^1da177e4 Linus Torvalds 2005-04-16 680 } > ^1da177e4 Linus Torvalds 2005-04-16 681 > > :: The code at line 672 was first introduced by commit > :: e7a088f935180b90cfe6ab0aaae8a556f46885fe sparc: convert /proc/io_map, > /proc/dvma_map to seq_file > > :: TO: Alexey Dobriyan> :: CC: David S. Miller > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/3] resource: Use list_head to link sibling resource
Hi, Thanks for telling! On 04/08/18 at 12:12pm, kbuild test robot wrote: > Hi Baoquan, > > I love your patch! Yet something to improve: > > [auto build test ERROR on linus/master] > [also build test ERROR on v4.16 next-20180406] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180408-110108 > config: parisc-c3000_defconfig (attached as .config) > compiler: hppa-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 > reproduce: > wget > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O > ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=parisc > > All errors (new ones prefixed by >>): > >drivers//parisc/lba_pci.c: In function 'lba_dump_res': > >> drivers//parisc/lba_pci.c:173:15: error: incompatible type for argument 1 > >> of 'lba_dump_res' > lba_dump_res(r->child, d+2); I compiled with allyesconfig, don't know why this was missed. Will change and repost. > ^ >drivers//parisc/lba_pci.c:162:1: note: expected 'struct resource *' but > argument is of type 'struct list_head' > lba_dump_res(struct resource *r, int d) > ^~~~ >drivers//parisc/lba_pci.c:174:15: error: incompatible type for argument 1 > of 'lba_dump_res' > lba_dump_res(r->sibling, d); > ^ >drivers//parisc/lba_pci.c:162:1: note: expected 'struct resource *' but > argument is of type 'struct list_head' > lba_dump_res(struct resource *r, int d) > ^~~~ > > vim +/lba_dump_res +173 drivers//parisc/lba_pci.c > > ^1da177e Linus Torvalds 2005-04-16 159 > ^1da177e Linus Torvalds 2005-04-16 160 > ^1da177e Linus Torvalds 2005-04-16 161 static void > ^1da177e Linus Torvalds 2005-04-16 162 lba_dump_res(struct resource *r, int > d) > ^1da177e Linus Torvalds 2005-04-16 163 { > ^1da177e Linus Torvalds 2005-04-16 164 int i; > ^1da177e Linus Torvalds 2005-04-16 165 > ^1da177e Linus Torvalds 2005-04-16 166 if (NULL == r) > ^1da177e Linus Torvalds 2005-04-16 167 return; > ^1da177e Linus Torvalds 2005-04-16 168 > ^1da177e Linus Torvalds 2005-04-16 169 printk(KERN_DEBUG "(%p)", > r->parent); > ^1da177e Linus Torvalds 2005-04-16 170 for (i = d; i ; --i) printk(" > "); > 645d11d4 Matthew Wilcox 2006-12-24 171 printk(KERN_DEBUG "%p > [%lx,%lx]/%lx\n", r, > 645d11d4 Matthew Wilcox 2006-12-24 172 (long)r->start, > (long)r->end, r->flags); > ^1da177e Linus Torvalds 2005-04-16 @173 lba_dump_res(r->child, d+2); > ^1da177e Linus Torvalds 2005-04-16 174 lba_dump_res(r->sibling, d); > ^1da177e Linus Torvalds 2005-04-16 175 } > ^1da177e Linus Torvalds 2005-04-16 176 > > :: The code at line 173 was first introduced by commit > :: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 > > :: TO: Linus Torvalds> :: CC: Linus Torvalds > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/3] resource: Use list_head to link sibling resource
Hi Baoquan, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.16 next-20180406] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180408-110108 config: sparc-defconfig (attached as .config) compiler: sparc-linux-gcc (GCC) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sparc All errors (new ones prefixed by >>): arch/sparc/kernel/ioport.c: In function 'sparc_io_proc_show': >> arch/sparc/kernel/ioport.c:672:9: error: incompatible types when assigning >> to type 'struct resource *' from type 'struct list_head' for (r = root->child; r != NULL; r = r->sibling) { ^ arch/sparc/kernel/ioport.c:672:37: error: incompatible types when assigning to type 'struct resource *' from type 'struct list_head' for (r = root->child; r != NULL; r = r->sibling) { ^ vim +672 arch/sparc/kernel/ioport.c ^1da177e4 Linus Torvalds 2005-04-16 666 e7a088f93 Alexey Dobriyan2009-09-01 667 static int sparc_io_proc_show(struct seq_file *m, void *v) ^1da177e4 Linus Torvalds 2005-04-16 668 { e7a088f93 Alexey Dobriyan2009-09-01 669struct resource *root = m->private, *r; ^1da177e4 Linus Torvalds 2005-04-16 670const char *nm; ^1da177e4 Linus Torvalds 2005-04-16 671 e7a088f93 Alexey Dobriyan2009-09-01 @672for (r = root->child; r != NULL; r = r->sibling) { c31f76518 Sam Ravnborg 2014-04-21 673if ((nm = r->name) == NULL) nm = "???"; e7a088f93 Alexey Dobriyan2009-09-01 674seq_printf(m, "%016llx-%016llx: %s\n", 685143ac1 Greg Kroah-Hartman 2006-06-12 675 (unsigned long long)r->start, 685143ac1 Greg Kroah-Hartman 2006-06-12 676 (unsigned long long)r->end, nm); ^1da177e4 Linus Torvalds 2005-04-16 677} ^1da177e4 Linus Torvalds 2005-04-16 678 e7a088f93 Alexey Dobriyan2009-09-01 679return 0; ^1da177e4 Linus Torvalds 2005-04-16 680 } ^1da177e4 Linus Torvalds 2005-04-16 681 :: The code at line 672 was first introduced by commit :: e7a088f935180b90cfe6ab0aaae8a556f46885fe sparc: convert /proc/io_map, /proc/dvma_map to seq_file :: TO: Alexey Dobriyan:: CC: David S. Miller --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/3] resource: Use list_head to link sibling resource
Hi Baoquan, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.16 next-20180406] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180408-110108 config: parisc-c3000_defconfig (attached as .config) compiler: hppa-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=parisc All errors (new ones prefixed by >>): drivers//parisc/lba_pci.c: In function 'lba_dump_res': >> drivers//parisc/lba_pci.c:173:15: error: incompatible type for argument 1 of >> 'lba_dump_res' lba_dump_res(r->child, d+2); ^ drivers//parisc/lba_pci.c:162:1: note: expected 'struct resource *' but argument is of type 'struct list_head' lba_dump_res(struct resource *r, int d) ^~~~ drivers//parisc/lba_pci.c:174:15: error: incompatible type for argument 1 of 'lba_dump_res' lba_dump_res(r->sibling, d); ^ drivers//parisc/lba_pci.c:162:1: note: expected 'struct resource *' but argument is of type 'struct list_head' lba_dump_res(struct resource *r, int d) ^~~~ vim +/lba_dump_res +173 drivers//parisc/lba_pci.c ^1da177e Linus Torvalds 2005-04-16 159 ^1da177e Linus Torvalds 2005-04-16 160 ^1da177e Linus Torvalds 2005-04-16 161 static void ^1da177e Linus Torvalds 2005-04-16 162 lba_dump_res(struct resource *r, int d) ^1da177e Linus Torvalds 2005-04-16 163 { ^1da177e Linus Torvalds 2005-04-16 164 int i; ^1da177e Linus Torvalds 2005-04-16 165 ^1da177e Linus Torvalds 2005-04-16 166 if (NULL == r) ^1da177e Linus Torvalds 2005-04-16 167 return; ^1da177e Linus Torvalds 2005-04-16 168 ^1da177e Linus Torvalds 2005-04-16 169 printk(KERN_DEBUG "(%p)", r->parent); ^1da177e Linus Torvalds 2005-04-16 170 for (i = d; i ; --i) printk(" "); 645d11d4 Matthew Wilcox 2006-12-24 171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, 645d11d4 Matthew Wilcox 2006-12-24 172 (long)r->start, (long)r->end, r->flags); ^1da177e Linus Torvalds 2005-04-16 @173 lba_dump_res(r->child, d+2); ^1da177e Linus Torvalds 2005-04-16 174 lba_dump_res(r->sibling, d); ^1da177e Linus Torvalds 2005-04-16 175 } ^1da177e Linus Torvalds 2005-04-16 176 :: The code at line 173 was first introduced by commit :: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2 :: TO: Linus Torvalds:: CC: Linus Torvalds --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/3] resource: Use list_head to link sibling resource
The struct resource uses singly linked list to link siblings. It's not easy to do reverse iteration on sibling list. So replace it with list_head. And this makes codes in kernel/resource.c more readable after refactoring than pointer operation. Suggested-by: Andrew MortonSigned-off-by: Baoquan He Cc: Patrik Jakobsson Cc: David Airlie Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Dmitry Torokhov Cc: Dan Williams Cc: Rob Herring Cc: Frank Rowand Cc: Keith Busch Cc: Jonathan Derrick Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Thomas Gleixner Cc: Brijesh Singh Cc: "Jérôme Glisse" Cc: Borislav Petkov Cc: Tom Lendacky Cc: Greg Kroah-Hartman Cc: Yaowei Bai Cc: Wei Yang Cc: de...@linuxdriverproject.org Cc: linux-in...@vger.kernel.org Cc: linux-nvd...@lists.01.org Cc: devicet...@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/gpu/drm/gma500/gtt.c| 5 +- drivers/hv/vmbus_drv.c | 52 drivers/input/joystick/iforce/iforce-main.c | 4 +- drivers/nvdimm/e820.c | 2 +- drivers/nvdimm/namespace_devs.c | 14 +- drivers/nvdimm/nd.h | 5 +- drivers/of/address.c| 4 +- drivers/pci/host/vmd.c | 8 +- drivers/pci/probe.c | 2 + drivers/pci/setup-bus.c | 2 +- include/linux/ioport.h | 4 +- kernel/resource.c | 193 ++-- 12 files changed, 151 insertions(+), 144 deletions(-) diff --git a/drivers/gpu/drm/gma500/gtt.c b/drivers/gpu/drm/gma500/gtt.c index 3949b0990916..addd3bc009af 100644 --- a/drivers/gpu/drm/gma500/gtt.c +++ b/drivers/gpu/drm/gma500/gtt.c @@ -565,7 +565,7 @@ int psb_gtt_init(struct drm_device *dev, int resume) int psb_gtt_restore(struct drm_device *dev) { struct drm_psb_private *dev_priv = dev->dev_private; - struct resource *r = dev_priv->gtt_mem->child; + struct resource *r; struct gtt_range *range; unsigned int restored = 0, total = 0, size = 0; @@ -573,14 +573,13 @@ int psb_gtt_restore(struct drm_device *dev) mutex_lock(_priv->gtt_mutex); psb_gtt_init(dev, 1); - while (r != NULL) { + list_for_each_entry(r, _priv->gtt_mem->child, sibling) { range = container_of(r, struct gtt_range, resource); if (range->pages) { psb_gtt_insert(dev, range, 1); size += range->resource.end - range->resource.start; restored++; } - r = r->sibling; total++; } mutex_unlock(_priv->gtt_mutex); diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index bc65c4d79c1f..7ba8a25520d9 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1413,9 +1413,8 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) { resource_size_t start = 0; resource_size_t end = 0; - struct resource *new_res; + struct resource *new_res, *tmp; struct resource **old_res = _mmio; - struct resource **prev_res = NULL; switch (res->type) { @@ -1462,44 +1461,36 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx) /* * If two ranges are adjacent, merge them. */ - do { - if (!*old_res) { - *old_res = new_res; - break; - } - - if (((*old_res)->end + 1) == new_res->start) { - (*old_res)->end = new_res->end; + if (!*old_res) { + *old_res = new_res; + return AE_OK; + } + tmp = *old_res; + list_for_each_entry_from(tmp, >parent->child, sibling) { + if ((tmp->end + 1) == new_res->start) { + tmp->end = new_res->end; kfree(new_res); break; } - if ((*old_res)->start == new_res->end + 1) { - (*old_res)->start = new_res->start; + if (tmp->start == new_res->end + 1) { + tmp->start = new_res->start; kfree(new_res); break; } -