public inbox for b43-dev@lists.infradead.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	b43-dev@lists.infradead.org
Subject: [PATCH] b43: HT-PHY: allow writing longer tables with a single call
Date: Tue, 23 Aug 2011 12:10:17 -0500	[thread overview]
Message-ID: <4E53DEF9.5080203@lwfinger.net> (raw)
In-Reply-To: <1314119370-22869-1-git-send-email-zajec5@gmail.com>

On 08/23/2011 12:09 PM, Rafa? Mi?ecki wrote:
> Sometimes we need to write table which is 2-10 elements long. It's
> easier to create such a function instead of defining array every time.
>
> Signed-off-by: Rafa? Mi?ecki<zajec5@gmail.com>

ACK.  Larry

> ---
>   drivers/net/wireless/b43/tables_phy_ht.c |   45 ++++++++++++++++++++++++++++++
>   drivers/net/wireless/b43/tables_phy_ht.h |    1 +
>   2 files changed, 46 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/wireless/b43/tables_phy_ht.c b/drivers/net/wireless/b43/tables_phy_ht.c
> index 2127bd2..677d217 100644
> --- a/drivers/net/wireless/b43/tables_phy_ht.c
> +++ b/drivers/net/wireless/b43/tables_phy_ht.c
> @@ -710,6 +710,51 @@ void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value)
>   	return;
>   }
>
> +void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...)
> +{
> +	va_list args;
> +	u32 type, value;
> +	unsigned int i;
> +
> +	type = offset&  B43_HTTAB_TYPEMASK;
> +	offset&= 0xFFFF;
> +
> +	va_start(args, num);
> +	switch (type) {
> +	case B43_HTTAB_8BIT:
> +		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
> +		for (i = 0; i<  num; i++) {
> +			value = va_arg(args, int);
> +			B43_WARN_ON(value&  ~0xFF);
> +			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
> +		}
> +		break;
> +	case B43_HTTAB_16BIT:
> +		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
> +		for (i = 0; i<  num; i++) {
> +			value = va_arg(args, int);
> +			B43_WARN_ON(value&  ~0xFFFF);
> +			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
> +		}
> +		break;
> +	case B43_HTTAB_32BIT:
> +		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
> +		for (i = 0; i<  num; i++) {
> +			value = va_arg(args, int);
> +			b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI,
> +				      value>>  16);
> +			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO,
> +				      value&  0xFFFF);
> +		}
> +		break;
> +	default:
> +		B43_WARN_ON(1);
> +	}
> +	va_end(args);
> +
> +	return;
> +}
> +
>   void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
>   			  unsigned int nr_elements, const void *_data)
>   {
> diff --git a/drivers/net/wireless/b43/tables_phy_ht.h b/drivers/net/wireless/b43/tables_phy_ht.h
> index bd20e9a..1b5ef2b 100644
> --- a/drivers/net/wireless/b43/tables_phy_ht.h
> +++ b/drivers/net/wireless/b43/tables_phy_ht.h
> @@ -14,6 +14,7 @@ u32 b43_httab_read(struct b43_wldev *dev, u32 offset);
>   void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset,
>   			 unsigned int nr_elements, void *_data);
>   void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value);
> +void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...);
>   void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
>   			  unsigned int nr_elements, const void *_data);
>

      reply	other threads:[~2011-08-23 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 17:09 [PATCH] b43: HT-PHY: allow writing longer tables with a single call Rafał Miłecki
2011-08-23 17:10 ` Larry Finger [this message]

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=4E53DEF9.5080203@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=b43-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --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