From patchwork Tue Dec 10 15:37:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitor Soares X-Patchwork-Id: 11282835 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FC8E14E3 for ; Tue, 10 Dec 2019 15:37:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1DD9E207FF for ; Tue, 10 Dec 2019 15:37:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IMh9bYJe"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="lj6AdmHY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DD9E207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=j3eoof96I2wa1gFnElZhI2i2rHvcwcYLGiOGp6JPbv8=; b=IMh9bYJe5b8EW5JP2dBWLlfKsR p3NM0gYxz0EPiGGD5Rz+sMHQ2YPDyu7duhCywTcDGyWJMbMZp9PaOU4m+WgqTw1yVcaekrvCj+sfv FBO5ij8F2Wka2ScCZDza4u1JytvAi5gKaK+0iWHFNL5xXvQUO+rpbaUtzHhQePU5+aWGh356h+rAP mvH9RJ6Ok/MjeQ4MWdvBmhVlorVM5HioyLQiEeq7lNWHMX+sEp8za176VM60D55M2vYOnBMXr6hxr i01x+conQUQq1AODyKKubSPF4vgsd+a7RBhLuMFxqFhLn2xXiH1lnMFpeWXDGQx33OQXm+eNwD36w HpXCdTxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ieha2-0003wD-GA; Tue, 10 Dec 2019 15:37:42 +0000 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iehZz-0003qO-RR for linux-i3c@lists.infradead.org; Tue, 10 Dec 2019 15:37:41 +0000 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191210_073739_932704_00738D98 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux I3C List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joao.Pinto@synopsys.com, arnd@arndb.de, wsa@the-dreams.de, gregkh@linuxfoundation.org, bbrezillon@kernel.org, Vitor Soares , broonie@kernel.org MIME-Version: 1.0 Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.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);