From patchwork Wed Sep 2 10:20:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 7110801 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DE311BEEC1 for ; Wed, 2 Sep 2015 10:20:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1231720643 for ; Wed, 2 Sep 2015 10:20:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3FC0A2063C for ; Wed, 2 Sep 2015 10:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753801AbbIBKUV (ORCPT ); Wed, 2 Sep 2015 06:20:21 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:43413 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752829AbbIBKUT (ORCPT ); Wed, 2 Sep 2015 06:20:19 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t82AKHW9025908; Wed, 2 Sep 2015 05:20:17 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t82AKHQl029117; Wed, 2 Sep 2015 05:20:17 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Wed, 2 Sep 2015 05:20:17 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t82AKDIj005007; Wed, 2 Sep 2015 05:20:16 -0500 From: Keerthy To: CC: , Subject: [RFC PATCH 1/4] ARM: OMAP2: DRA7: Modify optimize string comparisons in soc_is calls Date: Wed, 2 Sep 2015 15:50:10 +0530 Message-ID: <1441189213-8199-2-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441189213-8199-1-git-send-email-j-keerthy@ti.com> References: <1441189213-8199-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently everytime soc_is calls are made, firstly device tree nodes are parsed and then string comparisons are made to determine the soc version. Optimizing it to be done one time and store the result. Use the stored value in all the subsequent checks for soc_is calls. Signed-off-by: Keerthy --- arch/arm/mach-omap2/id.c | 18 ++++++++++++++++++ arch/arm/mach-omap2/soc.h | 15 ++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index e3f713f..19289df 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -44,12 +44,29 @@ static char soc_name[OMAP_SOC_MAX_NAME_LENGTH]; static char soc_rev[OMAP_SOC_MAX_NAME_LENGTH]; u32 omap_features; +static int soc_ids[MAX_ID]; + unsigned int omap_rev(void) { return omap_revision; } EXPORT_SYMBOL(omap_rev); +void init_dra_soc_id(void) +{ + if (of_machine_is_compatible("ti,dra7")) + soc_ids[DRA7XX] = 1; + if (of_machine_is_compatible("ti,dra74")) + soc_ids[DRA74X] = 1; + if (of_machine_is_compatible("ti,dra72")) + soc_ids[DRA72X] = 1; +} + +int check_dra_soc(int id) +{ + return soc_ids[id]; +} + int omap_type(void) { static u32 val = OMAP2_DEVICETYPE_MASK; @@ -643,6 +660,7 @@ void __init dra7xxx_check_revision(void) u16 hawkeye; u8 rev; + init_dra_soc_id(); idcode = read_tap_reg(OMAP_TAP_IDCODE); hawkeye = (idcode >> 12) & 0xffff; rev = (idcode >> 28) & 0xff; diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h index f97654d..cd10260 100644 --- a/arch/arm/mach-omap2/soc.h +++ b/arch/arm/mach-omap2/soc.h @@ -38,6 +38,15 @@ #include #include +enum soc_id_flags { + DRA7XX = 0, + DRA74X, + DRA72X, + MAX_ID, +}; + +int check_dra_soc(int id); + /* * Test if multicore OMAP support is needed */ @@ -397,9 +406,9 @@ IS_OMAP_TYPE(3430, 0x3430) #undef soc_is_dra7xx #undef soc_is_dra74x #undef soc_is_dra72x -#define soc_is_dra7xx() (of_machine_is_compatible("ti,dra7")) -#define soc_is_dra74x() (of_machine_is_compatible("ti,dra74")) -#define soc_is_dra72x() (of_machine_is_compatible("ti,dra72")) +#define soc_is_dra7xx() check_dra_soc(DRA7XX) +#define soc_is_dra74x() check_dra_soc(DRA74X) +#define soc_is_dra72x() check_dra_soc(DRA72X) #endif /* Various silicon revisions for omap2 */