[RFC PATCHv2 2/3] nvme: introduce multipath_head_always module param
Christoph Hellwig
hch at lst.de
Fri Apr 25 07:45:40 PDT 2025
On Fri, Apr 25, 2025 at 04:03:09PM +0530, Nilay Shroff wrote:
> +static int multipath_param_set(const char *val, const struct kernel_param *kp)
> +{
> + int ret;
> +
> + ret = param_set_bool(val, kp);
> + if (ret)
> + return ret;
> +
> + if (multipath_head_always && !*(bool *)kp->arg) {
> + pr_err("Can't disable multipath when multipath_head_always is configured.\n");
> + *(bool *)kp->arg = true;
This reads much nicer if you add a local bool * variable and avoid
all the casting, i.e.
bool *arg = kp->arg;
...
if (multipath_head_always && !*kp->arg) {
pr_err("Can't disable multipath when multipath_head_always is configured.\n");
*arg = true;
> +static int multipath_head_always_set(const char *val,
> + const struct kernel_param *kp)
> +{
> + int ret;
> +
> + ret = param_set_bool(val, kp);
> + if (ret < 0)
> + return ret;
> +
> + if (*(bool *)kp->arg)
> + multipath = true;
Same here.
More information about the Linux-nvme
mailing list