From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752723AbbCWOtA (ORCPT ); Mon, 23 Mar 2015 10:49:00 -0400 Received: from mail-we0-f175.google.com ([74.125.82.175]:36452 "EHLO mail-we0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752167AbbCWOs6 (ORCPT ); Mon, 23 Mar 2015 10:48:58 -0400 Date: Mon, 23 Mar 2015 14:48:51 +0000 From: Lee Jones To: Charles Keepax Cc: broonie@kernel.org, sameo@linux.intel.com, lgirdwood@gmail.com, patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/4] mfd: arizona: Factor out SYSCLK enable from wm5102 hardware patch Message-ID: <20150323144851.GL24804@x1> References: <1426608672-4895-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> <20150323135213.GH24804@x1> <20150323143644.GH23705@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150323143644.GH23705@opensource.wolfsonmicro.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Mar 2015, Charles Keepax wrote: > On Mon, Mar 23, 2015 at 01:52:13PM +0000, Lee Jones wrote: > > On Tue, 17 Mar 2015, Charles Keepax wrote: > > > > > wm5102 applies a custom hardware boot sequence, for this the SYSCLK > > > needs to be enabled. This patch factors out the code that enables > > > SYSCLK for this sequence such that it can be used for other boot time > > > operations that require SYSCLK. > > > > > > Signed-off-by: Charles Keepax > > > --- > > > > + > > > +static inline int arizona_apply_hardware_patch(struct arizona *arizona) > > > +{ > > > + return arizona_exec_with_sysclk(arizona, arizona_hardware_patch_wseq); > > > > Not sure I like this much. > > > > What's the reason for over-complicating this? Can you just: > > > > arizona_exec_with_sysclk(arizona); > > arizona_hardware_patch_wseq(arizona); > > > > ... or if you need that call to be in the middle, split the calls up > > further. > > > > Yeah, it was just a handy way to store the state and keep the > amount of code down. But I don't really have any problem with > explicitly storing the state if you prefer that. > > So would probably look something like: > > struct sysclk_state; > int ret; > > ret = arizona_force_sysclk(arizona, &sysclk_state); > if (ret) { > //Handle error > } > ret = arizona_hardware_patch_wseq(arizona); > if (ret) { > //Handle error > } > ret = arizona_restore_sysclk(arizona, &sysclk_state); > if (ret) { > //Handle error > } > > I will assume you want it updated to look like this so let me > know if not. Looks much cleaner/less hacky. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog