lkml.org 
[lkml]   [2014]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] net: via-rhine: fix compiler warning
Date
From: Jan Moskyto Matejka
> > > So why not just:
> > > revision = (unsigned long)match->data;
> > > and add a comment that the 0x84 is the revision - #define ??
> >
> > There is no particular reason why it should be u32 now - this is a
> > leftover from the previous iteration of code where revision was a
> > separate property in DT (sized u32). It actually mirrors the
> > respective field in struct pci_dev, which is u8 - don't see any issue
> > defining it as unsigned long (and also changing the definition in
> > struct rhine_private).
> >
> > The comment that it's the revision is right above the match table (cut
> > off in the patch) :)
> >
> > Jan, would you prefer to adjust your patch, or shall I send another
> > one to change rp->revision and friends to unsigned long?
>
> I prefer you to make another patch, you obviously know more about this
> driver. Also thanks for suggesting (void*)->(unsigned long), I didn't
> know that these two are defined to have the same size (in kernel code).

The kernel assumes that throughout - the double cast is common.
The C99 type is uintptr_t - but I don't think that is defined in kernel.
The only place I know where sizeof (long) != sizeof (void *) is 64bit
windows. So anyone trying to compile a linux driver to run in the
windows kernel might have issues (never mind the GPL ones).

David

\
 
 \ /
  Last update: 2014-04-30 12:21    [W:0.096 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site