Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3609791pxb; Mon, 30 Aug 2021 06:33:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQVcW92oLacruMEUcf8hnggAqFUguMeO9HqEldywgoawic2QYI1IwCec7uxzpDygK9ZX0A X-Received: by 2002:a5d:9253:: with SMTP id e19mr18699144iol.35.1630330428836; Mon, 30 Aug 2021 06:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630330428; cv=none; d=google.com; s=arc-20160816; b=E9u12nlNyPqCjGUi0tnlDesvq3Ky4NTyAY4AXWJDZUTQADXv+1WsyA7quFOSxDKnav csjHE7pf9YSZ/SLPpXEBgDsEVC2ssa7e9SQJni+HkdHKz9cs1zOhuigKiCGoDW63zAa+ kVDXvWFTs89JXCu80PSmU2NNOEcspwE74Xko5fssbJMVOJCO9K7UokQlPeZYdqBk9BVv 0h1i2IlWiqLM82xb+ecI9r/xoLYox7dPMWSkFbPpz+SmVBRK9YldVYIqONf/2nMKy4gS XMaYcd0o2pEw0bpIcI7ZEarl+0KyOmwFnNqOGyLtNkb7ZsqvtP+4tlea5mP1/tJDH61k qUxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0b2bACrbkRgqXKSLRsO3xPG2XcgJcietDNrkF4NIru4=; b=Ys37Mh38RIhUUNBrlUk+x1cegEEeiglsYa4dTQ6UzOA2FhJ0bhIqrzmyjn4VOgDcb8 DqHVfu8A10Byv74a2PsepmvxXZiSX6fIqGs3bS101x1LKbDLyVG2DtTMECEzecwFtc59 heyxCCcAEh9FiDOrOMRa+u4DYV5EXtBIMsESte1q4RsPCfvUgqMVtwgraDdu5LGuVDEN Bn7QHKYlYWWj87QlXM5ygYyGydSaAOB+klJWBE10Hox23+V1JA5pW5IIj+OCrbhboJe6 y8xURGWYFXw8tKB8LYDbge7tV9VuR+rqqKHOhsKSA8qi8XeYq32MXly2py0N/PgCNmxT 3TOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vqKcoWTp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c203si16683882iof.54.2021.08.30.06.33.35; Mon, 30 Aug 2021 06:33:48 -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=@infradead.org header.s=casper.20170209 header.b=vqKcoWTp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236718AbhH3Ndo (ORCPT + 99 others); Mon, 30 Aug 2021 09:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235904AbhH3Ndo (ORCPT ); Mon, 30 Aug 2021 09:33:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D14DC061575 for ; Mon, 30 Aug 2021 06:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0b2bACrbkRgqXKSLRsO3xPG2XcgJcietDNrkF4NIru4=; b=vqKcoWTpWzSksmiSAob/yn0ffG ON8YROPlWBCETSc/a6g51qeGA/Nwvs4NT3JT8SInooXFbhrgDK55iHtiRdjRzVF9FjJ3iPL0NYkQx Zj0zsIGBCCAJCctuTc06DceStTGXymvZYmPs5URd2MWWv7wHJYACYTpBJl7gL/644OhgJzyCT1cWy G8Vhyguzo2ICEgLHfn5ZntAlFwmiPnBpEaa/dxqfz2MX17ZScwYAjBuGzY8l1MaI1xHdE5D8nT6qj O68ANZujWlKc+Mf/FHYL0f4ZNTAc7DlkUga3/+qq9Wul83UtAkmBye0cQ5bpukVhamjaX4DyH8V/k VjamtLpQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKhNv-000BbN-OP; Mon, 30 Aug 2021 13:32:02 +0000 Date: Mon, 30 Aug 2021 14:31:35 +0100 From: Matthew Wilcox To: Johan Hovold Cc: "Fabio M. De Francesco" , Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] staging: greybus: Convert uart.c from IDR to XArray Message-ID: References: <20210829092250.25379-1-fmdefrancesco@gmail.com> <2879439.WEJLM9RBEh@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 30, 2021 at 02:33:05PM +0200, Johan Hovold wrote: > On Mon, Aug 30, 2021 at 01:16:07PM +0100, Matthew Wilcox wrote: > > On Mon, Aug 30, 2021 at 01:52:48PM +0200, Johan Hovold wrote: > > > Whether the API is better is debatable. As I said, almost no drivers use > > > the new XArray interface, and perhaps partly because the new interface > > > isn't as intuitive as has been claimed (e.g. xa_load() instead of > > > ida_find()). And IDR/IDA isn't marked/documented as deprecated as far as > > > I know. > > > > I can't just slap a 'deprecated' attribute on it. That'll cause a > > storm of warnings. What would you suggest I do to warn people that > > this interface is deprecated and I would like to remove it? > > I'd at least expect a suggestion in the IDR documentation to consider > using XArray instead. Fair enough. +The IDR interface is deprecated; please use the `XArray`_ instead. Just running that through htmldocs to make sure I've got the syntax right, and then I'll commit it. > > Why do you think that idr_find() is more intuitive than xa_load()? > > The 'find' verb means that you search for something. But it doesn't > > search for anything; it just returns the pointer at that index. > > 'find' should return the next non-NULL pointer at-or-above a given > > index. > > We're looking up a minor number which may or may not exist. "Find" (or > "lookup" or "search") seems to describe this much better than "load" > (even if that may better reflect the implementation of XArray). It's not the _implementation_ that it fits, it's the _idiom_. The implementation is a lookup in a trie. The idiom of the XArray is that it's a sparse array, and so it's a load. > And no, I would not expect a find implementation to return the next > entry if the requested entry does not exist (and neither does idr_find() > or radix_tree_lookup()). Oh dear. You've been corrupted by the bad naming of the IDR functions ;-(