From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbbCWOgs (ORCPT ); Mon, 23 Mar 2015 10:36:48 -0400 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:45016 "EHLO opensource.wolfsonmicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752106AbbCWOgq (ORCPT ); Mon, 23 Mar 2015 10:36:46 -0400 Date: Mon, 23 Mar 2015 14:36:44 +0000 From: Charles Keepax To: Lee Jones 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: <20150323143644.GH23705@opensource.wolfsonmicro.com> References: <1426608672-4895-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> <20150323135213.GH24804@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150323135213.GH24804@x1> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Charles