lkml.org 
[lkml]   [2022]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv6 15/30] x86/boot: Port I/O: allow to hook up alternative helpers
On Thu, Mar 17, 2022 at 01:23:12PM -0700, Dave Hansen wrote:
> On 3/17/22 13:20, Dave Hansen wrote:
> > You keep the preprocessor away from things like
> >
> > foo.inb = bar;
> >
> > with:
> >
> > #define inb(x) pio_ops.inb(x)
>
> ... and I spotted my nonsense just as I hit send.
>
> You could do that ^^. But you'd need to rename the 'inb' op like:
>
> struct port_io_ops {
> u8 (*f_inb)(u16 port);
> ...
> };
>
> so that you do:
>
> #define inb(x) pio_ops.f_inb(x)
>
> But, remember when I said I hate playing #define tricks? ;) This is one
> reason why.

But the define tricks are unrelated to the linker issue. The issue pops up
after you get past the preprocessor tricks.

--
Kirill A. Shutemov

\
 
 \ /
  Last update: 2022-03-17 23:50    [W:0.056 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site