Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122037
b: refs/heads/master
c: 4f6d4d1
h: refs/heads/master
i:
  122035: 5124206
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Nov 21, 2008
1 parent 954db7b commit bebdc32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 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: 96dd603f3817c5289a906539cb85bddae9536868
refs/heads/master: 4f6d4d1e36f30ac05bc39bcbfdba09e64e0f918c
25 changes: 10 additions & 15 deletions trunk/net/wireless/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,20 @@ static inline struct cfg80211_registered_device *dev_to_rdev(
return container_of(dev, struct cfg80211_registered_device, wiphy.dev);
}

static ssize_t _show_index(struct device *dev, struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "%d\n", dev_to_rdev(dev)->idx);
#define SHOW_FMT(name, fmt, member) \
static ssize_t name ## _show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \
}

static ssize_t _show_permaddr(struct device *dev,
struct device_attribute *attr,
char *buf)
{
unsigned char *addr = dev_to_rdev(dev)->wiphy.perm_addr;

return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
}
SHOW_FMT(index, "%d", idx);
SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);

static struct device_attribute ieee80211_dev_attrs[] = {
__ATTR(index, S_IRUGO, _show_index, NULL),
__ATTR(macaddress, S_IRUGO, _show_permaddr, NULL),
__ATTR_RO(index),
__ATTR_RO(macaddress),
{}
};

Expand Down

0 comments on commit bebdc32

Please sign in to comment.