Release 4.11 net/atm/atm_sysfs.c
/* ATM driver model support. */
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/kobject.h>
#include <linux/atmdev.h>
#include "common.h"
#include "resources.h"
#define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
static ssize_t show_type(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *adev = to_atm_dev(cdev);
return scnprintf(buf, PAGE_SIZE, "%s\n", adev->type);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 35 | 79.55% | 1 | 33.33% |
Kay Sievers | 6 | 13.64% | 1 | 33.33% |
Chas Williams | 3 | 6.82% | 1 | 33.33% |
Total | 44 | 100.00% | 3 | 100.00% |
static ssize_t show_address(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *adev = to_atm_dev(cdev);
return scnprintf(buf, PAGE_SIZE, "%pM\n", adev->esi);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 33 | 75.00% | 1 | 33.33% |
Kay Sievers | 6 | 13.64% | 1 | 33.33% |
Chas Williams | 5 | 11.36% | 1 | 33.33% |
Total | 44 | 100.00% | 3 | 100.00% |
static ssize_t show_atmaddress(struct device *cdev,
struct device_attribute *attr, char *buf)
{
unsigned long flags;
struct atm_dev *adev = to_atm_dev(cdev);
struct atm_dev_addr *aaddr;
int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
int i, j, count = 0;
spin_lock_irqsave(&adev->lock, flags);
list_for_each_entry(aaddr, &adev->local, entry) {
for (i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
if (j == *fmt) {
count += scnprintf(buf + count,
PAGE_SIZE - count, ".");
++fmt;
j = 0;
}
count += scnprintf(buf + count,
PAGE_SIZE - count, "%02x",
aaddr->addr.sas_addr.prv[i]);
}
count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
}
spin_unlock_irqrestore(&adev->lock, flags);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 158 | 80.61% | 1 | 33.33% |
Chas Williams | 32 | 16.33% | 1 | 33.33% |
Kay Sievers | 6 | 3.06% | 1 | 33.33% |
Total | 196 | 100.00% | 3 | 100.00% |
static ssize_t show_atmindex(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *adev = to_atm_dev(cdev);
return scnprintf(buf, PAGE_SIZE, "%d\n", adev->number);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Dan J Williams | 41 | 93.18% | 1 | 50.00% |
Chas Williams | 3 | 6.82% | 1 | 50.00% |
Total | 44 | 100.00% | 2 | 100.00% |
static ssize_t show_carrier(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *adev = to_atm_dev(cdev);
return scnprintf(buf, PAGE_SIZE, "%d\n",
adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 39 | 78.00% | 1 | 33.33% |
Kay Sievers | 6 | 12.00% | 1 | 33.33% |
Chas Williams | 5 | 10.00% | 1 | 33.33% |
Total | 50 | 100.00% | 3 | 100.00% |
static ssize_t show_link_rate(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct atm_dev *adev = to_atm_dev(cdev);
int link_rate;
/* show the link rate, not the data rate */
switch (adev->link_rate) {
case ATM_OC3_PCR:
link_rate = 155520000;
break;
case ATM_OC12_PCR:
link_rate = 622080000;
break;
case ATM_25_PCR:
link_rate = 25600000;
break;
default:
link_rate = adev->link_rate * 8 * 53;
}
return scnprintf(buf, PAGE_SIZE, "%d\n", link_rate);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 78 | 87.64% | 1 | 33.33% |
Kay Sievers | 6 | 6.74% | 1 | 33.33% |
Chas Williams | 5 | 5.62% | 1 | 33.33% |
Total | 89 | 100.00% | 3 | 100.00% |
static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
static struct device_attribute *atm_attrs[] = {
&dev_attr_atmaddress,
&dev_attr_address,
&dev_attr_atmindex,
&dev_attr_carrier,
&dev_attr_type,
&dev_attr_link_rate,
NULL
};
static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env)
{
struct atm_dev *adev;
if (!cdev)
return -ENODEV;
adev = to_atm_dev(cdev);
if (!adev)
return -ENODEV;
if (add_uevent_var(env, "NAME=%s%d", adev->type, adev->number))
return -ENOMEM;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 65 | 92.86% | 1 | 33.33% |
Kay Sievers | 5 | 7.14% | 2 | 66.67% |
Total | 70 | 100.00% | 3 | 100.00% |
static void atm_release(struct device *cdev)
{
struct atm_dev *adev = to_atm_dev(cdev);
kfree(adev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 25 | 96.15% | 1 | 50.00% |
Kay Sievers | 1 | 3.85% | 1 | 50.00% |
Total | 26 | 100.00% | 2 | 100.00% |
static struct class atm_class = {
.name = "atm",
.dev_release = atm_release,
.dev_uevent = atm_uevent,
};
int atm_register_sysfs(struct atm_dev *adev, struct device *parent)
{
struct device *cdev = &adev->class_dev;
int i, j, err;
cdev->class = &atm_class;
cdev->parent = parent;
dev_set_drvdata(cdev, adev);
dev_set_name(cdev, "%s%d", adev->type, adev->number);
err = device_register(cdev);
if (err < 0)
return err;
for (i = 0; atm_attrs[i]; i++) {
err = device_create_file(cdev, atm_attrs[i]);
if (err)
goto err_out;
}
return 0;
err_out:
for (j = 0; j < i; j++)
device_remove_file(cdev, atm_attrs[j]);
device_del(cdev);
return err;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 92 | 59.74% | 1 | 20.00% |
Jeff Garzik | 44 | 28.57% | 1 | 20.00% |
Dan J Williams | 11 | 7.14% | 1 | 20.00% |
Kay Sievers | 7 | 4.55% | 2 | 40.00% |
Total | 154 | 100.00% | 5 | 100.00% |
void atm_unregister_sysfs(struct atm_dev *adev)
{
struct device *cdev = &adev->class_dev;
device_del(cdev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 23 | 92.00% | 1 | 50.00% |
Kay Sievers | 2 | 8.00% | 1 | 50.00% |
Total | 25 | 100.00% | 2 | 100.00% |
int __init atm_sysfs_init(void)
{
return class_register(&atm_class);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 15 | 100.00% | 1 | 100.00% |
Total | 15 | 100.00% | 1 | 100.00% |
void __exit atm_sysfs_exit(void)
{
class_unregister(&atm_class);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Roman Kagan | 698 | 75.62% | 1 | 11.11% |
Dan J Williams | 67 | 7.26% | 2 | 22.22% |
Kay Sievers | 58 | 6.28% | 3 | 33.33% |
Chas Williams | 53 | 5.74% | 1 | 11.11% |
Jeff Garzik | 44 | 4.77% | 1 | 11.11% |
Tejun Heo | 3 | 0.33% | 1 | 11.11% |
Total | 923 | 100.00% | 9 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.