Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5540925ybl; Tue, 10 Dec 2019 07:40:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzTLD+UguMtN3wYxVXM1cCMDxlNCE0lLI69eWHINseZxctmQcziwdwhePIYCsAAdBro1sZL X-Received: by 2002:aca:f487:: with SMTP id s129mr4548357oih.154.1575992416798; Tue, 10 Dec 2019 07:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575992416; cv=none; d=google.com; s=arc-20160816; b=CfP5aZ44CLpZEN8y8AFzTR4SeSQJd3ihSlTd9JviaTpPqxKhIyvVRUiAccHRf20VCb Q/Fc2z9a13F1SWTwCrXWp38KcH7+E6L4T5DHoNFVZD99Ly2S46NOO6r2lmi7dFk9ThSj TUGkdypvM0kVGdHI5CrZulYciAlo2tt5ip0UOIsgkKiemb+tAd2EWC5g8qUVKcQ5APdX IAamsLZdz8mZIRykfx7j0LXV9uJF1ILPTppufvRXvOdLwXq4SVVKH9/p/UOIz0h1BacN dQXizSHxgQ9ZJkKjZImBryVUzBiYviprOQXBlK2wSWXWuZKTh3ND9KvRP4VL+oEGSBbL VyxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=iKeNviDEEF9odhMQJdypKBtaoLx0sSf4A0V7pYUNmlE=; b=OXRcHgXu53bTbu8O8F2ItYpmCKBdf7zc2lkYu/qGeHXg780YWRt23Is3NHFNkJxPbt Z+uAa6k9AZAADASNgh7NbP3u4hiT/i1GXy2nOCt4mq9qEdJ+2UMGp7p22cl8GXa6XGLr eNFZ4S58KK2DDS3jLufB9hYkqpefZyxngH0NScbewTfOkovn9LVZ0pclZUVQIFe5vOHv dCNoLjny6AXbowpUV2IhTZtUVeTY/9+wa+jlRJuu16lYD4OFMkjP7YpTEAWS6pHxqbLN jnWbRw1iKGL9OB3rd0uQwjfgqcNG4n9YsPqdY/lTYAEReDNYypLZ7yBbjyAoxIzRLUv9 IXBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=lj6AdmHY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si2018056ote.242.2019.12.10.07.40.04; Tue, 10 Dec 2019 07:40:16 -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=@synopsys.com header.s=mail header.b=lj6AdmHY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbfLJPhz (ORCPT + 99 others); Tue, 10 Dec 2019 10:37:55 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:45234 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727320AbfLJPhk (ORCPT ); Tue, 10 Dec 2019 10:37:40 -0500 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id B42EEC00A2; Tue, 10 Dec 2019 15:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1575992259; bh=69j7jHbx5yJ5MhVkwHC0PThYgKjCClJKrN77KC+ilaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=lj6AdmHY5d6/zKnLaJDfKGQkeuwYZ8dPP0k+lRnshmtc+9iZds0nmrUjvP0AK+jWU +5zGv7senN67OngiOPgLBWIAWUX4nQ7xmvb6gtaZT3uJqXqQv6XRRbzYaWNBXNlLV8 QpcGGdQBlB3QrDxQu43UJpve+oME81fEwYEWBKbnQSNKpgqnJy4/pHrywG7Y8fM79X IFfxGWBTpxBc3Own+RjQ4DXKmJTOe/cQEqN/dCESfAm0XVDkNo9Vt6jLo2a1w04rPa RZAvqeW0JFsQGJURhMYwkLVahtlh3tpT4ulPkPmLF4zt4Tp2MN3bx8nW3S/3xSBrOU h4AyhzEDoXkMA== Received: from de02.synopsys.com (de02.internal.synopsys.com [10.225.17.21]) by mailhost.synopsys.com (Postfix) with ESMTP id B48B9A005E; Tue, 10 Dec 2019 15:37:36 +0000 (UTC) Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by de02.synopsys.com (Postfix) with ESMTP id A0FB73E2D9; Tue, 10 Dec 2019 16:37:36 +0100 (CET) From: Vitor Soares To: linux-kernel@vger.kernel.org, linux-i3c@lists.infradead.org Cc: Joao.Pinto@synopsys.com, bbrezillon@kernel.org, gregkh@linuxfoundation.org, wsa@the-dreams.de, arnd@arndb.de, broonie@kernel.org, Vitor Soares Subject: [RFC 4/5] i3c: master: add i3c_for_each_dev helper Date: Tue, 10 Dec 2019 16:37:32 +0100 Message-Id: <5aa3bd64a6082ded430ce27f5ea3f6956d1436ac.1575977795.git.vitor.soares@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 a9df276..cc41efe 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); + + return res; +} +EXPORT_SYMBOL_GPL(i3c_for_each_dev); + static int __init i3c_init(void) { return bus_register(&i3c_bus_type); -- 2.7.4