Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79086
b: refs/heads/master
c: 35a84fd
h: refs/heads/master
v: v3
  • Loading branch information
Grant Likely authored and David S. Miller committed Jan 28, 2008
1 parent 82a3e04 commit ac60974
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 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: 43fd6c7ebdd50276a7d26d7dddcb109c291dde50
refs/heads/master: 35a84fdc89c493a6b0c1eb61296f9bd514f7b947
50 changes: 25 additions & 25 deletions trunk/drivers/net/gianfar_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,6 @@

#include "gianfar.h"

#define GFAR_ATTR(_name) \
static ssize_t gfar_show_##_name(struct device *dev, \
struct device_attribute *attr, char *buf); \
static ssize_t gfar_set_##_name(struct device *dev, \
struct device_attribute *attr, \
const char *buf, size_t count); \
static DEVICE_ATTR(_name, 0644, gfar_show_##_name, gfar_set_##_name)

#define GFAR_CREATE_FILE(_dev, _name) \
device_create_file(&_dev->dev, &dev_attr_##_name)

GFAR_ATTR(bd_stash);
GFAR_ATTR(rx_stash_size);
GFAR_ATTR(rx_stash_index);
GFAR_ATTR(fifo_threshold);
GFAR_ATTR(fifo_starve);
GFAR_ATTR(fifo_starve_off);

static ssize_t gfar_show_bd_stash(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -100,6 +82,8 @@ static ssize_t gfar_set_bd_stash(struct device *dev,
return count;
}

DEVICE_ATTR(bd_stash, 0644, gfar_show_bd_stash, gfar_set_bd_stash);

static ssize_t gfar_show_rx_stash_size(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -146,6 +130,9 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
return count;
}

DEVICE_ATTR(rx_stash_size, 0644, gfar_show_rx_stash_size,
gfar_set_rx_stash_size);

/* Stashing will only be enabled when rx_stash_size != 0 */
static ssize_t gfar_show_rx_stash_index(struct device *dev,
struct device_attribute *attr,
Expand Down Expand Up @@ -184,6 +171,9 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
return count;
}

DEVICE_ATTR(rx_stash_index, 0644, gfar_show_rx_stash_index,
gfar_set_rx_stash_index);

static ssize_t gfar_show_fifo_threshold(struct device *dev,
struct device_attribute *attr,
char *buf)
Expand Down Expand Up @@ -219,6 +209,9 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev,
return count;
}

DEVICE_ATTR(fifo_threshold, 0644, gfar_show_fifo_threshold,
gfar_set_fifo_threshold);

static ssize_t gfar_show_fifo_starve(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -253,6 +246,8 @@ static ssize_t gfar_set_fifo_starve(struct device *dev,
return count;
}

DEVICE_ATTR(fifo_starve, 0644, gfar_show_fifo_starve, gfar_set_fifo_starve);

static ssize_t gfar_show_fifo_starve_off(struct device *dev,
struct device_attribute *attr,
char *buf)
Expand Down Expand Up @@ -288,9 +283,13 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev,
return count;
}

DEVICE_ATTR(fifo_starve_off, 0644, gfar_show_fifo_starve_off,
gfar_set_fifo_starve_off);

void gfar_init_sysfs(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
int rc;

/* Initialize the default values */
priv->rx_stash_size = DEFAULT_STASH_LENGTH;
Expand All @@ -301,11 +300,12 @@ void gfar_init_sysfs(struct net_device *dev)
priv->bd_stash_en = DEFAULT_BD_STASH;

/* Create our sysfs files */
GFAR_CREATE_FILE(dev, bd_stash);
GFAR_CREATE_FILE(dev, rx_stash_size);
GFAR_CREATE_FILE(dev, rx_stash_index);
GFAR_CREATE_FILE(dev, fifo_threshold);
GFAR_CREATE_FILE(dev, fifo_starve);
GFAR_CREATE_FILE(dev, fifo_starve_off);

rc = device_create_file(&dev->dev, &dev_attr_bd_stash);
rc |= device_create_file(&dev->dev, &dev_attr_rx_stash_size);
rc |= device_create_file(&dev->dev, &dev_attr_rx_stash_index);
rc |= device_create_file(&dev->dev, &dev_attr_fifo_threshold);
rc |= device_create_file(&dev->dev, &dev_attr_fifo_starve);
rc |= device_create_file(&dev->dev, &dev_attr_fifo_starve_off);
if (rc)
dev_err(&dev->dev, "Error creating gianfar sysfs files.\n");
}

0 comments on commit ac60974

Please sign in to comment.