From patchwork Wed Mar 22 14:48:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 95733 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp227432obz; Wed, 22 Mar 2017 06:57:51 -0700 (PDT) X-Received: by 10.55.161.13 with SMTP id k13mr40106307qke.265.1490191071772; Wed, 22 Mar 2017 06:57:51 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b62si1130732qkb.312.2017.03.22.06.57.51; Wed, 22 Mar 2017 06:57:51 -0700 (PDT) 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 57671642BF; Wed, 22 Mar 2017 13:57:51 +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 96B7D642C3; Wed, 22 Mar 2017 13:50:17 +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 C6A4A642BD; Wed, 22 Mar 2017 13:50:09 +0000 (UTC) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by lists.linaro.org (Postfix) with ESMTPS id 704D1642B1 for ; Wed, 22 Mar 2017 13:49:23 +0000 (UTC) Received: by mail-wm0-f43.google.com with SMTP id u132so37320494wmg.0 for ; Wed, 22 Mar 2017 06:49:23 -0700 (PDT) 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=sBmR9G8Mrg460MDOAvY2r+3/Ru4VE8dPsAd3NCdso5U=; b=VzC1bSYTAWKg3GL0s2OC/+VXs+tLltEl7hjX56vScLIg+5qW6CutT86jsMHNUizhce 8rqMNMP8Fk0vdqftz54VqgPtc6su3V1jTkgiuhCjWBHBtSXtsdoDQ4Kb+iv3tOReCPYF sg+ah7DuKm9asN8DAxSA7dZvEioWS3S4QFjjFi/VR8tp7qPIHjagDA1NvWC0TusZBr8Y 2fgp1bRtpbnjl5abM2Mb4UDqUfrcRDOfTZqZFMSx7VNL/74y371/xQQ/ZzENZUCZVRRT TAwF6/NNgKf835X29Rey+QakUAwcxS2mggj5KmfYuIVgAhFgJ3Fwk6jrVhi6AASkQy6r psEw== X-Gm-Message-State: AFeK/H0ljvv3MhcMLol7PsDSe7ft1iIBHFG7BQpy2RCop2++CpnfTCIolCmollwdMHt8aBI2vtKGtNTc X-Received: by 10.25.19.90 with SMTP id j87mr11464159lfi.182.1490190562319; Wed, 22 Mar 2017 06:49:22 -0700 (PDT) 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 l23sm522305lfk.27.2017.03.22.06.49.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Mar 2017 06:49:21 -0700 (PDT) From: Christophe Milard To: yi.he@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Wed, 22 Mar 2017 15:48:15 +0100 Message-Id: <1490194110-40168-9-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490194110-40168-1-git-send-email-christophe.milard@linaro.org> References: <1490194110-40168-1-git-send-email-christophe.milard@linaro.org> Subject: [lng-odp] [API-NEXT PATCHv2 08/23] drv: driver: change drv unbind function name and pass correct parameter 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" The driver removal function expects a device, of course... Also unbind seems a better name to disconnect from a device since remove has been used for removing the object itself for enumerators. Some extra parameters to allow for graceful unbinding are also added. Signed-off-by: Christophe Milard --- include/odp/drv/spec/driver.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h index b08d7fb..8ff856c 100644 --- a/include/odp/drv/spec/driver.h +++ b/include/odp/drv/spec/driver.h @@ -300,14 +300,29 @@ struct odpdrv_driver_param_t { */ int (*probe)(odpdrv_device_t *dev); - /** Remove function: + /** unbind function: * Only called with devices whose probe() returned true * + * dev: the device to unbind + * callback: if flag ODPDRV_DRV_UNBIND_IMMEDIATE is not specified, + * unbind should be attempted gracefully, meaning that some IO may need + * to terminate before the driver is really unbound from the device: + * In this case (when the flag is not set), the driver is due to call + * the callback function when the driver is unbound from the device. + * This callback may occurs within the unbind() call if the driver + * does unbind immediately. + * If the ODPDRV_DRV_UNBIND_IMMEDIATE is specified, the driver is due + * to release the device immediately (poosibly less gracefully). + * The callback must be called immediately in this case. */ - int (*remove)(odpdrv_device_param_t *dev); - + int (*unbind)(odpdrv_device_t dev, + void (*callback)(odpdrv_device_t dev), + uint32_t flags); }; +/** The callback function must be called mmediately by the current ODP thread */ +#define ODPDRV_DRV_UNBIND_IMMEDIATE 0x00000001 + /** * Register an enumerator class. * Each enumerator class calls this function at init time.