Commit 13f1a041 authored by Christopher Brannon's avatar Christopher Brannon Committed by Greg Kroah-Hartman
Browse files

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: default avatarChristopher Brannon <chris@the-brannons.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e66c3d84
Loading
Loading
Loading
Loading
+34 −21
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ static int softsynth_is_alive(struct spk_synth *synth);
static unsigned char get_index(void);

static struct miscdevice synth_device;
static int initialized = 0;
static int initialized;
static int misc_registered;

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);
static struct kobj_attribute freq_attribute =
	__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 =
	__ATTR(pitch, USER_RW, spk_var_show, spk_var_store);
static struct kobj_attribute punct_attribute =
@@ -81,6 +79,13 @@ static struct kobj_attribute voice_attribute =
static struct kobj_attribute vol_attribute =
	__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 =
	__ATTR(delay_time, ROOT_W, spk_var_show, spk_var_store);
static struct kobj_attribute direct_attribute =
@@ -100,7 +105,7 @@ static struct attribute *synth_attrs[] = {
	&caps_start_attribute.attr,
	&caps_stop_attribute.attr,
	&freq_attribute.attr,
//	&lang_attribute.attr,
/*	&lang_attribute.attr, */
	&pitch_attribute.attr,
	&punct_attribute.attr,
	&rate_attribute.attr,
@@ -161,7 +166,8 @@ static char *get_initstring(void)
	while (var->var_id != MAXVARS) {
		if (var->var_id != CAPS_START && var->var_id != CAPS_STOP
			&& 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++;
	}
	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;
}

static int last_index = 0;
static int last_index;

static ssize_t softsynth_write(struct file *fp, const char *buf, size_t count,
			       loff_t *pos)
{
	unsigned long supplied_index = 0;
	int converted;
	char indbuf[5];
	if (count >= sizeof(indbuf))
		return -EINVAL;

	if (copy_from_user(indbuf, buf, count))
		return -EFAULT;
	indbuf[4] = 0;
	indbuf[count] = '\0';

	converted = strict_strtoul(indbuf, 0, &supplied_index);

	if (converted < 0)
		return converted;

	last_index = simple_strtoul(indbuf, NULL, 0);
	last_index = supplied_index;
	return count;
}

@@ -299,7 +312,7 @@ static unsigned char get_index(void)
	return rv;
}

static struct file_operations softsynth_fops = {
static const struct file_operations softsynth_fops = {
	.owner = THIS_MODULE,
	.poll = softsynth_poll,
	.read = softsynth_read,