From: Michael Buesch <mb@bu3sch.de>
To: John Linville <linville@tuxdriver.com>
Cc: bcm43xx-dev@lists.berlios.de, linux-wireless@vger.kernel.org
Subject: [PATCH] b43: Add mask/set capability to debugfs MMIO interface
Date: Thu, 19 Jun 2008 19:38:32 +0200 [thread overview]
Message-ID: <200806191938.33048.mb@bu3sch.de> (raw)
This adds an atomic mask/set capability to the debugfs MMIO interface.
This is needed to support mask and/or set operations from the userspace
debugging tools.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
---
John, please queue this for 2.6.27
Index: wireless-testing/drivers/net/wireless/b43/debugfs.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/b43/debugfs.c 2008-06-19 12:49:10.000000000 +0200
+++ wireless-testing/drivers/net/wireless/b43/debugfs.c 2008-06-19 16:02:54.000000000 +0200
@@ -264,32 +264,43 @@ static int mmio16read__write_file(struct
res = sscanf(buf, "0x%X", &addr);
if (res != 1)
return -EINVAL;
if (addr > B43_MAX_MMIO_ACCESS)
return -EADDRNOTAVAIL;
+ if ((addr % 2) != 0)
+ return -EINVAL;
dev->dfsentry->mmio16read_next = addr;
return 0;
}
static int mmio16write__write_file(struct b43_wldev *dev,
const char *buf, size_t count)
{
- unsigned int addr, val;
+ unsigned int addr, mask, set;
int res;
+ u16 val;
- res = sscanf(buf, "0x%X = 0x%X", &addr, &val);
- if (res != 2)
+ res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set);
+ if (res != 3)
return -EINVAL;
if (addr > B43_MAX_MMIO_ACCESS)
return -EADDRNOTAVAIL;
- if (val > 0xFFFF)
+ if ((mask > 0xFFFF) || (set > 0xFFFF))
return -E2BIG;
+ if ((addr % 2) != 0)
+ return -EINVAL;
+ if (mask == 0)
+ val = 0;
+ else
+ val = b43_read16(dev, addr);
+ val &= mask;
+ val |= set;
b43_write16(dev, addr, val);
return 0;
}
static ssize_t mmio32read__read_file(struct b43_wldev *dev,
@@ -317,32 +328,43 @@ static int mmio32read__write_file(struct
res = sscanf(buf, "0x%X", &addr);
if (res != 1)
return -EINVAL;
if (addr > B43_MAX_MMIO_ACCESS)
return -EADDRNOTAVAIL;
+ if ((addr % 4) != 0)
+ return -EINVAL;
dev->dfsentry->mmio32read_next = addr;
return 0;
}
static int mmio32write__write_file(struct b43_wldev *dev,
const char *buf, size_t count)
{
- unsigned int addr, val;
+ unsigned int addr, mask, set;
int res;
+ u32 val;
- res = sscanf(buf, "0x%X = 0x%X", &addr, &val);
- if (res != 2)
+ res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set);
+ if (res != 3)
return -EINVAL;
if (addr > B43_MAX_MMIO_ACCESS)
return -EADDRNOTAVAIL;
- if (val > 0xFFFFFFFF)
+ if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF))
return -E2BIG;
+ if ((addr % 4) != 0)
+ return -EINVAL;
+ if (mask == 0)
+ val = 0;
+ else
+ val = b43_read32(dev, addr);
+ val &= mask;
+ val |= set;
b43_write32(dev, addr, val);
return 0;
}
/* wl->irq_lock is locked */
reply other threads:[~2008-06-19 17:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200806191938.33048.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=bcm43xx-dev@lists.berlios.de \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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).