Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1179954lqo; Sat, 11 May 2024 10:42:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXo6L+SGATZfeQwsbM/YsMn8NMotiS/JZK/vLtIiIwgBKOr3oYTUwqQCa/GGPTQb7M2FMfNM+0DtQNkcLLIVWL3ZQ5uJqwzO7tWNjeC4Q== X-Google-Smtp-Source: AGHT+IEhVMI1htpAM0gho6/480fBmk0lNTVZcnpIHMfYzfsOJrmxOl8TQDH3diZy56094gAVpFSJ X-Received: by 2002:a17:90a:bd01:b0:2b6:208c:2aee with SMTP id 98e67ed59e1d1-2b6c76f9953mr8466480a91.20.1715449325471; Sat, 11 May 2024 10:42:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715449325; cv=pass; d=google.com; s=arc-20160816; b=nXa3IN7DjinaGnTN8V2L2PVfON5cx1H8+i7obQOp9LsL/3YLh5h3mhsmRRjgwerL0I QuRkeLyJ4ZYV14/d7LKdia17dlerZzbFHEQikLEHAnsS2ENae5OceFBb+Rkqb0B+fxT+ gx09sJ4T63jrhHMC0xM6Ajjd6nbSr9Fbzhm0QgAzUhuw88w38C5IHb7cAz/sCp5xKRGT ZMhgRz7LSTXLCr9Us17eHABOnsznIbXXFyHLb3yyySaVGZIRTds7ttN5QCUZ4l89+Qnn b68RV0d++ND73ZHCgRYY5ltlDd51CE0OvZCj2yErT86VizpbUTk07Hox9emkrgvZvyn7 3HTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=pw+ZLlwg2gEIAOR81RylenKik2gTI8uK/0afhU0qznI=; fh=Y2mEylfnpn36F7Ft6rmgNj+Pd4q05WwnNnrCQzlUmB8=; b=KlXCf57FeummAFY3JRQI43Y/uMCnYoBUyEFAo0HVhvAUKA4dN92JGqBMP/+cmGnvQ4 zzjQ7XGe8tgWJbaXpACZUVJ6sdKQxIOHAG48XBk1ps724d5sxsBa3b6lIIJtCKsdk8Yn hu3HB3hzQrccS6PVgcggO5me08NIxJQPc04GPxZ11QfK2FZS9Tr2doe/jnlCg/Kly00Z R+TNZkqk6s06Hs/K8EIaJ6Udo2NmdU8CTSYMVTep//SPU7yOgtCfc3AhoiV+CwxevifR hlPE4aYGvFwj253T2uDo133FkwMHpqmM6Mupvag+PyTn5uO7dDdeNhj9gK/M0KP9ItuO WDtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JJmAY7o4; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-176670-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176670-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b670f58e24si6156408a91.76.2024.05.11.10.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 10:42:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176670-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JJmAY7o4; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-176670-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176670-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9B9C6B212E7 for ; Sat, 11 May 2024 17:41:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 151031C6A1; Sat, 11 May 2024 17:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="JJmAY7o4" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 856C81BC57; Sat, 11 May 2024 17:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715449305; cv=none; b=uUAxh/CyfdpVZPmkRj9dLyAw9VvqNARR8kyxSs5PZi3JnGGEdOmaEMngZ0oPN73wA8wSvoHiHS/+roFT8OR9zGEzBzyvBAay2/qjMqFEXL0Of/6fGCo1mJ4dS7jW2Xb8BKOGl4gz1s5CLOqQWaVJ2AATAXJCoWWUiHAoteZAwko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715449305; c=relaxed/simple; bh=6KRvLIQLEzzBK+9haokroz6XdoCynKq4pJiaIZPv1sE=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=A66Lm25jc55BwXseOD8Ero+hf6/aI7gRe0BPcKwlgDQs5XK0ccax77n2MeRPNvFaW3MEGFtDZU/m5GeszTm4BVObKvB6I74TG8iZY2qcxRgJbBlg5iD6loo1xW7bV1ZJuHw79octhi+7uwE3NUQFqfiPQIadPuLBEtYO6h9gmKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=JJmAY7o4; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44BHfOVn046086; Sat, 11 May 2024 12:41:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1715449284; bh=pw+ZLlwg2gEIAOR81RylenKik2gTI8uK/0afhU0qznI=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=JJmAY7o4ILxTILk9xDc/hAw5+rKI0inDe3EPepH4qYO9pFQDa6cURdbY3LiK7g+ph TKVhquIVNyXeaqtHiYjxwhqjZfgjLYSS7xQ/MC3NmdEAWbf7Gkbl7lSsrk/L7Z4L1H CyTxYAP91Q+Rkdfnalzkev+px1YvmgYFGGu86qFc= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44BHfOMP025733 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 11 May 2024 12:41:24 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sat, 11 May 2024 12:41:24 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sat, 11 May 2024 12:41:24 -0500 Received: from [10.249.130.181] ([10.249.130.181]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44BHfEjI022895; Sat, 11 May 2024 12:41:15 -0500 Message-ID: <5ebcf480-81c6-4c2d-96e8-727d44f21ca9@ti.com> Date: Sat, 11 May 2024 23:11:14 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 6/8] math.h Add macros to round to closest specified power of 2 To: Jani Nikula , Andy Shevchenko CC: , , , , , , , , , , , , , , , , , , , , , , , , References: <20240509183952.4064331-1-devarsht@ti.com> <87fruphf55.fsf@intel.com> Content-Language: en-US From: Devarsh Thakkar In-Reply-To: <87fruphf55.fsf@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Hi Jani, Thanks for the quick review. On 10/05/24 20:45, Jani Nikula wrote: [...] > Moreover, I think the naming of round_up() and round_down() should have > reflected the fact that they operate on powers of 2. It's unfortunate > that the difference to roundup() and rounddown() is just the underscore! > That's just a trap. > > So let's perhaps not repeat the same with round_closest_up() and > round_closest_down()? > Yes the naming is inspired by existing macros i.e. round_up, round_down (which round up/down to next pow of 2) and DIV_ROUND_CLOSEST (which round the divided value to closest value) and there are already a lot of users for these API's : linux-next git:(heads/next-20240509) ✗ grep -nr round_up drivers | wc 730 4261 74775 linux-next git:(heads/next-20240509) ✗ grep -nr round_down drivers | wc 226 1293 22194 linux-next git:(heads/next-20240509) ✗ grep -nr DIV_ROUND_CLOSEST drivers | wc 1207 7461 111822 so I thought to align with existing naming convention assuming developers are already familiar with this. But if a wider consensus is to go with a newer naming convention then I am open to it, although a challenge there would be to keep it short. For e.g. this one is already 3 words, if we go with more explicit "round_closest_up_pow_2" it looks quite long in my opinion :) . Regards Devarsh