From patchwork Tue Dec 10 14:53:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181135 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606631och; Tue, 10 Dec 2019 06:54:59 -0800 (PST) X-Google-Smtp-Source: APXvYqz7X+p+3GW8fOZ+S/KKNwM+X+xKK8+R9dQaz1YdJ37pTd13IZA3OIF60Kty+5+izDXnBK/d X-Received: by 2002:a9d:150:: with SMTP id 74mr14996015otu.149.1575989699071; Tue, 10 Dec 2019 06:54:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989699; cv=none; d=google.com; s=arc-20160816; b=NpaEQMzpBBvuj0jlD7p1dNeY5D95Kjp4HFyGNXhPd4hUMVRe9P0Rb9MmuF+IZ7yoSe eoYGaQnJytt/fUcUWjz108Sv/o6tchHKHmCRMyiy6ACFOnj568ivecZP0jfMdJEW4Esl gfE1veDb4qNAHeuv9LnWwsYfudRCp8nXUDnEdr+WTHm6AVF8itz4ziIwdHE9ZVIeP4XL W3YReyDTQMiuzYJezKfmxx3paz+bIeMpMT2ytAkSg/euQd8Wph1+Z9d69gMNjgIeXC5w kW7Q0RU/zn/hhXAz3DEoF5A6oFJmBc6ILvv//oNQSqEU/J15Lg13uXgY2tmtnT8cJZ4A 9UxA== 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:message-id:date :subject:cc:to:from; bh=TvPUSE++IS2Q4iPpT+8V7yZqvADrqCQvmjFzzTIbvrA=; b=yP8D9Lxa4bH99soM1mKy7KWcWaCBhFxDFduXhpMrr+tDMSumgNFde6dDvFs1CnPhyX +v5r0Rck9xxDGAoju9+fVZNPjL34k+z5aFZ3MUjNc9YLcRZRvUkb9JcTIlgEfQWvNpsy tVssIzgrgfnrvcBghWvYLIgflItdKp7SrTIEeVwizulml2oLUlMlP8fT757nawnicF17 CRSWnVs8AyrKIUrI6odxm091PsYaVoCDAGmKhgVbuvXqtD2KkPfyyrNpjwc42OF804YF 7gI6041mdL28HKjYgL/1DBC0yzWMAoHf+Z9vhO2opTKOzrtsOXJ2VlMr7JLPnfll/Hh1 NB1g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si2053863oie.87.2019.12.10.06.54.58; Tue, 10 Dec 2019 06:54:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbfLJOy5 (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:57 -0500 Received: from foss.arm.com ([217.140.110.172]:47118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbfLJOyH (ORCPT ); Tue, 10 Dec 2019 09:54:07 -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 9C0441045; Tue, 10 Dec 2019 06:54:06 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E42D53F67D; Tue, 10 Dec 2019 06:54:05 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 02/15] firmware: arm_scmi: Skip scmi mbox channel setup for addtional devices Date: Tue, 10 Dec 2019 14:53:32 +0000 Message-Id: <20191210145345.11616-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the scmi bus supports adding multiple devices per protocol, and since scmi_create_protocol_device calls scmi_mbox_chan_setup, we must avoid allocating and initialising the mbox channel if it is already initialised. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 Reviewed-by: Cristian Marussi diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index dee7ce3bd815..2952fcd8dd8a 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -735,6 +735,11 @@ static int scmi_mbox_chan_setup(struct scmi_info *info, struct device *dev, idx = tx ? 0 : 1; idr = tx ? &info->tx_idr : &info->rx_idr; + /* check if already allocated, used for multiple device per protocol */ + cinfo = idr_find(idr, prot_id); + if (cinfo) + return 0; + if (scmi_mailbox_check(np, idx)) { cinfo = idr_find(idr, SCMI_PROTOCOL_BASE); if (unlikely(!cinfo)) /* Possible only if platform has no Rx */