From patchwork Mon Jan 18 10:09:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 59912 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1910910lbb; Mon, 18 Jan 2016 02:22:02 -0800 (PST) X-Received: by 10.140.93.166 with SMTP id d35mr29714745qge.29.1453112522059; Mon, 18 Jan 2016 02:22:02 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 141si30224243qhk.31.2016.01.18.02.22.01; Mon, 18 Jan 2016 02:22:02 -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 951796171F; Mon, 18 Jan 2016 10:22:01 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=QnzX3Aqe; 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_H3, RCVD_IN_MSPIKE_WL, 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 19B516171A; Mon, 18 Jan 2016 10:20:20 +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 7551361628; Mon, 18 Jan 2016 10:20:14 +0000 (UTC) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by lists.linaro.org (Postfix) with ESMTPS id B096E61628 for ; Mon, 18 Jan 2016 10:20:08 +0000 (UTC) Received: by mail-pa0-f52.google.com with SMTP id uo6so417833274pac.1 for ; Mon, 18 Jan 2016 02:20:08 -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=NG43jjUpW/Rtsdz6utOny0flNVKYhv44tx245L+u6+U=; b=QnzX3AqeTQx7Dhm9Rghd0uuufmrISAZ6WLAvpo9prCQHGyvuZYLf2hjxbfbWM88iua r+Ytje2/+XcWjiPSVvt9YTLyYOcR2Z6TLua/8TetGXwyY1+7OZkCDbMxwMPiK106+1rf /PPQ3he9pY+xWvW/NDoPCdjrEFR/6SEL4I/Qo= 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=NG43jjUpW/Rtsdz6utOny0flNVKYhv44tx245L+u6+U=; b=PAOQslfERGOMmgOX353A1pVEiKAFxmqvYWcptQw+Vg7jUulYd2tm3xmxb6869ffQTC 0/c/jOBP9y6lgNLj1O5SXoimcFyoP1kp+BpnSa4SOeCUV05Hbr97/vyleW9ovx4GY1Xa 40JunGrdR30lX2PEeeh4L6jBh6uOhq+/zarZTeDVqjKEdXj4pHEGFD4JjZrvNyDUULSb eJBikX6LmRHMYbDsztneV/dS5KCLX69hdL10lFnjlNtXiAfHiP3M74r/qY0DHFbVSoF5 Fza/pZY39YTVIE8ZI7UvUcP4Cl2oV3HrhF2fCeu+ePL2ohgGABI+CqXLo3VoZQA8tS2+ 6zGg== X-Gm-Message-State: ALoCoQlFihHga5i7WlLDKuHzWOPBLYFSbIWYnNaAhmNzUbWubsVBqBYqj/Y5lExK5hd9SmD6Q8MB2dCgj61MwP9D4yujEbJKqw== X-Received: by 10.66.140.14 with SMTP id rc14mr35392416pab.65.1453112408051; Mon, 18 Jan 2016 02:20:08 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id x10sm32844521pas.37.2016.01.18.02.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jan 2016 02:20:07 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Mon, 18 Jan 2016 18:09:58 +0800 Message-Id: <1453111808-15762-3-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453111808-15762-1-git-send-email-hongbo.zhang@linaro.org> References: <1453111808-15762-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v5 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 | 34 +++++--------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 8cbdd58..a829b01 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,7 +174,7 @@ static uint64_t arch_cpu_hz_current(int id) #elif defined __arm__ || defined __aarch64__ -static int cpuinfo_arm(FILE *file 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);