From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74E71A0487 for ; Wed, 3 Jul 2019 17:37:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5056A25D9; Wed, 3 Jul 2019 17:37:26 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id AFE8DF04 for ; Wed, 3 Jul 2019 17:37:25 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id o13so1425716pgp.12 for ; Wed, 03 Jul 2019 08:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o1lCAfzfjiTjjQ2/+LzUw4tBiPu1BcsUrtx6g+rDmTw=; b=ZSDtVVjvBjcR3kIh2CtMDtZzwv/D4aCGLvR/DU4BvN8I3PJtIQ4OUUSDh1ZJwJ/oVt FasYHoPJJPrdFeumuYNplQP/gObOj6TpfmM4+mF3Jo2c+wTN03vjhEQ52b+TecM1WJ3S dJtsIwRP8HKA/G5D4DfLfKKP61VaiQpel2Vq7taMKjxR0/agEHtl5VEWYK58Riaky7j5 Rtk4yCB7c/71CUcn8IrTlFeMREcBCmvFMgAV0V+7zclr0a8RBacUiKLXU/vsO/DHnFX5 Q8LzEMoaXskHO4cLxpkEoJsFXKagY284/kcb9tZcc5bhKiAs0waMG4VPWKWo6PQzzxtN 3b2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o1lCAfzfjiTjjQ2/+LzUw4tBiPu1BcsUrtx6g+rDmTw=; b=cU5tdneMoEWGK5d9xMSRMtieiEXm9kuWzzlpcUbOyY4PW40qmz4KHDtUl5NJWp1G7I O/PKjuRTd5EgZYsOAAZTMeJ/UHoDBe+dn+ClwFadZ1tb4o5PnP0etgeLlGKpZyHu2cJS VxD/aMhWp6La6nnZKUfXLx25fI3arMA/H3c8yPomSZj6RW3ehImiP3nU8LwKwisDT35r tNcGEWD1D+XB4PMi1xjuMlKeuj2zzI3UAClqqSG4QzwkBy6uWQNqeeWLbRZ+93ZsuKQM LpyXfJYYlLLw+FTME8I14WAQHOVhvB5Hp6gMSkqwZg2fwYwkxEXhnENO9TdMw76GELi6 cEHg== X-Gm-Message-State: APjAAAVpEL501WYXSPRbO1acROWo3dQqqGR5SKJFWoWSJu/kG7MXDBjj TihiTBF+7DYgmnnD1ooJxZQ= X-Google-Smtp-Source: APXvYqzld9RlgOzHtJ1wbESkvgl4RLSi2fuNthMfsX0vC8fprm3N0DqBGsbKLmkM8xbAAz9pMFbFkw== X-Received: by 2002:a17:90a:2768:: with SMTP id o95mr13461592pje.37.1562168244818; Wed, 03 Jul 2019 08:37:24 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t29sm5247297pfq.156.2019.07.03.08.37.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 08:37:24 -0700 (PDT) Date: Wed, 3 Jul 2019 08:37:17 -0700 From: Stephen Hemminger To: Ziyang Xuan Cc: , , , , Message-ID: <20190703083717.6c5a7eae@hermes.lan> In-Reply-To: <1562168142-219415-1-git-send-email-xuanziyang2@huawei.com> References: <1562168142-219415-1-git-send-email-xuanziyang2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1 1/1] net/hinic: use mutex replace spin lock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 3 Jul 2019 23:35:42 +0800 Ziyang Xuan wrote: > > +static inline int hinic_mutex_init(pthread_mutex_t *pthreadmutex, > + const pthread_mutexattr_t *mattr) > +{ > + int err; > + > + err = pthread_mutex_init(pthreadmutex, mattr); > + if (unlikely(err)) > + PMD_DRV_LOG(ERR, "Fail to initialize mutex, error: %d", err); > + > + return err; > +} > + > +static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex) > +{ > + int err; > + > + err = pthread_mutex_destroy(pthreadmutex); > + if (unlikely(err)) > + PMD_DRV_LOG(ERR, "Fail to destroy mutex, error: %d", err); > + > + return err; > +} > + I don't think the wrapper functions add much. pthread_mutex_init just sets internals of data structure and won't fail ever if mutexattr_t is NULL. Just use pthread_mutex_init/pthread_mutex_destroy directly and ignore errors.