[PATCH v3 1/4] params: lift param_set_uint_minmax to common code
Daniel Wagner
dwagner at suse.de
Thu Jun 17 01:00:04 PDT 2021
On Wed, Jun 16, 2021 at 02:19:33PM -0700, Sagi Grimberg wrote:
> It is a useful helper hence move it to common code so others can enjoy
> it.
>
> Suggested-by: Christoph Hellwig <hch at lst.de>
> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> Cc: linux-nfs at vger.kernel.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
[...]
> +int param_set_uint_minmax(const char *val,
> + const struct kernel_param *kp,
> + unsigned int min, unsigned int max)
> +{
> + unsigned int num;
> + int ret;
> +
> + if (!val)
> + return -EINVAL;
> + ret = kstrtouint(val, 0, &num);
> + if (ret)
> + return ret;
> + if (num < min || num > max)
> + return -EINVAL;
> + *((unsigned int *)kp->arg) = num;
> + return 0;
> +}
> +EXPORT_SYMBOL(param_set_uint_minmax);
Couldn't this be EXPORT_SYMBOL_GPL?
More information about the Linux-nvme
mailing list