Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1940714pxb; Sun, 5 Sep 2021 04:08:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB+AkNMGGmhNkP7sACOyBJZwTdbrgbod6oeidtcpOqKXzrjGgGb8I9Jaj2kb5hBKqmVIKT X-Received: by 2002:a5d:9b8b:: with SMTP id r11mr5572272iom.26.1630840117552; Sun, 05 Sep 2021 04:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630840117; cv=none; d=google.com; s=arc-20160816; b=vISro6KP77Bcv77kRqcA4/O8dWHxRH4xdYM9lrrORdlw0p7helV5RG3gh5OYD30/2b KCg7ZNPu4E6VUu37x4lAH9IyyfSkebmkU+5pUFjjRhFkDfmjcUWxPQptb2nfzyyqqKs2 EyLMGctHgoOctp6ltGOIpJD76/wCt+NO3Z15hrTcxaKWuSBVuqFPPH/rKLc1b4isAuI9 arSO8aN7IzfrqIHYPQ7Na/r6o8fPcMJTGtp7ogU8JWpZt2xZSaNvGh2HEDDCK+6XomkE e0ssaf3NsHcmJXRz4776Ycv6snlNRhVhph6Km+JD9p0YI/5AgmO3iKxHsAfN5AwAY7cS OAaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=adfImsLuIBmE9B3O/GcwYBEqtVqoYR6DLj0yykn077s=; b=sA895KU1AEQYlyOuXMZ6WyjBKKB+zZkXMw/pN9NrqtxWk6yzw4Iy/NxXcrZCB2KAHR hQnZOhS2TvIamRU+NtN15PExfY67GspZwlXIeXste2QI2d7xaheTxKa2F49oHaAlVgwq cbjTyxDQ4mpCx7BV+L5WiqLS4/tFWA2EsvlUn//+UJM2xS3PZ0/YfNqNvf6HWy6llPB6 LiIXeV+2BRCf8XtPQOg6xEntx3Go3UDDkQUSalfm52Q3sd1QfH8oBJYSscRQL1OlU26p Mndjgk/qSgrVL9c4hXFpDFJ16qWGB8UhQj0WibxpL1hKEUOGN0D+S26mGKmQLXk5PLDa gyDQ== ARC-Authentication-Results: i=1; mx.google.com; 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 y9si5180570ilu.22.2021.09.05.04.08.24; Sun, 05 Sep 2021 04:08:37 -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; 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 S237756AbhIELGT (ORCPT + 99 others); Sun, 5 Sep 2021 07:06:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:38084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbhIELGP (ORCPT ); Sun, 5 Sep 2021 07:06:15 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B13260F45; Sun, 5 Sep 2021 11:05:10 +0000 (UTC) Date: Sun, 5 Sep 2021 12:08:32 +0100 From: Jonathan Cameron To: Alexandru Ardelean Cc: Andy Shevchenko , linux-iio , Linux Kernel Mailing List , linux-doc@vger.kernel.org, hdegoede@redhat.com, wens@csie.org Subject: Re: [PATCH 1/5] iio: inkern: introduce devm_iio_map_array_register() short-hand function Message-ID: <20210905120832.6566219d@jic23-huawei> In-Reply-To: References: <20210903072917.45769-1-aardelean@deviqon.com> <20210903072917.45769-2-aardelean@deviqon.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 Sep 2021 16:56:43 +0300 Alexandru Ardelean wrote: > On Fri, 3 Sept 2021 at 16:40, Andy Shevchenko > wrote: > > > > On Fri, Sep 03, 2021 at 10:29:13AM +0300, Alexandru Ardelean wrote: > > > This change introduces a device-managed variant to the > > > iio_map_array_register() function. It's a simple implementation of calling > > > iio_map_array_register() and registering a callback to > > > iio_map_array_unregister() with the devm_add_action_or_reset(). > > > > > > The function uses an explicit 'dev' parameter to bind the unwinding to. It > > > could have been implemented to implicitly use the parent of the IIO device, > > > however it shouldn't be too expensive to callers to just specify to which > > > device object to bind this unwind call. > > > It would make the API a bit more flexible. > > > > AFAIU this dev pointer is kinda discussable thing. What scenario do you expect > > (have in mind) when it shouldn't use parent? > > So, this brings me back to an older discussion about devm_ when I > thought about making some devm_ function that implicitly takes uses > the parent of the IIO device. > > Jonathan mentioned that if we go that route, maybe we should prefix it > with iiom_ . > But we weren't sure at the time if that makes sense. > The idea was to bind the management of the unwinding to either the > parent of the IIO device, or the IIO device itself (indio_dev->dev). I'm not keen on playing the same games that say pcim does where it effectively combines all cleanup into one devres call because that can end up doing things in an order that isn't strict reversal if the setup path isn't carefully organised. It's 'clever' but to my mind doing something similar in IIO would need to subtle bugs. So we would simply be using iiom_ as a shortcut to say bind to the parent device. Might be worth considering long term but I'm not keen to do it for a random little used function first! Series looks good to me, but I'll let it sit a little longer before applying. Jonathan > > We kind of concluded that it may probably not be a good to hide > anything and make standard a devm_ function with an explicit 'dev' > object parameter. > > I found a recent mention here (while searching for iiom_ on linux-iio): > https://lore.kernel.org/linux-iio/20210313192150.74c0a91b@archlinux/ > > > > > > -- > > With Best Regards, > > Andy Shevchenko > > > >