Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4518983ybb; Tue, 14 Apr 2020 08:50:44 -0700 (PDT) X-Google-Smtp-Source: APiQypJyiFvlUtKq5UhgKD7sojMQrf20NVnCVc3Cm4ZWFhuOS1/AViEC8+9aG/NoTR6jEIdPbX50 X-Received: by 2002:a17:906:6845:: with SMTP id a5mr725641ejs.143.1586879444309; Tue, 14 Apr 2020 08:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586879444; cv=none; d=google.com; s=arc-20160816; b=CclnqNJSCvKyAy+/Dm+YhDsyNC5BRrgyvNwt2lvzd2uS2Hcmsp/EZ/LIz0bjBK7Qmg C79T3DWrjlO8fTVY6VXYYPUedp1NKZy0/B3Fj93PdZQyFUKV0263zkdbQd7Hy/lLrWOJ MBKu4e1/vQalMJi3y32X5mEQho7KyPKs++As1HUBK73jtkl5ZP0o/r33wE9ffs+wE/ii 7kcbID4ib0/D/b/UccuNnnhCBkBOGCO+RXMkDW9dLdNzgbQKy0J14GmgrbImmtI9g3rv 2PUmzpEzWps6vxPv3DJNBCMi7zrS/BjlndBYMRQhvqjJiyzyYGL5mttsyQoHzDKug+LR xzDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gatGl3cXyXLavzUnNcCzXYbQt7xdiunM/YVOCfb2tV0=; b=k8ft60dBLsgGLX7Ki5AwAL/+bR6lBh9iTQaVGcOQS04cw6Hw/mFU8eKg1BvqEEYDT+ lUdLuErRjTn35mJ2g/n5qzAkneQtTNNS69wcJdBDTANJ9RFnH7d1V5Fe5/V1tia/mYjS 8WhDjG74vE+uD45sm3sspwTzvXaqD6/j/RvdsaWl/AesNk/9OW+zgGCEQtAFOyx0r9Iv 4Ng7cid87BeKE4F5wL02HyRmjdq51uz5i3m56XMvNCNbESNgwEBu6fMrMUVPJZvlCwOG IMBTNTYO3hQEPOH6U1LprJSvHi2qBYoINtp4w/P/om0N02mRGkzmSf9a1JROkuJs8R8/ Dnlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=hYCUF+Lr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si2562026edr.528.2020.04.14.08.50.19; Tue, 14 Apr 2020 08:50:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=hYCUF+Lr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731836AbgDNN2n (ORCPT + 99 others); Tue, 14 Apr 2020 09:28:43 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:58044 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731898AbgDNN0H (ORCPT ); Tue, 14 Apr 2020 09:26:07 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03EDO5UW043642; Tue, 14 Apr 2020 13:26:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=gatGl3cXyXLavzUnNcCzXYbQt7xdiunM/YVOCfb2tV0=; b=hYCUF+LrRDOfYKEY32wyv0mlGa/Jg4YKSL4HygoQ2650pcI7mMZ2UAKoZcbyU7zi4ltC 1nFIdXP7YNr+RcQ+cOPtdsOnpzBQKQjcmWe8Svvz1aNpe15Po3rhSc2WLnQGx/eUk+bJ k62dcz8aKQ7TDKz4g+QsGHswgU06ZFQSlVMotzspusEyly1IHKkqeY52pTZ69VbFs+kU z/TetCRr6C0M6qWwfZzuinuo1mpOk195dGqkTivLEqt1KdvyJKAXEfpePrrVH+/m2m7x ULp9pGwqBEkPrynPFIJWfCbg3gLBPKh/flQ8OwFh+/rHMyMVOBTyT8koVioRA5g1rLB7 8Q== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 30b5um4n05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Apr 2020 13:26:00 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03EDLlFB177137; Tue, 14 Apr 2020 13:26:00 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 30bqchndks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Apr 2020 13:26:00 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03EDPwi6019231; Tue, 14 Apr 2020 13:25:58 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Apr 2020 06:25:58 -0700 Date: Tue, 14 Apr 2020 16:25:51 +0300 From: Dan Carpenter To: Ivan Safonov Cc: devel@driverdev.osuosl.org, Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , Nishka Dasgupta , Larry Finger Subject: Re: [PATCH 5/8] staging: rtl8188eu: Remove function rtw_modular64() Message-ID: <20200414132551.GJ1163@kadam> References: <20190712071746.2474-5-nishkadg.linux@gmail.com> <66fb1e37-107e-54f4-4986-ca4e4bb99d2d@yandex.ru> <20200414115604.GF1163@kadam> <20becb6f-7bf6-8618-9525-b64c226088c7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20becb6f-7bf6-8618-9525-b64c226088c7@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9590 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 mlxlogscore=999 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004140110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9590 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1011 bulkscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 spamscore=0 suspectscore=1 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004140110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 14, 2020 at 03:22:59PM +0300, Ivan Safonov wrote: > On 4/14/20 2:56 PM, Dan Carpenter wrote: > > On Sun, Apr 12, 2020 at 04:34:08PM +0300, Ivan Safonov wrote: > > > > Remove function rtw_modular64 as all it does is call do_div. > > > > > > This is wrong. Macro do_div(x, y) change first argument x, but > > > rtw_modular64(x, y) preserve it. > > > > > > > + tsf = pmlmeext->TSFValue - do_div(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) - 1024; /* us */ > > > > > > rounddown(pmlmeext->TSFValue, pmlmeinfo->bcn_interval * 1024) - 1024 > > > is a better replacement for > > > > You're absolutely correct that the patch is buggy, but I'm not sure that > > rounddown() is what we want. > > > > rtw_modular64() took the MOD of x. So it should be something like: > > > > tsf = pmlmeext->TSFValue - (pmlmeext->TSFValue % (pmlmeinfo->bcn_interval * 1024)) - 1024; /* us */ > > > > But what the heck is that even??? If pmlmeinfo->bcn_interval is zero > > or one then the subtraction ends up giving us a negative. > > > > regards, > > dan carpenter > > > > 1. pmlmeext->TSFValue can not be negative, because it is uint64_t; > 2. pmlmeext->TSFValue is cyclic value: > https://en.wikipedia.org/wiki/Timing_synchronization_function ; > 3. (rounddown(a, b)) is equal to (a - a % b) by definition. Yeah. You're right. I got mixed up and I misread what you were suggesting. tsf = rounddown(pmlmeext->TSFValue, pmlmeinfo->bcn_interval * 1024) - 1024; regards, dan carpenter