From patchwork Tue May 11 00:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hilber X-Patchwork-Id: 12250375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FD8AC433ED for ; Tue, 11 May 2021 10:00:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 F187161621 for ; Tue, 11 May 2021 10:00:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F187161621 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=opensynergy.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Gx+8Ir1TQHq0OosiQW7TEmAKs1IFXYgupVi9nKp8FIc=; b=kUaxaNebdrFipw074SsyLhUFs wl/b+5WULe1Pj4xke6M6fiF9ZXoYaun73v+oaffpTcKNSZ/aB7ogwgWquOeenYwt2+3l+muKgoqDK JzF/oi5LHxmXcEd+sdXg6HbCOEJ0vDvSxeNLS26tSOYCytggIXnav7wiEqMhK3K5LgXjI/3zK5RO7 ZpZIQbCrTCFykaHCl9BEz26V7S/NGJJXfCoCQDUJM6PrYR1U4txADlk+fBmQjMLlvAes8J7FQtA7w xyyP5dD9snq9xyB6J+7f0j3/SvCGqZrWJoOZFzehIa3g7excYmGwQyOxzqjSEgJJyPAiTwDsqBpdw sFPLOuZaQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgPAm-00Gnfj-FM; Tue, 11 May 2021 09:59:28 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGoU-00G0on-2N for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 01:03:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=uVXQj8vtCYsoWfIdT2YmI6MruqMQhZ51sMrsMngt+4c=; b=OtxF7l393eI95Mx6Cy2YjRFZpl ZQ66GT7VkRPZcRQmcL4QiTtZfnAzlo+F8iad6OsQlbO8Wm+ShD3nQh9nJHmYgxKLewnCng5i//hEG fdE5mOyTEYRM6DJdKvIY3YHo7tiUeaGJqMQwVbJw9z9FGmJ6u509jlbMKcfi8DvKhEK/xMNRO8UOu H+NS+WJyfp1JvzWUNWNgH7UEC7Ff6grRcyXa+OZhMtJlaWR5ea59TdRzmLGyoENytR0Xd99x0N1Tr 5CDZPmJWRDpa7XQqxqwZjtuVB8n8VzGef3YxXTp7KJ1u1cjv3TCvpaDxpdTHwd5raqzRfkpA1Vcmk OLjUTWKA==; Received: from mx1.opensynergy.com ([217.66.60.4]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgGGQ-009DPp-H6 for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 00:28:44 +0000 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id 1B765A1A30; Tue, 11 May 2021 02:22:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=srmailgate02; bh=uVXQj8vtCYso WfIdT2YmI6MruqMQhZ51sMrsMngt+4c=; b=bub2NUPQ/1YkHW/fBbb4rG6AQdkz 53zguMOjN7F+aEjMXK1IfPIpCrOOb0eNS5MMVhePifFi074BXvPPYN/sAWXRvrmX TdwmYlCc9MAPpVMEB15jf6tLCejtiebPengFdBWMFH0RDhUIiBRM45bOTU7bnupZ z6Slz8DMjiJ1/7jmL7EzPoZtR7vEDYjhQnVY3+7j/yekK7HDF5wXZMGQ718WK9Pb lRTLW3ZWqKv7QkP7ZK0+Up369Rrm3ZV8bZ9CKbe3VcbPy0lGlQrYkzrlppef/5fA SHAOMj5sSelTbNboJRAcJbQIWyHjSDPupXKXtlortgkHOaIVnQWRoQYnXA== From: Peter Hilber To: , CC: Peter Hilber , Rob Herring , , , , , , , , , Vasyl Vavrychuk , Andriy Tryshnivskyy , Cristian Marussi Subject: [RFC PATCH v3 06/12] firmware: arm_scmi: Add is_scmi_protocol_device() Date: Tue, 11 May 2021 02:20:34 +0200 Message-ID: <20210511002040.802226-7-peter.hilber@opensynergy.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210511002040.802226-1-peter.hilber@opensynergy.com> References: <20210511002040.802226-1-peter.hilber@opensynergy.com> MIME-Version: 1.0 X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-02.open-synergy.com (10.26.10.22) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_172842_752888_37A3AC22 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_172842_752888_37A3AC22 X-CRM114-Status: UNSURE ( 7.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The scmi-virtio transport driver will need to distinguish SCMI protocol devices from the SCMI instance device in the chan_setup() and chan_free() ops. Add this internal helper to be able to distinguish the two. Signed-off-by: Peter Hilber --- drivers/firmware/arm_scmi/bus.c | 5 +++++ drivers/firmware/arm_scmi/common.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 784cf0027da3..06148e972d1a 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -134,6 +134,11 @@ static struct bus_type scmi_bus_type = { .remove = scmi_dev_remove, }; +bool is_scmi_protocol_device(struct device *dev) +{ + return dev->bus == &scmi_bus_type; +} + int scmi_driver_register(struct scmi_driver *driver, struct module *owner, const char *mod_name) { diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 61b22cdeaeeb..9488c682a51d 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -231,6 +231,8 @@ struct scmi_protocol { const struct scmi_protocol_events *events; }; +bool is_scmi_protocol_device(struct device *dev); + int __init scmi_bus_init(void); void __exit scmi_bus_exit(void);