From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: Franky Lin <frankyl@broadcom.com>,
devel@linuxdriverproject.org, gregkh@suse.de,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 04/20] staging: brcm80211: various __iomem additions to softmac.
Date: Mon, 10 Oct 2011 20:45:06 +0300 [thread overview]
Message-ID: <20111010174506.GA18470@longonot.mountain> (raw)
In-Reply-To: <CACna6rzFQZqed3ZfRxcd_WCvOsjKgeDd=T8EgtgpJttmTO3+cg@mail.gmail.com>
On Mon, Oct 10, 2011 at 04:23:28PM +0200, Rafał Miłecki wrote:
> > -#define CCREGS_FAST(si) (((char *)((si)->curmap) + PCI_16KB0_CCREGS_OFFSET))
> > +#define CCREGS_FAST(si) (((char __iomem *)((si)->curmap) + \
> > + PCI_16KB0_CCREGS_OFFSET))
>
> I've a question (not to just you), should we prefer u8/u16/u32 types in code?
> If so, you could think to changing this since you already touch this code.
>
The char is just so that the addition works, the caller will have to
cast it again. It's up to the author to decide.
If you're going to be doing bitwise operations then you can run into
signedness bugs using char.
printf("0x%x\n", (int) 0 | (char) -1); /* 0xffffffff */
printf("0x%x\n", (int) 0 | (unsigned char) -1); /* 0xff */
Also if you are going to save hex digits to it, then it should be u8.
You occasionally see bugs like this:
char x = 0xff;
if (x == 0xff)
printf("dead code here.\n");
else
printf("signed chars only reach up to 0x7f\n");
regards,
dan carpenter
next prev parent reply other threads:[~2011-10-10 17:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 17:14 [PATCH 00/20] staging: brcm80211: code clean up Franky Lin
2011-10-02 17:14 ` [PATCH 01/20] staging: brmc80211: removed some unused fmac variable declarations Franky Lin
2011-10-02 17:14 ` [PATCH 02/20] staging: brcm80211: removed unused smac tx ampdu packet queue Franky Lin
2011-10-02 17:14 ` [PATCH 03/20] staging: brcm80211: cleaning up tx rate control code in softmac Franky Lin
2011-10-02 17:14 ` [PATCH 04/20] staging: brcm80211: various __iomem additions to softmac Franky Lin
2011-10-10 14:23 ` Rafał Miłecki
2011-10-10 17:45 ` Dan Carpenter [this message]
2011-10-02 17:14 ` [PATCH 05/20] staging: brcm80211: reduced softmac sparse warnings Franky Lin
2011-10-02 17:14 ` [PATCH 06/20] staging: brcm80211: added __iomem qualifier to softmac main.c Franky Lin
2011-10-02 17:14 ` [PATCH 07/20] staging: brcm80211: added __iomem qualifier to softmac dma.c Franky Lin
2011-10-02 17:14 ` [PATCH 08/20] staging: brcm80211: added __iomem qualifier to softmac phy Franky Lin
2011-10-02 17:14 ` [PATCH 09/20] staging: brcm80211: only allow one call to add_interface callback Franky Lin
2011-10-02 17:14 ` [PATCH 10/20] staging: brcm80211: reduce indentation level in dhd_sdio.c #1 Franky Lin
2011-10-02 17:14 ` [PATCH 11/20] staging: brcm80211: reduce indentation level in dhd_sdio.c #2 Franky Lin
2011-10-02 17:14 ` [PATCH 12/20] staging: brcm80211: reduce indentation level in dhd_sdio.c #3 Franky Lin
2011-10-02 17:14 ` [PATCH 13/20] staging: brcm80211: reducing indentation levels in bcmsdh_sdmmc.c Franky Lin
2011-10-02 17:14 ` [PATCH 14/20] staging: brcm80211: removed unused fullmac spinlock Franky Lin
2011-10-02 17:14 ` [PATCH 15/20] staging: brcm80211: removed unused softmac mimo disable code Franky Lin
2011-10-02 17:14 ` [PATCH 16/20] staging: brcm80211: removed fullmac function brcmf_bus_devreset() Franky Lin
2011-10-02 17:14 ` [PATCH 17/20] staging: brcm80211: removed 'enforce_mutex' parameter in fullmac Franky Lin
2011-10-02 17:14 ` [PATCH 18/20] staging: brcm80211: renamed ioctl functions/structs to dcmd Franky Lin
2011-10-02 17:14 ` [PATCH 19/20] staging: brcm80211: cleaned up buffer len defines in fullmac Franky Lin
2011-10-02 17:14 ` [PATCH 20/20] staging: brcm80211: removed functionality to disable N mode Franky Lin
2011-10-03 23:23 ` [PATCH 00/20] staging: brcm80211: code clean up Greg KH
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=20111010174506.GA18470@longonot.mountain \
--to=dan.carpenter@oracle.com \
--cc=devel@linuxdriverproject.org \
--cc=frankyl@broadcom.com \
--cc=gregkh@suse.de \
--cc=linux-wireless@vger.kernel.org \
--cc=zajec5@gmail.com \
/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).