From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39902C001DE for ; Fri, 4 Aug 2023 04:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233330AbjHDEHb (ORCPT ); Fri, 4 Aug 2023 00:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233110AbjHDEHY (ORCPT ); Fri, 4 Aug 2023 00:07:24 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861AF3C28; Thu, 3 Aug 2023 21:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691122042; x=1722658042; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Nct1OPaQWyF0NLQQ6u7Wq7eG9CS3igaS6y0hh8xq7cc=; b=P+mTRk0pXznlqitB1u0k4IgWqFzHW6Q69Y7LD1EgJiZ8s32Wnp8jexBh Q6npLYLmmP8Zcu0bFVOGXi0sO06FlbQ9qliXd2+TXhQ0CA0Jr4qf1QaRC EgHc8X+NyeUeWym7wWggt60pVhftfk+EEQA3d1x1JezGZM60vivSeIlu/ CId8NjVOlGe+KCrhctoIsk5z8z5NikS9P+c7dIjCrcxzn7Gms3NCjzjPE fQrBvR3KjCSkL3CO0XxZ7JzWT7pCCc2z60e9Y6DVv4zTKaNiQOxWePeQS Oaxvh5VVxvvBYG6abP4ob7hwKQRoVC30JXaN74Poyk6wZTevn0Kxx3mIb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="368962279" X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="scan'208";a="368962279" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 21:07:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="679758521" X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="scan'208";a="679758521" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga003.jf.intel.com with ESMTP; 03 Aug 2023 21:07:16 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qRm5q-008pgS-0y; Fri, 04 Aug 2023 07:07:14 +0300 Date: Fri, 4 Aug 2023 07:07:14 +0300 From: Andy Shevchenko To: Andrew Morton Cc: Jani Nikula , Imre Deak , Philipp Zabel , Andi Shyti , Jiri Slaby , Greg Kroah-Hartman , Alexey Dobriyan , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-fbdev@vger.kernel.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Helge Deller , Rasmus Villemoes Subject: Re: [PATCH v4 1/1] drm/i915: Move abs_diff() to math.h Message-ID: References: <20230803131918.53727-1-andriy.shevchenko@linux.intel.com> <20230803102446.8edf94acc77e81ab2e09cee3@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803102446.8edf94acc77e81ab2e09cee3@linux-foundation.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 03, 2023 at 10:24:46AM -0700, Andrew Morton wrote: > On Thu, 3 Aug 2023 16:19:18 +0300 Andy Shevchenko wrote: ... > > +#define abs_diff(a, b) ({ \ > > + typeof(a) __a = (a); \ > > + typeof(b) __b = (b); \ > > + (void)(&__a == &__b); \ > > + __a > __b ? (__a - __b) : (__b - __a); \ > > +}) > > Can we document it please? > > Also, the open-coded type comparison could be replaced with __typecheck()? > > And why the heck isn't __typecheck() in typecheck.h, to be included by > minmax.h. > > etcetera. Sigh. I'll grab it, but please at least send along some > kerneldoc? Sure and thank you! -- With Best Regards, Andy Shevchenko