From patchwork Wed Jan 27 08:56:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 60597 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2466219lbb; Wed, 27 Jan 2016 01:17:00 -0800 (PST) X-Received: by 10.141.28.149 with SMTP id f143mr34655284qhe.66.1453886220727; Wed, 27 Jan 2016 01:17:00 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h33si5783306qge.30.2016.01.27.01.17.00; Wed, 27 Jan 2016 01:17:00 -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 4DEEE617D7; Wed, 27 Jan 2016 09:17:00 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=jmHq6/oY; 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 A7658617B4; Wed, 27 Jan 2016 09:16:23 +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 A19FA61952; Wed, 27 Jan 2016 09:16:19 +0000 (UTC) Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by lists.linaro.org (Postfix) with ESMTPS id 05A46617B4 for ; Wed, 27 Jan 2016 09:15:46 +0000 (UTC) Received: by mail-pf0-f169.google.com with SMTP id q63so1820794pfb.1 for ; Wed, 27 Jan 2016 01:15:46 -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=BnhH/93xCJLqKLlk5UThi2VqL5AEW/mHHHrHxhRuVqw=; b=jmHq6/oYNnyayQQbJ0JZRyGoMfo1nykpHhscT0VGnuOvOsLkvbRQMxY60tThcb26X8 NT045EcT1sb0qlBwwzXL/+DsTHTamMg7SdkpHJ2oJTL4aeJ6NxZE7Z0w0e1Y/x2msfwt fjVDh+JFEjZLuEGhP+APGVbJN5wFea05LbC70= 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=BnhH/93xCJLqKLlk5UThi2VqL5AEW/mHHHrHxhRuVqw=; b=M+5pv40EsOETQpqKmn81yAq32z8Ux+nzOhd/63x4mBguy7wn2bIJv8E5QMwnvdFfeZ sCdkAeQy9TXzKsXxILaJuZmsHvgjnPJFOBXxzaXgsAiTwaVlGV580SwQxbCQvf1LYhTE 0R0sgCp3g+6eE5ch2us0xpRdKB7c+pdlDwW9iAh0uFT0Q1fDYm/l50PSgOidEhyi74rc LJYKY1lzsW3x5d6ApXPGn5i2TO3s2Ax4DA8ooP+rzOrwyA+R1mocDxfNSz1SXD0uhzQB +Yydv58RnKb65rert0CP6wUxwU0v/qStE2sA5y8cGBWeMU6T3oKltvHa3ZfKVXodH3U0 VaKg== X-Gm-Message-State: AG10YOTOkT3tIVpQeSNFr0ZyY83bkAzLdlLkRrwR2vjltPE+DONTEHNIagmwytKx58MEMnkVQno= X-Received: by 10.98.13.195 with SMTP id 64mr40805880pfn.164.1453886146141; Wed, 27 Jan 2016 01:15:46 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id f27sm7407314pfj.0.2016.01.27.01.15.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jan 2016 01:15:45 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Wed, 27 Jan 2016 16:56:04 +0800 Message-Id: <1453884974-24724-3-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453884974-24724-1-git-send-email-hongbo.zhang@linaro.org> References: <1453884974-24724-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v8 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 2e3726e..113ae63 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -25,12 +25,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" @@ -117,7 +111,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; @@ -181,8 +175,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; } @@ -194,7 +188,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; @@ -240,7 +234,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; @@ -289,24 +283,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__ @@ -398,7 +374,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);