From: Michael Buesch <mb@bu3sch.de>
To: "Gábor Stefanik" <netrolller.3d@gmail.com>
Cc: John Linville <linville@tuxdriver.com>,
Larry Finger <Larry.Finger@lwfinger.net>,
Johannes Berg <johannes@sipsolutions.net>,
Broadcom Wireless <bcm43xx-dev@lists.berlios.de>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH RFC] ssb: Implement the remaining rev.8 SPROM vars needed for LP-PHY
Date: Mon, 10 Aug 2009 21:01:38 +0200 [thread overview]
Message-ID: <200908102101.38698.mb@bu3sch.de> (raw)
In-Reply-To: <4A806B9E.5010105@gmail.com>
On Monday 10 August 2009 20:49:02 Gábor Stefanik wrote:
> Also add a "SPEX32" macro for extracting 32-bit SPROM variables.
>
> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> ---
> I'm not quite sure that the SPEX32 macro is sane endianness-wise;
> please review it carefully. (In the future, we will probably need
> a SPEX64 macro too, to correctly extract boardflags.)
>
> drivers/ssb/pci.c | 53 +++++++++++++++++++++++++++++++++-
> include/linux/ssb/ssb.h | 44 +++++++++++++++++++++++----
> include/linux/ssb/ssb_regs.h | 66 +++++++++++++++++++++++++++++++++++++----
> 3 files changed, 148 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
> index 40ea417..50811e4 100644
> --- a/drivers/ssb/pci.c
> +++ b/drivers/ssb/pci.c
> @@ -169,8 +169,14 @@ err_pci:
> /* Get the word-offset for a SSB_SPROM_XXX define. */
> #define SPOFF(offset) (((offset) - SSB_SPROM_BASE) / sizeof(u16))
> /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */
> -#define SPEX(_outvar, _offset, _mask, _shift) \
> +#define SPEX16(_outvar, _offset, _mask, _shift) \
> out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift))
> +#define SPEX32(_outvar, _offset, _mask, _shift) \
> + out->_outvar = ((((in[SPOFF((_offset)+2)] << sizeof(u16)) | \
^^^^^^^^^^^^^^
This shifts by 2 bit. Did you want 16 bits? Just write << 16 then.
Also, it seems you need +1 instead of +2 (it is an u16 pointer).
I also usually cast u16 values to u32 before shifting >=16 bits.
The result of shifting a 16bit variable left by 16bits is machine dependent.
It works as expected for every linux architecture, but I prefer the cast anyway.
Your macro extracts the value in littleendian format. I didn't check if this is
correct for your values. But there also are values stored in BE format.
--
Greetings, Michael.
next prev parent reply other threads:[~2009-08-10 19:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 18:49 [PATCH RFC] ssb: Implement the remaining rev.8 SPROM vars needed for LP-PHY Gábor Stefanik
2009-08-10 19:01 ` Michael Buesch [this message]
2009-08-10 19:07 ` Gábor Stefanik
2009-08-10 19:12 ` 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=200908102101.38698.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=Larry.Finger@lwfinger.net \
--cc=bcm43xx-dev@lists.berlios.de \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netrolller.3d@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.