[PATCH v7 05/10] PCI: Add support for relative addressing in quirk tables

From
Ard Biesheuvel <hidden>
Date
2018-01-05 17:45:08
Also in
linux-mips, linuxppc-dev, lkml, sparclinux
Reply to
Catalin Marinas, 2018-01-05
On 5 January 2018 at 17:41, Catalin Marinas [off-list ref] wrote:
On Tue, Jan 02, 2018 at 08:05:44PM +0000, Ard Biesheuvel wrote:
quoted
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 10684b17d0bd..b6d51b4d5ce1 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3556,9 +3556,16 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
                   f->vendor == (u16) PCI_ANY_ID) &&
                  (f->device == dev->device ||
                   f->device == (u16) PCI_ANY_ID)) {
-                     calltime = fixup_debug_start(dev, f->hook);
-                     f->hook(dev);
-                     fixup_debug_report(dev, calltime, f->hook);
+                     void (*hook)(struct pci_dev *dev);
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+                     hook = (void *)((unsigned long)&f->hook_offset +
+                                     f->hook_offset);
+#else
+                     hook = f->hook;
+#endif
More of a nitpick but I've seen this pattern in several places in your
code, maybe worth defining a macro (couldn't come up with a better
name):

#define offset_to_ptr(off) \
        ((void *)((unsigned long)&(off) + (off)))
Yeah, good point. Or even

static inline void *offset_to_ptr(const s32 *off)
{
    return (void *)((unsigned long)off + *off);
}
Thread (19 messages) 19 messages, 3 authors, last reply 2018-01-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help