From patchwork Sun Feb 24 13:06:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noa Osherovich X-Patchwork-Id: 10827937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED27213B5 for ; Sun, 24 Feb 2019 13:08:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD1A02846C for ; Sun, 24 Feb 2019 13:08:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D21192B4AD; Sun, 24 Feb 2019 13:08:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F8552B4A6 for ; Sun, 24 Feb 2019 13:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727594AbfBXNIt (ORCPT ); Sun, 24 Feb 2019 08:08:49 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:50455 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728059AbfBXNIt (ORCPT ); Sun, 24 Feb 2019 08:08:49 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from noaos@mellanox.com) with ESMTPS (AES256-SHA encrypted); 24 Feb 2019 15:06:48 +0200 Received: from reg-l-vrt-059-009.mtl.labs.mlnx (reg-l-vrt-059-009.mtl.labs.mlnx [10.135.59.9]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x1OD6mfW026210; Sun, 24 Feb 2019 15:06:48 +0200 From: Noa Osherovich To: leonro@mellanox.com, jgg@mellanox.com, dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Noa Osherovich Subject: [PATCH rdma-core 02/19] pyverbs: Unify close functions Date: Sun, 24 Feb 2019 15:06:21 +0200 Message-Id: <20190224130638.31848-3-noaos@mellanox.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190224130638.31848-1-noaos@mellanox.com> References: <20190224130638.31848-1-noaos@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of a declaring both cdef and def function, use a single cpdef close(). The main drawback of such an apporoach is a potential performance degradation, but it will be visible only during objects teardown, which don't have performance constraints anyway. Signed-off-by: Noa Osherovich --- pyverbs/device.pxd | 2 +- pyverbs/device.pyx | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/pyverbs/device.pxd b/pyverbs/device.pxd index 31d243a80dd5..7a6489da11bf 100644 --- a/pyverbs/device.pxd +++ b/pyverbs/device.pxd @@ -8,7 +8,7 @@ cimport pyverbs.libibverbs as v cdef class Context(PyverbsObject): cdef v.ibv_context *context cdef object name - cdef _close(self) + cpdef close(self) cdef class DeviceAttr(PyverbsObject): cdef v.ibv_device_attr dev_attr diff --git a/pyverbs/device.pyx b/pyverbs/device.pyx index 3fad6af41ecc..cb3baed38afa 100644 --- a/pyverbs/device.pyx +++ b/pyverbs/device.pyx @@ -102,16 +102,9 @@ cdef class Context(PyverbsObject): Closes the inner IB device. :return: None """ - self._close() + self.close() - def close(self): - """ - Closes the inner IB device. - :return: None - """ - self._close() - - cdef _close(self): + cpdef close(self): self.logger.debug('Closing Context') if self.context != NULL: rc = v.ibv_close_device(self.context)