Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp693442yba; Fri, 26 Apr 2019 07:16:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7H93+nOn0GNYJXKRdzqpm9Agl5nMkmoVHykHilGNROYxm3uc7KlzCmVwDQFOGh0cBGNCn X-Received: by 2002:a62:1c87:: with SMTP id c129mr22469869pfc.113.1556288182684; Fri, 26 Apr 2019 07:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556288182; cv=none; d=google.com; s=arc-20160816; b=PzrO4IJ59f2gTgyecWVedmT6SAjCm6YLToPk4o3OKIOlU23ymyVLcXwvwPRKQT943N w3FyXtLPibwXlZ2gmG6+jtQkv1P/SiI6VWwfeRI/OJQoJY7j4raGXqk7eM41UCBkLRka rILm7UC9vxwS/M1hGAC0cmhbIxVne11Jlsd/lWx+9CBPa8Y5pxLXvyHMgsNihJ+elh6Q +n/PI4wN4wady3obeelcj+XU2ngPrvnQsd246CVZImwJcxO/1nhhmthjUECEfBopyc09 dfNeP4NEDZXJg/DJ3h2Dk1FZXMWBKrEKc5RB4EHOvNCurW47bQ5TCFG8gGFTpgUVg+lD WNjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yW5kv3I/idzumD0kD5brzMhB82n0REr+cs1o/i56S3M=; b=VrTVs/9ImUddHkNWbyq7F1c42tZG5F8hkbhLS9uBZg8Eb0O859vRkIyMRSC+KtubCf VeuTCQKRbKuim4w+nxCyzXnS5bJqZe3OabTXUiyUO2dAb8XVyiWujwlVUXjlq/lk2ZQY swNMRM0Gk8ihd8GQNe7cCzH9oo06FGYVemLNvVtI9YAe3/MicMmGgolhqfbwvyap2oHv ao1I95ry+u9l1Rq+OnNaSQtczx98lH1kRFD5X5mS/MrcnbT+5Oif4qf8AKfE6kdNmGlX Aecade7VzwF6FM6Mhq8EgylxkHCAp2Bpr2nMSBuLvN5yXiBuJ/qeZChqBBV8so8VHF9y UpVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=Fx5NJNjg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10si23990465pga.205.2019.04.26.07.16.07; Fri, 26 Apr 2019 07:16:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=Fx5NJNjg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbfDZOPQ (ORCPT + 99 others); Fri, 26 Apr 2019 10:15:16 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:45522 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbfDZOPP (ORCPT ); Fri, 26 Apr 2019 10:15:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yW5kv3I/idzumD0kD5brzMhB82n0REr+cs1o/i56S3M=; b=Fx5NJNjgKn5RAaQIvKMBSvlHlY FmxKMBq5k76zpXXlIJMsJUKAWDxSFGcFVZRIJYkL0aEeY7LEe5oxIhxe6DqFZ5nozTJXRXYeafnZV eiAY9TOXXOA7jev/MMeXzzsloeiJm19Zn9q9VKOC4RBAUdP+1lRwixCLlJCHNERbsWaU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hK1cx-0001CF-0p; Fri, 26 Apr 2019 16:14:59 +0200 Date: Fri, 26 Apr 2019 16:14:58 +0200 From: Andrew Lunn To: Esben Haabendal Cc: netdev@vger.kernel.org, "David S. Miller" , Michal Simek , YueHaibing , Yang Wei , Luis Chamberlain , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/12] net: ll_temac: Support indirect_mutex share within TEMAC IP Message-ID: <20190426141458.GH14432@lunn.ch> References: <20190426073231.4008-1-esben@geanix.com> <20190426073231.4008-8-esben@geanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190426073231.4008-8-esben@geanix.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 09:32:26AM +0200, Esben Haabendal wrote: > @@ -1092,7 +1092,15 @@ static int temac_probe(struct platform_device *pdev) > lp->dev = &pdev->dev; > lp->options = XTE_OPTION_DEFAULTS; > spin_lock_init(&lp->rx_lock); > - mutex_init(&lp->indirect_mutex); > + > + /* Setup mutex for synchronization of indirect register access */ > + if (pdata && pdata->indirect_mutex) { > + lp->indirect_mutex = pdata->indirect_mutex; > + } else { > + lp->indirect_mutex = devm_kmalloc( > + &pdev->dev, sizeof(*lp->indirect_mutex), GFP_KERNEL); > + mutex_init(lp->indirect_mutex); > + } Hi Esben I would make the mutex mandatory, not optional. I think there will be less hard to debug errors that way. You want the developer to actually think about this mutex, should it be shared, or individual. Forcing them to provide it means they are more likely to read the documentation, and more likely to over share it than under share it. That is maybe not so good for performance, but safer. Andrew