[alsa-devel] [PATCH] sound: replace strict_strto*() with kstrto*()

Takashi Iwai tiwai at suse.de
Sun Jul 21 11:56:52 CEST 2013


At Fri, 19 Jul 2013 16:24:59 +0900,
Jingoo Han wrote:
> 
> The usage of strict_strto*() is not preferred, because
> strict_strto*() is obsolete. Thus, kstrto*() should be
> used.
> 
> Signed-off-by: Jingoo Han <jg1.han at samsung.com>

Thanks, applied.


Takashi

> ---
>  sound/drivers/dummy.c     |    2 +-
>  sound/pci/hda/hda_hwdep.c |    6 +++---
>  sound/soc/codecs/wm8962.c |    2 +-
>  sound/soc/omap/mcbsp.c    |    2 +-
>  sound/soc/soc-core.c      |    8 +++++---
>  5 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
> index 11048cc..915b4d7 100644
> --- a/sound/drivers/dummy.c
> +++ b/sound/drivers/dummy.c
> @@ -1022,7 +1022,7 @@ static void dummy_proc_write(struct snd_info_entry *entry,
>  		if (i >= ARRAY_SIZE(fields))
>  			continue;
>  		snd_info_get_str(item, ptr, sizeof(item));
> -		if (strict_strtoull(item, 0, &val))
> +		if (kstrtoull(item, 0, &val))
>  			continue;
>  		if (fields[i].size == sizeof(int))
>  			*get_dummy_int_ptr(dummy, fields[i].offset) = val;
> diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
> index ce67608..fe0bda1 100644
> --- a/sound/pci/hda/hda_hwdep.c
> +++ b/sound/pci/hda/hda_hwdep.c
> @@ -295,7 +295,7 @@ static ssize_t type##_store(struct device *dev,			\
>  	struct snd_hwdep *hwdep = dev_get_drvdata(dev);		\
>  	struct hda_codec *codec = hwdep->private_data;		\
>  	unsigned long val;					\
> -	int err = strict_strtoul(buf, 0, &val);			\
> +	int err = kstrtoul(buf, 0, &val);			\
>  	if (err < 0)						\
>  		return err;					\
>  	codec->type = val;					\
> @@ -654,7 +654,7 @@ int snd_hda_get_int_hint(struct hda_codec *codec, const char *key, int *valp)
>  	p = snd_hda_get_hint(codec, key);
>  	if (!p)
>  		ret = -ENOENT;
> -	else if (strict_strtoul(p, 0, &val))
> +	else if (kstrtoul(p, 0, &val))
>  		ret = -EINVAL;
>  	else {
>  		*valp = val;
> @@ -751,7 +751,7 @@ static void parse_##name##_mode(char *buf, struct hda_bus *bus, \
>  				 struct hda_codec **codecp) \
>  { \
>  	unsigned long val; \
> -	if (!strict_strtoul(buf, 0, &val)) \
> +	if (!kstrtoul(buf, 0, &val)) \
>  		(*codecp)->name = val; \
>  }
>  
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index e2de9ec..e37c06f 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -3175,7 +3175,7 @@ static ssize_t wm8962_beep_set(struct device *dev,
>  	long int time;
>  	int ret;
>  
> -	ret = strict_strtol(buf, 10, &time);
> +	ret = kstrtol(buf, 10, &time);
>  	if (ret != 0)
>  		return ret;
>  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 361e4c0..83433fd 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -781,7 +781,7 @@ static ssize_t prop##_store(struct device *dev,				\
>  	unsigned long val;						\
>  	int status;							\
>  									\
> -	status = strict_strtoul(buf, 0, &val);				\
> +	status = kstrtoul(buf, 0, &val);				\
>  	if (status)							\
>  		return status;						\
>  									\
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 0ec070c..88daa64 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -192,7 +192,7 @@ static ssize_t pmdown_time_set(struct device *dev,
>  	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
>  	int ret;
>  
> -	ret = strict_strtol(buf, 10, &rtd->pmdown_time);
> +	ret = kstrtol(buf, 10, &rtd->pmdown_time);
>  	if (ret)
>  		return ret;
>  
> @@ -237,6 +237,7 @@ static ssize_t codec_reg_write_file(struct file *file,
>  	char *start = buf;
>  	unsigned long reg, value;
>  	struct snd_soc_codec *codec = file->private_data;
> +	int ret;
>  
>  	buf_size = min(count, (sizeof(buf)-1));
>  	if (copy_from_user(buf, user_buf, buf_size))
> @@ -248,8 +249,9 @@ static ssize_t codec_reg_write_file(struct file *file,
>  	reg = simple_strtoul(start, &start, 16);
>  	while (*start == ' ')
>  		start++;
> -	if (strict_strtoul(start, 16, &value))
> -		return -EINVAL;
> +	ret = kstrtoul(start, 16, &value);
> +	if (ret)
> +		return ret;
>  
>  	/* Userspace has been fiddling around behind the kernel's back */
>  	add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE);
> -- 
> 1.7.10.4
> 
> 


More information about the Alsa-devel mailing list