Received: by 10.192.165.156 with SMTP id m28csp927013imm; Wed, 11 Apr 2018 09:23:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ZRlbGn2/zz2D3IrL9W7LGg0wIapmeUPlPPY9xpRqMhsv/vcgPUFG3O5APXidmA5c/+3bb X-Received: by 10.101.78.194 with SMTP id w2mr3997293pgq.242.1523463792175; Wed, 11 Apr 2018 09:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523463792; cv=none; d=google.com; s=arc-20160816; b=poALh5TOg2AjMNegOEX8vB3AL1POj22q1vWSilCuExYwL16z/HpNYkucodhZlFie+a stilM99pjQ7xFHIOuN4veupzmOYdYtZi32tgnrk1g7Ukp/06LFCGpDFqEewXsbMcX1CI Rx4JcH+PFnwDpOptwRLIp9oO3sz7nk9/YVFe757gfURkbdskzhFZo33kUmhlnn9pEbUm 4GNLhWHuUMExQzEzhQo3LyJK78/m8T27RTBmFgQDzxFikVR0p9lef7q1SZVvs5HHrZ7G YeI27MaEcUoC83yl3aUcHB7miaatXyZ+sbJ+CSxeFvCzGH/02UoVdbGwt+rsnZdyuWal Z/1A== 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:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=L9oGxxwKXuk/dxtkhobLrNJVtX4fbtHO53u0+SDaen4=; b=QUCgZizZVFA2FEenvuEusVPDejsEOXZyLczQc5KuYXjjZ1vMfHegufV0x+I6poeT6u VhgV44bKKCefh6Wp2E6yeQp3r3zmnYxWEUtrhj650HWVFclx98KWF6cRVCB3HqlD1wPu VvU6Po2as2I7vPzTbiqZ+OvDP6HiLZ7YMy3ZF12a3JNKS5p51vLfMrnDJwm7bIpOz36k 0icDkfVGK2xn74h6L3VplqxQ6iVkDdhsvbHlWt3l6Fgpj9XIUb7PUkwFfi6TFFH65ken dEm5oEiCah4fwJ3ozCAZMbbv5ILvg4LhoC5Ge3Jm2mv0CACyG4ybi3v/5RJht+EW4BjW FeDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IPbaCDst; 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 v14si1070767pfm.198.2018.04.11.09.22.35; Wed, 11 Apr 2018 09:23:12 -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=IPbaCDst; 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 S1753751AbeDKQTU (ORCPT + 99 others); Wed, 11 Apr 2018 12:19:20 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:43574 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753402AbeDKQTR (ORCPT ); Wed, 11 Apr 2018 12:19:17 -0400 Received: by mail-qt0-f193.google.com with SMTP id s48so2511689qtb.10; Wed, 11 Apr 2018 09:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=L9oGxxwKXuk/dxtkhobLrNJVtX4fbtHO53u0+SDaen4=; b=IPbaCDstZDcnKZRKELQ3zgZrxqo2V35dRwldMUfCjgRvuuWTicqhfBgatSjcxYs/O6 dDFovtlIjifVeaEvBRVweMY4fhZQKpQgABA6LijpM43MjgOl0prSbUnGJ3PscW++l89Y mesSJuy32bzm8cf/iSVoDPcZ5mgrEVD6sPyw2RAWkDhgxoKUJrFaGDlVhbkVU3NJqXeA Siu0INZ+I4M4wDECB+G0kR4M2ZksySZw4hERn1WbVOre/2ZxOXUIMTKBdkeP2YH656gr Jgrq+czOs1F9vg2KkjIhOGQwTdjDBa3DgYW5qiNJigpS7n7k91CkBWDHtlmmgawfL/jV VPUQ== 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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=L9oGxxwKXuk/dxtkhobLrNJVtX4fbtHO53u0+SDaen4=; b=hvWamGa7mIJWlHT9jxEPHSU5gwJbcr9iD9takxMAAZo256rQlIWlqRK464mX0zksVW aW3oTGbUdGd2DBEvyZwa5F52tytQKRDrGKfD67ZbIb5rUEKRrB0OV00oyqiC3yAO/Mjj tQfEnCzEMNky8ZqT6nxeAHPKKKKHL96w9eJJuu5eDKfUiq5H7PYrndwXvpqLJRIKINgL MPXqY0tRBO/vLSoejZ/VOQLDGk+YE0oKL73dKgk0zl5E6+HBm+VDm24TXXRLKEK3LJJ/ /AQy9wKyQs/C4xa2omcAMMyNQa13h25IdubEOaRvVBJ33laZct123X/H5ZSYXJhLruhT 6DSQ== X-Gm-Message-State: ALQs6tBNIH104BPH7x+kXSdMyNC1JIhooXHtAQ75jSrWL8kGtnMvT38G IbqH6cxJtx6W829bB5z7VDUxeIN7 X-Received: by 10.237.38.101 with SMTP id z92mr5498886qtc.303.1523463556384; Wed, 11 Apr 2018 09:19:16 -0700 (PDT) Received: from [10.69.41.93] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id c29sm1200855qtb.75.2018.04.11.09.19.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 09:19:15 -0700 (PDT) Subject: Re: [PATCH] net: dsa: b53: Replace mdelay with msleep in b53_switch_reset_gpio To: Jia-Ju Bai , 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> From: Florian Fainelli Openpgp: preference=signencrypt Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlIgVoOAJbh qIWgvr3SIEuR6ayY3f5j0f2ejUMYlYYnKdiHXFlF9uXm1ELrb0YX4GMHz80nRmxvcmlhbiBG YWluZWxsaSA8Zi5mYWluZWxsaUBnbWFpbC5jb20+wmYEExECACYCGyMGCwkIBwMCBBUCCAME F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wGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJU X9LxBQkeXB3fAAoJEGFXmRW1Y3YOj4UAn3nrFLPZekMeqX5aD/aq/dsbXSfyAKC45Go0YyxV HGuUuzv+GKZ6nsysJw== Message-ID: <7d376874-8078-0252-ed7e-29392a519fc8@gmail.com> Date: Wed, 11 Apr 2018 09:19:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <7c9dffb7-d55a-98f5-4024-7e2f0c704a56@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks! -- Florian