Received: by 10.192.165.156 with SMTP id m28csp1393840imm; Wed, 11 Apr 2018 18:53:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lqXG8ll3E1XzLxP5rsJ3mYd//bosnuHqBTxc/Vm+gQ97hjTDRkT9Vn/hB/+I/XNlq1X3c X-Received: by 10.99.121.136 with SMTP id u130mr5158417pgc.414.1523497989563; Wed, 11 Apr 2018 18:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523497989; cv=none; d=google.com; s=arc-20160816; b=ZNIw3+1M0MEbL9OIw4EIZLivVUmj1qCIL+wtP4iZwyb7EMTUbC5s088I4hUBkFhtgF awMw9tGkRZtCGc2N6R2j0mCN+bAzKL/8kqciJXbKpbwgkaTnYI7m2mWhY1ysDywrcN56 Rp3g5361Qwf99AT915K+H2djxduw6omNugr31WFgfjzPvxuwCERKruz1U48F7M+bp0Vx /qaavTuYUlnpP8K/F+jZ0cWq1zKtpGCIRKwb6jmEgkdPD3j3XmS/A9/rXdddLS0ESfy4 jO2l8eWKSvY8PDPwUmpttzGWlkaTDDUxyBGBNAoaakzo1Nsy80zTTzbJboqA4xSTSTot 0m6A== 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=qzyfY5SNpECV043m8g82VAYgQZQQQVL9b+8Mtp8x2nE=; b=qEjRh4KN7l8JrDdMS8jFDMG4vAEJf+qBK7dT9rPOqT8QHCbhLUf/unHSv9iNYjorwq hyZkfb4e5P97OqTnUq5gEr9nlxM31IFag0TfJv5ruq/nbT1uWOBzEtuBn4XZdhfj4ReV MJV0pg2+thD3t/7NQuyO5ugi8mcPgO7qOHGBPyCaPDx72JT1/SdQTLfJIhPqNQRqeIhi /z4G6Tvu+PifChDO4JcVyWMDt0ZbkfulBYfILbuP+Ub3kBllwd4Zu/IkCm+Iakcofi07 QFMBuxOD/pFDlK5CM4Y/41JW4A5JE2ohktdjFpdRKDkHkShaJzM4qKbTTFiBh+HWjPsb Oo9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nODlXziH; 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 i61-v6si2240383plb.560.2018.04.11.18.52.32; Wed, 11 Apr 2018 18:53:09 -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=nODlXziH; 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 S1752754AbeDLBty (ORCPT + 99 others); Wed, 11 Apr 2018 21:49:54 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:37191 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbeDLBtx (ORCPT ); Wed, 11 Apr 2018 21:49:53 -0400 Received: by mail-pf0-f196.google.com with SMTP id p6so2248509pfn.4; Wed, 11 Apr 2018 18:49:52 -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=qzyfY5SNpECV043m8g82VAYgQZQQQVL9b+8Mtp8x2nE=; b=nODlXziHvX1mGa7QmpTDVxhnfVtZ6GGkmMTFw49WqbK0Fk9YvobxCOyw4Kevqh2U4d /jRyBtfFgC7y/zMZlnj8CM3kaxLGSIe5wNZv03Bxj65uL6rCHPcw9F4qXroK1/bSvBLs 2xcma6+DrjSGSe97mCtiLfa49l3Vhi96w9pqTgi52EA9TmkUmU/vOvpe8tMd3Wl01qsZ hpitPaRYWPJpC1Mxvk5PUgoKETqxZnTvyBVpz4/qzX/yZb4NKpSePNO3TFn42F5F2ytP HNH1qkobDTVDNYZZN9H7E9PgsYFzFdw+d2myYRC3AngwSPpLot+kuwTgGQqpuVkqxa2V cG7w== 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=qzyfY5SNpECV043m8g82VAYgQZQQQVL9b+8Mtp8x2nE=; b=smsYFYKfSOdDg0YIA7fjMXEA98VmBCpppCJ5FCnGvuxuFEgOmmcb0oc6Vl3Sp2uf0K OlrskJZiTYiyZjxAwxke4znv+Q7tjGCTqr9YssI9AdpxliZ/BWWEON7LEiTn8x8thPNs PwjxWNbtzVfYTVEz+P7pICmQl9C/8RtgNPS2sHu4YF4Kw/+9wjvRl1ubD+2CqkGMUB4y s9B0F5UFjmEduQuOk4pCi8CQd7kiKfZeVe1xbXK0A9wDKRE9XyH6BFAsgaA74HcQP6eL +SHnSU+REC1muGmF82uHl4ATOfQcy4uCvHQzAYLK/7J0EmxfyzgZBqrhEnYpxOQ1Xlw7 VtZA== X-Gm-Message-State: ALQs6tCkmOhtE4m7BmZJ2byX07ii/BcvnmwwvJKCC1s65E4DHy11dasz KsDC/O9oDRJ/yvXv2qR0CIAoqJHY X-Received: by 10.99.109.203 with SMTP id i194mr5258682pgc.314.1523497792290; Wed, 11 Apr 2018 18:49:52 -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 w16sm6337803pfk.125.2018.04.11.18.49.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 18:49:51 -0700 (PDT) Subject: Re: [PATCH] net: dsa: b53: Replace mdelay with msleep in b53_switch_reset_gpio To: Florian Fainelli , Phil Reid , 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> <7c9dffb7-d55a-98f5-4024-7e2f0c704a56@gmail.com> <7d376874-8078-0252-ed7e-29392a519fc8@gmail.com> From: Jia-Ju Bai Message-ID: <20571ede-a5a2-a901-2e9a-4e78d1520baf@gmail.com> Date: Thu, 12 Apr 2018 09:49:33 +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: <7d376874-8078-0252-ed7e-29392a519fc8@gmail.com> 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/12 0:19, Florian Fainelli wrote: > On 04/11/2018 12:14 AM, Jia-Ju Bai wrote: >> >> 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()? > Yes, I would lump these two changes in the same patch since this is > effectively about solving sleeping vs. non sleeping operations. Okay, I have sent a V2 patch, and you can have a look :) Best wishes, Jia-Ju Bai