Received: by 10.192.165.156 with SMTP id m28csp312396imm; Tue, 10 Apr 2018 22:33:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49wfLZh9wy4oksqL2JNWGjuJuI6VIvw3ZUo6WC+64fONlPL7n1/m5pngpdIwbCxR8X2qEdf X-Received: by 10.101.74.6 with SMTP id s6mr2387609pgq.79.1523424822627; Tue, 10 Apr 2018 22:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523424822; cv=none; d=google.com; s=arc-20160816; b=UVj1c/8Orwgwm4JkvhXgxxNxORnt7144eIsPvx6B4PHkMlqItNh+7uSbWrZNJM4EQw 75b3p+TkXzG6QMpJ5wnQaQkQbiwn82znzSuYiWmTeZEDOwJMHr5p/B/qyCK+LyG/7jWx JfQbVw9w7VoGMYW45rFEncPpWfYhE6AbjJUI2LQ4p95uBtmYqBYMvkc+J4tjUBF/kZGH UUv/0Y1R7ckTjsskQk7r0OV3lvbDT3cPMSW9ScWVE0iTF3Duv3mwbP9PqpJiD4d4lX2c 0gYUbnLF67R/imeEM4gm1GNO6pfqH/rdfhJQ34AuY5pFLTSioK8SyOqSBvPDNbBRCyCB CKbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=9U8w3WSQTwf10jrB4ng94LgLlzdGTMssx473H154HSQ=; b=ZysiqT5B4l9zMCvnMvR4JhLGlUSc4xpyuT8JT52G58jTiFd+V6lZhpmQU8tnos+RhH bBIQSmpi6o4e77UcPfo8rLWe4+WkfZ15BPD9uHYWm8QdWqvcMU0KZIKcgmaAAdpDiJte h9mEJ5+G//7CvbZfRyTXu9zFFcuaH+jJlP1ZWIDxBeEXkIs04lisAsA4jEIVsvQrl6Uq iW9/YSY6yTUbUSVfAc7wqHvNzQ+TqfMYH30VQSQ6qalnJDwmXIQVXXrnZVqIrX9NwuBR 8JiWIDamAaxd2q7RnlhGuryexRYrRKkTQmdemwFXnFnH9mb/g2nNWx2kPoxhh07ZK1Gm Nrgg== ARC-Authentication-Results: i=1; mx.google.com; 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 m39-v6si379890plg.570.2018.04.10.22.33.02; Tue, 10 Apr 2018 22:33:42 -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; 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 S1751745AbeDKFaY (ORCPT + 99 others); Wed, 11 Apr 2018 01:30:24 -0400 Received: from anchovy2.45ru.net.au ([203.30.46.146]:48358 "EHLO anchovy2.45ru.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750797AbeDKFaX (ORCPT ); Wed, 11 Apr 2018 01:30:23 -0400 Received: (qmail 10909 invoked by uid 5089); 11 Apr 2018 05:30:21 -0000 Received: by simscan 1.2.0 ppid: 10825, pid: 10826, t: 0.0415s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.122?) (preid@electromag.com.au@203.59.235.95) by anchovy3.45ru.net.au with ESMTPA; 11 Apr 2018 05:30:20 -0000 Subject: Re: [PATCH] net: dsa: b53: Replace mdelay with msleep in b53_switch_reset_gpio To: Jia-Ju Bai , f.fainelli@gmail.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1523411485-2030-1-git-send-email-baijiaju1990@gmail.com> From: Phil Reid Message-ID: <11d079ab-3c07-a10d-c321-f873c53e9690@electromag.com.au> Date: Wed, 11 Apr 2018 13:30:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1523411485-2030-1-git-send-email-baijiaju1990@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/04/2018 09:51, Jia-Ju Bai wrote: > b53_switch_reset_gpio() is never called in atomic context. > > The call chain ending up at b53_switch_reset_gpio() is: > [1] b53_switch_reset_gpio() <- b53_switch_reset() <- > b53_reset_switch() <- b53_setup() > > b53_switch_reset_gpio() is set as ".setup" in struct dsa_switch_ops. > This function is not called in atomic context. > > Despite never getting called from atomic context, b53_switch_reset_gpio() > calls mdelay() to busily wait. > This is not necessary and can be replaced with msleep() to > avoid busy waiting. > > This is found by a static analysis tool named DCNS written by myself. > And I also manually check it. > > Signed-off-by: Jia-Ju Bai > --- > drivers/net/dsa/b53/b53_common.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c > index 274f367..e070ff6 100644 > --- a/drivers/net/dsa/b53/b53_common.c > +++ b/drivers/net/dsa/b53/b53_common.c > @@ -597,10 +597,10 @@ static void b53_switch_reset_gpio(struct b53_device *dev) > /* Reset sequence: RESET low(50ms)->high(20ms) > */ > gpio_set_value(gpio, 0); > - mdelay(50); > + msleep(50); > > gpio_set_value(gpio, 1); > - mdelay(20); > + msleep(20); > > dev->current_page = 0xff; > } > Would that also imply gpio_set_value could be gpio_set_value_cansleep? -- Regards Phil Reid