[lkml]   [2015]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: On register r/w macros/procedures of drivers/media/pci
On Sun, Apr 19, 2015 at 11:28 AM, Hans Verkuil <> wrote:
> Check the types of llmio and bbmio:
> u32 __iomem *lmmio;
> u8 __iomem *bmmio;
> So the values of the pointers are the same, but the types are not.
> So 'lmmio + 1' == 'bmmio + sizeof(u32)' == 'bbmio + 4'.
> Since all the registers are defined as byte offsets relative to the start
> of the memory map you cannot just do 'lmmio + reg' since that would be a
> factor 4 off. Instead you have to divide by 4 to get it back in line.
> Frankly, I don't think lmmio is necessary at all since readl/writel don't
> need a u32 pointer at all since they use void pointers. I never noticed
> that when I cleaned up the tw68 driver. Using 'void __iomem *mmio' instead
> of lmmio/bmmio and dropping the shifts in the tw_ macros would work just
> as well.

> Hope this helps,

Oh, indeed, I have forgot this basic thing of pointer arithmetics.
Thanks a lot for elaboration and the proposed solution.

Bluecherry developer.

 \ /
  Last update: 2015-04-19 11:01    [W:0.066 / U:23.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site