Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1807771ybv; Fri, 21 Feb 2020 03:52:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwZh4z44uLp7LNJUHEbHh6klON6d6ZOXYj26KYFI8weKLifRh9Xut4cqn5H9yHd8wdxMb8a X-Received: by 2002:a9d:6181:: with SMTP id g1mr28958514otk.104.1582285967497; Fri, 21 Feb 2020 03:52:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582285967; cv=none; d=google.com; s=arc-20160816; b=rzhsv+P0z1liuVBp+c6FmLMPCGwwdVQKn7PFXyZlaH58wGgmAYpy/lLv1pgqqLJ/Sz NFGIja0pxL7bKPYVEC5RUe5MehLXpXf6CBvmJ26SYWjFEfk1LwECuG55Ti1pV14Vrv5t xMRtZC7pUJkT61gGKc2d+AlBe17LpeOEhFZyvGXZlImrNaV4Qic1IersqXImMLR0NMh1 onDdnZmJeUZ+Y86729jzX/YiMEw5L+31jA1byMuoA4wvOeaV9pajMKxUILQcdeam9LXX vU6gujb/Y2CFcusdyHV/q3iXdqI8lRk9M3TkPkKyJ9msNS28gboslcuyNCoQlWpTc7kG yPCg== 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=0Q+SjF2zwG8aBwlv4Qslf7A8UkFa8G0DH6EBSMKoIrA=; b=JQYND3gwsyruXBZ6L/4v2qHm/CHsLqvsu3gzuh3j27l1qhWqeBylwz1yhVkKcfhV6h tu6w1/R5UBiC6gXVKkmICggICA+nQ+ZRAC8OXHQGJ46pZ//+ngsyvmYITmm5ZmiGmeiG poY4xBRO3ZEBoJErVe4ZoUR4HsNvFK9GqL3WDrjQzTY1sbYGcqcWVE3NpyEMaLwptMso euf/qh0nZmtj706Y7VmiwyeGRzylGwmopz972WQVTzNEJW9vtPXxo7ZGR/3KjKbxy2GP yLNTCYQFUsezJUGzW9wJtadgNMr9997lzSBqq3E9Xs7YLIs9a05DOA1+qz4wwFcgl4I2 g+AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vBksp1iF; 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 m4si1409440otn.281.2020.02.21.03.52.35; Fri, 21 Feb 2020 03:52:47 -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=vBksp1iF; 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 S1727448AbgBULwc (ORCPT + 99 others); Fri, 21 Feb 2020 06:52:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:45962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbgBULwc (ORCPT ); Fri, 21 Feb 2020 06:52:32 -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 5740E208C4; Fri, 21 Feb 2020 11:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582285951; bh=fD0A4i7ST85sMfr8X97BCWyBGGZcF1CFchsdK+XT4Ko=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vBksp1iFJRObYfBEPPhfNm7oh5LD50AgE+h7nbC7zrlruU2QrxEq0MTlYFcB3rbiO ekOqkGl2LPLxsbHt2cOw1GimvpzlmjmZYgKalG6nk2uHoLjIVaSqsLpjG6NTI1ssWZ eh5lFbu+ZlHbIXppox1O9gS1yMg7gvNk59T8zNfQ= Date: Fri, 21 Feb 2020 12:52:29 +0100 From: Greg KH To: Vitor Soares Cc: Jose Abreu , "corbet@lwn.net" , Joao Pinto , "arnd@arndb.de" , "wsa@the-dreams.de" , "bbrezillon@kernel.org" , "linux-kernel@vger.kernel.org" , "broonie@kernel.org" , "linux-i3c@lists.infradead.org" Subject: Re: [PATCH v3 3/5] i3c: master: add i3c_for_each_dev helper Message-ID: <20200221115229.GA116368@kroah.com> References: <868e5b37fd817b65e6953ed7279f5063e5fc06c5.1582069402.git.vitor.soares@synopsys.com> <20200219073548.GA2728338@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 21, 2020 at 11:47:22AM +0000, Vitor Soares wrote: > Hi Greg, > > From: Greg KH > Date: Wed, Feb 19, 2020 at 07:35:48 > > > 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 want to make sure that no new devices (eg: Hot-Join capable device) are > added during this iteration and after this call, each new device will > release a bus notification. > > > > > I don't see bus-specific-locks around other subsystem functions that do > > this (like usb_for_each_dev). > > I based in I2C use case. Check to see if this is really needed, for some reason I doubt it... thanks, greg k-h