On Friday 14 August 2009 23:46:54 Pavel Roskin wrote:
> On Fri, 2009-08-14 at 17:29 -0400, Pavel Roskin wrote:
> > On Fri, 2009-08-14 at 23:00 +0200, Michael Buesch wrote:
> > > On Friday 14 August 2009 22:52:13 Pavel Roskin wrote:
> > > > On Fri, 2009-08-14 at 22:15 +0200, Michael Buesch wrote:
> > > > 
> > > > > > -                   b43_phy_mask(dev, 0x048A, (u16)~0x8000);
> > > > > > +                   b43_phy_mask(dev, 0x048A, (u16)(~0x8000 & 
> > > > > > 0xFFFF));
> > > > > 
> > > 
> > > > I would just use 0x7fff here.
> > > 
> > > That does not work if 0x8000 is a #defined bit.
> > 
> > One approach would be to use a macro and tell sparse to ignore it
> > 
> > #define NEGATE(x) (__force typeof(x))(~x)
> 
> Scratch that.  It has no change to work for constants unless we hardcode
> the size, e.g. by having NEGATE16, NEGATE32 etc.
> 
> The best I could do is:
> 
> #define NEGATE16(x) (0xFFFF & ~x)
> b43_phy_mask(dev, 0x048A, NEGATE16(0x8000));

I think the real question is whether this does really prevent any bugs or 
whether
it just introduces new possibilities for bugs.

void my_func(u32 x);

my_func(NEGATE16(0x8000));

-- 
Greetings, Michael.
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to