public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Matt Porter <matt.porter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Koen Kooi
	<koen-QLwJDigV5abLmq1fohREcCpxlwaOVQ5f@public.gmane.org>,
	Alison Chaiken
	<Alison_Chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>,
	Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jan Lubbe <jluebbe-H4yykcOXDpCzQB+pC5nmwQ@public.gmane.org>,
	Alexander Sverdlin
	<alexander.sverdlin-OYasijW0DpE@public.gmane.org>,
	Michael Stickel <ms-g5CePrrZ5ROELgA04lAiVw@public.gmane.org>,
	Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
	Dirk Behme <dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Alan Tull
	<delicious.quinoa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Michael Bohan <mbohan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Ionut Nicu <ioan.nicu.ext-OYasijW0DpE@public.gmane.org>,
	Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>,
	Matt Ranostay <mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Pantelis Antoniou
	<panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
Subject: Re: [PATCH 4/5] OF: Export all DT proc update functions
Date: Mon, 11 Nov 2013 16:09:09 +0000	[thread overview]
Message-ID: <20131111160909.840EAC42311@trevor.secretlab.ca> (raw)
In-Reply-To: <1383673816-29293-5-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>

On Tue,  5 Nov 2013 19:50:15 +0200, Pantelis Antoniou <panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org> wrote:
> There are other users for the proc DT functions.
> Export them.
> 
> Signed-off-by: Pantelis Antoniou <panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>

These are all very much internal DT APIs. There is no way that anything
outside of drivers/of should ever be calling them. (In fact, I want to
be rid of the /proc/devicetree implementation entirely and put it into
sysfs, but that is a separate patch set). If they need to be broken out
into a header file, can they be put into something like
drivers/of/of_private.h?

g.

> ---
>  drivers/of/base.c  | 70 ++++++++++++++++++++++++++++++------------------------
>  include/linux/of.h | 29 ++++++++++++++++++++++
>  2 files changed, 68 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 0ffc5a9..c3c5391 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1435,6 +1435,40 @@ int of_property_notify(int action, struct device_node *np,
>  }
>  #endif
>  
> +#ifdef CONFIG_PROC_DEVICETREE
> +
> +void of_add_proc_dt_entry(struct device_node *dn)
> +{
> +	struct proc_dir_entry *ent;
> +
> +	ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
> +	if (ent)
> +		proc_device_tree_add_node(dn, ent);
> +}
> +
> +void of_add_proc_dt_prop_entry(struct device_node *np,
> +		struct property *prop)
> +{
> +	if (np && prop && np->pde)
> +		proc_device_tree_add_prop(np->pde, prop);
> +}
> +
> +void of_remove_proc_dt_prop_entry(struct device_node *np,
> +		struct property *prop)
> +{
> +	if (np && prop && np->pde)
> +		proc_device_tree_remove_prop(np->pde, prop);
> +}
> +
> +void of_update_proc_dt_prop_entry(struct device_node *np,
> +		struct property *newprop, struct property *oldprop)
> +{
> +	if (np && newprop && oldprop && np->pde)
> +		proc_device_tree_update_prop(np->pde, newprop, oldprop);
> +}
> +
> +#endif /* CONFIG_PROC_DEVICETREE */
> +
>  /**
>   * of_add_property - Add a property to a node
>   */
> @@ -1462,11 +1496,8 @@ int of_add_property(struct device_node *np, struct property *prop)
>  	*next = prop;
>  	raw_spin_unlock_irqrestore(&devtree_lock, flags);
>  
> -#ifdef CONFIG_PROC_DEVICETREE
>  	/* try to add to proc as well if it was initialized */
> -	if (np->pde)
> -		proc_device_tree_add_prop(np->pde, prop);
> -#endif /* CONFIG_PROC_DEVICETREE */
> +	of_add_proc_dt_prop_entry(np, prop);
>  
>  	return 0;
>  }
> @@ -1508,11 +1539,7 @@ int of_remove_property(struct device_node *np, struct property *prop)
>  	if (!found)
>  		return -ENODEV;
>  
> -#ifdef CONFIG_PROC_DEVICETREE
> -	/* try to remove the proc node as well */
> -	if (np->pde)
> -		proc_device_tree_remove_prop(np->pde, prop);
> -#endif /* CONFIG_PROC_DEVICETREE */
> +	of_remove_proc_dt_prop_entry(np, prop);
>  
>  	return 0;
>  }
> @@ -1562,11 +1589,8 @@ int of_update_property(struct device_node *np, struct property *newprop)
>  	if (!found)
>  		return -ENODEV;
>  
> -#ifdef CONFIG_PROC_DEVICETREE
>  	/* try to add to proc as well if it was initialized */
> -	if (np->pde)
> -		proc_device_tree_update_prop(np->pde, newprop, oldprop);
> -#endif /* CONFIG_PROC_DEVICETREE */
> +	of_update_proc_dt_prop_entry(np, newprop, oldprop);
>  
>  	return 0;
>  }
> @@ -1602,22 +1626,6 @@ int of_reconfig_notify(unsigned long action, void *p)
>  	return notifier_to_errno(rc);
>  }
>  
> -#ifdef CONFIG_PROC_DEVICETREE
> -static void of_add_proc_dt_entry(struct device_node *dn)
> -{
> -	struct proc_dir_entry *ent;
> -
> -	ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
> -	if (ent)
> -		proc_device_tree_add_node(dn, ent);
> -}
> -#else
> -static void of_add_proc_dt_entry(struct device_node *dn)
> -{
> -	return;
> -}
> -#endif
> -
>  /**
>   * of_attach_node - Plug a device node into the tree and global list.
>   */
> @@ -1643,12 +1651,12 @@ int of_attach_node(struct device_node *np)
>  }
>  
>  #ifdef CONFIG_PROC_DEVICETREE
> -static void of_remove_proc_dt_entry(struct device_node *dn)
> +void of_remove_proc_dt_entry(struct device_node *dn)
>  {
>  	proc_remove(dn->pde);
>  }
>  #else
> -static void of_remove_proc_dt_entry(struct device_node *dn)
> +void of_remove_proc_dt_entry(struct device_node *dn)
>  {
>  	return;
>  }
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 6fec255..a56c450 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -318,6 +318,35 @@ static inline int of_property_notify(int action, struct device_node *np,
>  }
>  #endif
>  
> +#ifdef CONFIG_PROC_DEVICETREE
> +
> +extern void of_add_proc_dt_entry(struct device_node *dn);
> +extern void of_remove_proc_dt_entry(struct device_node *dn);
> +
> +extern void of_add_proc_dt_prop_entry(struct device_node *np,
> +		struct property *prop);
> +
> +extern void of_remove_proc_dt_prop_entry(struct device_node *np,
> +		struct property *prop);
> +
> +extern void of_update_proc_dt_prop_entry(struct device_node *np,
> +		struct property *newprop, struct property *oldprop);
> +#else
> +
> +static inline void of_add_proc_dt_entry(struct device_node *dn) { }
> +static inline void of_remove_proc_dt_entry(struct device_node *dn) { }
> +
> +static inline void of_add_proc_dt_prop_entry(struct device_node *np,
> +		struct property *prop) { }
> +
> +static inline void of_remove_proc_dt_prop_entry(struct device_node *np,
> +		struct property *prop) { }
> +
> +static inline void of_update_proc_dt_prop_entry(struct device_node *np,
> +		struct property *newprop, struct property *oldprop) { }
> +
> +#endif
> +
>  extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
>  extern int of_alias_get_id(struct device_node *np, const char *stem);
>  
> -- 
> 1.7.12
> 

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

  parent reply	other threads:[~2013-11-11 16:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 17:50 [PATCH 0/5] OF: Fixes in preperation of DT overlays Pantelis Antoniou
2013-11-05 17:50 ` [PATCH 1/5] OF: Clear detach flag on attach Pantelis Antoniou
     [not found]   ` <1383673816-29293-2-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-05 19:43     ` Gerhard Sittig
     [not found]       ` <20131105194310.GB17929-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org>
2013-11-05 20:03         ` Pantelis Antoniou
2013-11-06  8:46           ` Alexander Sverdlin
2013-11-06  8:49             ` Pantelis Antoniou
2013-11-06 10:05               ` Alexander Sverdlin
2013-11-11 16:05               ` Grant Likely
2013-11-05 17:50 ` [PATCH 2/5] OF: Introduce device tree node flag helpers Pantelis Antoniou
     [not found]   ` <1383673816-29293-3-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-11 16:05     ` Grant Likely
2013-11-05 17:50 ` [PATCH 3/5] OF: export of_property_notify Pantelis Antoniou
2013-11-05 18:12   ` Matt Porter
2013-11-05 18:15     ` Pantelis Antoniou
     [not found]   ` <1383673816-29293-4-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-11 16:06     ` Grant Likely
     [not found]       ` <20131111160649.58E70C4230C-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12  9:31         ` Pantelis Antoniou
2013-11-05 17:50 ` [PATCH 4/5] OF: Export all DT proc update functions Pantelis Antoniou
     [not found]   ` <1383673816-29293-5-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-11 16:09     ` Grant Likely [this message]
2013-11-12 10:21       ` Pantelis Antoniou
2013-11-05 17:50 ` [PATCH 5/5] OF: Introduce utility helper functions Pantelis Antoniou
     [not found]   ` <1383673816-29293-6-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-06  9:21     ` Ionut Nicu
     [not found]       ` <527A0A12.2050803-OYasijW0DpE@public.gmane.org>
2013-11-06  9:34         ` Pantelis Antoniou
2013-11-06 14:53           ` Guenter Roeck
     [not found]             ` <527A57D9.3070402-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-11-06 15:08               ` Pantelis Antoniou
2013-11-11 16:12             ` Grant Likely
2013-11-11 16:37     ` Grant Likely
     [not found]       ` <20131111163743.D136CC42330-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-12 10:39         ` Pantelis Antoniou
     [not found]           ` <89491720-464B-47EC-A888-9CDE29B035F5-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-13  1:34             ` Grant Likely
     [not found]               ` <20131113013459.D3886C40F49-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-13  9:03                 ` Pantelis Antoniou
     [not found]                   ` <F88335D9-6515-4E48-A21F-25039F16754A-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-14  1:44                     ` Grant Likely
     [not found]                       ` <20131114014420.E871CC4054D-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-14  9:51                         ` Pantelis Antoniou
     [not found]   ` < 20131111163743.D136CC42330@trevor.secretlab.ca>
     [not found]     ` < 89491720-464B-47EC-A888-9CDE29B035F5@antoniou-consulting.com>
     [not found]       ` < 20131113013459.D3886C40F49@trevor.secretlab.ca>
     [not found]         ` < F88335D9-6515-4E48-A21F-25039F16754A@antoniou-consulting.com>
     [not found]           ` < 20131114014420.E871CC4054D@trevor.secretlab.ca>
     [not found]             ` < F61B515B-7024-4C4A-8E78-CEF8E032DF59@antoniou-consulting.com>
     [not found]               ` <F61B515B-7024-4C4A-8E78-CEF8E032DF59-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-15  6:27                 ` Grant Likely
     [not found]                   ` <20131115062729.09E4FC4073F-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-11-16 12:23                     ` Pantelis Antoniou
     [not found] ` <1383673816-29293-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2013-11-06 15:41   ` [PATCH 0/5] OF: Fixes in preperation of DT overlays Alexander Sverdlin

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=20131111160909.840EAC42311@trevor.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=Alison_Chaiken-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org \
    --cc=alexander.sverdlin-OYasijW0DpE@public.gmane.org \
    --cc=delicious.quinoa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=dirk.behme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ioan.nicu.ext-OYasijW0DpE@public.gmane.org \
    --cc=jluebbe-H4yykcOXDpCzQB+pC5nmwQ@public.gmane.org \
    --cc=koen-QLwJDigV5abLmq1fohREcCpxlwaOVQ5f@public.gmane.org \
    --cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.porter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=mbohan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org \
    --cc=mranostay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ms-g5CePrrZ5ROELgA04lAiVw@public.gmane.org \
    --cc=panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org \
    --cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    /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