From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EFAC23A9B3 for ; Sun, 8 Feb 2026 16:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770568575; cv=none; b=tDtMfwzToWmPzywDbNTmwgSPVCsQu0KlYS+ofhfhDahr7ipAVDb0J/raiZGzUsB734MDi1qp+1eo0LHWNMsgMdbeON/TSqmMxQRZgB4BC9sD6z36enq6TI4vGe2zwwPdERxTpnPq1ZQ8wHUAI8u6U6Jlv6bIDVj3KQQFhMyjW3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770568575; c=relaxed/simple; bh=HtFlRzBKp/Dl5EdM0MhNuwnqeC8FseUBJoLCtq4GGDk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=qP2sK5T/zAvFzPBBcoiQTjeidXn00gJKjBnoK0L5gHbDC1T2VjsblxSfrYLmOmk7JRrJWMYccCspMzwdeT/+/Ytpo5gfc6WFzLrUmdCGDoGhYAUFgvQKdzv/CfKsTe9D28SalcuAiA6aXEQgz4JOANRjSfwitSiLnGyUJ0vK3m4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4B2FCC21A7; Sun, 8 Feb 2026 16:36:08 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA id 3105234; Sun, 8 Feb 2026 16:36:06 +0000 (UTC) Message-ID: <67577c238ead009b3b061a43d443dc69da2aee64.camel@perches.com> Subject: Re: [PATCH] checkpatch: suggest fsleep() for short msleep() calls From: Joe Perches To: Neel Bullywon , apw@canonical.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, andriy.shevchenko@intel.com, linux-kernel@vger.kernel.org Date: Sun, 08 Feb 2026 08:36:05 -0800 In-Reply-To: <20260208155935.72687-1-neelb2403@gmail.com> References: <20260208155935.72687-1-neelb2403@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: 3105234 X-Stat-Signature: e95jad93dmrjrwit1z9jee8dt1gqpgtk X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19smlJHi+fwwf66IiedcL1ke51RtFKiD6Q= X-HE-Tag: 1770568566-122143 X-HE-Meta: U2FsdGVkX18/Q+Gdf8GXVFj312uWx1n3LIUCCBPKsrn1HcFqBdFRgQRrPXUcPN8lRDwehZDApdd4KPdARfIRSnhx74XF549xbkjf9fQ5tK/6i43xHWejdic/af4zhHymXB3Yx08vJZ8P2dEAVOMRW3XdhDZV5Q9k7RF8oPh+xMa9xtJJa18WgdnB7MR/CPayZOEY37Hv7F7esH4syjDejWZgAMvQJq3iwX+9NFLLZIDwNrFsuP6d4hF2sIGkoOkMrdRQWu6i+FU0dedIDCo7HGGlskIZuxEKDqp+WlcrmH/63cur/avPx5TXkUZULQDB On Sun, 2026-02-08 at 10:59 -0500, Neel Bullywon wrote: > Update the MSLEEP warning to suggest fsleep() as a duration based > sleep API. fsleep() autoselects the best sleep mechanism (udelay, > usleep_range, or msleep) based on the requested duration, making > it the preferred replacement for short msleep() calls. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -6636,7 +6636,7 @@ sub process { > if ($line =3D~ /\bmsleep\s*\((\d+)\);/) { > if ($1 < 20) { > WARN("MSLEEP", > - "msleep < 20ms can sleep for up to 20ms; see function descripti= on of msleep().\n" . $herecurr); > + "msleep < 20ms can sleep for up to 20ms; see function descripti= on of fsleep().\n" . $herecurr); > } > } maybe change msleep to a #define macro so if the argument is constant call fsleep instead Something like: #define msleep(msecs) \ do { \ if (__builtin_constant_p(msecs) && (msecs) < 20) \ fsleep((msecs) * 1000UL); \ else \ msleep(msecs); \ } while (0) and change the definition of void msleep(unsigned int msecs) to void (msleep)(unsigned int msecs) { etc... } and remove the checkpatch test.