Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1423366pxb; Thu, 28 Oct 2021 03:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyNJwFGiQvSt+Yi6v/v/YlbO1e2dO5O/JO6TqOnb0s4+sQDQWiVtmxPQDnbUMMy+H29kWO X-Received: by 2002:a17:902:b583:b0:13d:e495:187a with SMTP id a3-20020a170902b58300b0013de495187amr2933888pls.9.1635416891281; Thu, 28 Oct 2021 03:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635416891; cv=none; d=google.com; s=arc-20160816; b=NApg3ANIoe9QSDLhmLlJv02phj3G7bTQ7msXRBnhoKTCuTj4rv5wRp6GuKgVxqUbTm mtNdEOZpKcIM8BkKaQow+lOOPTg4sojxGvjK7bVMtEBVcUGZ3I0uyQTFLN9SzowjgcZ9 CwYSMvWaalZeJgY4QzLKzs+aaO0T2JTSBgTOkcsHRxq7vQFmZ4CDc/SH6AM23Xee2Upy Ze96OFDsbM+e06Br5P7UAmxudQYclJ4cmK4tk48b0RSFE2uaO+PP5vMdkBbu5Wetn0X8 va77IoU2WoUCkeOszBcK7tb8zC58GEfJbiAOnM/3vRLU9n8W+Y+U81NRoy3yEizas467 PwWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=x5pT//UQaL7euDOvojBQvZaQtog7UFRTQVBLvvJ8oFg=; b=ZkQ8P7iuHwx7qFtqKUTBVogBZvEeObYWUtvRdnK133HZaiwjPauWv0NJYKGx77YeWA xaBA/ODE+VdZGpkL7R2kRU8kgVzD0EI3s8PHVeRWGjnm3fsWrXsddSgCbdBQS1/z6khM /YC3ZbYhRqmNJXdnSCtCPVn+YItJojHN3xuxf6c4ad0fsnvIu6fFgsC5Ckux/1G2d4OU /TzlwcDw0919zlgU8GjvUcNjk4wxZJZvvsWidJ+baGvpeEave4EWCnIUmkENQXy7oqEw 63BAmL9sb8ONXt4LzX2BuoaB6pcbij9z5FeTQB5NXcUmBJGhztOI8jh3350D3wAFnWt8 5pKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=M+fk3xpP; spf=pass (google.com: 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si3446354plg.285.2021.10.28.03.27.59; Thu, 28 Oct 2021 03:28:11 -0700 (PDT) Received-SPF: pass (google.com: 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=@gmail.com header.s=20210112 header.b=M+fk3xpP; spf=pass (google.com: 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbhJ1K3M (ORCPT + 99 others); Thu, 28 Oct 2021 06:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbhJ1K3K (ORCPT ); Thu, 28 Oct 2021 06:29:10 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8257AC061570; Thu, 28 Oct 2021 03:26:42 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id w15so22802303edc.9; Thu, 28 Oct 2021 03:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x5pT//UQaL7euDOvojBQvZaQtog7UFRTQVBLvvJ8oFg=; b=M+fk3xpPH0QNFxXsT3zunN3ji29hRoUJpjXF7HyNe2bKWAEbx/T00ytqSdvn3TierB 4P4WhavE47ghsinlNHMjzSgCIFLuul5GnqmDZ4p7q42TelA1Fxr0F9U1ijCFNrIMITb5 qFuRLlIEA7G/3fpj50tdQ0OlO4vJVzvNeqR56I5DHe2aTx9M5joAP+3fpS/SoGAwQRG2 a/wh3o/I4vnva9RH7EGTcDcpGVCUX0CssvcDaYfHPO/b5kRk1Kq5TJH0xGL5kpicXqSh mzvFrP7tqKEu8RzPCdMWMhghfBxZNtGEmcnZy/ax4G/RqcCOv+10d9yVcXiM1iFw0RqH KqpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x5pT//UQaL7euDOvojBQvZaQtog7UFRTQVBLvvJ8oFg=; b=BltHuszqOb7V3Tmw9RAyCaciqoRNm74ZO+8bu2PMlHpzs6EB/E2sPrDD90HQZsqpnE Her/ycX+uq1OB7NzftfItRwN3JGJdTkohhIdd8Y4N4CEx9QoVFuJtkTPN7gd45P/z3Ga 5rRYl3cTlRVG/CzDZNUtBCjUAy5RB2oRdYNEZSPdg+F6qwRnyz+7EPwRo0y5Hh7anAmr qCo5sx/8yyDo9x7iVMXp6AmpEXVz3unaMHmJIL5ERfZM6jfOTBGgi0ckcs+Tog0G6olC Mt8B7o8RJ0VMGOAHHMwMHGlJxdlcDaET1NNV7aa6f6pMXOlQC1KV/ho9Ex3eOqkbPYc6 ZxDA== X-Gm-Message-State: AOAM5314fgCTs4wqF6yG3uogRKKv7GkuKgktGbU+7t1HJZmz0cykoPnB g1f6Yf3yce4GTdrZyA74SySh9eLt1Ta9+ehBvso= X-Received: by 2002:a17:907:7601:: with SMTP id jx1mr4246924ejc.69.1635416801123; Thu, 28 Oct 2021 03:26:41 -0700 (PDT) MIME-Version: 1.0 References: <20210715141742.15072-1-andrea.merello@gmail.com> <20211028101840.24632-1-andrea.merello@gmail.com> <20211028101840.24632-2-andrea.merello@gmail.com> In-Reply-To: <20211028101840.24632-2-andrea.merello@gmail.com> From: Andy Shevchenko Date: Thu, 28 Oct 2021 13:25:48 +0300 Message-ID: Subject: Re: [v2 01/10] utils_macro: introduce find_closest_unsorted() To: Andrea Merello Cc: Jonathan Cameron , Mauro Carvalho Chehab , linux-iio , Linux Kernel Mailing List , devicetree , Lars-Peter Clausen , Rob Herring , Matt Ranostay , Alexandru Ardelean , jmondi , Andrea Merello Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 28, 2021 at 1:18 PM Andrea Merello wrote: > > This is similar to find_closest() and find_closest_descending(), but, it > doesn't make any assumption about the array being ordered. Macros in general are not so welcoming. Why do you do it as a macro? ... > +#include Wondering if the current header misses other inclusions it's a direct user of. ... > +/** > + * find_closest_unsorted - locate the closest element in a unsorted array an > + * @x: The reference value. > + * @a: The array in which to look for the closest element. > + * @as: Size of 'a'. > + * > + * Similar to find_closest() but 'a' has no requirement to being sorted > + */ -- With Best Regards, Andy Shevchenko