Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3621993pxb; Fri, 4 Feb 2022 12:35:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxom/EFggnxNnvQWVSuh2jhnQcwRCN9/4krMoz6L+l6DqtBHtj9BqKfaHISeYMfsCaxzPi9 X-Received: by 2002:a17:90b:3b8d:: with SMTP id pc13mr5081726pjb.54.1644006934856; Fri, 04 Feb 2022 12:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644006934; cv=none; d=google.com; s=arc-20160816; b=sA0BTlYHadLvcIrDV3hWoUK99+RmX0IRCoBc7MTms+Ywm5P9nAR9mavWhWzfdl/URr e6GCRwgelb883Eg7IBVwUnh6GdGqLKH3yK0DnsmWsQfisnJvTIuX3W00AUwJsRBBgXkk 31s0hICbRCKNgT7RMtF2n+dnmwQc7JmIYb/GHBIeuQWVJXl6FSwevfdSyq504F3PjUwJ u4rkb2DU4IPx4SRPY5Wi9DliIqvregsaZBvYwvwVTZ9UFByGWiLiPILuOnQZIlqY7naA yu/B48vdQYB+9NH9KDOBrYlTVdE/98vYY3FTe9SC1ZQbTgWvOqDrekxZ9Lsnx+6BylBC /NFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kmF/moFaP2vIu3wyyPlPwTNgQVyw6cgxTUQxtgkWdeo=; b=BV9hhYmMctcjPDfH/2jvI2PUTU24ni7Vd3pKidckj1z0pEyfOvA99qeGEbek/Nb00V s3mWRDWOzw5MmhRVMqY0IFnd+gGUEsgx97d89UP2co42dAZSBbPy7+1qrZVJRZ1v0Nk/ w8fFEd06UT2qujWLtNy2VyghWwpLreYe/auPLRxyBADCLmTFxZytZJUI/8qYbeQiaTLj qDzyEwQ4cDORUDFd0OX8HpBBZU+LhJaOVm2a6UFIKozg4aLFfLcNYN2/Vzck89tze16G pZEsTm1gDKSOM6jrU0ZEfj3KqgB7tULjLn4qTJ54pWN+MN7f/ufUo89UwqPGLm0RXGPC fHwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t5BfgawT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h185si2957689pge.300.2022.02.04.12.35.23; Fri, 04 Feb 2022 12:35:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t5BfgawT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235143AbiBDTvL (ORCPT + 99 others); Fri, 4 Feb 2022 14:51:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234962AbiBDTvA (ORCPT ); Fri, 4 Feb 2022 14:51:00 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4675C061757 for ; Fri, 4 Feb 2022 11:50:56 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id c188so8700168iof.6 for ; Fri, 04 Feb 2022 11:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kmF/moFaP2vIu3wyyPlPwTNgQVyw6cgxTUQxtgkWdeo=; b=t5BfgawT/Wi7BmrdzbQR8QJ+QBreob1GlKCLwZgqgf1bRGhvxIC96l1yYniIAJJOvr RojhGZHINyxfRZUofCo5qxAutycDc6s0FTMi2j8aZQpGWIJY77vzqX5GGb0LYnjCRCp+ G4C2CfCwJ49OfMY8jBde4zjpjcgzUQ862CJfRyXrofRs5uXXbs9ka0A2jNh1bsKnw/wI VIxwlcO5njztQsVeiI/UF2llVsZ4C3qelhUT0ZsHnPp7JIFKHcNZBZGeDX8/Hd1olUKb MhBd4joG/lOC0yHP0uPVlqFkaN4EXj4wNuTwJG90Nz41DSEnZMUZOAspV5MQUygbOoQ5 46gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kmF/moFaP2vIu3wyyPlPwTNgQVyw6cgxTUQxtgkWdeo=; b=swd4htSgaWa7lGexPKsyC2Ame54SQ7pHriAsbwP98WXYLE6l+hrJW157TSOz2ZVrkY SSp0qNDqxc3lMkSQ9/Igu8S/VSHhb/r87KtDaaFTtN+gk7LQGXj+T/irsqprhn5D0HgH 8ne7w5ihzqeOcHdEzJx8iz+FB2CWTvsESwXWUefKqJmfeNCMgzyZbE/0K+UkEnHFbt/i GVy883J3OLcTB8lEJJALTZgv9k8ZYS0sk3nXM4c8UQN02iSZEnJoJwv+ziVN7ZrHguEE 3blVbB/kvqkdRQF4iVGWz5QwOXjmDGgESuM4NnZZ8FPD1DYUenynVtjpIBRLRHh65Op2 HpQQ== X-Gm-Message-State: AOAM532wV4hhm5S6+R7zPU1fW3BDQpuvl4BbCQQ5Dfqn0YR2/vOJqA3e QTLegzuoZbO8xgvnOMvfPlWZXA== X-Received: by 2002:a05:6638:379c:: with SMTP id w28mr326787jal.275.1644004255938; Fri, 04 Feb 2022 11:50:55 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id k13sm1417564ili.22.2022.02.04.11.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 11:50:55 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: djakov@kernel.org, bjorn.andersson@linaro.org, mka@chromium.org, evgreen@chromium.org, cpratapa@codeaurora.org, avuyyuru@codeaurora.org, jponduru@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/7] net: ipa: use bulk interconnect initialization Date: Fri, 4 Feb 2022 13:50:42 -0600 Message-Id: <20220204195044.1082026-6-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220204195044.1082026-1-elder@linaro.org> References: <20220204195044.1082026-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous patch used bulk interconnect operations to initialize IPA interconnects one at a time. This rearranges things to use the bulk interfaces as intended--on all interconnects together. As a result ipa_interconnect_init_one() and ipa_interconnect_exit_one() are no longer needed. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_power.c | 66 +++++++++++++------------------------ 1 file changed, 23 insertions(+), 43 deletions(-) diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index c0da1274f5d67..b1f6978dddadb 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -70,38 +70,6 @@ struct ipa_power { struct icc_bulk_data *interconnect; }; -static int ipa_interconnect_init_one(struct device *dev, - struct icc_bulk_data *interconnect, - const struct ipa_interconnect_data *data) -{ - int ret; - - /* interconnect->path is filled in by of_icc_bulk_get() */ - interconnect->name = data->name; - interconnect->avg_bw = data->average_bandwidth; - interconnect->peak_bw = data->peak_bandwidth; - - ret = of_icc_bulk_get(dev, 1, interconnect); - if (ret) - return ret; - - /* All interconnects are initially disabled */ - icc_bulk_disable(1, interconnect); - - /* Set the bandwidth values to be used when enabled */ - ret = icc_bulk_set_bw(1, interconnect); - if (ret) - icc_bulk_put(1, interconnect); - - return ret; -} - -static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect) -{ - icc_bulk_put(1, interconnect); - memset(interconnect, 0, sizeof(*interconnect)); -} - /* Initialize interconnects required for IPA operation */ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev, const struct ipa_interconnect_data *data) @@ -116,18 +84,34 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev, return -ENOMEM; power->interconnect = interconnect; + /* Initialize our interconnect data array for bulk operations */ while (count--) { - ret = ipa_interconnect_init_one(dev, interconnect, data++); - if (ret) - goto out_unwind; + /* interconnect->path is filled in by of_icc_bulk_get() */ + interconnect->name = data->name; + interconnect->avg_bw = data->average_bandwidth; + interconnect->peak_bw = data->peak_bandwidth; + data++; interconnect++; } + ret = of_icc_bulk_get(dev, power->interconnect_count, + power->interconnect); + if (ret) + goto err_free; + + /* All interconnects are initially disabled */ + icc_bulk_disable(power->interconnect_count, power->interconnect); + + /* Set the bandwidth values to be used when enabled */ + ret = icc_bulk_set_bw(power->interconnect_count, power->interconnect); + if (ret) + goto err_bulk_put; + return 0; -out_unwind: - while (interconnect-- > power->interconnect) - ipa_interconnect_exit_one(interconnect); +err_bulk_put: + icc_bulk_put(power->interconnect_count, power->interconnect); +err_free: kfree(power->interconnect); power->interconnect = NULL; @@ -137,11 +121,7 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev, /* Inverse of ipa_interconnect_init() */ static void ipa_interconnect_exit(struct ipa_power *power) { - struct icc_bulk_data *interconnect; - - interconnect = power->interconnect + power->interconnect_count; - while (interconnect-- > power->interconnect) - ipa_interconnect_exit_one(interconnect); + icc_bulk_put(power->interconnect_count, power->interconnect); kfree(power->interconnect); power->interconnect = NULL; } -- 2.32.0