From patchwork Wed Jan 20 09:20:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 60016 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3067070lbb; Wed, 20 Jan 2016 01:37:17 -0800 (PST) X-Received: by 10.55.73.199 with SMTP id w190mr43248014qka.77.1453282637161; Wed, 20 Jan 2016 01:37:17 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h34si32334015qgf.80.2016.01.20.01.37.16; Wed, 20 Jan 2016 01:37:17 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 501BE611FF; Wed, 20 Jan 2016 09:37:16 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=kgl4S/1s; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id ADBF96178A; Wed, 20 Jan 2016 09:36:07 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 47B2F611FF; Wed, 20 Jan 2016 09:36:00 +0000 (UTC) Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by lists.linaro.org (Postfix) with ESMTPS id 2A0DC610D5 for ; Wed, 20 Jan 2016 09:35:25 +0000 (UTC) Received: by mail-pf0-f171.google.com with SMTP id 65so1993467pff.2 for ; Wed, 20 Jan 2016 01:35:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zYSUol8XF/8uerhWmwQHTbGBtIwugSDpiQDPV4j6pGU=; b=kgl4S/1s4wr9umrNo0WCzRnXVFpWhiD6Y4F7PIvpqvWpwyOyuHTC6Lbz323VMQHcJH Xga6dkGsNdn147cKxqi8vKMI7o++PBdQDWm4k5wb+kmu74oQJLy8eKIoqvrGN4Cd+NWK cgJ3iSOX6ks7blbuvJz72ZBc3Twq5m8dj2pfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zYSUol8XF/8uerhWmwQHTbGBtIwugSDpiQDPV4j6pGU=; b=i4qLxEMcKDXOwqLeMVXDKnSRBMVJp08RizRbj7Ob2S0L8Ou+vHu0vI2PQoCecF5DnY a9NmRZvivF93ApeZEeFr6u2LmdrB8QwjhH1zF01Q4kvP5ksQ4O7GSuZQLyr1HbV6ey16 ZNKSH9XdlQkAiniygbDvNTApg1Z1mYTp7kInbPtcKgPzhgHMLE2xIuFgsE8T3vta3Bmr +oemU4et6Yx0cTT6pyQvPtOuR6RJNV6OQOBkzcGAwLgfdn2O3FaFqxqB5yBqmlTTcCJd NqN4Z8qCr/jxElLWHTKvuldZ6WF+UcD2BFv5vIXiaXT6br6OgKsGvRlVd1nJTjGVwYNp hk8Q== X-Gm-Message-State: ALoCoQm76jud4tdwunQ9vyoT1w8NMXcfLYM/MQsbysVfyDkFZCyHDTYzwRd5lbPO7KOXBdKeJWxTfEdMh13555t3NMjAlHaA8A== X-Received: by 10.98.72.135 with SMTP id q7mr50814876pfi.151.1453282524445; Wed, 20 Jan 2016 01:35:24 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id xz6sm47592797pab.42.2016.01.20.01.35.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jan 2016 01:35:23 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Wed, 20 Jan 2016 17:20:52 +0800 Message-Id: <1453281662-31499-3-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453281662-31499-1-git-send-email-hongbo.zhang@linaro.org> References: <1453281662-31499-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v7 API-NEXT 02/12] linux-generic: sysinfo: use uniform call odp_sysinfo_parser X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Hongbo Zhang It is common way that the general top layer calls a uniform interface to initialize data structrure for different plarform, this patch introduces odp_sysinfo_parser() instead of using different interfaces for each platform, and also removes using structure odp_compiler_info_t since both members inside it become useless now. This is still another pre-step for separating platform specific codes into their own arch files. Signed-off-by: Hongbo Zhang --- platform/linux-generic/odp_system_info.c | 36 ++++++-------------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index f965023..b019f11 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -24,12 +24,6 @@ #include - -typedef struct { - int (*cpuinfo_parser)(FILE *file, odp_system_info_t *sysinfo); - -} odp_compiler_info_t; - #define CACHE_LNSZ_FILE \ "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size" @@ -116,7 +110,7 @@ static int huge_page_size(void) */ #if defined __x86_64__ || defined __i386__ -static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) +static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) { char str[1024]; char *pos; @@ -180,8 +174,8 @@ static uint64_t arch_cpu_hz_current(int id) #elif defined __arm__ || defined __aarch64__ -static int cpuinfo_arm(FILE *file ODP_UNUSED, -odp_system_info_t *sysinfo ODP_UNUSED) +static int odp_cpuinfo_parser(FILE *file ODP_UNUSED, + odp_system_info_t *sysinfo ODP_UNUSED) { return 0; } @@ -193,7 +187,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED) #elif defined __OCTEON__ -static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) +static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) { char str[1024]; char *pos; @@ -239,7 +233,7 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED) } #elif defined __powerpc__ -static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) +static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) { char str[1024]; char *pos; @@ -288,24 +282,6 @@ static uint64_t arch_cpu_hz_current(int id ODP_UNUSED) #error GCC target not found #endif -static odp_compiler_info_t compiler_info = { - #if defined __x86_64__ || defined __i386__ - .cpuinfo_parser = cpuinfo_x86 - - #elif defined __arm__ || defined __aarch64__ - .cpuinfo_parser = cpuinfo_arm - - #elif defined __OCTEON__ - .cpuinfo_parser = cpuinfo_octeon - - #elif defined __powerpc__ - .cpuinfo_parser = cpuinfo_powerpc - - #else - #error GCC target not found - #endif -}; - #if defined __x86_64__ || defined __i386__ || defined __OCTEON__ || \ defined __powerpc__ @@ -397,7 +373,7 @@ int odp_system_info_init(void) return -1; } - compiler_info.cpuinfo_parser(file, &odp_global_data.system_info); + odp_cpuinfo_parser(file, &odp_global_data.system_info); fclose(file);