From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH v7 5/6] of: overlay: add per overlay sysfs attributes Date: Thu, 22 Oct 2015 13:21:41 -0700 Message-ID: <20151022202141.GE27977@kroah.com> References: <1445543427-26275-1-git-send-email-pantelis.antoniou@konsulko.com> <1445543427-26275-6-git-send-email-pantelis.antoniou@konsulko.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1445543427-26275-6-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Pantelis Antoniou Cc: Rob Herring , Frank Rowand , Matt Porter , Koen Kooi , Guenter Roeck , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Pantelis Antoniou List-Id: linux-api@vger.kernel.org On Thu, Oct 22, 2015 at 10:50:26PM +0300, Pantelis Antoniou 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 > --- > 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 91f10ed..6398810 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; > }; > @@ -252,6 +273,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: > @@ -262,6 +285,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)); Same minor nit here, but really not a big deal, nice job overall with this, sorry working with 'raw' kobjects is so messy. Acked-by: Greg Kroah-Hartman -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965635AbbJVUVn (ORCPT ); Thu, 22 Oct 2015 16:21:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40514 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965200AbbJVUVl (ORCPT ); Thu, 22 Oct 2015 16:21:41 -0400 Date: Thu, 22 Oct 2015 13:21:41 -0700 From: Greg Kroah-Hartman To: Pantelis Antoniou Cc: Rob Herring , Frank Rowand , Matt Porter , Koen Kooi , Guenter Roeck , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Pantelis Antoniou Subject: Re: [PATCH v7 5/6] of: overlay: add per overlay sysfs attributes Message-ID: <20151022202141.GE27977@kroah.com> References: <1445543427-26275-1-git-send-email-pantelis.antoniou@konsulko.com> <1445543427-26275-6-git-send-email-pantelis.antoniou@konsulko.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1445543427-26275-6-git-send-email-pantelis.antoniou@konsulko.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 22, 2015 at 10:50:26PM +0300, Pantelis Antoniou 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 > --- > 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 91f10ed..6398810 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; > }; > @@ -252,6 +273,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: > @@ -262,6 +285,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)); Same minor nit here, but really not a big deal, nice job overall with this, sorry working with 'raw' kobjects is so messy. Acked-by: Greg Kroah-Hartman