Release 4.14 arch/sh/drivers/dma/dma-sysfs.c
/*
* arch/sh/drivers/dma/dma-sysfs.c
*
* sysfs interface for SH DMA API
*
* Copyright (C) 2004 - 2006 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/stat.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/string.h>
#include <asm/dma.h>
static struct bus_type dma_subsys = {
.name = "dma",
.dev_name = "dma",
};
static ssize_t dma_show_devices(struct device *dev,
struct device_attribute *attr, char *buf)
{
ssize_t len = 0;
int i;
for (i = 0; i < 16; i++) {
struct dma_info *info = get_dma_info(i);
struct dma_channel *channel = get_dma_channel(i);
if (unlikely(!info) || !channel)
continue;
len += sprintf(buf + len, "%2d: %14s %s\n",
channel->chan, info->name,
channel->dev_id);
}
return len;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 79 | 78.22% | 1 | 20.00% |
Paul Mundt | 16 | 15.84% | 2 | 40.00% |
Andi Kleen | 4 | 3.96% | 1 | 20.00% |
Kay Sievers | 2 | 1.98% | 1 | 20.00% |
Total | 101 | 100.00% | 5 | 100.00% |
static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL);
static int __init dma_subsys_init(void)
{
int ret;
ret = subsys_system_register(&dma_subsys, NULL);
if (unlikely(ret))
return ret;
return device_create_file(dma_subsys.dev_root, &dev_attr_devices);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 27 | 62.79% | 1 | 33.33% |
Kay Sievers | 9 | 20.93% | 1 | 33.33% |
Paul Mundt | 7 | 16.28% | 1 | 33.33% |
Total | 43 | 100.00% | 3 | 100.00% |
postcore_initcall(dma_subsys_init);
static ssize_t dma_show_dev_id(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct dma_channel *channel = to_dma_channel(dev);
return sprintf(buf, "%s\n", channel->dev_id);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 36 | 85.71% | 1 | 33.33% |
Andi Kleen | 4 | 9.52% | 1 | 33.33% |
Kay Sievers | 2 | 4.76% | 1 | 33.33% |
Total | 42 | 100.00% | 3 | 100.00% |
static ssize_t dma_store_dev_id(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct dma_channel *channel = to_dma_channel(dev);
strcpy(channel->dev_id, buf);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 40 | 86.96% | 1 | 33.33% |
Andi Kleen | 4 | 8.70% | 1 | 33.33% |
Kay Sievers | 2 | 4.35% | 1 | 33.33% |
Total | 46 | 100.00% | 3 | 100.00% |
static DEVICE_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id);
static ssize_t dma_store_config(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct dma_channel *channel = to_dma_channel(dev);
unsigned long config;
config = simple_strtoul(buf, NULL, 0);
dma_configure_channel(channel->vchan, config);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 54 | 88.52% | 1 | 25.00% |
Andi Kleen | 4 | 6.56% | 1 | 25.00% |
Kay Sievers | 2 | 3.28% | 1 | 25.00% |
Paul Mundt | 1 | 1.64% | 1 | 25.00% |
Total | 61 | 100.00% | 4 | 100.00% |
static DEVICE_ATTR(config, S_IWUSR, NULL, dma_store_config);
static ssize_t dma_show_mode(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct dma_channel *channel = to_dma_channel(dev);
return sprintf(buf, "0x%08x\n", channel->mode);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 36 | 85.71% | 1 | 33.33% |
Andi Kleen | 4 | 9.52% | 1 | 33.33% |
Kay Sievers | 2 | 4.76% | 1 | 33.33% |
Total | 42 | 100.00% | 3 | 100.00% |
static ssize_t dma_store_mode(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct dma_channel *channel = to_dma_channel(dev);
channel->mode = simple_strtoul(buf, NULL, 0);
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 44 | 88.00% | 1 | 33.33% |
Andi Kleen | 4 | 8.00% | 1 | 33.33% |
Kay Sievers | 2 | 4.00% | 1 | 33.33% |
Total | 50 | 100.00% | 3 | 100.00% |
static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode);
#define dma_ro_attr(field, fmt) \
static ssize_t dma_show_##field(struct device *dev, \
struct device_attribute *attr, char *buf)\
{ \
struct dma_channel *channel = to_dma_channel(dev); \
return sprintf(buf, fmt, channel->field); \
} \
static DEVICE_ATTR(field, S_IRUGO, dma_show_##field, NULL);
dma_ro_attr(count, "0x%08x\n");
dma_ro_attr(flags, "0x%08lx\n");
int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info)
{
struct device *dev = &chan->dev;
char name[16];
int ret;
dev->id = chan->vchan;
dev->bus = &dma_subsys;
ret = device_register(dev);
if (ret)
return ret;
ret |= device_create_file(dev, &dev_attr_dev_id);
ret |= device_create_file(dev, &dev_attr_count);
ret |= device_create_file(dev, &dev_attr_mode);
ret |= device_create_file(dev, &dev_attr_flags);
ret |= device_create_file(dev, &dev_attr_config);
if (unlikely(ret)) {
dev_err(&info->pdev->dev, "Failed creating attrs\n");
return ret;
}
snprintf(name, sizeof(name), "dma%d", chan->chan);
return sysfs_create_link(&info->pdev->dev.kobj, &dev->kobj, name);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Paul Mundt | 80 | 46.24% | 2 | 50.00% |
Andrew Morton | 79 | 45.66% | 1 | 25.00% |
Kay Sievers | 14 | 8.09% | 1 | 25.00% |
Total | 173 | 100.00% | 4 | 100.00% |
void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info)
{
struct device *dev = &chan->dev;
char name[16];
device_remove_file(dev, &dev_attr_dev_id);
device_remove_file(dev, &dev_attr_count);
device_remove_file(dev, &dev_attr_mode);
device_remove_file(dev, &dev_attr_flags);
device_remove_file(dev, &dev_attr_config);
snprintf(name, sizeof(name), "dma%d", chan->chan);
sysfs_remove_link(&info->pdev->dev.kobj, name);
device_unregister(dev);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Paul Mundt | 94 | 88.68% | 1 | 50.00% |
Kay Sievers | 12 | 11.32% | 1 | 50.00% |
Total | 106 | 100.00% | 2 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 488 | 62.01% | 1 | 10.00% |
Paul Mundt | 205 | 26.05% | 4 | 40.00% |
Kay Sievers | 64 | 8.13% | 2 | 20.00% |
Andi Kleen | 24 | 3.05% | 1 | 10.00% |
Paul Gortmaker | 3 | 0.38% | 1 | 10.00% |
Tim Schmielau | 3 | 0.38% | 1 | 10.00% |
Total | 787 | 100.00% | 10 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.