Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203436
b: refs/heads/master
c: c69fb76
h: refs/heads/master
v: v3
  • Loading branch information
Karl Hiramoto authored and David S. Miller committed Jul 9, 2010
1 parent 50b5b3b commit 093f8f0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 005066122b58f3b350736cc896af46aea2e32d23
refs/heads/master: c69fb76e8f53b36b81fd7c8a1ed251aaf6bb0386
39 changes: 39 additions & 0 deletions trunk/drivers/atm/adummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,42 @@ struct adummy_dev {

static LIST_HEAD(adummy_devs);

static ssize_t __set_signal(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{
struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
int signal;

if (sscanf(buf, "%d", &signal) == 1) {

if (signal < ATM_PHY_SIG_LOST || signal > ATM_PHY_SIG_FOUND)
signal = ATM_PHY_SIG_UNKNOWN;

atm_dev_signal_change(atm_dev, signal);
return 1;
}
return -EINVAL;
}

static ssize_t __show_signal(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *atm_dev = container_of(dev, struct atm_dev, class_dev);
return sprintf(buf, "%d\n", atm_dev->signal);
}
static DEVICE_ATTR(signal, 0644, __show_signal, __set_signal);

static struct attribute *adummy_attrs[] = {
&dev_attr_signal.attr,
NULL
};

static struct attribute_group adummy_group_attrs = {
.name = NULL, /* We want them in dev's root folder */
.attrs = adummy_attrs
};

static int __init
adummy_start(struct atm_dev *dev)
{
Expand Down Expand Up @@ -128,6 +164,9 @@ static int __init adummy_init(void)
adummy_dev->atm_dev = atm_dev;
atm_dev->dev_data = adummy_dev;

if (sysfs_create_group(&atm_dev->class_dev.kobj, &adummy_group_attrs))
dev_err(&atm_dev->class_dev, "Could not register attrs for adummy\n");

if (adummy_start(atm_dev)) {
printk(KERN_ERR DEV_LABEL ": adummy_start() failed\n");
err = -ENODEV;
Expand Down

0 comments on commit 093f8f0

Please sign in to comment.