staging: speakup: speakup_soft.c: style fixes
* Clean this file based on reports from checkpatch.pl. * Make the file_operations structure const. * Use strict_strtoul instead of simple_strtoul. Signed-off-by: Christopher Brannon <chris@the-brannons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
e66c3d8475
Коммит
13f1a041ac
|
@ -40,7 +40,7 @@ static int softsynth_is_alive(struct spk_synth *synth);
|
||||||
static unsigned char get_index(void);
|
static unsigned char get_index(void);
|
||||||
|
|
||||||
static struct miscdevice synth_device;
|
static struct miscdevice synth_device;
|
||||||
static int initialized = 0;
|
static int initialized;
|
||||||
static int misc_registered;
|
static int misc_registered;
|
||||||
|
|
||||||
static struct var_t vars[] = {
|
static struct var_t vars[] = {
|
||||||
|
@ -66,8 +66,6 @@ static struct kobj_attribute caps_stop_attribute =
|
||||||
__ATTR(caps_stop, USER_RW, spk_var_show, spk_var_store);
|
__ATTR(caps_stop, USER_RW, spk_var_show, spk_var_store);
|
||||||
static struct kobj_attribute freq_attribute =
|
static struct kobj_attribute freq_attribute =
|
||||||
__ATTR(freq, USER_RW, spk_var_show, spk_var_store);
|
__ATTR(freq, USER_RW, spk_var_show, spk_var_store);
|
||||||
//static struct kobj_attribute lang_attribute =
|
|
||||||
// __ATTR(lang, USER_RW, spk_var_show, spk_var_store);
|
|
||||||
static struct kobj_attribute pitch_attribute =
|
static struct kobj_attribute pitch_attribute =
|
||||||
__ATTR(pitch, USER_RW, spk_var_show, spk_var_store);
|
__ATTR(pitch, USER_RW, spk_var_show, spk_var_store);
|
||||||
static struct kobj_attribute punct_attribute =
|
static struct kobj_attribute punct_attribute =
|
||||||
|
@ -81,6 +79,13 @@ static struct kobj_attribute voice_attribute =
|
||||||
static struct kobj_attribute vol_attribute =
|
static struct kobj_attribute vol_attribute =
|
||||||
__ATTR(vol, USER_RW, spk_var_show, spk_var_store);
|
__ATTR(vol, USER_RW, spk_var_show, spk_var_store);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We should uncomment the following definition, when we agree on a
|
||||||
|
* method of passing a language designation to the software synthesizer.
|
||||||
|
* static struct kobj_attribute lang_attribute =
|
||||||
|
* __ATTR(lang, USER_RW, spk_var_show, spk_var_store);
|
||||||
|
*/
|
||||||
|
|
||||||
static struct kobj_attribute delay_time_attribute =
|
static struct kobj_attribute delay_time_attribute =
|
||||||
__ATTR(delay_time, ROOT_W, spk_var_show, spk_var_store);
|
__ATTR(delay_time, ROOT_W, spk_var_show, spk_var_store);
|
||||||
static struct kobj_attribute direct_attribute =
|
static struct kobj_attribute direct_attribute =
|
||||||
|
@ -100,7 +105,7 @@ static struct attribute *synth_attrs[] = {
|
||||||
&caps_start_attribute.attr,
|
&caps_start_attribute.attr,
|
||||||
&caps_stop_attribute.attr,
|
&caps_stop_attribute.attr,
|
||||||
&freq_attribute.attr,
|
&freq_attribute.attr,
|
||||||
// &lang_attribute.attr,
|
/* &lang_attribute.attr, */
|
||||||
&pitch_attribute.attr,
|
&pitch_attribute.attr,
|
||||||
&punct_attribute.attr,
|
&punct_attribute.attr,
|
||||||
&rate_attribute.attr,
|
&rate_attribute.attr,
|
||||||
|
@ -161,7 +166,8 @@ static char *get_initstring(void)
|
||||||
while (var->var_id != MAXVARS) {
|
while (var->var_id != MAXVARS) {
|
||||||
if (var->var_id != CAPS_START && var->var_id != CAPS_STOP
|
if (var->var_id != CAPS_START && var->var_id != CAPS_STOP
|
||||||
&& var->var_id != DIRECT)
|
&& var->var_id != DIRECT)
|
||||||
cp = cp + sprintf(cp, var->u.n.synth_fmt, var->u.n.value);
|
cp = cp + sprintf(cp, var->u.n.synth_fmt,
|
||||||
|
var->u.n.value);
|
||||||
var++;
|
var++;
|
||||||
}
|
}
|
||||||
cp = cp + sprintf(cp, "\n");
|
cp = cp + sprintf(cp, "\n");
|
||||||
|
@ -260,20 +266,27 @@ static ssize_t softsynth_read(struct file *fp, char *buf, size_t count,
|
||||||
return chars_sent;
|
return chars_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int last_index = 0;
|
static int last_index;
|
||||||
|
|
||||||
static ssize_t softsynth_write(struct file *fp, const char *buf, size_t count,
|
static ssize_t softsynth_write(struct file *fp, const char *buf, size_t count,
|
||||||
loff_t *pos)
|
loff_t *pos)
|
||||||
{
|
{
|
||||||
|
unsigned long supplied_index = 0;
|
||||||
|
int converted;
|
||||||
char indbuf[5];
|
char indbuf[5];
|
||||||
if (count >= sizeof(indbuf))
|
if (count >= sizeof(indbuf))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (copy_from_user(indbuf, buf, count))
|
if (copy_from_user(indbuf, buf, count))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
indbuf[4] = 0;
|
indbuf[count] = '\0';
|
||||||
|
|
||||||
last_index = simple_strtoul(indbuf, NULL, 0);
|
converted = strict_strtoul(indbuf, 0, &supplied_index);
|
||||||
|
|
||||||
|
if (converted < 0)
|
||||||
|
return converted;
|
||||||
|
|
||||||
|
last_index = supplied_index;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +312,7 @@ static unsigned char get_index(void)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations softsynth_fops = {
|
static const struct file_operations softsynth_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.poll = softsynth_poll,
|
.poll = softsynth_poll,
|
||||||
.read = softsynth_read,
|
.read = softsynth_read,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче