From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 9111F2E11D2 for ; Tue, 27 Jan 2026 17:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769535584; cv=none; b=fxe3CtWR7puRmgVrz2tMvpvzmRdwwpPXTAiFK21v2/nw3FC0G74of1d27l+bmGbH4WUCEGoDPdzOyFP8Xe1+GCaa4GS6MHFtoXo5cmsfENlCpm+bF6JbIVhmu6PrIiy+zMXSABNLz6+F0g4d72To7IRJUrrfznrzqOPcC40ATlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769535584; c=relaxed/simple; bh=285wXAUAKukpPV13c4TnQrN++LpdmiJbKoWO+put4jo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j/zzsGv7OlhiVc0WPVmkGclAMxpkvzY5dHYNmrc2k/b7umW+0PJOmUjD77xn/XNj0lT1Kwam2Xv74aiQgEMsw+kFHFvQwYMO7/uA6yoYEXXpN5SGL95YtWmqfhmyGuz3Djt+pMotilfOflDtgybPlwNhduDKB6Fzfv9qdOlQ1x4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JfAx07Hx; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JfAx07Hx" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-432755545fcso4472971f8f.1 for ; Tue, 27 Jan 2026 09:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769535581; x=1770140381; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=syfA3BkKAIe5vn02Wihs7fQFdQwNkyJZbjNriJ6lerQ=; b=JfAx07HxwoZpXiyRw3BxRFloT9+ZE0W6l8xXk+FTEKzk8l8l8AmeefY5Go9xP6yiCL 5kBeBa5ek8wgbbTNuDcelBh2OUqNv0o4mPONpMe9sQfMBib2ZJ+uVwxonHbbC1xP6Sdt HdAwlkDR5xT5e8IkyI/Yo4E3Zupylrv1EO4T3e1AJuOTtr4W0qdR4HmoGs8coFXpe1Mx Yrr9pzHPWtmEiUcIvvx6Gv0ycCpz8iHmmFtO35d1Y0WODRJLllin94JvqFdjAEADQYDD bpq1yfhdhsdGdlEpRf1hPPz0VP1xyUB6SvbECIvpydCTzAeYrGEdrZY8c8U8h1CufpjV gYwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769535581; x=1770140381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=syfA3BkKAIe5vn02Wihs7fQFdQwNkyJZbjNriJ6lerQ=; b=JGPr9Aca8Y6I+2FaHEUOy+BGTR23xvcn9uljXjXcX5+HFDLIvAQjbUVL1lzUJnoRdQ wVJlYNri780zj7wCadgegcQVUTsYf9BdbCWBiNPY+B1HInGaVPE3iRx/v8jr5wJpEDfW LVSqeiuzdyIMzwVy9h6lMs1YBREcdG2wi9cBdQtwud01xsQWN9NofMzTpdUHiQXhQEkk c9H7KyfwXgezIVlLSPiVGhBnkunAJ3A7mXqNXXTV9lIThW6X+UwsSgkIfUfux3C8WOQT y+PpmLPgz23bMeSn5DMrYXGzM3RO2GRngcVUDotuv7buYaUEzDHAP+VPgmwkFR4IRZ+k gunA== X-Forwarded-Encrypted: i=1; AJvYcCX4Anzplx9omRRh8kdIzpQUxm+ec9zjQhiiGgT3bMkeE42as+l1r5YwkP9JhbeCytQPn5C/aWy4r3YvOl0=@vger.kernel.org X-Gm-Message-State: AOJu0YxFDqqSsyMc3VwlLeaLaxMAXtoFNS85z0v4WXsmXVwsqqNFOwCm uwm68R2Ef3VNcNUvpT1mcCZ+vknF16cu1I6zgXBpo4kvb8Bpi/AZszkE X-Gm-Gg: AZuq6aKkk3vPCOZqppzdPosUvzWC2ZdCXq0BjU8+uZ/kScjQD8ITIKrW0iLzOllIn2p OBChLVL5O4IW4k1GfmEq3MlzYAcUERQnv3uZhyGG3nhO35CJ6b5XRTQZVBJeOOtYKVmFoZxd2vJ F/m3H2CQx3ALe6em7NTjvUzKTUDpqgn5GxTmpO9H4H/R3GMm5zA4zzGB4QcV7lAeNWYFol4VaEB P0kL70xW9bbu9n16fjMftxpEPHkFbZBI6K5ltQOtU8ijpURgGI91pE/XKk+vB56+syObvlJB8BI svcmXcCNJYagAXQCAuWwKjdY5tb/uQAhtFaCdoo+krbusj5UDndLQD3acyAPRGkHN/f1rkCEsdb lE/Saz/8JaBb8qJxDuA9oFIMcASbBuNyOpYMYsReehoCY8cHHzhUU+bw/08V3hDZkc6igal2nIH bHW0lLNgl8Fnu5lRZFTvevnONnQSD2K72zVwnNOa2//YVxU2KUogqh X-Received: by 2002:a5d:5f88:0:b0:435:a647:a3c3 with SMTP id ffacd0b85a97d-435dd073c0fmr3746612f8f.23.1769535580531; Tue, 27 Jan 2026 09:39:40 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e132356dsm335609f8f.33.2026.01.27.09.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 09:39:40 -0800 (PST) Date: Tue, 27 Jan 2026 17:39:38 +0000 From: David Laight To: Andy Shevchenko Cc: Jani Nikula , Cristian Ciocaltea , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sandy Huang , Heiko =?UTF-8?B?U3TDvGJuZXI=?= , Andy Yan , Louis Chauvet , Haneen Mohammed , Melissa Wen , Robert Mader , kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, "=?UTF-8?B?TsOtY29sYXM=?= F. R. A. Prado" , Diederik de Haas Subject: Re: [PATCH v5 1/4] uapi: Provide DIV_ROUND_CLOSEST() Message-ID: <20260127173938.314d922c@pumpkin> In-Reply-To: References: <20260127-rk3588-bgcolor-v5-0-b25aa8613211@collabora.com> <20260127-rk3588-bgcolor-v5-1-b25aa8613211@collabora.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) 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-Transfer-Encoding: 7bit On Tue, 27 Jan 2026 16:38:00 +0200 Andy Shevchenko wrote: > On Tue, Jan 27, 2026 at 03:58:13PM +0200, Jani Nikula wrote: > > On Tue, 27 Jan 2026, Cristian Ciocaltea wrote: > > > Currently DIV_ROUND_CLOSEST() is only available for the kernel via > > > include/linux/math.h. > > > > > > Expose it to userland as well by adding __KERNEL_DIV_ROUND_CLOSEST() as > > > a common definition in uapi. > > > > > > Additionally, ensure it allows building ISO C applications by switching > > > from the 'typeof' GNU extension to the ISO-friendly __typeof__. > > > > I am not convinced that it's a good idea to make the implementation of > > kernel DIV_ROUND_CLOSEST() part of the kernel UAPI, which is what this > > change effectively does. > > > > I'd at least like to get an ack from Andy Shevchenko first (Cc'd). > > Thanks for Cc'ing me! > > So, the history of the DIV_ROUND_UP() to appear in UAPI is a response to > the ethtool change that missed the fact that this was a kernel internal macro. > Giving a precedent there is no technical issues to add DIV_ROUND_CLOSEST() > to UAPI as proposed. Main question here is: Does DRM headers in question > (that are going to use it) really need this? My 2c... And is it actually going to 'clean compile' in userspace? The tests for x < 0 are very likely to generate warnings when x is unsigned. It is hard to avoid those in the kernel build, never mind some 'random' userspace build. I'd have thought that the only reason for any of the kernel defines 'leaking' into the uapi headers is that they are used in other uapi headers for constants that programs need to use. It isn't as though it isn't hard to write something that will 'do the job' and in a place where the definition will be found while reading the sources. Even just 'hiding' the definitions the kernel itself uses in the uapi headers doesn't really help anyone. David