Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4294697pxb; Tue, 31 Aug 2021 01:20:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU3/wtBHs87EYQJiGMIQcecF9fw3cgvEIsPTWIUrdAzldBjzn/Rs3tGjTaHIRVaZzIIa6i X-Received: by 2002:a17:906:3146:: with SMTP id e6mr29331672eje.296.1630398058135; Tue, 31 Aug 2021 01:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630398058; cv=none; d=google.com; s=arc-20160816; b=UzfGwty6pLQC53scw/RR2qEqhZfBRvgYgyB706J1ZsXSO/1U3zu13GadpZCC8MVbYM cwssbq0McJs0AymK/S3Ih00+fBHODJZQqqbb/U8K59Xd7chKa658gfkGj71E9gRQAv/e fcI8IScoT3lQfgCO7MpL0J/3UCYbZU7bXJZWeJQEbJ1p34/Q3vYizmU+84rUqx1Zgkjs R07Kg7bCy+6pmHjXKZvK741g+yqfaZqYQDTAUFh95AHIEvIe0QflAIuyKPKHjjpjkfP3 jGtvgfBdDkAnCFOZCuWuc/OKqIVE40zQxS0yGvLO3uohfLfHe2r0L6LZojo4oMoBCYuk Vhqw== 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=AfGrY+Z0HddbIavvmguwaCqULHDJqlaJHhofhZDVqsY=; b=GrYHk4SeDOAUkV/inF03QJ226Ca6HK3Po0xIPy7HD59KxdrNuIf4Rkz3gzbk1CI+lF DvlWP0Q5WKCurlt2bUj4naguim73a4LfQqlwNnmB3SsAti3jDOFdHF6mNktsQ4nnfEic Qte2dLzG14t/5jdEoZdcKXiLoAEeLVRZ+dG3AMczr4Icci92f8PoGYIzlnAoJqWCGTgC jKaptSAVnVhrusvse9bg/szrIMDklBxZHS6fuXNHkGIuHCnxCmgK4hx1EVRxFuHfwEzE /8vtJ1URIc4ngsnInaxLrpZGTa7nV/5utIDYV18AQTAWGM4CrGNXfYujHtLNhkGQFaj5 h6SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sRYw1zSn; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n26si16306724ejd.436.2021.08.31.01.20.23; Tue, 31 Aug 2021 01:20:58 -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=@kernel.org header.s=k20201202 header.b=sRYw1zSn; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240220AbhHaIRq (ORCPT + 99 others); Tue, 31 Aug 2021 04:17:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:58544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240192AbhHaIRp (ORCPT ); Tue, 31 Aug 2021 04:17:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABDF360FC0; Tue, 31 Aug 2021 08:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630397810; bh=yTyNUSNUuUCigkGqM37M/tkhLWZdGvb5UP17lvLzs8w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sRYw1zSnhFopgKVsOrgKcwvby1ylBT/KdnY49F8pG8P7vQRZXH2kDIUVmJr9b1f12 VEU7Z7ZNu62RbECi8Ak+ykJSNiuCuwfhwv2uEgYpJ9QLo+3OHNZo+BYQNXJrPKlC5h 2yk5D7U6UBWE1GKH5Ktrs7QlpqAWiLNFBB3AcGhCijZ7xOIIhkAv2LlUNyP8zI82Lm kDk5jS+tsa6h/k+OJfNzLVqnFSPKy6GJ9Tr2BsTtNmZkKkDIAeeumwWday1wYd7B85 MVjzDHwsc2k4PbWINaRgbSCbISKdUrq1HPhZe1IKmYfhiXJbXvD8CBxM2VCPD4nvH0 YrY4h13WDxabA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1mKywk-0007Cy-V0; Tue, 31 Aug 2021 10:16:43 +0200 Date: Tue, 31 Aug 2021 10:16:42 +0200 From: Johan Hovold To: Matthew Wilcox 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:31:35PM +0100, Matthew Wilcox wrote: > 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. > > > 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. Ok, but it still stands out in the conversions since it is in no way obvious that idr_find() should be replaced by xa_load() from just looking at the diff. You need to look up the interface for that. > > 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 > ;-( Heh. Don't flatter yourself. Just look up any text book on data structures. Johan