From patchwork Wed Feb 22 12:55:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 94308 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp876292qgi; Wed, 22 Feb 2017 03:58:12 -0800 (PST) X-Received: by 10.36.227.198 with SMTP id d189mr1449993ith.70.1487764692223; Wed, 22 Feb 2017 03:58:12 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r192si1281442ith.83.2017.02.22.03.58.11; Wed, 22 Feb 2017 03:58:12 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C363860DB8; Wed, 22 Feb 2017 11:58:11 +0000 (UTC) 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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 3B06F60DED; Wed, 22 Feb 2017 11:57:27 +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 6279B60D7B; Wed, 22 Feb 2017 11:57:21 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id 0969C60D7B for ; Wed, 22 Feb 2017 11:57:20 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id z127so131662lfa.2 for ; Wed, 22 Feb 2017 03:57:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8DsWC5dRlZzr+gxZ+hx22Ksx115HAR4IUL2mY27dtHA=; b=JLHqMopNdxItYCSnP7wD16uRbGw03SUWYuYzlA4p9y8yAeA9+BFnJCb35gxqXLhtdf ALFFLOZzc63fXoz1lxmaPaapPQ14u84QYSavN1PQYurbSQHQyFH9IofMa38+w50PtePl 0Q+6v4vZcjva2+haZCTegT6QpSo61mFWUlrOvPTdodA9J9m0Z4kGPKpX/FegTHaMK6GD JHipi1xy83dNltWDtwQDDrR4KDPD+0J3hyoXJLhTHDkkcl/JvTIA+QeNuA0JUaoSzg1S easY6EId5x/Td2M6s1U5+45KMNviyqLSmn/GHCuMW2jRZ9vQPu9Q/dHhUPVpzVjHtKeR VLWA== X-Gm-Message-State: AMke39kcUMmD9dugS/ZeT9b5pNe7oSTSdYfqvstDVaiWrVmqtEscc1UAkJ43eqY9akRKj8qMhEA= X-Received: by 10.46.77.17 with SMTP id a17mr7471907ljb.2.1487764638848; Wed, 22 Feb 2017 03:57:18 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id v21sm7035187ljd.9.2017.02.22.03.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Feb 2017 03:57:18 -0800 (PST) From: Christophe Milard To: mike.holmes@linaro.org, yi.he@linaro.org, forrest.shi@linaro.org, sachin.saxena@linaro.com, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Wed, 22 Feb 2017 13:55:44 +0100 Message-Id: <1487768164-43184-2-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487768164-43184-1-git-send-email-christophe.milard@linaro.org> References: <1487768164-43184-1-git-send-email-christophe.milard@linaro.org> Subject: [lng-odp] [API-NEXT PATCH 01/21] drv: making parameter strings dynamically computable 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Declaring strings as const in the driver API prevents dynamic calculation of these strings, which is a drawback. For instance, the device addresses (string) are typically calculated by enumerators, and should therefore not be const... Other strings may also be the result of a computation. This change is made to allow this. Signed-off-by: Christophe Milard --- include/odp/drv/spec/driver.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h index d83e907..b08d7fb 100644 --- a/include/odp/drv/spec/driver.h +++ b/include/odp/drv/spec/driver.h @@ -170,7 +170,7 @@ struct odpdrv_enumr_class_param_t { /** Enumerator name: mostly used for debug purpose. * Name must be unique (e.g. "PCI-DPAA2") */ - const char name[ODPDRV_NAME_SIZE]; + char name[ODPDRV_NAME_SIZE]; /** Probe function: * Called by ODP to get the enumerator class instances registered @@ -198,7 +198,7 @@ struct odpdrv_enumr_param_t { * The format of the enum_dev part for the odpdrv_device_param_t * structure is identified by the api-name and version below */ - const char api_name[ODPDRV_NAME_SIZE]; + char api_name[ODPDRV_NAME_SIZE]; uint32_t api_version; /**<< the version of the provided API */ /** Probe function: @@ -240,7 +240,7 @@ struct odpdrv_device_param_t { * e.g. "0000.23.12.1" for PCI domain 0, bus 23, device 12, function 1. * This string identifies the device uniquely. */ - const char address[ODPDRV_NAME_ADDR_SZ]; + char address[ODPDRV_NAME_ADDR_SZ]; /** Enumerator dependent part * This part is allocated by the enumerator and is enumerator dependent @@ -260,13 +260,13 @@ struct odpdrv_devio_param_t { * with same provided interface should refer to a common enumerator * class) */ - const char api_name[ODPDRV_NAME_SIZE]; + char api_name[ODPDRV_NAME_SIZE]; uint32_t api_version; /**<< the version of the provided API */ /** Enumerator interface name and version * The enumerator interface this devio needs. */ - const char enumr_api_name[ODPDRV_NAME_SIZE]; + char enumr_api_name[ODPDRV_NAME_SIZE]; uint32_t enumr_api_version; /**<< required enumerator API version */ /** Ops @@ -283,14 +283,14 @@ struct odpdrv_driver_param_t { * The driver name (the pair {driver-name, enum-api-name} must * be unique) */ - const char name[ODPDRV_NAME_SIZE]; + char name[ODPDRV_NAME_SIZE]; /** Supported devios: * The list of supported devio: one of the following devio * (with correct version) must be available for the driver to work: */ struct { - const char api_name[ODPDRV_NAME_SIZE]; /**<< devio API name */ + char api_name[ODPDRV_NAME_SIZE]; /**<< devio API name */ uint32_t api_version; /**<< devio API version */ } devios[ODPDRV_MAX_DEVIOS];