Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1252040

Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes

From Rob Herring <robherring2@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes
Date 2015-10-20 23:10 +0200
Message-ID <qlMkq-74W-13@gated-at.bofh.it> (permalink)
References <qlKBX-4yw-3@gated-at.bofh.it> <qlKBX-4yw-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Oct 20, 2015 at 2:13 PM, Pantelis Antoniou
<pantelis.antoniou@konsulko.com> wrote:
> * A per overlay can_remove sysfs attribute that reports whether
> the overlay can be removed or not due to another overlapping overlay.
>
> * A target sysfs attribute listing the target of each fragment,
> in a group named after the name of the fragment.
>
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> ---
>  drivers/of/overlay.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 99 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 067404e..2d51d9e2 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -25,8 +25,23 @@
>
>  #include "of_private.h"
>
> +/* fwd. decl */
> +struct of_overlay;
> +struct of_overlay_info;
> +
> +/* an attribute for each fragment */
> +struct fragment_attribute {
> +       struct attribute attr;
> +       ssize_t (*show)(struct kobject *kobj, struct fragment_attribute *fattr,
> +                       char *buf);
> +       ssize_t (*store)(struct kobject *kobj, struct fragment_attribute *fattr,
> +                        const char *buf, size_t count);
> +       struct of_overlay_info *ovinfo;
> +};
> +
>  /**
>   * struct of_overlay_info - Holds a single overlay info
> + * @info:      info node that contains the target and overlay
>   * @target:    target of the overlay operation
>   * @overlay:   pointer to the overlay contents node
>   *
> @@ -34,8 +49,13 @@
>   * records.
>   */
>  struct of_overlay_info {
> +       struct of_overlay *ov;
> +       struct device_node *info;
>         struct device_node *target;
>         struct device_node *overlay;
> +       struct attribute_group attr_group;
> +       struct attribute *attrs[2];
> +       struct fragment_attribute target_attr;
>  };
>
>  /**
> @@ -52,6 +72,7 @@ struct of_overlay {
>         struct list_head node;
>         int count;
>         struct of_overlay_info *ovinfo_tab;
> +       const struct attribute_group **attr_groups;
>         struct of_changeset cset;
>         struct kobject kobj;
>  };
> @@ -245,6 +266,8 @@ static int of_fill_overlay_info(struct of_overlay *ov,
>         if (ovinfo->target == NULL)
>                 goto err_fail;
>
> +       ovinfo->info = of_node_get(info_node);
> +
>         return 0;
>
>  err_fail:
> @@ -255,6 +278,17 @@ err_fail:
>         return -EINVAL;
>  }
>
> +static ssize_t target_show(struct kobject *kobj,
> +               struct fragment_attribute *fattr, char *buf)
> +{
> +       struct of_overlay_info *ovinfo = fattr->ovinfo;
> +
> +       return snprintf(buf, PAGE_SIZE, "%s\n",
> +                       of_node_full_name(ovinfo->target));

This can be a link to the node itself, can't it?

Rob
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2015-10-20 21:20 +0200
  Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Rob Herring <robherring2@gmail.com> - 2015-10-20 23:10 +0200
    Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2015-10-20 23:20 +0200
      Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Rob Herring <robherring2@gmail.com> - 2015-10-21 00:00 +0200
        Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2015-10-21 21:40 +0200
          Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Rob Herring <robherring2@gmail.com> - 2015-10-22 00:00 +0200
            Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2015-10-22 18:20 +0200
  Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-20 23:10 +0200
    Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Pantelis Antoniou <pantelis.antoniou@konsulko.com> - 2015-10-20 23:20 +0200
      Re: [PATCH v6 3/4] of: overlay: add per overlay sysfs attributes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-21 01:30 +0200

csiph-web