Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1104803pxu; Wed, 6 Jan 2021 12:23:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbMF8ZsELFnsl6u9g6T8qJnIEN6Pqwxa5oI39DjsGd/X5FnB2NGefXHXYBgFDaWBBB7ZDr X-Received: by 2002:a17:906:b2da:: with SMTP id cf26mr4121863ejb.176.1609964586657; Wed, 06 Jan 2021 12:23:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609964586; cv=none; d=google.com; s=arc-20160816; b=NgV3TluR+ZfPCWwcCTFd5rmPN9aHdeWVS6Qk6/mo+mbn5/HbQyQn06ZquhiAAbBU0l iEA2Rp3ei4P5yd0VzePqYGwqJqJM+nzkYbu0iuKk+pJQo6kOyiPTE/fhMzPC9rmyyUnD oZ1KX3Eg8FX8v/lflNXfdkE3CjunAonoEMXDH2ftRI+XYpQEtsDRWex5Uw5l4kra9VpD AoJYtO7+ynpEuYre9DHeqpQP4VueRelNhWjZnggDc8Zh0Si544EmQq/XiL1oGfswnW/C cIuFhS2PFMr4ZSdc3Pj9mR5AwMSya2G2sTDokl7vKmxndbLfLTX9Y555Bf44Y5FtEEyv lnMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=krRZxp4+mHO5BxGlJxWiF2X2pgNXLrgQJOjcIaKzWvI=; b=n7q+ZPOCi4Jig3VGC71XtYw0kodeFYB3NBQ4vcnat5sQI+33YYYHIt9g3kGyOb/tIE ttAIgUtk+ksgRCde5bgEikXJ28rfRV7Wt7yBdzO5KWnnAAYQiM8uINsBoDv3NDoEqlyp xfqXskuPWj9qrWWbjf99bp2SywqjNike3FOIjrVkqEqB7XnmtA4B/407Cnc/reqd9bhV isjp6RV1zLu1wgjcwHPa3pF4+ulYNvjLD0g9AhpIFSRnL0Hcjt/dugkuGjPtW5KSN8kf 3BBa3mtG0yROr0rspRlZoeRUt5WdqOnM8YpTgZomRSIEyoEXUwa8ZwE4nnJmENFwAo6p xDNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s2si1327861eds.424.2021.01.06.12.22.43; Wed, 06 Jan 2021 12:23:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727747AbhAFUTC (ORCPT + 99 others); Wed, 6 Jan 2021 15:19:02 -0500 Received: from foss.arm.com ([217.140.110.172]:47002 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727727AbhAFUSx (ORCPT ); Wed, 6 Jan 2021 15:18:53 -0500 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 5D6781595; Wed, 6 Jan 2021 12:18:15 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9BE3E3F719; Wed, 6 Jan 2021 12:18:12 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, lukasz.luba@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, thara.gopinath@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, cristian.marussi@arm.com Subject: [PATCH v4 32/37] firmware: arm_scmi: cleanup legacy protocol init code Date: Wed, 6 Jan 2021 20:16:05 +0000 Message-Id: <20210106201610.26538-33-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210106201610.26538-1-cristian.marussi@arm.com> References: <20210106201610.26538-1-cristian.marussi@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; -- 2.17.1