From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964982AbcIGJby (ORCPT ); Wed, 7 Sep 2016 05:31:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48194 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753359AbcIGJbw (ORCPT ); Wed, 7 Sep 2016 05:31:52 -0400 Subject: Re: [PATCH] simplefb: Disable and release clocks and regulators in destroy callback To: Chen-Yu Tsai , Jean-Christophe Plagniol-Villard , Tomi Valkeinen References: <20160907090919.27187-1-wens@csie.org> Cc: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Hans de Goede Message-ID: <4c1de4ed-37de-7be6-4836-3f5f714fb8b2@redhat.com> Date: Wed, 7 Sep 2016 11:31:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160907090919.27187-1-wens@csie.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 07 Sep 2016 09:31:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 07-09-16 11:09, Chen-Yu Tsai wrote: > simplefb gets unregister when a proper framebuffer driver comes in and > kicks it out. However the claimed clocks and regulators stay enabled > as they are only released in the platform device remove function, which > in theory would never get called. > > Move the clock/regulator cleanup into the framebuffer destroy callback, > which gets called as part of the framebuffer unregister process. > > Note this introduces asymmetry in how the resources are claimed and > released. > > Signed-off-by: Chen-Yu Tsai Good catch, patch LGTM: Reviewed-by: Hans de Goede Regards, Hans > --- > drivers/video/fbdev/simplefb.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c > index e9cf19977285..3620d10a0d00 100644 > --- a/drivers/video/fbdev/simplefb.c > +++ b/drivers/video/fbdev/simplefb.c > @@ -74,8 +74,14 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, > return 0; > } > > +struct simplefb_par; > +static void simplefb_clocks_destroy(struct simplefb_par *par); > +static void simplefb_regulators_destroy(struct simplefb_par *par); > + > static void simplefb_destroy(struct fb_info *info) > { > + simplefb_regulators_destroy(info->par); > + simplefb_clocks_destroy(info->par); > if (info->screen_base) > iounmap(info->screen_base); > } > @@ -487,11 +493,8 @@ error_fb_release: > static int simplefb_remove(struct platform_device *pdev) > { > struct fb_info *info = platform_get_drvdata(pdev); > - struct simplefb_par *par = info->par; > > unregister_framebuffer(info); > - simplefb_regulators_destroy(par); > - simplefb_clocks_destroy(par); > framebuffer_release(info); > > return 0; >