From patchwork Wed Dec 2 20:40:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 11947145 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=-18.2 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=unavailable 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 806FBC6369E for ; Wed, 2 Dec 2020 20:59:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 139FE2222E for ; Wed, 2 Dec 2020 20:59:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 139FE2222E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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=merlin.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=EBP75Ecgl+Y+9ldRv/ss4bsfP1w0eU13ArDiDVRByK4=; b=Q79ivR3myszcvpy8OAIF9MFsMJ hFXYihvj5BzhuFkyBTPN9bqMh3us1fvYu0WftzmE37XxJfvLOdbPp6HQJakL7NzggjVf40gxNclqB ok3grwXdYvKBFAtLuxUG7SChQXIPwr4ov82ew4wjVKo+noSW4V3aqMVv8TxwT4ryCgkuCP1pac3Zt nSjBxEkmPBAE3KZnOFWn7s5bNW1CKVTLX6FssWNqEc/fdBHCzEoU2r95QoD9dabrVThN5eBo5Qpzc bfJYtfD4dTSkayeu5F7T5nsA+ncgcbXITX3Cy6avgO7UlCjIDXJltbtLnkf55eHlb+u+KpSRheUmt mCzcQ6rw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkZCN-0000Ln-4Q; Wed, 02 Dec 2020 20:58:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkYwP-0002bA-48 for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2020 20:41:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F013115AD; Wed, 2 Dec 2020 12:41:32 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4902D3F575; Wed, 2 Dec 2020 12:41:31 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 32/37] firmware: arm_scmi: cleanup legacy protocol init code Date: Wed, 2 Dec 2020 20:40:04 +0000 Message-Id: <20201202204009.32073-33-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202204009.32073-1-cristian.marussi@arm.com> References: <20201202204009.32073-1-cristian.marussi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201202_154134_136547_F53077DA X-CRM114-Status: GOOD ( 15.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, vincent.guittot@linaro.org, sudeep.holla@arm.com, thara.gopinath@linaro.org, Cristian Marussi , james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, souvik.chakravarty@arm.com, etienne.carriere@linaro.org, lukasz.luba@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that all protocols and drivers have been ported to the new interface based on protocol handles and get/put operations, remove all the legacy transient initialization code. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/bus.c | 26 +------------------------- drivers/firmware/arm_scmi/common.h | 5 +---- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 044aa9e3ebb0..9fbf618b9c4b 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -66,27 +66,11 @@ const struct scmi_protocol *scmi_get_protocol(int protocol_id) return proto; } -static int scmi_protocol_init(int protocol_id, struct scmi_handle *handle) -{ - const struct scmi_protocol *proto; - - proto = scmi_get_protocol(protocol_id); - if (!proto) - return -EINVAL; - return proto->init(handle); -} - -static int scmi_protocol_dummy_init(struct scmi_handle *handle) -{ - return 0; -} - static int scmi_dev_probe(struct device *dev) { struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver); struct scmi_device *scmi_dev = to_scmi_dev(dev); const struct scmi_device_id *id; - int ret; id = scmi_dev_match_id(scmi_dev, scmi_drv); if (!id) @@ -95,14 +79,6 @@ static int scmi_dev_probe(struct device *dev) if (!scmi_dev->handle) return -EPROBE_DEFER; - ret = scmi_protocol_init(scmi_dev->protocol_id, scmi_dev->handle); - if (ret) - return ret; - - /* Skip protocol initialisation for additional devices */ - idr_replace(&scmi_available_protocols, &scmi_protocol_dummy_init, - scmi_dev->protocol_id); - return scmi_drv->probe(scmi_dev); } @@ -219,7 +195,7 @@ int scmi_protocol_register(const struct scmi_protocol *proto) return -EINVAL; } - if (!proto->init && !proto->init_instance) { + if (!proto->init_instance) { pr_err("missing .init() for protocol 0x%x\n", proto->id); return -EINVAL; } diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 45387a32d79e..86f4fb707145 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -224,14 +224,12 @@ int scmi_version_get(const struct scmi_handle *h, u8 protocol, u32 *version); void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph, u8 *prot_imp); -typedef int (*scmi_prot_init_fn_t)(struct scmi_handle *); typedef int (*scmi_prot_init_ph_fn_t)(const struct scmi_protocol_handle *); /** * struct scmi_protocol - Protocol descriptor * @id: Protocol ID. - * @init: Mandatory protocol initialization function. - * @init_instance: Optional protocol instance initialization function. + * @init_instance: Mandatory protocol initialization function. * @deinit_instance: Optional protocol de-initialization function. * @ops: Optional reference to the operations provided by the protocol and * exposed in scmi_protocol.h. @@ -239,7 +237,6 @@ typedef int (*scmi_prot_init_ph_fn_t)(const struct scmi_protocol_handle *); */ struct scmi_protocol { const u8 id; - const scmi_prot_init_fn_t init; const scmi_prot_init_ph_fn_t init_instance; const scmi_prot_init_ph_fn_t deinit_instance; const void *ops;