From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Rob Herring <robherring2@gmail.com>,
Frank Rowand <frowand.list@gmail.com>,
Matt Porter <mporter@konsulko.com>,
Koen Kooi <koen@dominion.thruhere.net>,
Guenter Roeck <linux@roeck-us.net>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-api@vger.kernel.org,
Pantelis Antoniou <panto@antoniou-consulting.com>
Subject: Re: [PATCH v7 2/6] of: overlay: global sysfs enable attribute
Date: Thu, 22 Oct 2015 13:19:11 -0700 [thread overview]
Message-ID: <20151022201911.GB27977@kroah.com> (raw)
In-Reply-To: <1445543427-26275-3-git-send-email-pantelis.antoniou@konsulko.com>
On Thu, Oct 22, 2015 at 10:50:23PM +0300, Pantelis Antoniou wrote:
> A throw once master enable switch to protect against any
> further overlay applications if the administrator desires so.
>
> A kernel command line option is provided as well.
>
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> ---
> drivers/of/overlay.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 12c3e47..91f10ed 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -21,6 +21,7 @@
> #include <linux/err.h>
> #include <linux/idr.h>
> #include <linux/sysfs.h>
> +#include <linux/atomic.h>
>
> #include "of_private.h"
>
> @@ -55,8 +56,19 @@ struct of_overlay {
> struct kobject kobj;
> };
>
> +/* master enable switch; once set to 0 can't be re-enabled */
> +static atomic_t ov_enable = ATOMIC_INIT(1);
> +
> +static int __init of_overlay_disable_setup(char *str __always_unused)
> +{
> + atomic_set(&ov_enable, 0);
> + return 1;
> +}
> +__setup("of_overlay_disable", of_overlay_disable_setup);
> +
> static int of_overlay_apply_one(struct of_overlay *ov,
> struct device_node *target, const struct device_node *overlay);
> +static int overlay_removal_is_ok(struct of_overlay *ov);
>
> static int of_overlay_apply_single_property(struct of_overlay *ov,
> struct device_node *target, struct property *prop)
> @@ -339,6 +351,35 @@ void of_overlay_release(struct kobject *kobj)
> kfree(ov);
> }
>
> +static ssize_t enable_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&ov_enable));
Minor nit, you never need to care about the size of the buffer for a
sysfs file, if you do, you are doing something wrong. So this can just
be:
return sprintf(buf, "%d\n", atomic_read(&ov_enable));
Anyway, nothing worth keeping this from being merged:
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2015-10-22 20:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-22 19:50 [PATCH v7 0/6] of: overlay: kobject & sysfs'ation Pantelis Antoniou
2015-10-22 19:50 ` [PATCH v7 1/6] of: overlay: kobjectify overlay objects Pantelis Antoniou
2015-10-22 20:17 ` Greg Kroah-Hartman
2015-10-22 19:50 ` [PATCH v7 2/6] of: overlay: global sysfs enable attribute Pantelis Antoniou
2015-10-22 20:19 ` Greg Kroah-Hartman [this message]
2015-10-22 20:25 ` Pantelis Antoniou
2015-10-22 19:50 ` [PATCH v7 3/6] Documentation: ABI: overlays - global attributes Pantelis Antoniou
2015-10-22 20:19 ` Greg Kroah-Hartman
2015-10-22 19:50 ` [PATCH v7 4/6] Documentation: document of_overlay_disable parameter Pantelis Antoniou
2015-10-22 20:19 ` Greg Kroah-Hartman
2015-10-22 19:50 ` [PATCH v7 5/6] of: overlay: add per overlay sysfs attributes Pantelis Antoniou
2015-10-22 20:21 ` Greg Kroah-Hartman
2015-10-22 19:50 ` [PATCH v7 6/6] Documentation: ABI: overlays - per overlay docs Pantelis Antoniou
2015-10-22 20:22 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151022201911.GB27977@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=koen@dominion.thruhere.net \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mporter@konsulko.com \
--cc=pantelis.antoniou@konsulko.com \
--cc=panto@antoniou-consulting.com \
--cc=robherring2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®