Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4497230ybb; Tue, 14 Apr 2020 08:25:52 -0700 (PDT) X-Google-Smtp-Source: APiQypKEcbvsCw8PDbxniUpQxMMK+ios9VEFDBxz4OkArJdyrOqJKKNjpngU4ZXoLEcvI0Q63ZS1 X-Received: by 2002:a17:906:130d:: with SMTP id w13mr598537ejb.253.1586877951905; Tue, 14 Apr 2020 08:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586877951; cv=none; d=google.com; s=arc-20160816; b=rYqFj2M0Ekku5kNJpJgf3N/RGfB1Qs4mjiAb5hYaX81zAMYpAZsLLosoKUXQNZI/0m X6PP8h0lBPLm6cPNdhdNDG/GKNkzdNfEwjdc7MXScT6za7WmTL0tXiXrRc4eFw9Dh+ha RWw0bW0kMGdRnRUdZ+GqHMCHjhOzj7o2ifJPaWEa3N/7ofx9GiKNnfzWYZrJu0vqfvG1 X/hRwtszHymOsIMuXCrMFLxLvjGeasllR84hKBo3rxR0SiDdjrBtXtKSinYtjr5GJGjI BKc+CMjc+9cIrl46ojEK/SYO1TXTezzn9yJKRRMh+EfV4YK/d0IlbXwPxZZ13YL4Ld0d tyXg== 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=FHLWQFpis8qC0ost0GJpkrUK3UmvMx3TtVVZsTxGv0U=; b=U63adFtDKh/jNAfDxb+KugEJJcsMN0pR1X7sEP9Eg8w+HyBwmmx1YySvklrfTT9bHq MbwYJjuHBdxbFSg4EMMA5SZvCwnBgWovXmGZ57vK2Y9rOC7Eb/U6J/Ov+gCVWg5N0jz/ DxYjrlAK6W5NSmsvPnR0b9XTdpcFDB6n+cnzbEC75FHVVuwT2SV/OkTgl9XTIPQiEBL0 BLz/YR2FQDyDFeDuo13wtV+iH3vQK3kUXgaMHcYVwIsxRwyoOVNygP/jS14YOdZOi3z3 wnCcD8gpJ5fQL5gtLSoTnFnbZkNGgpdXIiDkFRCh0frI7k87cvduFqopgeoC/z9lRsl1 4dWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="cMRgeWs/"; 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 z5si9904934edp.102.2020.04.14.08.25.28; Tue, 14 Apr 2020 08:25:51 -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="cMRgeWs/"; 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 S2439728AbgDNL4g (ORCPT + 99 others); Tue, 14 Apr 2020 07:56:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46136 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439721AbgDNL4X (ORCPT ); Tue, 14 Apr 2020 07:56:23 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03EBmdm8015076; Tue, 14 Apr 2020 11:56:16 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=FHLWQFpis8qC0ost0GJpkrUK3UmvMx3TtVVZsTxGv0U=; b=cMRgeWs/2IvX4EUo3a/Lvzs1QAww3YiHVsDUnb7nUtGaieQCbJ+cDRNcPdqqreGvcvNY iy6hcoXcGVx0N7b8HdF6eaywud0fc1sPgEx66gnVpMlwy0qj74K2MEdbBiSm8szKsdBC tOUMKetRp4kjYsB0NoHy+Djxsj/nzGPQHSIn3NmAnkVuGeDYGaD/ORbZtyA1lFkn/I3u mcb4s7GhnSXvYe0U0qfdcYeY1jUuj/nzAo5rlQAotADyVg6Jv3nlumq7F/l1/cs6AEBh 0M6blAkcalb8/xm1hs9JdKz7n7lJe4VxRQURar1Uh/ufc+JfMmpfXGVWrjbUgZLrlLH3 2A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 30b5ar42t8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Apr 2020 11:56:16 +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 03EBliJY083552; Tue, 14 Apr 2020 11:56:15 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 30bqchf63b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Apr 2020 11:56:15 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 03EBuCNt014251; Tue, 14 Apr 2020 11:56:14 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Apr 2020 04:56:12 -0700 Date: Tue, 14 Apr 2020 14:56:05 +0300 From: Dan Carpenter To: Ivan Safonov Cc: Nishka Dasgupta , Larry Finger , Greg Kroah-Hartman , Michael Straube , devel@driverdev.osuosl.org, "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 5/8] staging: rtl8188eu: Remove function rtw_modular64() Message-ID: <20200414115604.GF1163@kadam> References: <20190712071746.2474-5-nishkadg.linux@gmail.com> <66fb1e37-107e-54f4-4986-ca4e4bb99d2d@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <66fb1e37-107e-54f4-4986-ca4e4bb99d2d@yandex.ru> 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=18 mlxlogscore=822 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-2004140099 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9590 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 impostorscore=0 clxscore=1011 priorityscore=1501 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=890 suspectscore=18 adultscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004140099 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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