Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966299AbbDWPW5 (ORCPT ); Thu, 23 Apr 2015 11:22:57 -0400 Received: from mail-qg0-f48.google.com ([209.85.192.48]:36307 "EHLO mail-qg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752618AbbDWPWx (ORCPT ); Thu, 23 Apr 2015 11:22:53 -0400 Date: Thu, 23 Apr 2015 11:22:49 -0400 From: Tejun Heo To: "Luis R. Rodriguez" Cc: rusty@rustcorp.com.au, akpm@linux-foundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, keescook@chromium.org, casey@schaufler-ca.com, cocci@systeme.lip6.fr, "Luis R. Rodriguez" , Jani Nikula Subject: Re: [PATCH v2 3/8] kernel/params.c: generalize bool_enable_only Message-ID: <20150423152249.GK10738@htj.duckdns.org> References: <1429739711-9415-1-git-send-email-mcgrof@do-not-panic.com> <1429739711-9415-4-git-send-email-mcgrof@do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429739711-9415-4-git-send-email-mcgrof@do-not-panic.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 930 Lines: 33 Hello, On Wed, Apr 22, 2015 at 02:55:06PM -0700, Luis R. Rodriguez wrote: > +int param_set_bool_enable_only(const char *val, const struct kernel_param *kp) > +{ > + int err = 0; > + bool new_value; > + bool orig_value = *(bool *)kp->arg; > + struct kernel_param dummy_kp = *kp; > + > + dummy_kp.arg = &new_value; > + > + err = param_set_bool(val, &dummy_kp); > + if (err) > + return err; > + > + /* Don't let them unset it once it's set! */ > + if (!new_value && orig_value) > + return -EROFS; I know that this was moved from another place but as we're making it generic now I'm a bit curious about -EROFS. Wouldn't -EINVAL be a more conventional choice here? Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/