Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751200AbdGOI4n (ORCPT ); Sat, 15 Jul 2017 04:56:43 -0400 Received: from mail-ua0-f180.google.com ([209.85.217.180]:36704 "EHLO mail-ua0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbdGOI4l (ORCPT ); Sat, 15 Jul 2017 04:56:41 -0400 MIME-Version: 1.0 In-Reply-To: <20170607.143844.682492319776197931.davem@davemloft.net> References: <1496758626-2726-1-git-send-email-liu.xiang6@zte.com.cn> <20170607.143844.682492319776197931.davem@davemloft.net> From: xiang fei Date: Sat, 15 Jul 2017 16:56:40 +0800 Message-ID: Subject: Re: [PATCH v2] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine To: David Miller Cc: liu.xiang6@zte.com.cn, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 730 Lines: 19 Hi, In this patch, I don't change the routine of dm9000_phy_write(). I just abstract the real phy operation from dm9000_phy_write() to make a new function dm9000_phy_write_reg(), which contains no lock. It is called in dm9000_phy_write() or dm9000_init_dm9000(). Since dm9000_timeout() holds the main spinlock through the entire routine, dm9000_phy_write_reg() called in this routine is protected from another thread. I think there is no need to acquire any locks. The only problem is dm9000_init_dm9000() may be called in dm9000_open(). If another thread calls dm9000_open() in timeout may cause race condition. dm9000_init_dm9000() needs lock to avoid race condition, did you mean that? Thanks!