Release 4.7 drivers/staging/speakup/devsynth.c
#include <linux/errno.h>
#include <linux/miscdevice.h> /* for misc_register, and SYNTH_MINOR */
#include <linux/types.h>
#include <linux/uaccess.h>
#include "speakup.h"
#include "spk_priv.h"
#ifndef SYNTH_MINOR
#define SYNTH_MINOR 25
#endif
static int misc_registered;
static int dev_opened;
static ssize_t speakup_file_write(struct file *fp, const char __user *buffer,
size_t nbytes, loff_t *ppos)
{
size_t count = nbytes;
const char __user *ptr = buffer;
size_t bytes;
unsigned long flags;
u_char buf[256];
if (!synth)
return -ENODEV;
while (count > 0) {
bytes = min(count, sizeof(buf));
if (copy_from_user(buf, ptr, bytes))
return -EFAULT;
count -= bytes;
ptr += bytes;
spin_lock_irqsave(&speakup_info.spinlock, flags);
synth_write(buf, bytes);
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
}
return (ssize_t) nbytes;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 130 | 96.30% | 2 | 40.00% |
andrew morton | andrew morton | 2 | 1.48% | 1 | 20.00% |
emil goode | emil goode | 2 | 1.48% | 1 | 20.00% |
shraddha barke | shraddha barke | 1 | 0.74% | 1 | 20.00% |
| Total | 135 | 100.00% | 5 | 100.00% |
static ssize_t speakup_file_read(struct file *fp, char __user *buf,
size_t nbytes, loff_t *ppos)
{
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 25 | 96.15% | 1 | 50.00% |
emil goode | emil goode | 1 | 3.85% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static int speakup_file_open(struct inode *ip, struct file *fp)
{
if (!synth)
return -ENODEV;
if (xchg(&dev_opened, 1))
return -EBUSY;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 41 | 97.62% | 1 | 50.00% |
shraddha barke | shraddha barke | 1 | 2.38% | 1 | 50.00% |
| Total | 42 | 100.00% | 2 | 100.00% |
static int speakup_file_release(struct inode *ip, struct file *fp)
{
dev_opened = 0;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 23 | 100.00% | 1 | 100.00% |
| Total | 23 | 100.00% | 1 | 100.00% |
static const struct file_operations synth_fops = {
.read = speakup_file_read,
.write = speakup_file_write,
.open = speakup_file_open,
.release = speakup_file_release,
};
static struct miscdevice synth_device = {
.minor = SYNTH_MINOR,
.name = "synth",
.fops = &synth_fops,
};
void speakup_register_devsynth(void)
{
if (misc_registered != 0)
return;
/* zero it so if register fails, deregister will not ref invalid ptrs */
if (misc_register(&synth_device)) {
pr_warn("Couldn't initialize miscdevice /dev/synth.\n");
} else {
pr_info("initialized device: /dev/synth, node (MAJOR %d, MINOR %d)\n",
MISC_MAJOR, SYNTH_MINOR);
misc_registered = 1;
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 44 | 95.65% | 1 | 50.00% |
christian colic | christian colic | 2 | 4.35% | 1 | 50.00% |
| Total | 46 | 100.00% | 2 | 100.00% |
void speakup_unregister_devsynth(void)
{
if (!misc_registered)
return;
pr_info("speakup: unregistering synth device /dev/synth\n");
misc_deregister(&synth_device);
misc_registered = 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 28 | 100.00% | 1 | 100.00% |
| Total | 28 | 100.00% | 1 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
william hubbs | william hubbs | 377 | 97.42% | 2 | 28.57% |
emil goode | emil goode | 3 | 0.78% | 1 | 14.29% |
shraddha barke | shraddha barke | 2 | 0.52% | 1 | 14.29% |
christian colic | christian colic | 2 | 0.52% | 1 | 14.29% |
andrew morton | andrew morton | 2 | 0.52% | 1 | 14.29% |
tracey dent | tracey dent | 1 | 0.26% | 1 | 14.29% |
| Total | 387 | 100.00% | 7 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.