Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1154921yba; Sat, 6 Apr 2019 05:09:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQ95n+/5551xMI9VswlPXRHV17Gy0k19Vff24ZJxTycy5JB5f29VhF66Lh8rxCVawsUDka X-Received: by 2002:a65:5ac3:: with SMTP id d3mr18003384pgt.168.1554552573356; Sat, 06 Apr 2019 05:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554552573; cv=none; d=google.com; s=arc-20160816; b=QJMZc0wc3wDNf+/Tz+VI7ua7kJE+BLwLzXLgbcBjU5qtILI7+WdkfLP7B8reOlp7HV fixLUgVY8PCPMgMnzn4bDJpG33ps3ZC9dMbLU+rZeUIT4Jx/xQI9hRcuMlwtUs7zq9I7 t71sO04cf9Oqbi+vGkdTp1GNptjhRf7XGGqEqQeUSlYsI9gtR+iGHpCwZBOb/xLZCz7t NaYaYSrlgFOR33Gp1hZRgLqKckNQ4kfCFGtYGfTy11ysojo7apGtXHXqhu2dSsW2ofBS A5DDiqhYhmTC0qS97nW2eBp5SwX9pl+AXSDH3weKmLxURMZtYiG89dNVobxBBggsoyuh ombQ== 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; bh=H4E/+wZI437j+NsRvmdE2WOMe3B9UiQ4P3WiE7g0Vic=; b=hSYYX2HymA+o6cGP5wkf43eCByRDxu2dxBcGlvx9VGjESF1t/ingsr+K234iy6gpoY cE8KN3XCWBkwWZAxI7820/ZJVHwp/Ejh+8SYYk69XZOykBhWIopf5CAQMVG7hPCeeW3U taDgwttdFkx8QlTZewNwsk7qu/619IMPvvtK9W7GgmAv9gPoOx+KLmcLxScmH7fyZx3m 3Kzht85zXwOSru3/uIJ4mORB/ALhZu/EyJkke73hoD0qGqqWeCpnrctUe8LZbR226ldR aNzwCAwYii/WakCONgi9dYhVnXiYezuu+6JsLUpeyUCxqMtjGckdG8FJ6FHy25bM6Qn2 P/sQ== 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 h185si21238791pfc.241.2019.04.06.05.08.43; Sat, 06 Apr 2019 05:09:33 -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 S1726471AbfDFMGf (ORCPT + 99 others); Sat, 6 Apr 2019 08:06:35 -0400 Received: from www.osadl.org ([62.245.132.105]:60710 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726271AbfDFMGf (ORCPT ); Sat, 6 Apr 2019 08:06:35 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x36C6Fvj014363; Sat, 6 Apr 2019 14:06:15 +0200 From: Nicholas Mc Guire To: Adham Abozaeid Cc: Ajay Singh , Greg Kroah-Hartman , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH RFC] staging: wilc1000: give usleep_range a range Date: Sat, 6 Apr 2019 14:01:07 +0200 Message-Id: <1554552067-15421-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org usleep_range() is called in non-atomic context so there is little point in setting min==max the jitter of hrtimer is determined by interruptions anyway. usleep_range can only perform the intended coalescence if some room for placing the hrtimer is provided. Given the range of milliseconds the delay will be anything from 2 to a few anyway - so make it 2-5 ms. Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script ./drivers/staging/wilc1000/wilc_wlan.c:411:4-16: WARNING: inefficient usleep_range with range 0 (min==max) ./drivers/staging/wilc1000/wilc_wlan.c:426:4-16: WARNING: inefficient usleep_range with range 0 (min==max) Someone that knows the motivation for setting the time to 2 millisecond might need to check if the 2 milliseconds where seen as tollerable max or min - I'm assuming it was the min so extending. Patch was compile tested with: x86_64_defconfig + Staging=y, WILC1000_SDIO=m, WILC1000_SPI=m, WILC1000=m Patch is against 5.1-rc3 (localversion-next is -next-20190405) drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c238969..42da533 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -408,7 +408,7 @@ void chip_wakeup(struct wilc *wilc) wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1)); do { - usleep_range(2 * 1000, 2 * 1000); + usleep_range(2 * 1000, 5 * 1000); wilc_get_chipid(wilc, true); } while (wilc_get_chipid(wilc, true) == 0); } while (wilc_get_chipid(wilc, true) == 0); @@ -423,7 +423,7 @@ void chip_wakeup(struct wilc *wilc) &clk_status_reg); while ((clk_status_reg & 0x1) == 0) { - usleep_range(2 * 1000, 2 * 1000); + usleep_range(2 * 1000, 5 * 1000); wilc->hif_func->hif_read_reg(wilc, 0xf1, &clk_status_reg); -- 2.1.4