Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp303761ybv; Tue, 18 Feb 2020 23:37:07 -0800 (PST) X-Google-Smtp-Source: APXvYqygTACTyhfz9uM3WL0u1T2ytSZ+UAFz2uZ+YUtyTw2xn22ScbDwPCf8eCNBIb1wj99VWfxM X-Received: by 2002:a05:6830:114c:: with SMTP id x12mr18850016otq.324.1582097827105; Tue, 18 Feb 2020 23:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582097827; cv=none; d=google.com; s=arc-20160816; b=hAnhe3dG72EYVKs3iGS0toOoZ+y/9RdFcZP8J1Cc45B+5eCf+m6hy7tY0aQRFhWkRy CCaZAh/bYiV4Yj5BU4n7fTVXRRYtz880+u1IcHSIeqK5s6YEV0qYgpqKXVvVlOhNMb/I pMfHh1kdx7kQCaN5v9wto88nu+uqJcgVxvd25uJ+JHy96d57vkh4x1kNKSPGWiN+EvL7 GbbytKUKtaVpEdJxJMmQiIr9sVfOxeSx8PJYbbBQtQav9TOqTjNub8XMMYtDn2RGA644 0uCufs4X/DgFNeuiW2PIK/SJgOo9UGDnPSJfBviUrz5H/TZbD95W1o2Ic9qJ50eavf9q leHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=gB63Qg2+bE8rb5i2PvO4jJA3nODBBz4vXrSUjRoP8F8=; b=09xVN+3qMkpo8cFPFDAzKrSJ/Zjci4N7MmDpx0WeqgdRRoOdQPijtXwoxhc7wC+UeD X7YSbkstWDaNPe9PU37gW50QmnPSNBDn9/ENrMBf6U1EjoNwl7s+gzCzQXt1oXM9bz0J ZyMhfKMe4oT35YUxtdHtjZo/SHQlDCPltXwO5C7XQgmEJvH/7EmRTfPIMedMpg8OItVW SjW4M8fDETxTMS4yb8qs1oSR83Tfxnlla0ST6vOBUsh/Ao67Pt/UL4zAEZDaG3XcBNdm wT8hczNI1LeYQ4gmi5pQIANPf5ydZoSYMf4JnDFzf4nNkOVyp5khogTEoT6dqbYTzki0 u4gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nbpaBGt2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si8766584oie.240.2020.02.18.23.36.55; Tue, 18 Feb 2020 23:37:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nbpaBGt2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbgBSHfv (ORCPT + 99 others); Wed, 19 Feb 2020 02:35:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:52936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgBSHfu (ORCPT ); Wed, 19 Feb 2020 02:35:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D36D52176D; Wed, 19 Feb 2020 07:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582097750; bh=fX6KRM1X5Jo5RsKxZDPRp/cqOi3EYu6e+t9QUMDjriI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nbpaBGt2aLkLH3ZuPkT6aBpFHK2ZLlle7+OW+GguJBosgroGRskPpVF9whQNGQsvI PEAFOezHGk/veRsnuLPNdfMdanf5cO+9GFAZGqMeIqp4prWGMMB5KEATX+Q4tEl5y7 2QLp1KlAYcoFv+hHFmO9ZlA/wx+Poo4n4lIDq4V8= Date: Wed, 19 Feb 2020 08:35:48 +0100 From: Greg KH To: Vitor Soares Cc: linux-kernel@vger.kernel.org, linux-i3c@lists.infradead.org, Joao.Pinto@synopsys.com, Jose.Abreu@synopsys.com, bbrezillon@kernel.org, wsa@the-dreams.de, arnd@arndb.de, broonie@kernel.org, corbet@lwn.net Subject: Re: [PATCH v3 3/5] i3c: master: add i3c_for_each_dev helper Message-ID: <20200219073548.GA2728338@kroah.com> References: <868e5b37fd817b65e6953ed7279f5063e5fc06c5.1582069402.git.vitor.soares@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <868e5b37fd817b65e6953ed7279f5063e5fc06c5.1582069402.git.vitor.soares@synopsys.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 19, 2020 at 01:20:41AM +0100, Vitor Soares wrote: > Introduce i3c_for_each_dev(), an i3c device iterator for use by i3cdev. > > Signed-off-by: Vitor Soares > --- > drivers/i3c/internals.h | 1 + > drivers/i3c/master.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h > index bc062e8..a6deedf 100644 > --- a/drivers/i3c/internals.h > +++ b/drivers/i3c/internals.h > @@ -24,4 +24,5 @@ int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev); > int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev, > const struct i3c_ibi_setup *req); > void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev); > +int i3c_for_each_dev(void *data, int (*fn)(struct device *, void *)); > #endif /* I3C_INTERNAL_H */ > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > index 21c4372..8e22da2 100644 > --- a/drivers/i3c/master.c > +++ b/drivers/i3c/master.c > @@ -2640,6 +2640,18 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev) > dev->ibi = NULL; > } > > +int i3c_for_each_dev(void *data, int (*fn)(struct device *, void *)) > +{ > + int res; > + > + mutex_lock(&i3c_core_lock); > + res = bus_for_each_dev(&i3c_bus_type, NULL, data, fn); > + mutex_unlock(&i3c_core_lock); Ick, why the lock? Are you _sure_ you need that? The core should handle any list locking issues here, right? I don't see bus-specific-locks around other subsystem functions that do this (like usb_for_each_dev). thanks, greg k-h