Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752717AbbGWJLo (ORCPT ); Thu, 23 Jul 2015 05:11:44 -0400 Received: from ozlabs.org ([103.22.144.67]:36006 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752465AbbGWJLP (ORCPT ); Thu, 23 Jul 2015 05:11:15 -0400 Message-ID: <1437642672.29271.2.camel@ellerman.id.au> Subject: Re: [PATCH v5 4/7] powerpc/powernv: detect supported nest pmus and its events From: Michael Ellerman To: Madhavan Srinivasan Cc: Daniel Axtens , linux-kernel@vger.kernel.org, Stephane Eranian , Paul Mackerras , Anton Blanchard , Sukadev Bhattiprolu , linuxppc-dev@lists.ozlabs.org, Anshuman Khandual Date: Thu, 23 Jul 2015 19:11:12 +1000 In-Reply-To: <55B083A2.4030404@linux.vnet.ibm.com> References: <1437045206-7491-1-git-send-email-maddy@linux.vnet.ibm.com> <1437045206-7491-5-git-send-email-maddy@linux.vnet.ibm.com> <1437538064.30906.20.camel@axtens.net> <55B083A2.4030404@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1410 Lines: 34 On Thu, 2015-07-23 at 11:33 +0530, Madhavan Srinivasan wrote: > > On Wednesday 22 July 2015 09:37 AM, Daniel Axtens wrote: > > > >> static struct perchip_nest_info p8_nest_perchip_info[P8_NEST_MAX_CHIPS]; > >> +static struct nest_pmu *per_nest_pmu_arr[P8_NEST_MAX_PMUS]; > >> + > >> +static int nest_event_info(struct property *pp, char *name, > >> + struct nest_ima_events *p8_events, int string, u32 val) > > 'int string' is a bit confusing. 'bool is_string' might be clearer, but > > I think it would be even better still to have different functions for > > string and non-string cases, especially because you only need val in the > > non-string case. > > I would perfer to be a single function, since most of the code is same > just of the sting or val part. yes. We can make is as is_string and will > add comment explaining what is done here? I think Daniel's right, it would be better as two functions. The only part that is common after the if (string) check is the p8_events->ev_value = buf assignment. So you should be able to keep all the code up to the if (string) check in a shared function and just have two wrappers that use it. cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/