Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1217288 > unrolled thread
| Started by | Rob Herring <robherring2@gmail.com> |
|---|---|
| First post | 2015-09-02 04:40 +0200 |
| Last post | 2015-09-02 04:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v4 3/4] of: overlay: add per overlay sysfs attributes Rob Herring <robherring2@gmail.com> - 2015-09-02 04:40 +0200
| From | Rob Herring <robherring2@gmail.com> |
|---|---|
| Date | 2015-09-02 04:40 +0200 |
| Subject | Re: [PATCH v4 3/4] of: overlay: add per overlay sysfs attributes |
| Message-ID | <q467U-ax-1@gated-at.bofh.it> |
On Fri, Jun 12, 2015 at 2:38 PM, Pantelis Antoniou
<pantelis.antoniou@konsulko.com> wrote:
> The two default overlay attributes are:
>
> * A targets sysfs attribute listing the targets of the installed
> overlay. The targets list the path on the kernel's device tree
> where each overlay fragment is applied to
>
> * A per overlay can_remove sysfs attribute that reports whether
> the overlay can be removed or not due to another overlapping overlay.
What will a user do with this information? Can this just be debugfs?
Don't we already have the targets in the overlay itself? If we are
going to provide some overlay info, shouldn't we provide all of it
(i.e. the FDT). For example, what do we do on a kexec?
Rob
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> ---
> drivers/of/overlay.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
>
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 37ec858..747568f 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -373,8 +373,61 @@ static const struct attribute *overlay_global_attrs[] = {
> NULL
> };
>
> +static ssize_t can_remove_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + struct of_overlay *ov = kobj_to_overlay(kobj);
> +
> + return snprintf(buf, PAGE_SIZE, "%d\n", overlay_removal_is_ok(ov));
> +}
> +
> +static ssize_t targets_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + struct of_overlay *ov = kobj_to_overlay(kobj);
> + struct of_overlay_info *ovinfo;
> + char *s, *e;
> + ssize_t ret;
> + int i, len;
> +
> + s = buf;
> + e = buf + PAGE_SIZE;
> +
> + mutex_lock(&of_mutex);
> +
> + /* targets */
> + for (i = 0; i < ov->count; i++) {
> + ovinfo = &ov->ovinfo_tab[i];
> +
> + len = snprintf(s, e - s, "%s\n",
> + of_node_full_name(ovinfo->target));
> + if (len == 0) {
> + ret = -ENOSPC;
> + goto err;
> + }
> + s += len;
> + }
> +
> + /* the buffer is zero terminated */
> + ret = s - buf;
> +err:
> + mutex_unlock(&of_mutex);
> + return ret;
> +}
> +
> +static struct kobj_attribute can_remove_attr = __ATTR_RO(can_remove);
> +static struct kobj_attribute targets_attr = __ATTR_RO(targets);
> +
> +static struct attribute *overlay_attrs[] = {
> + &can_remove_attr.attr,
> + &targets_attr.attr,
> + NULL
> +};
> +
> static struct kobj_type of_overlay_ktype = {
> .release = of_overlay_release,
> + .sysfs_ops = &kobj_sysfs_ops, /* default kobj sysfs ops */
> + .default_attrs = overlay_attrs,
> };
>
> static struct kset *ov_kset;
> --
> 1.7.12
>
--
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 top | Article view | linux.kernel
csiph-web