Received: by 10.192.165.156 with SMTP id m28csp163961imm; Tue, 10 Apr 2018 18:54:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx48NMSbEFDWE9qMfzki4ZAJsgZF344o43AOn9fRsOON3feKcjye+AGlu8hqV1I68DMZSYEFI X-Received: by 10.101.73.74 with SMTP id q10mr1963074pgs.323.1523411693927; Tue, 10 Apr 2018 18:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523411693; cv=none; d=google.com; s=arc-20160816; b=b46/UCSAUfusWuWGWmmmKjUofGkusDUBpo4P9oL3qbqvLd4Lmg4hPLjTOXqvMcTd9+ Rc337CVVk6KRljghGxElqSNIvMvbwtW05gPv48LkETK/JA3iGimBhmOr4hxP2rbb66Mm 0Pi53yB9mrYYciX4BXvUXNpfG2dgG1fK5fN02Ud6/OwqF66zz+3iGh3p1Co/S7yWGh2m U+G5/4YjJcccYYORr6feEFf/DQasZlwvFqlUvNOGGCEEGNJVc2QVj6f3xsKDoAUBLvfR VQV4HLIzKjpbZeWOz4fRe5xcXnCtmeALHH5hqtlHCy9ab/+AlqRgQEl9dvEcbGb4zp3t /lAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ldLxyVFCASGen28D46F7f0e7s4YUQmQkvjcAJV2uW1A=; b=Y08pP/KsrqUHBAW72JyPs3Tscr6cWtXedYaNXK8kaPxvW9Jt7A3xWRFaoFGv7XqjAd hewfo9Ey1zBm8KMVX1rl8y7dzS/RGGhMFVvs83W3FopSvfKXXsluMty7AyCUxsa93ggF W5ZfEXaqA+7/omjiD6C/t/H7gUKg9H8skVgyzpoABmOJ/hrwVPOlCMHtW30qm9/B/gGl CR1uTcvHedhBxLHiUinPB4mH0mBTQvvB0QMceuzvKWxyRoO64+oyzCj0HQQLVQrcq6FT zvM/BTr0Ka+IuRx1poT//ol9UXA9AutflT3+sz91ZTuj01IiF4QBidTjj4NcZyiNpE2I 0Nag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ri88wTg4; 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 x8si7361pgr.301.2018.04.10.18.54.16; Tue, 10 Apr 2018 18:54:53 -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=Ri88wTg4; 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 S1752552AbeDKBvh (ORCPT + 99 others); Tue, 10 Apr 2018 21:51:37 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35678 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752016AbeDKBvf (ORCPT ); Tue, 10 Apr 2018 21:51:35 -0400 Received: by mail-pf0-f194.google.com with SMTP id u86so185915pfd.2; Tue, 10 Apr 2018 18:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ldLxyVFCASGen28D46F7f0e7s4YUQmQkvjcAJV2uW1A=; b=Ri88wTg4E6kdF+dYodIMjciFyD5kjAcSlVwiZJvpJWMCa9PQNdnFz+Aq+Fu5+fJJ8j pARbBxpsrDVdC0P1PeI+hX1Cuif1sidpoh5HhFtR3JeN3H+T6w4MihwpOFS1op5uEylw /sjX8OkvKtNnaM5ESjH2ytguHXJuWWXWE+SUZSJpxlXOIbqyyBOBF3kQmdtHyzaa0XTC GQkESjm2NMqVwUX7hmINjitpvt4+MXXLsT04G3LwgCPeRmaMs36n2Vnizv+aSd/crw6e JUZ7ngg3V3AfftWWi2KzYofQDRowIb+7r9XVdPUPgPF5PNqw0jM+0yGe6oI3MV9u1g4d vNWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ldLxyVFCASGen28D46F7f0e7s4YUQmQkvjcAJV2uW1A=; b=XYoBdwtKVVIhms+nt8QZkl8uRU2pEidiNFDZPo/OO9WmCxcyjufwb+jp9TdlAMBzyA Y63tFqG39wbBfS/tRyRjuBNDLmtGLrGql4fkcCZ2mD037+i5gKJQ+p52qqzMBLwJZGQO ZmLIF+FfK6qLBf0rfXE6uPaFYK2vfgJ4F/ln9s3nFbTnit3G3sji17lGnQhGclDWfWag bNuefA7oFOcjjL9YtiWcreBu1cD8ZzQ/pg7chnxSH/OND9qrag3jxd8T+STwtBKoRVzD x9MZVw0jFSeJ7pC6lFqyEIf/EkvMzPZZIMFue41eX8iaI/ibQOUIbokrAMnxnB7lAm58 dUHg== X-Gm-Message-State: ALQs6tC9E70yBWKwsMUmaTXxEejLZixkLFi3gOYzJuU+glMrjazKH6WM znfC5jEchgY0m3zNskfRH3YdW10a X-Received: by 10.98.253.9 with SMTP id p9mr2254777pfh.152.1523411495200; Tue, 10 Apr 2018 18:51:35 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id 81sm66535pfl.92.2018.04.10.18.51.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 18:51:34 -0700 (PDT) From: Jia-Ju Bai To: f.fainelli@gmail.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: dsa: b53: Replace mdelay with msleep in b53_switch_reset_gpio Date: Wed, 11 Apr 2018 09:51:25 +0800 Message-Id: <1523411485-2030-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 1.9.1