Received: by 10.192.165.156 with SMTP id m28csp387774imm; Wed, 11 Apr 2018 00:18:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+J+b9b4qFjak5jjvR55PAWJmKGSXKK0NuAz0s5A0qKO/tsreMsqqALPqZSyKmJGqhjoqee X-Received: by 10.167.130.2 with SMTP id k2mr3060333pfi.14.1523431091072; Wed, 11 Apr 2018 00:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523431091; cv=none; d=google.com; s=arc-20160816; b=HBe4xp+OIfd8/f1v5mJy+Egdw/71nVOePGJOki6S2XB2hqPzJWE8HjSkRcBWRzMvsF aupIZjYO8+yJO0G/2HDkI/7TQ00vaalIMPCHexGJwh/wor7INoOtAb2NHHGyumk0CcK4 zVB/gPvkrzWRH31mWvXyNtP9CFxAX2UGbKldzl/ovScO0OLRU6oM4/2RqtSX6CNiwJPG DocxeE4KeI6r379bSaXPDiOYX5VopagCNt/kgeyO2LYpnWuyscFxucOCn0RG+AyXZzX+ 4Zdo0zJAefnVZYH/WeecvwNmvkMs9c7/RFFym80ReFCIStfBTuu8mYWqNgASO5AB5ed8 kobA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=8gRN/zFMev56S4G9C3DVwrXzcd91MlqsymNldvR5OOU=; b=NRdei4MEsZqXpYR0R5JF9TeYFuR4/WY8tBgOwQ8gYyjoFrWPEcb+vYMcS7ZJj33tKN 3NOh3qjIz9y+cs+GOVVJKZb3u5JGe47vVgv9QpeIGY22RAdffuuJ3a0lUIhriQpb7F4E uoj+LmOdM1UFDAW4eB+iIVWOijyfZDPEXDiJDnacLOe0wI8RPBYag7psCuLbUhjuztUQ HF2m3oBBZrypBakp14XruMx+aAwnP5ck3oCezeM7Mgd+KKnyROyLhcln9ZWzgSOvU/D0 42R13Y0r83ym9+kk7s6Y/6/u87QSG18Oqg3f0SXCbIRNrqGYR7uQijE7GIqW/OwhZqcS gjuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NoVQsScq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4si351527pgr.72.2018.04.11.00.17.33; Wed, 11 Apr 2018 00:18:11 -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=pass header.i=@gmail.com header.s=20161025 header.b=NoVQsScq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752491AbeDKHO4 (ORCPT + 99 others); Wed, 11 Apr 2018 03:14:56 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:42227 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbeDKHOx (ORCPT ); Wed, 11 Apr 2018 03:14:53 -0400 Received: by mail-pf0-f195.google.com with SMTP id o16so500041pfk.9; Wed, 11 Apr 2018 00:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=8gRN/zFMev56S4G9C3DVwrXzcd91MlqsymNldvR5OOU=; b=NoVQsScq2IzhVnM0y8Py87spnHVmYE0QHvemf29Y5qZwn2m1nChcZcskh1O8hEWGH3 neBcQm0emrRrC5JuwVnw3xCvrNmFvfYBoSNd5hpc5TmYKr1S6nH0M9O5hrfiMzsiDIlD 1UwnuyihMQvc7jKvXVQ07PecFkhpQmnPfLxr4kJ6gsNNmWhP7AlflFOrHZYxtdM6fLwV K2Oj2AZWk4nxTBpETnulj0NTq4XPzTd1FVpzkHwCP6mFrW4oU1rc556I5g8rIu3mYGVm ScFJgXrcQOwaEEHoUmg6+sRy1z4hORiiFAoSSZFX8sEyPxbUiiDnqgH9mwWTCIkPppbv qylg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=8gRN/zFMev56S4G9C3DVwrXzcd91MlqsymNldvR5OOU=; b=c72snDr6HbTtvqGoO6E7byS6EkQAMXVW0RIFqYyB6mrIMI+35SWp4jssrlcx2GHeQ5 TZP80jHlG/JImZgxHadMfoo80mDe09TE0iKI/zX2Uhn+4UD9FPgHcDYF9jmb2jJxHuBU QSe6XUgc2WpUuxPGGLhnDGKs9DMpahItb/JfpcbB1vhMksDCYOKVVjVB9QZrFotgUL84 U1PU9PxjScD5Z8XJm6Hm79nlP+XIA2AZBG9TMdeq1zjvjOpBVxsb4SnfX2YLOcLreCfj 9sXrDvo0nUOt2U6eVg7IKkz1nfsk7kAlNPFjPpOrfiuoc//cpmz63IMZFhEp9+t+IyZ2 ZRAA== X-Gm-Message-State: ALQs6tApj/3aS429IrihUKTAt5/iA/4NO+ae5yROgQHoJb7sglw/Tjt+ Ztwj8Kl5qKv+u9vXrc9Jl4PjLZV8k9U= X-Received: by 10.99.96.19 with SMTP id u19mr2489207pgb.261.1523430893278; Wed, 11 Apr 2018 00:14:53 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.53? ([2402:f000:1:1501:200:5efe:a66f:4635]) by smtp.gmail.com with ESMTPSA id w24sm1484623pfl.84.2018.04.11.00.14.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 00:14:52 -0700 (PDT) Subject: Re: [PATCH] net: dsa: b53: Replace mdelay with msleep in b53_switch_reset_gpio To: Phil Reid , 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> <11d079ab-3c07-a10d-c321-f873c53e9690@electromag.com.au> From: Jia-Ju Bai Message-ID: <7c9dffb7-d55a-98f5-4024-7e2f0c704a56@gmail.com> Date: Wed, 11 Apr 2018 15:14:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <11d079ab-3c07-a10d-c321-f873c53e9690@electromag.com.au> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/4/11 13:30, Phil Reid wrote: > 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? > Yes, I think gpio_set_value_cansleep() is okay here? Do I need to send a V2 patch to replace gpio_set_value()? Best wishes, Jia-Ju Bai