lkml.org 
[lkml]   [2008]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: gart: factor out common code
SL Baur wrote:
> On 4/16/08, Pavel Machek <pavel@ucw.cz> wrote:
>> On Tue 2008-04-15 16:25:29, SL Baur wrote:
>> > On 4/15/08, Pavel Machek <pavel@ucw.cz> wrote:
>
>> > Other reviewer comments:
>> > The casting between struct pci_dev * and u64 is kind of ugly,
>> > I presume the reason for the narrowing casts in the block of
>> > code you moved is documented somewhere.
>>
>>
>> Where am I doing that?
>
> The struct pci_dev */u64 casting is in init_k8_gatt. If Ingo is happy, then
> forget my comment. I don't have this kind of system to test the patch on, it
> was just that as I was looking it over, all the casts kind of made my head
> swim.

I think the casts make it more clear because the register is 32bit.
The only truly ugly bit is naming a variable "tmp".

> The narrowing cast is here:
> +static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
> +{
> + u32 tmp, ctl;
> +
> + /* address of the mappings table */
> + addr >>= 12;
> + tmp = (u32) addr<<4;
>
> Also, putting on my Andrew Morton cap, which I should have done before,
> that function is too big to be inlined so you should probably drop the explicit
> `inline' and let the compiler decide.

In a header static inline is needed, otherwise the compiler will warn
about an unused static if it's not used which is unfortunate because
not every includer wants to use all functions.

That said the function should probably not be in a header.

-Andi


\
 
 \ /
  Last update: 2008-04-17 08:33    [W:0.049 / U:1.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site