From patchwork Tue Apr 17 17:12:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10346083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C41F860216 for ; Tue, 17 Apr 2018 17:12:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B474327CAF for ; Tue, 17 Apr 2018 17:12:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A94692834A; Tue, 17 Apr 2018 17:12:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AF41284F1 for ; Tue, 17 Apr 2018 17:12:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751863AbeDQRMh (ORCPT ); Tue, 17 Apr 2018 13:12:37 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:42491 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752829AbeDQRMf (ORCPT ); Tue, 17 Apr 2018 13:12:35 -0400 Received: by mail-pf0-f194.google.com with SMTP id o16so12438382pfk.9 for ; Tue, 17 Apr 2018 10:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=VdC7PIG2C9kRDU+xEbtUQLQpqNTUWJQXiVDUyscPtuA=; b=M2i1goVLEatU/d4HqNRXVpsT239x7rMWoekhDQq9Iethpz1VeriHaBfGS6u+KLqhdw 85LS1VQTEpEWbTB33fvr5vwTsNOrp0Pt0EO+Vo0d7sJcBkVsRbtt7YjYtfkfNT2l4jHE 92ooiUtDS/jNPbae88SkzIzBcp8NNBNEIoykw= 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; bh=VdC7PIG2C9kRDU+xEbtUQLQpqNTUWJQXiVDUyscPtuA=; b=DgpYBCKQCS/WkoIU378NgtTFJrhFrs4pTwGbot2mJkJcq03QL2riAcP/Y0z6erKI7H cyt/QD0gtKSgtAa5BqoOKgoQcOEdAZBsDDNn2/BbBCbVqkaV/L8zlC5cygvFuA02uxmB duEoE1v9T6j202TbVjpT8uYntNYTYrZf9owzCImU7RlYScFvnwuD75/heRmXU1EXSQq2 HBFjQViAkr3TEAUfCnI3H2fsw3ing/bfL1DRuebixf1s1wEFK85HLvJdS18hUWS0V9x7 KmBXSnxHFgzetO8ZQzR53AsJxWUuaRu7BWx/Rl1aMt63HLHeY3A3Me2tN3JYUkQPiMZQ 6ilg== X-Gm-Message-State: ALQs6tApZEi2cfgMi2IClJhn4Qj/06MMPyg9zFOnPCzBu3RSa1IJbN+h Y62Fw25g9T6izNu7YqCjdhiPgQ== X-Google-Smtp-Source: AIpwx4+2cWASjrSDumH40W5gV3IQUPR4Q3b0YS6ire+tp8iXeWFulhQKK5WjHQOH14SiC5xBkbnwJw== X-Received: by 10.98.75.89 with SMTP id y86mr2774514pfa.140.1523985154640; Tue, 17 Apr 2018 10:12:34 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:0:1000:1511:bde7:107f:fd5:44c8]) by smtp.gmail.com with ESMTPSA id c3sm32172736pfd.28.2018.04.17.10.12.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 10:12:33 -0700 (PDT) From: Douglas Anderson To: broonie@kernel.org Cc: David Collins , evgreen@chromium.org, swboyd@chromium.org, Douglas Anderson , Javier Martinez Canillas , linux-kernel@vger.kernel.org, Liam Girdwood , Tony Lindgren , linux-omap@vger.kernel.org Subject: [PATCH] regulator: Fix return type of of_map_mode() Date: Tue, 17 Apr 2018 10:12:04 -0700 Message-Id: <20180417171204.259146-1-dianders@chromium.org> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In of_get_regulation_constraints() it can clearly be seen that the return value of of_map_mode() is assigned to a signed integer. This is important because the first thing the regulator core does with this value is to compare it to -EINVAL. Let's fix the return type of all of the current of_map_mode() functions. While we're at it, we'll remove one pointless "inline". Fixes: 5e5e3a42c653 ("regulator: of: Add support for parsing initial and suspend modes") Signed-off-by: Douglas Anderson --- drivers/regulator/cpcap-regulator.c | 2 +- drivers/regulator/max77802-regulator.c | 2 +- drivers/regulator/qcom_spmi-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- include/linux/regulator/driver.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c index f541b80f1b54..46eba038f8e9 100644 --- a/drivers/regulator/cpcap-regulator.c +++ b/drivers/regulator/cpcap-regulator.c @@ -214,7 +214,7 @@ static int cpcap_regulator_disable(struct regulator_dev *rdev) return error; } -static unsigned int cpcap_map_mode(unsigned int mode) +static int cpcap_map_mode(unsigned int mode) { switch (mode) { case CPCAP_BIT_AUDIO_NORMAL_MODE: diff --git a/drivers/regulator/max77802-regulator.c b/drivers/regulator/max77802-regulator.c index b6261903818c..8c6b5d2aec86 100644 --- a/drivers/regulator/max77802-regulator.c +++ b/drivers/regulator/max77802-regulator.c @@ -75,7 +75,7 @@ struct max77802_regulator_prv { unsigned int opmode[MAX77802_REG_MAX]; }; -static inline unsigned int max77802_map_mode(unsigned int mode) +static inline int max77802_map_mode(unsigned int mode) { return mode == MAX77802_OPMODE_NORMAL ? REGULATOR_MODE_NORMAL : REGULATOR_MODE_STANDBY; diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index 63c7a0c17777..c83124061632 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c @@ -1432,7 +1432,7 @@ static void spmi_regulator_get_dt_config(struct spmi_regulator *vreg, &data->vs_soft_start_strength); } -static unsigned int spmi_regulator_of_map_mode(unsigned int mode) +static int spmi_regulator_of_map_mode(unsigned int mode) { if (mode == 1) return REGULATOR_MODE_NORMAL; diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index a4456db5849d..496917bfad05 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -266,7 +266,7 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode) return twl4030_send_pb_msg(message); } -static inline unsigned int twl4030reg_map_mode(unsigned int mode) +static int twl4030reg_map_mode(unsigned int mode) { switch (mode) { case RES_STATE_ACTIVE: diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4fc96cb8e5d7..c98da2500c9f 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -367,7 +367,7 @@ struct regulator_desc { unsigned int off_on_delay; - unsigned int (*of_map_mode)(unsigned int mode); + int (*of_map_mode)(unsigned int mode); }; /**