From patchwork Sat Jun 29 01:22:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 255702 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D6C802C009A for ; Sat, 29 Jun 2013 11:27:56 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Usjx1-0001j8-DQ; Sat, 29 Jun 2013 01:27:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Usjwy-0002b1-Sw; Sat, 29 Jun 2013 01:27:40 +0000 Received: from mail-pb0-f52.google.com ([209.85.160.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Usjwx-0002aX-7X for linux-arm-kernel@lists.infradead.org; Sat, 29 Jun 2013 01:27:39 +0000 Received: by mail-pb0-f52.google.com with SMTP id xa12so2848575pbc.25 for ; Fri, 28 Jun 2013 18:27:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent:x-gm-message-state; bh=W8qtpvK7dCjdmHZcNJOntpeoliuY03wp1vSlXz5GMXU=; b=QdP+LIsO8yfFIgV/Pw8uV5NiZLU33wWPIF55OGNvOwbPQffICoxfg2jQIfNhLgXYpf gDpsVeSAbLAp9Pzzx1kDPn4L9akL4+jWYKC2iSdazXfTi1W0wHFkALFWVUj0mYz3upAD SveTVYSchs+ZFaJapEGkiqLmRT35kRfj7IFK2dzV8wukdyRK4T3+ID7sXSpU2WHcFEEZ DhPV7I3hoHdUuUA6Dk/DXdEIOLPuH217JJHyjLG1RzhZUAu8vldVoEUtDwnBBTPjztdX iJFbxo+LORGIE5T7XnJ4iae/ssO7oH4n4yGiB35gAvvVAEamPBA3aWanLRmEVw+JQFC/ pR2A== X-Received: by 10.66.159.195 with SMTP id xe3mr13816146pab.49.1372469237424; Fri, 28 Jun 2013 18:27:17 -0700 (PDT) Received: from localhost (ip-64-134-225-216.public.wayport.net. [64.134.225.216]) by mx.google.com with ESMTPSA id oy10sm11382143pac.9.2013.06.28.18.27.15 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Jun 2013 18:27:16 -0700 (PDT) Date: Fri, 28 Jun 2013 18:22:55 -0700 From: Anton Vorontsov To: Rhyland Klein Subject: Re: [PATCH 1/4] power_supply: Add of_node_put to fix refcount Message-ID: <20130629012255.GA20924@lizard> References: <1370899602-22123-1-git-send-email-rklein@nvidia.com> <1370899602-22123-2-git-send-email-rklein@nvidia.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1370899602-22123-2-git-send-email-rklein@nvidia.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnFollQ4VSqhdSnOvqdyM9s8Gpi3I20Z00haS8tuwdhOTURJB0uyNMlnpUN5OgGm9bLumlD X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130628_212739_363008_641391F3 X-CRM114-Status: GOOD ( 13.37 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.52 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stephen Warren X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 > --- 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 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 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,