From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3000299944 for ; Mon, 16 Mar 2026 08:56:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773651366; cv=none; b=mlmydsV2J/95zIKCFszHfMcNFnpgoPuLBWtEJv2vCFBZR5AfHQzZpv9wngAzPj78HQy6H4NACwuk5dI0yYnnSoHyKFD9LW4rN50AnAM1lVBaJFeHoQY34gHPuQZkPo5i5rYUKVRiszpsh7sjwa6TIjXzMO4+Uoc2n2bVMM4hyrQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773651366; c=relaxed/simple; bh=eABlA2VDKd3+5VX2KjIEWTpjrYdlhep34hzJgLFMIQ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gFMImdvbpl6CN5/zU+HZcYFZhS9jnfY5NRpfgJFzswieEIvTkQgykoB/02gAt2K9voCYDU/vqYjRXb/rC8YdtFHmCJ9FOMidQ91dE3xJj5emLhKCyZkIhn6gIqKHsy6Y32VHZN4jJHyVLgw9CqYUOUHMS9owh3bVEJRX1oPVuBc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=v7nSbt7q; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="v7nSbt7q" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-48535a0ef86so35905875e9.1 for ; Mon, 16 Mar 2026 01:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773651363; x=1774256163; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ElOuVFXFpDm6rPhqYIQli2UADT/0TqiBL46FFSx3R8I=; b=v7nSbt7q+colGqm/jChX166IjWgV4HzTD7dMQi5Pjuhp25bePbMeclmMMbZcBkFNcS MuiZUrKBXls+LRnWgG8QmGwhLAXOMYFoh12/TO2/4fMWve/R48y6mzOUL6y/GuoqtVcS OvJYVKF+lNxd99eDcGn44MLzXrIqrb87UiX2q4eA0R6AJYUK/Y/tkd2jggrUIKDGDAqs psZNSNXJ3uaIZ7RWGazL/wM6aCbTvXiXPR6FEfMQhrOu5tYmBON2XZAqneIDAr37iCzd Io4Jl7QMMmsMgNv6iTqkxdadRJIcioc2ejzeSXNB4k9Ks8MOet2A0fBuPY2fyjImSKT1 KAXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773651363; x=1774256163; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ElOuVFXFpDm6rPhqYIQli2UADT/0TqiBL46FFSx3R8I=; b=OF0INB3Rhu9uGyLUZzdGJ86C59b0SclMDR6i5PhAExJ3pbuB5I1Xqssbtmxr9A+l5d cS0hgQJwdh/P+NL72HkRYJmpjKNEcYnufzEFF5SiKPpBC3rzKV7REWnseN+XD9oBoDN+ MkjKBK/2YB0q1Gp1IlCRNL/IUpbLj45jHcPFWhivUqxHaD06Xfrvt0eGVGeWRK6/1Gjo asEtB44W3c1p5iaXn4QZdouaugRokSRIbBxFCp+gaVu4+KRdQ2gOuhCP/1qtq72WQoir uyPapQDTwSADW+JQYsvRE3ycdzEQgZCtFV4uRBwzqaq5P+1zyUuSYObz8cZrphuVDDuZ Q3hA== X-Forwarded-Encrypted: i=1; AJvYcCX5hliX6/4OrT8HubDwn9lU7AkwTUh30ndA7gOo9i9pZcUw5MgJ9zDugZDEqut76L9jucmZ0Cv8OrnRbV0=@vger.kernel.org X-Gm-Message-State: AOJu0YykegpvID9JxXFYpq6wpueLBb8woUw8K40HAOumgeZTMKL6c3O2 dshOX7M1LzbmEFhATLe434v/CHxu0O47t0SNu9fsUCmtgo+1npM10A3RHQNM3TDv8G0= X-Gm-Gg: ATEYQzxyJHWlDArrCW7vWoUCTLd9cSedtNYke11OMJ2aB4uANuW5zGRvCr19x1iq+/g xv836GutK6MajHilBlSfl8B7VyTKCmBu0VfM2/2zIiaCTyV6rN4uIh/vhPeNHnNpZWTYctyc/np wB9Lae40V7c9n+mXD0XvKpZFlFENSL1joEYNMpN0cDoS3vRAjdVAHA37NN56pW2B4OSmoaIkFO7 q1zgka9IjmXMhWtiUwMKZsG0a8DOQHrhAW2P1TJQ5DgEOY2GjOTRzQ7Vjo6wv3TdM/QH6RQNuOB yR4uq/rIHWjwuwUPGuSHd1qNcv4H+bZurGeAbQ63vGjoN21gpZeYOt+WvIxdCQ66NOXtFmZGfdy p4rZ7uZZGOuxekWIWE0louG2zto84r9vghZ+nCO36q4tM9T11kgDwW9/7fMTVYXafZF3YH14nAV t7wBnfQJghQtblSVBUW0+ImPXAT21o X-Received: by 2002:a05:600c:8b6f:b0:485:550c:cda4 with SMTP id 5b1f17b1804b1-485566d9318mr194216815e9.8.1773651363073; Mon, 16 Mar 2026 01:56:03 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4855778eda8sm138525295e9.5.2026.03.16.01.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 01:56:02 -0700 (PDT) Date: Mon, 16 Mar 2026 11:55:59 +0300 From: Dan Carpenter To: OaroraEtimis , Sudip Mukherjee Cc: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com, gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: sm750fb: Replace busy-wait loop with udelay() Message-ID: References: <20260315150532.87280-1-OaroraEtimis@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260315150532.87280-1-OaroraEtimis@gmail.com> Hi Sudip, What the status on a replacement for the sm750fb driver? On Sun, Mar 15, 2026 at 11:05:32PM +0800, OaroraEtimis wrote: > The empty for-loop in sw_i2c_wait() triggers a -Wunused-but-set-variable > warning and can be optimized away by modern compilers. > > Fix this by replacing the unreliable loop with a standard udelay(2). > This also cleans up the unused 'tmp' variable and outdated comments. > Include to resolve the implicit function declaration. > > Signed-off-by: OaroraEtimis > --- > drivers/staging/sm750fb/ddk750_swi2c.c | 20 ++------------------ > 1 file changed, 2 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c > index 0ef8d4ff2ef9..d0aeb917be92 100644 > --- a/drivers/staging/sm750fb/ddk750_swi2c.c > +++ b/drivers/staging/sm750fb/ddk750_swi2c.c > @@ -11,6 +11,7 @@ > #include "ddk750_reg.h" > #include "ddk750_swi2c.h" > #include "ddk750_power.h" > +#include > > /* > * I2C Software Master Driver: > @@ -80,24 +81,7 @@ static unsigned long sw_i2c_data_gpio_data_dir_reg = GPIO_DATA_DIRECTION; > */ > static void sw_i2c_wait(void) > { > - /* find a bug: > - * peekIO method works well before suspend/resume > - * but after suspend, peekIO(0x3ce,0x61) & 0x10 > - * always be non-zero,which makes the while loop > - * never finish. > - * use non-ultimate for loop below is safe > - */ > - > - /* Change wait algorithm to use PCI bus clock, > - * it's more reliable than counter loop .. > - * write 0x61 to 0x3ce and read from 0x3cf > - */ > - int i, tmp; > - > - for (i = 0; i < 600; i++) { > - tmp = i; > - tmp += i; > - } > + udelay(2); What an interesting thing... This function has always been nonsense since it was first merged. The comment talks about the old code which did: while (peekIO(0x3ce, 0x61) & 0x10) ; Which apparently "works well" except that after suspend it becomes a forever loop so instead of that they have this bonkers "count to 600" loop. Your patch looks reasonable, but generally we don't merge that sort of patch without anyone to test it. The problem with merging your code is that it looks so reasonable, that people might assume it's correct. Meanwhile if we just leave it as-is, everyone can see it's totally buggy so when people report bugs we'll know exactly where to look. Sudip was working on a replacement for this driver. Let's ask him for advice. regards, dan carpenter