linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: Michael Buesch <mb@bu3sch.de>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	John W Linville <linville@tuxdriver.com>,
	bcm43xx-dev@lists.berlios.de, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] b43: Fix sparse warnings
Date: Fri, 14 Aug 2009 17:46:54 -0400	[thread overview]
Message-ID: <1250286414.8137.55.camel@mj> (raw)
In-Reply-To: <1250285371.8137.44.camel@mj>

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));

> Another approach would be to have b43_phy_mask() and similar functions
> accept int and do the bit cutting in one place.

I tend to think that it would be the best approach.

> It should also be possible to have separate functions e.g.
> b43_phy_unmask() that would do the negation, so that the caller won't
> need to do it.

This could make the code hard to read.

-- 
Regards,
Pavel Roskin

  reply	other threads:[~2009-08-14 21:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13 22:15 [PATCH] b43: Fix sparse warnings Larry Finger
2009-08-14 20:15 ` Michael Buesch
2009-08-14 20:52   ` Pavel Roskin
2009-08-14 21:00     ` Michael Buesch
2009-08-14 21:04       ` Gábor Stefanik
2009-08-14 21:35         ` Pavel Roskin
2009-08-15 10:04           ` Michael Buesch
2009-08-17 20:30             ` Pavel Roskin
2009-08-18 13:12               ` Michael Buesch
2009-08-14 21:29       ` Pavel Roskin
2009-08-14 21:46         ` Pavel Roskin [this message]
2009-08-15 10:08           ` Michael Buesch
2009-08-14 21:33   ` Larry Finger
  -- strict thread matches above, loose matches on Subject: below --
2007-09-19 16:30 Michael Buesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250286414.8137.55.camel@mj \
    --to=proski@gnu.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mb@bu3sch.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).