From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dong Aisheng Subject: Re: [PATCH v4 1/7] mfd: add syscon driver based on regmap Date: Mon, 3 Sep 2012 16:02:00 +0800 Message-ID: <20120903080159.GA1740@shlinux2.ap.freescale.net> References: <1346237818-9498-1-git-send-email-b29396@freescale.com> <1346237818-9498-2-git-send-email-b29396@freescale.com> <20120831012626.GA7726@r65073-Latitude-D630> <20120903023102.GA11891@shlinux2.ap.freescale.net> <20120903030858.GF2362@S2101-09.ap.freescale.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20120903030858.GF2362-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: Shawn Guo Cc: Zhao Richard-B20223 , "linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org" , "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" , "s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org" , "broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org" , "kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org" , "lrg-l0cyMroinI0@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org" List-Id: devicetree@vger.kernel.org On Mon, Sep 03, 2012 at 11:09:01AM +0800, Shawn Guo wrote: > On Mon, Sep 03, 2012 at 10:31:03AM +0800, Dong Aisheng wrote: > > > > > > I think of_node_put should be moved out from here and put into > > > syscon_node_to_regmap and syscon_regmap_lookup_by_compatible. > > > > > I guess no, if you want to move of_node_put into syscon_regmap_lookup_by_phandle, > > then syscon_regmap_lookup_by_phandle has the same issue. > > I guess not. syscon_regmap_lookup_by_phandle itself calls of_parse_phandle, > and that's where the refcount gets incremented, so syscon_regmap_lookup_by_phandle > should be responsible for calling of_node_put to get the refcount decremented. > Yes, the of_node_put will be done in syscon_node_to_regmap which is called by syscon_regmap_lookup_by_phandle, The reason why we do it is as i said in my last reply. I think one known issue is that syscon_node_to_regmap may not be suitable to be used by the driver who still wants to use the regmap node after calling the syscon_node_to_regmap. I still do not find such using case but i'm not sure whether it may exist. Probably the safe way currently to do is just as you said: Not put the node in syscon_node_to_regmap and let user decide. Ok, i will update it. Regards Dong Aisheng