Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103173
b: refs/heads/master
c: efa2758
h: refs/heads/master
i:
  103171: 40736e0
v: v3
  • Loading branch information
Michael Buesch authored and John W. Linville committed Jun 26, 2008
1 parent 2ae51c5 commit c9c0ae0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6bbc321a96d4d3533eb136b981baba6c8248d635
refs/heads/master: efa275822b50ab942c79ba26f053f9a0cd220e9e
38 changes: 30 additions & 8 deletions trunk/drivers/net/wireless/b43/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ static int mmio16read__write_file(struct b43_wldev *dev,
return -EINVAL;
if (addr > B43_MAX_MMIO_ACCESS)
return -EADDRNOTAVAIL;
if ((addr % 2) != 0)
return -EINVAL;

dev->dfsentry->mmio16read_next = addr;

Expand All @@ -276,17 +278,26 @@ static int mmio16read__write_file(struct b43_wldev *dev,
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;
Expand Down Expand Up @@ -320,6 +331,8 @@ static int mmio32read__write_file(struct b43_wldev *dev,
return -EINVAL;
if (addr > B43_MAX_MMIO_ACCESS)
return -EADDRNOTAVAIL;
if ((addr % 4) != 0)
return -EINVAL;

dev->dfsentry->mmio32read_next = addr;

Expand All @@ -329,17 +342,26 @@ static int mmio32read__write_file(struct b43_wldev *dev,
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;
Expand Down

0 comments on commit c9c0ae0

Please sign in to comment.