Thread (32 messages) 32 messages, 6 authors, 2021-04-08

Re: [PATCH v4 11/18] asm-generic/io.h: implement pci_remap_cfgspace using ioremap_np

From: Will Deacon <will@kernel.org>
Date: 2021-04-07 21:03:35
Also in: linux-arch, linux-devicetree, linux-doc, lkml

On Wed, Apr 07, 2021 at 04:27:42PM +0300, Andy Shevchenko wrote:
On Fri, Apr 2, 2021 at 12:07 PM Hector Martin [off-list ref] wrote:
quoted
Now that we have ioremap_np(), we can make pci_remap_cfgspace() default
to it, falling back to ioremap() on platforms where it is not available.

Remove the arm64 implementation, since that is now redundant. Future
cleanups should be able to do the same for other arches, and eventually
make the generic pci_remap_cfgspace() unconditional.
...
quoted
+       void __iomem *ret = ioremap_np(offset, size);
+
+       if (!ret)
+               ret = ioremap(offset, size);
+
+       return ret;
Usually negative conditions are worse for cognitive functions of human beings.
(On top of that some patterns are applied)

I would rewrite above as

void __iomem *ret;

ret = ioremap_np(offset, size);
if (ret)
  return ret;

return ioremap(offset, size);
Looks like it might be one of those rare occasions where the GCC ternary if
extension thingy comes in handy:

	return ioremap_np(offset, size) ?: ioremap(offset, size);

but however it's done, the logic looks good to me and thanks Hector for
updating this:

Acked-by: Will Deacon <will@kernel.org>

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help