From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06602C43219 for ; Fri, 26 Apr 2019 14:15:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCF44206C1 for ; Fri, 26 Apr 2019 14:15:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BuDEqw/A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Fx5NJNjg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCF44206C1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XmYXZqvcPnusmQytX1R6hNI8H+RIatQmavu0jgKv//Y=; b=BuDEqw/Ady5kWz 4VYfnR49qfvywIyU6PxAMbp+myw3MIKKa00X8zgfWrrpT8y8SQfdy8wZfcGxG1QUr5j1lvROT7kaB ELYoVnXM0KiqFcOa1Z0vei5Q+x2U/payPTa2kCTm8Lim4Ih7t4UsjPKRZg97fvhQMBK2RnNhMwNc8 7kpQKNkE+JBazbMZFlEK4RoQ4Upk52KbflRYl/njXn3RXJ3lODE/GkayXpFGI9h5H1dAFv7ozvsF9 +EaMUhP1/DV+N2KhU2At+0umkHa0tr5uPTKX64rJ8EAYRIKRopOOwffmtw8oF+gtHzr3X+M4Ujqw7 len0+wCOtL+ymOMQ5WZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hK1dE-0004uy-DU; Fri, 26 Apr 2019 14:15:16 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hK1dB-0004uI-5x for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2019 14:15:14 +0000 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 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-Disposition: inline In-Reply-To: <20190426073231.4008-8-esben@geanix.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190426_071513_376698_6FE2E05C X-CRM114-Status: GOOD ( 11.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, YueHaibing , Michal Simek , linux-kernel@vger.kernel.org, Yang Wei , Luis Chamberlain , "David S. Miller" , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel