linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: anton@enomsg.org (Anton Vorontsov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] power_supply: Add of_node_put to fix refcount
Date: Fri, 28 Jun 2013 18:22:55 -0700	[thread overview]
Message-ID: <20130629012255.GA20924@lizard> (raw)
In-Reply-To: <1370899602-22123-2-git-send-email-rklein@nvidia.com>

On Mon, Jun 10, 2013 at 05:26:39PM -0400, Rhyland Klein wrote:
> of_parse_phandle increments the refcount for a dt node before returning
> it. Add of_node_put where needed to properly decrement the refcount
> when we are done using a given node.
> 
> Signed-off-by: Rhyland Klein <rklein@nvidia.com>
> ---

With CONFIG_OF=n I got this:

  CC      drivers/power/sbs-battery.o
  drivers/power/sbs-battery.c: In function ?sbs_probe?:
  drivers/power/sbs-battery.c:707:20: error: ?struct power_supply? has no
  member named ?of_node?
  make[1]: *** [drivers/power/sbs-battery.o] Error 1

I fixed this by the patch below and applied your 1-3 series.

Thanks!

Anton

commit b50df95c8f0703c95625181d2eaf53855c5ebee5
Author: Anton Vorontsov <anton@enomsg.org>
Date:   Fri Jun 28 18:17:22 2013 -0700

    power_supply: Move of_node out of the #ifdef CONFIG_OF
    
    Similar to linux/device.h, move of_node struct member out of the #ifdef
    CONFIG_OF so that the drivers won't have to mess with #ifdefs in .c files.
    
    Signed-off-by: Anton Vorontsov <anton@enomsg.org>

diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 3828cef..804b906 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -162,6 +162,8 @@ union power_supply_propval {
 	const char *strval;
 };
 
+struct device_node;
+
 struct power_supply {
 	const char *name;
 	enum power_supply_type type;
@@ -173,9 +175,7 @@ struct power_supply {
 
 	char **supplied_from;
 	size_t num_supplies;
-#ifdef CONFIG_OF
 	struct device_node *of_node;
-#endif
 
 	int (*get_property)(struct power_supply *psy,
 			    enum power_supply_property psp,

  reply	other threads:[~2013-06-29  1:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 21:26 [PATCH 0/4] Fix and start using supplied_from logic Rhyland Klein
2013-06-10 21:26 ` [PATCH 1/4] power_supply: Add of_node_put to fix refcount Rhyland Klein
2013-06-29  1:22   ` Anton Vorontsov [this message]
2013-07-01 16:13     ` Rhyland Klein
2013-06-10 21:26 ` [PATCH 2/4] power: sbs-battery: Add dt to power_supply struct Rhyland Klein
2013-06-10 21:26 ` [PATCH 3/4] power: tps65090-charger: Add dt node to power_supply Rhyland Klein
2013-06-10 21:26 ` [PATCH 4/4] arm: tegra: Add power-supplies link between battery and charger Rhyland Klein
2013-06-12 17:44   ` Stephen Warren
2013-06-12 17:46     ` Rhyland Klein
2013-06-12 21:32   ` Stephen Warren

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=20130629012255.GA20924@lizard \
    --to=anton@enomsg.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).