From patchwork Sun Mar 14 16:33:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400305 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 2B201C43332 for ; Sun, 14 Mar 2021 16:35:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04BD064EE3 for ; Sun, 14 Mar 2021 16:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234339AbhCNQfG (ORCPT ); Sun, 14 Mar 2021 12:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233995AbhCNQef (ORCPT ); Sun, 14 Mar 2021 12:34:35 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FCFC061574; Sun, 14 Mar 2021 09:34:35 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 124-20020a1c00820000b029010b871409cfso18823645wma.4; Sun, 14 Mar 2021 09:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WFjfvKJPz8sbDbBeOUgNkZKVwUwXHq+oQD2VCuoa4pw=; b=BllpC4pPefzxeU7jZI7bQnUlVgqXCHiKnM1jBT9h12ks6LuI8pvAMEuHNyTtfs1KAk Xeui5vrH+ietKxwFFUUQyQ43s61StZ1i5zdkz9T9FerQ7F/cQqJluw/dZ2dKG901hKKA X/itdsteel3yva0dSmOVeoh/nans62SxyomrLeLjqk53Eo5+IKXFuojDvt8kzvV7FR2B /kNh6+2NkCSqxw964oVPOM29hvK23u0aPuB6iUKvczNyHaEI6WPTBfIVsa8ZIR3dBKSs Ai5G5A0Meyqf7xWxXGd8yO06kW6f5vQdYZYSkfhkn+WmlK6WSHVfqVSViOJq4voYtM+L kN/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WFjfvKJPz8sbDbBeOUgNkZKVwUwXHq+oQD2VCuoa4pw=; b=TQYMCMiaH16TK1tkCKUDQTiQkkLMTaZbd2YLiVrnT27USJp4kF4B77+kTr3VQISx2c JLTjt4cmO8OKCnMwCLNClzapx841MewRYOITTeS3TVs/Nd82g7R3MknTJAveMxXvubqI nPUg4ACoZsWqxSdKwQzEi+/zq1F3YLeQIOClPsaQkjLE1bJjhNu5S83XODQiDC2SHbCh jHCeRNsWT19YDtcgNeSv1XVwg53e1BnhwJPVXvtUGRpK8LEHslvFiGHXFqQICLV7N7sH 2HcrlLEIGWgfubPKxuKmnjOubgGVW83a6r6n6CcWI/HDVLsXwTXiigordeTmSkZCwxT/ 882g== X-Gm-Message-State: AOAM532Fo53dI1rrjz2ADM7U8XZ4MyzBjhKeBm7EmFaQDoTnJePMOMwp 9khefFGAGsT06EuLYEChJHA= X-Google-Smtp-Source: ABdhPJyUcffwLSfcuDKZsqd4cFI+5GusDMa3Li6cgqYN//6b1wkOrcYQ0Xn0QIqzL4JghKStdfI5ww== X-Received: by 2002:a1c:4145:: with SMTP id o66mr17710829wma.68.1615739673784; Sun, 14 Mar 2021 09:34:33 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:33 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 02/15] opp: Add devres wrapper for dev_pm_opp_set_regulators Date: Sun, 14 Mar 2021 19:33:55 +0300 Message-Id: <20210314163408.22292-3-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Add devres wrapper for dev_pm_opp_set_regulators() to simplify drivers code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 30 ++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 02e46508a3a2..6217af05141f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2047,6 +2047,36 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_put_regulators); +static void devm_pm_opp_regulators_release(void *data) +{ + dev_pm_opp_put_regulators(data); +} + +/** + * devm_pm_opp_set_regulators() - Set regulator names for the device + * @dev: Device for which regulator name is being set. + * @names: Array of pointers to the names of the regulator. + * @count: Number of regulators. + * + * This is a resource-managed variant of dev_pm_opp_set_regulators(). + * + * Return: 0 on success and errorno otherwise. + */ +int devm_pm_opp_set_regulators(struct device *dev, + const char * const names[], + unsigned int count) +{ + struct opp_table *opp_table; + + opp_table = dev_pm_opp_set_regulators(dev, names, count); + if (IS_ERR(opp_table)) + return PTR_ERR(opp_table); + + return devm_add_action_or_reset(dev, devm_pm_opp_regulators_release, + opp_table); +} +EXPORT_SYMBOL_GPL(devm_pm_opp_set_regulators); + /** * dev_pm_opp_set_clkname() - Set clk name for the device * @dev: Device for which clk name is being set. diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 0583d775aa5a..3e667af57211 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -148,6 +148,7 @@ struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) void dev_pm_opp_put_prop_name(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); void dev_pm_opp_put_regulators(struct opp_table *opp_table); +int devm_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name); void dev_pm_opp_put_clkname(struct opp_table *opp_table); int devm_pm_opp_set_clkname(struct device *dev, const char *name); @@ -349,6 +350,13 @@ static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, co static inline void dev_pm_opp_put_regulators(struct opp_table *opp_table) {} +static inline int devm_pm_opp_set_regulators(struct device *dev, + const char * const names[], + unsigned int count) +{ + return -EOPNOTSUPP; +} + static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name) { return ERR_PTR(-EOPNOTSUPP); From patchwork Sun Mar 14 16:33:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400306 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 3F7F7C4332D for ; Sun, 14 Mar 2021 16:35:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24BAA64EF6 for ; Sun, 14 Mar 2021 16:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234357AbhCNQfH (ORCPT ); Sun, 14 Mar 2021 12:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233999AbhCNQeh (ORCPT ); Sun, 14 Mar 2021 12:34:37 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27373C061574; Sun, 14 Mar 2021 09:34:37 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id v15so7488960wrx.4; Sun, 14 Mar 2021 09:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hPYuaQIiYacDdTRkFz7tGyExYGJ5aL233qtVSVNLxbM=; b=u+Tt9wWI4e3BQ1rYQRpaqKQDgHwRnDqzBh78+io9i+PwANlqkgXpLBdJ0l0ArdAeJR 0wQLZUsIpbwe8BV0z1sh5u9qJ5lw7zXq+EBwqV+CHMuS5/kC2Cl99xWRUsIMKVQgX3lp kZVodOmxbA0vfSykFlRqfrpYBetNmq+8trL0ILDyT8yykYfhnIVmCjxis6SS/GlZDKMA fuOT3dCrNcyj9IAkCm5EfrYbWe8Y6OSAr/Zx+wz+UWY2256KVXw/z77MB8Y7oXg/b6f7 BKnIkcfIZwstErOYkjtwUgnLsyGZvC1+jBV+sPXtYjeUGT7a4M/xHBChZEGLidK3wumh H9fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hPYuaQIiYacDdTRkFz7tGyExYGJ5aL233qtVSVNLxbM=; b=EwrV4RXVoNY8HuIMweTU/eDlQqNGjI6wrcTEA53zno/NOSi27ak9dbuWCP33+Gwf5B vSdxRjgVdI2lkWHTq8DWofclyusrse3WpHIA6CSdtjO3fzVjAfUiUnSxBRLD0XQQzIlW nsc5AismKasvZsThNNVLBuqygPQzPqib1t+ojA/POPM/nAgzoETv8II2et0usssbothE 3qnU7H4MfLPesBYCZrgW4zxn76o7Ze5DJ22zhCJPyEpONXLI9yCXBLMsRzCPwkbSm/rE ve3DD1xMbFUzhZL1+qGoVw+CDJK2s5pa4PA/8XqNbiLa39tHQ764tWOZDrlDBVU8e/nT NBzg== X-Gm-Message-State: AOAM533lxA+5jF8qzJuGuMG9cpIKVv8FmtWq2YwXwfHWMzzvs9McwnL8 BjxdCYpDVGxBcQtjcmC85lU= X-Google-Smtp-Source: ABdhPJwRxZyo8Lm2nydoYcYZxtHj/cVPyavor29AJZSFgxwGb12emaS8kHyyqbuV8T+gbvxEe7TieQ== X-Received: by 2002:a05:6000:18ac:: with SMTP id b12mr23809490wri.77.1615739675873; Sun, 14 Mar 2021 09:34:35 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:35 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 03/15] opp: Add devres wrapper for dev_pm_opp_set_supported_hw Date: Sun, 14 Mar 2021 19:33:56 +0300 Message-Id: <20210314163408.22292-4-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Add devres wrapper for dev_pm_opp_set_supported_hw() to simplify drivers code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 29 +++++++++++++++++++++++++++++ include/linux/pm_opp.h | 8 ++++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 6217af05141f..34b054bbb28f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1857,6 +1857,35 @@ void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_put_supported_hw); +static void devm_pm_opp_supported_hw_release(void *data) +{ + dev_pm_opp_put_supported_hw(data); +} + +/** + * devm_pm_opp_set_supported_hw() - Set supported platforms + * @dev: Device for which supported-hw has to be set. + * @versions: Array of hierarchy of versions to match. + * @count: Number of elements in the array. + * + * This is a resource-managed variant of dev_pm_opp_set_supported_hw(). + * + * Return: 0 on success and errorno otherwise. + */ +int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, + unsigned int count) +{ + struct opp_table *opp_table; + + opp_table = dev_pm_opp_set_supported_hw(dev, versions, count); + if (IS_ERR(opp_table)) + return PTR_ERR(opp_table); + + return devm_add_action_or_reset(dev, devm_pm_opp_supported_hw_release, + opp_table); +} +EXPORT_SYMBOL_GPL(devm_pm_opp_set_supported_hw); + /** * dev_pm_opp_set_prop_name() - Set prop-extn name * @dev: Device for which the prop-name has to be set. diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 3e667af57211..e455b187e405 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -144,6 +144,7 @@ int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); +int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count); struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count); @@ -321,6 +322,13 @@ static inline struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) {} +static inline int devm_pm_opp_set_supported_hw(struct device *dev, + const u32 *versions, + unsigned int count) +{ + return -EOPNOTSUPP; +} + static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)) { From patchwork Sun Mar 14 16:33:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400304 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 6F663C4332E for ; Sun, 14 Mar 2021 16:35:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E60964EE7 for ; Sun, 14 Mar 2021 16:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234401AbhCNQfJ (ORCPT ); Sun, 14 Mar 2021 12:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234014AbhCNQem (ORCPT ); Sun, 14 Mar 2021 12:34:42 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A048BC061762; Sun, 14 Mar 2021 09:34:41 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id e9so4486915wrw.10; Sun, 14 Mar 2021 09:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qS29V1BJSlNMqK4W3VtZ1MYGmSsW4VwhnDeOAdwAbvw=; b=cpESHBVt3ogqmVmqovwCZn1Ag4Z0WFHp1c7v/S1vqDt5xpVGRBRQSp3hdj6hYduwoW xwGGoudfu69sETSQWvPJAwqnraJugbB8M4h79Gcy6kRt+BBF8i7u8fExVH61Oxd7swVN 3RxNgAJug2nueZJCGlp++UlnCrZ9BxYhQmR3zI9mYzX7OhCbpR4OxFTPfR2PEkEoXP05 5c0g8NdyTdsvDH+VVAwEOwx289IIvY389tRFixFHI54GQWF9cP3uyZpepH7jW1jD/Loe bY2F33UJcx+BhojpDpWAPsARYYGAsuEcxAztWBmCxtRvcarqEVJP8bWKrVDOq+vgz2fl 7Uww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qS29V1BJSlNMqK4W3VtZ1MYGmSsW4VwhnDeOAdwAbvw=; b=tV2Ml73XhiUrYd5TSWlWifEbzd7+ma3EghE5Pu7cqARGlracjzRCaVh8Z++VufkYGi X93fJySUGY9aJK7B2LPwzgTc8regHAQ82i4ax9yn+2BKtKC6TXZyX8K8NRCHOCns31pI IKRC4dxzzfK5O+hak4X008mKQ24Gw68FBxsAbhgdWlIeAiZVicJLS3i4cKdoS40Lq3EF poNDth8xZ7jk2JfJV26LdHT+Akl6TddykStXRdOioZg2eILpzyTVSZXsCpACEWyirFXw SxJ86sGA+csvUwFfIezj6R51MBHc/CSDMgLJ1XrYT3hqVWCXreDgqpIrq8BX67u6QrV0 QjZw== X-Gm-Message-State: AOAM5332qznujveRx9A094e82TlTE3CDhxD1h8FWJzNWcfvll3YKSkiJ 6jACLC6Mg5C/wG/U98eJY8o= X-Google-Smtp-Source: ABdhPJwqAJpoo+3WpdYcCXMr1WxDj94mxJyjdRzjlxT5Tk19OseUPJKhU3WGd48Tc+w6ggG6mD+4CQ== X-Received: by 2002:a5d:6443:: with SMTP id d3mr23825109wrw.292.1615739680210; Sun, 14 Mar 2021 09:34:40 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:40 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 05/15] opp: Change return type of devm_pm_opp_register_set_opp_helper() Date: Sun, 14 Mar 2021 19:33:58 +0300 Message-Id: <20210314163408.22292-6-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Make devm_pm_opp_register_set_opp_helper() to return error code instead of opp_table pointer in order to have return type consistent with the other resource-managed OPP helpers. Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 18 ++++++------------ include/linux/pm_opp.h | 6 +++--- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 34b054bbb28f..4f44f02e6049 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2295,25 +2295,19 @@ static void devm_pm_opp_unregister_set_opp_helper(void *data) * * This is a resource-managed version of dev_pm_opp_register_set_opp_helper(). * - * Return: pointer to 'struct opp_table' on success and errorno otherwise. + * Return: 0 on success and errorno otherwise. */ -struct opp_table * -devm_pm_opp_register_set_opp_helper(struct device *dev, - int (*set_opp)(struct dev_pm_set_opp_data *data)) +int devm_pm_opp_register_set_opp_helper(struct device *dev, + int (*set_opp)(struct dev_pm_set_opp_data *data)) { struct opp_table *opp_table; - int err; opp_table = dev_pm_opp_register_set_opp_helper(dev, set_opp); if (IS_ERR(opp_table)) - return opp_table; - - err = devm_add_action_or_reset(dev, devm_pm_opp_unregister_set_opp_helper, - opp_table); - if (err) - return ERR_PTR(err); + return PTR_ERR(opp_table); - return opp_table; + return devm_add_action_or_reset(dev, devm_pm_opp_unregister_set_opp_helper, + opp_table); } EXPORT_SYMBOL_GPL(devm_pm_opp_register_set_opp_helper); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 3f8894012429..865426b525a8 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -155,7 +155,7 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_table); int devm_pm_opp_set_clkname(struct device *dev, const char *name); struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); -struct opp_table *devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); +int devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs); void dev_pm_opp_detach_genpd(struct opp_table *opp_table); struct opp_table *devm_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs); @@ -337,11 +337,11 @@ static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) {} -static inline struct opp_table * +static int devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)) { - return ERR_PTR(-EOPNOTSUPP); + return -EOPNOTSUPP; } static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) From patchwork Sun Mar 14 16:34:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400303 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 11C54C2BB56 for ; Sun, 14 Mar 2021 16:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9A7E64EC6 for ; Sun, 14 Mar 2021 16:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234442AbhCNQfM (ORCPT ); Sun, 14 Mar 2021 12:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234033AbhCNQeq (ORCPT ); Sun, 14 Mar 2021 12:34:46 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE370C061574; Sun, 14 Mar 2021 09:34:45 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id y124-20020a1c32820000b029010c93864955so18824918wmy.5; Sun, 14 Mar 2021 09:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sWkE1WsTkUBL6nZDojhWUmQnQSjSLYp0gyDUfjHX3tw=; b=cSRN2y/tFestNZrESCS+KzkQ57FoXybXRzZLeRHuPVB2i3UPQ3T0LMt8IYTS1MtSw3 k7WXzZh1XLATuVEVwbHL7djV2gSVBx++Z5JLAS3gAfGoDt0sYVs8MWg+HYvgYjsyn6T4 tI1eoDiYa61+/CCL8pvSFBl/wqpe3xS7UYtoMbT2jJJvGqkbAnTqdbC73psUVGasoTI9 OJNkYM0JrO83EBXuM/zzwgNM2RCf2VjL8h4Q+hqyqJWvsnSrADr4kBW0ZGVTdTcrzbgv p00a9xQNc7hrR27z/yJrIEyCSpUsg9iO4FoUiGw7EON9ZgIM2LqG7bsd0oWFd90pRO6P X8xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sWkE1WsTkUBL6nZDojhWUmQnQSjSLYp0gyDUfjHX3tw=; b=kDs4qFsdMUet7yuSrYl4qDIG4KJlIAmRym3XOdm1O07gxuVOB6UlwXF8jDAD9e1IiG V5hlQkomnx49fJbVVZ/iCdXyEi/KZ+EfpReGxaTxs4dY/AOr38jE2IbI5a634REXob9b dw9kIAkujdcTSL+auuS9flffvteeRIqORqGiy15rl69iOsJ8mMuo/2ot3NxVQBLivseh n9MaPlD8YKna8QWawX0te3bMCe5L6vpnrW4hhSOCIkSJEL12P9uFuLqpnBKfG98PFEMO oDwZWs5ZObzPkQwXS44KTb+PdR+3Ef5CNsy/v6aTrLeaS4I0tl141YbUrzlcm+I7D+Hc GiRA== X-Gm-Message-State: AOAM532k1L5hWjrQqwH92P8DUMXoaMJuFlGiiYdSzyTyskBjxiZK6OKZ fctm5k3Gv8wBclVaphf0UdY= X-Google-Smtp-Source: ABdhPJzytN+oHophUDTCGClKZO9DIbz4gbFiuvi8oNRIXU4bqMoNeMMCp+cq4eL36pRbJLjGGBYMcg== X-Received: by 2002:a1c:7715:: with SMTP id t21mr22166814wmi.132.1615739684501; Sun, 14 Mar 2021 09:34:44 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:44 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 07/15] serial: qcom_geni_serial: Convert to use resource-managed OPP API Date: Sun, 14 Mar 2021 19:34:00 +0300 Message-Id: <20210314163408.22292-8-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Use resource-managed OPP API to simplify code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/tty/serial/qcom_geni_serial.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 291649f02821..3872bbfac24b 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1433,14 +1433,14 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap")) port->cts_rts_swap = true; - port->se.opp_table = dev_pm_opp_set_clkname(&pdev->dev, "se"); - if (IS_ERR(port->se.opp_table)) - return PTR_ERR(port->se.opp_table); + ret = devm_pm_opp_set_clkname(&pdev->dev, "se"); + if (ret) + return ret; /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(&pdev->dev); + ret = devm_pm_opp_of_add_table(&pdev->dev); if (ret && ret != -ENODEV) { dev_err(&pdev->dev, "invalid OPP table in device tree\n"); - goto put_clkname; + return ret; } port->private_data.drv = drv; @@ -1450,7 +1450,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) ret = uart_add_one_port(drv, uport); if (ret) - goto err; + return ret; irq_set_status_flags(uport->irq, IRQ_NOAUTOEN); ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr, @@ -1458,7 +1458,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) if (ret) { dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); uart_remove_one_port(drv, uport); - goto err; + return ret; } /* @@ -1475,16 +1475,11 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) if (ret) { device_init_wakeup(&pdev->dev, false); uart_remove_one_port(drv, uport); - goto err; + return ret; } } return 0; -err: - dev_pm_opp_of_remove_table(&pdev->dev); -put_clkname: - dev_pm_opp_put_clkname(port->se.opp_table); - return ret; } static int qcom_geni_serial_remove(struct platform_device *pdev) @@ -1492,8 +1487,6 @@ static int qcom_geni_serial_remove(struct platform_device *pdev) struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); struct uart_driver *drv = port->private_data.drv; - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(port->se.opp_table); dev_pm_clear_wake_irq(&pdev->dev); device_init_wakeup(&pdev->dev, false); uart_remove_one_port(drv, &port->uport); From patchwork Sun Mar 14 16:34:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400302 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 CB88BC2BB55 for ; Sun, 14 Mar 2021 16:35:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5B2864EC3 for ; Sun, 14 Mar 2021 16:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234718AbhCNQfr (ORCPT ); Sun, 14 Mar 2021 12:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234064AbhCNQev (ORCPT ); Sun, 14 Mar 2021 12:34:51 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1302DC061762; Sun, 14 Mar 2021 09:34:50 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id e18so4488457wrt.6; Sun, 14 Mar 2021 09:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gbw+Rc1RCI0Y3s+TLqxAUCfojdebzXyiUkV92Pla9uQ=; b=CHUhQMOY8SZwVo+F0SA+pV7IE73Qkpv8I/oDmA+M+JXPvxhX0I2Lqqalwp5dK5Lt9n gaZfSV1O+Y4fpf85zBne8oRYD6GkwYLbrJ45NWodBwl4AFVr2LMpO+x8yVGyIyuVCNtF +A1v5n4HpGv5RRk7BdZ8RBMYBFXByzBufZgdi1jxHkklbuSg88u0ARfbehoXBd6pcmfB Ush5FdcBnb5tOT92D9Oqq7xLdP9B3iqWHgwTSsKf/FMPHzKAKQ4JVJcjkOmcb/pJeMMO vFujXneJiegHG7hgBx1vGaEWvCOvope9ET/4XbVs0Jn1BZ1j8y94BDwZ16FL3LVFhLGX 8sVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gbw+Rc1RCI0Y3s+TLqxAUCfojdebzXyiUkV92Pla9uQ=; b=k549ymkx7z6yo/W3daxmGYC8yxpXwXVuwshGJlVkLQXRDAN7pqCYzdCnTnNuNkx85C Q6jFHlJjbmAl3ku3fywIt5IB/G5yJZX5xZYyAf4tn5z0IDwgX3BV2xhIN4TEHQVULzDd ncK1z5fLaKWuHBo+IqzDHxwcY9b6+4rxQmDz+ihO1aKJgxDsYHZu8tXW19H+0CNQKlFj JJpHn5gWNO80jd7CanXEgPBUtjZCeR3bF5z5hFQgET1s4kmbQq4bQ+WixAdqW6pElmTl KBDt2aL3Z07OWo+Z9cFhhNlgrH8GJvtGbD17gnJNX8+puWHdy6GzPy8tL1NsMeaCiW22 Sdnw== X-Gm-Message-State: AOAM532Oi6j9Qgf9jqLvDgUQS3mse82c3/nUjMKlujSyGKP9wqCa2xtI 7CRpdOA0p+BfsFkPeNZyVG8= X-Google-Smtp-Source: ABdhPJwittQM+2OpIIzVYUjKc3KCiZLlqN1EcIvKXJnc7fVVXF8K+vQIz9r147YJ8DNuoBWWHq/6Bw== X-Received: by 2002:a5d:43c5:: with SMTP id v5mr18951856wrr.265.1615739688805; Sun, 14 Mar 2021 09:34:48 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:48 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 09/15] spi: spi-qcom-qspi: Convert to use resource-managed OPP API Date: Sun, 14 Mar 2021 19:34:02 +0300 Message-Id: <20210314163408.22292-10-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Use resource-managed OPP API to simplify code. Signed-off-by: Yangtao Li Acked-by: Mark Brown Signed-off-by: Dmitry Osipenko --- drivers/spi/spi-qcom-qspi.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c index 1dbcc410cd35..c334dfec4117 100644 --- a/drivers/spi/spi-qcom-qspi.c +++ b/drivers/spi/spi-qcom-qspi.c @@ -142,7 +142,6 @@ struct qcom_qspi { struct clk_bulk_data *clks; struct qspi_xfer xfer; struct icc_path *icc_path_cpu_to_qspi; - struct opp_table *opp_table; unsigned long last_speed; /* Lock to protect data accessed by IRQs */ spinlock_t lock; @@ -530,14 +529,14 @@ static int qcom_qspi_probe(struct platform_device *pdev) master->handle_err = qcom_qspi_handle_err; master->auto_runtime_pm = true; - ctrl->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core"); - if (IS_ERR(ctrl->opp_table)) - return PTR_ERR(ctrl->opp_table); + ret = devm_pm_opp_set_clkname(&pdev->dev, "core"); + if (ret) + return ret; /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(&pdev->dev); + ret = devm_pm_opp_of_add_table(&pdev->dev); if (ret && ret != -ENODEV) { dev_err(&pdev->dev, "invalid OPP table in device tree\n"); - goto exit_probe_put_clkname; + return ret; } pm_runtime_use_autosuspend(dev); @@ -549,10 +548,6 @@ static int qcom_qspi_probe(struct platform_device *pdev) return 0; pm_runtime_disable(dev); - dev_pm_opp_of_remove_table(&pdev->dev); - -exit_probe_put_clkname: - dev_pm_opp_put_clkname(ctrl->opp_table); return ret; } @@ -560,14 +555,11 @@ static int qcom_qspi_probe(struct platform_device *pdev) static int qcom_qspi_remove(struct platform_device *pdev) { struct spi_master *master = platform_get_drvdata(pdev); - struct qcom_qspi *ctrl = spi_master_get_devdata(master); /* Unregister _before_ disabling pm_runtime() so we stop transfers */ spi_unregister_master(master); pm_runtime_disable(&pdev->dev); - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(ctrl->opp_table); return 0; } From patchwork Sun Mar 14 16:34:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400301 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 88049C2BC0E for ; Sun, 14 Mar 2021 16:35:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 78A5F64EF5 for ; Sun, 14 Mar 2021 16:35:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234728AbhCNQft (ORCPT ); Sun, 14 Mar 2021 12:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234085AbhCNQex (ORCPT ); Sun, 14 Mar 2021 12:34:53 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 271E7C061762; Sun, 14 Mar 2021 09:34:52 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id n11-20020a05600c4f8bb029010e5cf86347so1259198wmq.1; Sun, 14 Mar 2021 09:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ekucTjVivEQ90zhQvUqUcTjBwjviVC3YtIBQBVEBzF4=; b=Qd9you/7YOWedpOG1hvsUbVfiK6yVG8ZIN1eeu8EeN0oBoynBCJqewyO2AUV65SZK4 I3/qUxhda2DRofX+y5Vqzu7fqIzYlw2DqB+9jK9UAHSKpj5NqscMLcQGNg5ShHKQfseN 8ivwaU4F/qGeJzS3bjBg9hwpVynsI36qfyRUWF5oAsyeMHhD9eyj9sanwrZaRgjA1csz yXvSdS9/m9UEcj2BykHoqz+Qc9Y3YRGVU05CVjS9XwXdFImfbjbQRIGqwNEkZjWrmoX8 NG4olmzn8kZdcomDkFWi0DHlUc491i2dog4piB204tHMBvUEHJJW7aM4l7e/XtJyJMo5 HACw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ekucTjVivEQ90zhQvUqUcTjBwjviVC3YtIBQBVEBzF4=; b=MmJhOqwsFYn9Fl3WRMz7xd6CM673ki6rcWGClibGLPedmJ2llBKjoJElV+/TTKCT8v 3UeFEEEvuDT4TEsWig9qwiGk/j5fOZQ5wpLqUNNN8qzAkRFXGFqBtWE6gdai32VrwSJk 9vWfY+vQn8fo6kJDwYyxbZQDpMqTbHPYZLzHtFNZEbTcN5e3/r4NfLX5pZfk7v4vs/tT bFChO1p2o5lzANXkKNOh5Wj+B9xo09OODWDfSBhFj6razCsdYxG0VeBok8hDGygv+Lvu 8WzxYpaPZvSRvNaJDAnJLe4CckECbrLpb0+PyS4AnWybzvtO8CQXCgmt7llGRuzDW3g4 8X8Q== X-Gm-Message-State: AOAM533zNbj63znIDH6lbbbZWL/MPp9s+DCLeVBAHrh3He5eo4RqDtpq VQpKV5e5vzq8ZlJo3WzOKI4= X-Google-Smtp-Source: ABdhPJxCnEzz9dJy2Xdztr6bWqPxnNPEWIx01FtULZIwAIx6ZrM+uJHA7UaOro3z3yHFaKdZAMcN2g== X-Received: by 2002:a05:600c:4013:: with SMTP id i19mr16812944wmm.33.1615739690935; Sun, 14 Mar 2021 09:34:50 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:50 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 10/15] mmc: sdhci-msm: Convert to use resource-managed OPP API Date: Sun, 14 Mar 2021 19:34:03 +0300 Message-Id: <20210314163408.22292-11-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Use resource-managed OPP API to simplify code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/mmc/host/sdhci-msm.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 5e1da4df096f..d170c919e6e4 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -264,7 +264,6 @@ struct sdhci_msm_host { struct clk_bulk_data bulk_clks[5]; unsigned long clk_rate; struct mmc_host *mmc; - struct opp_table *opp_table; bool use_14lpp_dll_reset; bool tuning_done; bool calibration_done; @@ -2551,17 +2550,15 @@ static int sdhci_msm_probe(struct platform_device *pdev) if (ret) goto bus_clk_disable; - msm_host->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core"); - if (IS_ERR(msm_host->opp_table)) { - ret = PTR_ERR(msm_host->opp_table); + ret = devm_pm_opp_set_clkname(&pdev->dev, "core"); + if (ret) goto bus_clk_disable; - } /* OPP table is optional */ - ret = dev_pm_opp_of_add_table(&pdev->dev); + ret = devm_pm_opp_of_add_table(&pdev->dev); if (ret && ret != -ENODEV) { dev_err(&pdev->dev, "Invalid OPP table in Device tree\n"); - goto opp_put_clkname; + goto bus_clk_disable; } /* Vote for maximum clock rate for maximum performance */ @@ -2587,7 +2584,7 @@ static int sdhci_msm_probe(struct platform_device *pdev) ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), msm_host->bulk_clks); if (ret) - goto opp_cleanup; + goto bus_clk_disable; /* * xo clock is needed for FLL feature of cm_dll. @@ -2732,10 +2729,6 @@ static int sdhci_msm_probe(struct platform_device *pdev) clk_disable: clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), msm_host->bulk_clks); -opp_cleanup: - dev_pm_opp_of_remove_table(&pdev->dev); -opp_put_clkname: - dev_pm_opp_put_clkname(msm_host->opp_table); bus_clk_disable: if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); @@ -2754,8 +2747,6 @@ static int sdhci_msm_remove(struct platform_device *pdev) sdhci_remove_host(host, dead); - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_clkname(msm_host->opp_table); pm_runtime_get_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); From patchwork Sun Mar 14 16:34:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400300 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 F163BC43333 for ; Sun, 14 Mar 2021 16:35:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB6E064E25 for ; Sun, 14 Mar 2021 16:35:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234753AbhCNQfw (ORCPT ); Sun, 14 Mar 2021 12:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234165AbhCNQe7 (ORCPT ); Sun, 14 Mar 2021 12:34:59 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C79C061763; Sun, 14 Mar 2021 09:34:56 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id e10so7465407wro.12; Sun, 14 Mar 2021 09:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PhE/K8bjASn8uLSTMIHNbfNHkAkLrKT1OIOAoWkyNMs=; b=JlbqBDD6VH/xWHNATviIFRij7A1yTX/41RQ/gP5liwDY6o/bg43TnBdFfp1r4AfeHn vqpZOQsiUZt5zb4LqGLSF+hHfse5JOEUSoFUbG7/b7O9b2S+Ck7qKiZThLyHnx8NPDDb lmsMv+BsRqy+gizrUv7fElmmg53XiF9Zf4EJpvL3lmXaz8YxEU5vNgYAZyWhOTbaJ45i L/AOuhvBNZPymMXp0fxCOQ2wT1OTpbGhWb1RHD0H8i3LEfb7FjXK51U34hepv7B1yL2G zalBwYmPXFohPra/kB5NUb8QCHLK3jovNlYwiiYGAUzWz1i8iikcKrbriuWTtrHGvUue 7mAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PhE/K8bjASn8uLSTMIHNbfNHkAkLrKT1OIOAoWkyNMs=; b=XJqa+aWdsIBnE0cVdUDbJG3xNl9T26YPVEvfm1DUrTw9mfQ/CvuoZyVuUOrCEsaYb1 Wnf1TZzDrfrNn1BZhXC0euPlWu6STSZwSnovmEn76OynF2uGjzQiyLaWa6E2zZXqpuMM HH1Zv9utsl6rnLoHE1RgzsNXSZ8t/KcHpENQTBwt9CxZ3MiZB6m3qqeM5KOQXzUWA65l VuFdbisAXHqcTUk+tKf04AtQJ5HRf6mFWk14SSoBCE/KB7Hn+ZS3ZYEBYiFeLtJYgbee 06ItOS3DsUSYYUzdclGp9vZ5DQ4OEM6eaKwwHL9KCvRKEhGHNqW6Hdq0lXPbFAY6V4jS 1N8A== X-Gm-Message-State: AOAM533paOunSU7fOvfZ8nDzxPYUM2MaEfK7EgfheAzfq5LRU58qqfpE 3ynNgr+9bNGjYKG7D4M9KCI= X-Google-Smtp-Source: ABdhPJykydbD1QSNBzjvynpExNSxqOmcvB2KV3huIvD7l9+VLK0Psklcp/ruNZ1u/a5qgp+/3m9sfw== X-Received: by 2002:a05:6000:192:: with SMTP id p18mr23372896wrx.403.1615739695119; Sun, 14 Mar 2021 09:34:55 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:54 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 12/15] drm/lima: Convert to use resource-managed OPP API Date: Sun, 14 Mar 2021 19:34:05 +0300 Message-Id: <20210314163408.22292-13-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Use resource-managed OPP API to simplify code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/lima/lima_devfreq.c | 47 +++++++---------------------- drivers/gpu/drm/lima/lima_devfreq.h | 3 -- 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c index 5686ad4aaf7c..dbc1d1eb9543 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.c +++ b/drivers/gpu/drm/lima/lima_devfreq.c @@ -99,20 +99,12 @@ void lima_devfreq_fini(struct lima_device *ldev) devm_devfreq_remove_device(ldev->dev, devfreq->devfreq); devfreq->devfreq = NULL; } - - dev_pm_opp_of_remove_table(ldev->dev); - - dev_pm_opp_put_regulators(devfreq->regulators_opp_table); - dev_pm_opp_put_clkname(devfreq->clkname_opp_table); - devfreq->regulators_opp_table = NULL; - devfreq->clkname_opp_table = NULL; } int lima_devfreq_init(struct lima_device *ldev) { struct thermal_cooling_device *cooling; struct device *dev = ldev->dev; - struct opp_table *opp_table; struct devfreq *devfreq; struct lima_devfreq *ldevfreq = &ldev->devfreq; struct dev_pm_opp *opp; @@ -125,40 +117,28 @@ int lima_devfreq_init(struct lima_device *ldev) spin_lock_init(&ldevfreq->lock); - opp_table = dev_pm_opp_set_clkname(dev, "core"); - if (IS_ERR(opp_table)) { - ret = PTR_ERR(opp_table); - goto err_fini; - } - - ldevfreq->clkname_opp_table = opp_table; - - opp_table = dev_pm_opp_set_regulators(dev, - (const char *[]){ "mali" }, - 1); - if (IS_ERR(opp_table)) { - ret = PTR_ERR(opp_table); + ret = devm_pm_opp_set_clkname(dev, "core"); + if (ret) + return ret; + ret = devm_pm_opp_set_regulators(dev, (const char *[]){ "mali" }, 1); + if (ret) { /* Continue if the optional regulator is missing */ if (ret != -ENODEV) - goto err_fini; - } else { - ldevfreq->regulators_opp_table = opp_table; + return ret; } - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (ret) - goto err_fini; + return ret; lima_devfreq_reset(ldevfreq); cur_freq = clk_get_rate(ldev->clk_gpu); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) { - ret = PTR_ERR(opp); - goto err_fini; - } + if (IS_ERR(opp)) + return PTR_ERR(opp); lima_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); @@ -167,8 +147,7 @@ int lima_devfreq_init(struct lima_device *ldev) DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); if (IS_ERR(devfreq)) { dev_err(dev, "Couldn't initialize GPU devfreq\n"); - ret = PTR_ERR(devfreq); - goto err_fini; + return PTR_ERR(devfreq); } ldevfreq->devfreq = devfreq; @@ -180,10 +159,6 @@ int lima_devfreq_init(struct lima_device *ldev) ldevfreq->cooling = cooling; return 0; - -err_fini: - lima_devfreq_fini(ldev); - return ret; } void lima_devfreq_record_busy(struct lima_devfreq *devfreq) diff --git a/drivers/gpu/drm/lima/lima_devfreq.h b/drivers/gpu/drm/lima/lima_devfreq.h index 2d9b3008ce77..688ee71e263a 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.h +++ b/drivers/gpu/drm/lima/lima_devfreq.h @@ -8,15 +8,12 @@ #include struct devfreq; -struct opp_table; struct thermal_cooling_device; struct lima_device; struct lima_devfreq { struct devfreq *devfreq; - struct opp_table *clkname_opp_table; - struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; ktime_t busy_time; From patchwork Sun Mar 14 16:34:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 400299 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 47B49C4332D for ; Sun, 14 Mar 2021 16:36:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2600964EC6 for ; Sun, 14 Mar 2021 16:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234765AbhCNQfx (ORCPT ); Sun, 14 Mar 2021 12:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234211AbhCNQfB (ORCPT ); Sun, 14 Mar 2021 12:35:01 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A6F7C061762; Sun, 14 Mar 2021 09:35:00 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id t9so4484619wrn.11; Sun, 14 Mar 2021 09:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mgZKFLRFAbBRu7Q5z215LMK01y6B/VlLhTD6jZqDHxk=; b=H8o2FrMfH9tVu1ztan+gWiBd5bSVUm05dSFXZPAoZffhE06GKaXK7RxLEX2BIZ+OSg KmSaaU1WbXyqIzqzbi4zmt4+Zz1ark29b9LV0ic78Irq7sIv+PRFji3Ht8MMMFTvs/WG R6rLeHeZQ0fInZZchJpX7vd9vxb3hDGw6d/bHB6xzSstme+lgVDvHrn5ilkZDuSw8Cy4 NGS+cBsEtmktgYM2PICmTgp5kmLeZIn9q3pgc7idtv+GgAPwtDgfyNgy8+QpfB62MN0c hN7U4R348CTb70GQ15NLtWFsJNSF0ifkPMrnYf4SLCgu8BzQ5S3L+nbbns+OXXy8iyCg AiuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mgZKFLRFAbBRu7Q5z215LMK01y6B/VlLhTD6jZqDHxk=; b=UbwQK9ZBIXG6YjkGIJGTwlYo4/EEWKurblqBf/bAvTUkbmXl5cCOBiAJnRwFqpE3fQ ArJnK1EstLFmRu8uqRxNvx9ZH0WLUkMkt7yOr3leu4yqnr+5AF2Mwl14FSjkeuhASCkF Zmp6CVO930FAbraYjCZhaJxeP6Xy1QGZMAEdHMz1ATXNtJFagBm4N5bFBfp3EpQZ1qWJ iIBnS4A+UoOvOC3NEU1LGdjDxXXFedhfaBHli3O7nGpi3vTDOlu3Y8YJvV28jo5C5+q1 NX8qdP9CCjLpLLDFRgrqjDA57LV/XKkjPM3mg2lwhDvDLTYzfoD9gRZ8jjpuNjMt+ygo /EkA== X-Gm-Message-State: AOAM530jCQkk2QZIC84pRXik9xL5YfTrv0OZE53/zfVgikZc7Wt1RpIG 0LB36/5emEJ/BO7Z7MySqek= X-Google-Smtp-Source: ABdhPJwPZqEVDSr9D0mUwH6ne5arFGsjVko9cENT/XLUXmmB5qBPOLoqvm+C5z1r87vsWkwte6sPcQ== X-Received: by 2002:adf:fa08:: with SMTP id m8mr23720418wrr.12.1615739699340; Sun, 14 Mar 2021 09:34:59 -0700 (PDT) Received: from localhost.localdomain (109-252-193-52.dynamic.spd-mgts.ru. [109.252.193.52]) by smtp.gmail.com with ESMTPSA id o7sm15723239wrs.16.2021.03.14.09.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Mar 2021 09:34:59 -0700 (PDT) From: Dmitry Osipenko To: Qiang Yu , Rob Clark , Sean Paul , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Stanimir Varbanov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Lukasz Luba , Krzysztof Kozlowski , Adrian Hunter , Ulf Hansson , Viresh Kumar , Nishanth Menon , Stephen Boyd , Mark Brown , Greg Kroah-Hartman , Jiri Slaby , Yangtao Li Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 14/15] media: venus: Convert to use resource-managed OPP API Date: Sun, 14 Mar 2021 19:34:07 +0300 Message-Id: <20210314163408.22292-15-digetx@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210314163408.22292-1-digetx@gmail.com> References: <20210314163408.22292-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Yangtao Li Use resource-managed OPP API to simplify code. Signed-off-by: Yangtao Li Signed-off-by: Dmitry Osipenko --- drivers/media/platform/qcom/venus/core.h | 1 - .../media/platform/qcom/venus/pm_helpers.c | 35 +++++-------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index a252ed32cc14..d35f60d2cb56 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -125,7 +125,6 @@ struct venus_core { struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; struct icc_path *video_path; struct icc_path *cpucfg_path; - struct opp_table *opp_table; bool has_opp_table; struct device *pmdomains[VIDC_PMDOMAINS_NUM_MAX]; struct device_link *opp_dl_venus; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 43c4e3d9e281..e61317220b9a 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -756,7 +756,6 @@ static int venc_power_v4(struct device *dev, int on) static int vcodec_domains_get(struct device *dev) { int ret; - struct opp_table *opp_table; struct device **opp_virt_dev; struct venus_core *core = dev_get_drvdata(dev); const struct venus_resources *res = core->res; @@ -779,11 +778,9 @@ static int vcodec_domains_get(struct device *dev) return 0; /* Attach the power domain for setting performance state */ - opp_table = dev_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); - if (IS_ERR(opp_table)) { - ret = PTR_ERR(opp_table); + ret = devm_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); + if (ret) goto opp_attach_err; - } core->opp_pmdomain = *opp_virt_dev; core->opp_dl_venus = device_link_add(dev, core->opp_pmdomain, @@ -792,13 +789,11 @@ static int vcodec_domains_get(struct device *dev) DL_FLAG_STATELESS); if (!core->opp_dl_venus) { ret = -ENODEV; - goto opp_dl_add_err; + goto opp_attach_err; } return 0; -opp_dl_add_err: - dev_pm_opp_detach_genpd(core->opp_table); opp_attach_err: for (i = 0; i < res->vcodec_pmdomains_num; i++) { if (IS_ERR_OR_NULL(core->pmdomains[i])) @@ -830,8 +825,6 @@ static void vcodec_domains_put(struct device *dev) if (core->opp_dl_venus) device_link_del(core->opp_dl_venus); - - dev_pm_opp_detach_genpd(core->opp_table); } static int core_get_v4(struct device *dev) @@ -860,45 +853,33 @@ static int core_get_v4(struct device *dev) if (legacy_binding) return 0; - core->opp_table = dev_pm_opp_set_clkname(dev, "core"); - if (IS_ERR(core->opp_table)) - return PTR_ERR(core->opp_table); + ret = devm_pm_opp_set_clkname(dev, "core"); + if (ret) + return ret; if (core->res->opp_pmdomain) { - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (!ret) { core->has_opp_table = true; } else if (ret != -ENODEV) { dev_err(dev, "invalid OPP table in device tree\n"); - dev_pm_opp_put_clkname(core->opp_table); return ret; } } ret = vcodec_domains_get(dev); - if (ret) { - if (core->has_opp_table) - dev_pm_opp_of_remove_table(dev); - dev_pm_opp_put_clkname(core->opp_table); + if (ret) return ret; - } return 0; } static void core_put_v4(struct device *dev) { - struct venus_core *core = dev_get_drvdata(dev); - if (legacy_binding) return; vcodec_domains_put(dev); - - if (core->has_opp_table) - dev_pm_opp_of_remove_table(dev); - dev_pm_opp_put_clkname(core->opp_table); - } static int core_power_v4(struct device *dev, int on)