From patchwork Tue Jan 26 07:37:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 12047659 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 AD538C433E9 for ; Tue, 26 Jan 2021 18:36:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D4432223D for ; Tue, 26 Jan 2021 18:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387930AbhAZRXj (ORCPT ); Tue, 26 Jan 2021 12:23:39 -0500 Received: from mail.v3.sk ([167.172.186.51]:48082 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389342AbhAZHio (ORCPT ); Tue, 26 Jan 2021 02:38:44 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id A5EF0E0B03; Tue, 26 Jan 2021 07:33:43 +0000 (UTC) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id u4fMlcvWkBjT; Tue, 26 Jan 2021 07:33:42 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id AFFE4E0B05; Tue, 26 Jan 2021 07:33:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 1w52DoKF2SmU; Tue, 26 Jan 2021 07:33:42 +0000 (UTC) Received: from localhost (unknown [109.183.109.54]) by zimbra.v3.sk (Postfix) with ESMTPSA id B8731E0B00; Tue, 26 Jan 2021 07:33:41 +0000 (UTC) From: Lubomir Rintel To: Hans de Goede Cc: Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel Subject: [PATCH 1/3] Platform: OLPC: Fix probe error handling Date: Tue, 26 Jan 2021 08:37:38 +0100 Message-Id: <20210126073740.10232-2-lkundrak@v3.sk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210126073740.10232-1-lkundrak@v3.sk> References: <20210126073740.10232-1-lkundrak@v3.sk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Reset ec_priv if probe ends unsuccessfully. Signed-off-by: Lubomir Rintel --- drivers/platform/olpc/olpc-ec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c index f64b82824db28..2db7113383fdc 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev) /* get the EC revision */ err = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1); - if (err) { - ec_priv = NULL; - kfree(ec); - return err; - } + if (err) + goto error; config.dev = pdev->dev.parent; config.driver_data = ec; @@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev) if (IS_ERR(ec->dcon_rdev)) { dev_err(&pdev->dev, "failed to register DCON regulator\n"); err = PTR_ERR(ec->dcon_rdev); - kfree(ec); - return err; + goto error; } ec->dbgfs_dir = olpc_ec_setup_debugfs(); + return 0; + +error: + ec_priv = NULL; + kfree(ec); return err; } From patchwork Tue Jan 26 07:37:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 12047661 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 1E490C4332D for ; Tue, 26 Jan 2021 18:36:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7ED02224C for ; Tue, 26 Jan 2021 18:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387833AbhAZRX3 (ORCPT ); Tue, 26 Jan 2021 12:23:29 -0500 Received: from mail.v3.sk ([167.172.186.51]:48094 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389376AbhAZHio (ORCPT ); Tue, 26 Jan 2021 02:38:44 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 099F8E0AE3; Tue, 26 Jan 2021 07:33:44 +0000 (UTC) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LiDkEwULDfYZ; Tue, 26 Jan 2021 07:33:43 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 02148E0B00; Tue, 26 Jan 2021 07:33:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zfSGgeEiMIkE; Tue, 26 Jan 2021 07:33:42 +0000 (UTC) Received: from localhost (unknown [109.183.109.54]) by zimbra.v3.sk (Postfix) with ESMTPSA id 32E5DE075A; Tue, 26 Jan 2021 07:33:42 +0000 (UTC) From: Lubomir Rintel To: Hans de Goede Cc: Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel Subject: [PATCH 2/3] Platform: OLPC: Remove dcon_rdev from olpc_ec_priv Date: Tue, 26 Jan 2021 08:37:39 +0100 Message-Id: <20210126073740.10232-3-lkundrak@v3.sk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210126073740.10232-1-lkundrak@v3.sk> References: <20210126073740.10232-1-lkundrak@v3.sk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org It is not needed. Use a local variable instead. Signed-off-by: Lubomir Rintel --- drivers/platform/olpc/olpc-ec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c index 2db7113383fdc..3c852d573e9b4 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -37,7 +37,6 @@ struct olpc_ec_priv { struct mutex cmd_lock; /* DCON regulator */ - struct regulator_dev *dcon_rdev; bool dcon_enabled; /* Pending EC commands */ @@ -405,6 +404,7 @@ static int olpc_ec_probe(struct platform_device *pdev) { struct olpc_ec_priv *ec; struct regulator_config config = { }; + struct regulator_dev *regulator; int err; if (!ec_driver) @@ -432,11 +432,10 @@ static int olpc_ec_probe(struct platform_device *pdev) config.dev = pdev->dev.parent; config.driver_data = ec; ec->dcon_enabled = true; - ec->dcon_rdev = devm_regulator_register(&pdev->dev, &dcon_desc, - &config); - if (IS_ERR(ec->dcon_rdev)) { + regulator = devm_regulator_register(&pdev->dev, &dcon_desc, &config); + if (IS_ERR(regulator)) { dev_err(&pdev->dev, "failed to register DCON regulator\n"); - err = PTR_ERR(ec->dcon_rdev); + err = PTR_ERR(regulator); goto error; } From patchwork Tue Jan 26 07:37:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 12047657 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 8EA9BC433DB for ; Tue, 26 Jan 2021 18:36:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5996E2224C for ; Tue, 26 Jan 2021 18:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388153AbhAZRXs (ORCPT ); Tue, 26 Jan 2021 12:23:48 -0500 Received: from mail.v3.sk ([167.172.186.51]:48106 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389447AbhAZHip (ORCPT ); Tue, 26 Jan 2021 02:38:45 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 7CDC7E0B00; Tue, 26 Jan 2021 07:33:44 +0000 (UTC) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id G4dx_yet5KKS; Tue, 26 Jan 2021 07:33:43 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 9D7EDE0838; Tue, 26 Jan 2021 07:33:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bH9cakOCdFqc; Tue, 26 Jan 2021 07:33:43 +0000 (UTC) Received: from localhost (unknown [109.183.109.54]) by zimbra.v3.sk (Postfix) with ESMTPSA id 98AEFE0AE3; Tue, 26 Jan 2021 07:33:42 +0000 (UTC) From: Lubomir Rintel To: Hans de Goede Cc: Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Lubomir Rintel Subject: [PATCH 3/3] Platform: OLPC: Specify the enable time Date: Tue, 26 Jan 2021 08:37:40 +0100 Message-Id: <20210126073740.10232-4-lkundrak@v3.sk> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210126073740.10232-1-lkundrak@v3.sk> References: <20210126073740.10232-1-lkundrak@v3.sk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Determined empirically. Signed-off-by: Lubomir Rintel --- drivers/platform/olpc/olpc-ec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c index 3c852d573e9b4..72dbbea0005c5 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -393,11 +393,12 @@ static struct regulator_ops dcon_regulator_ops = { }; static const struct regulator_desc dcon_desc = { - .name = "dcon", - .id = 0, - .ops = &dcon_regulator_ops, - .type = REGULATOR_VOLTAGE, - .owner = THIS_MODULE, + .name = "dcon", + .id = 0, + .ops = &dcon_regulator_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .enable_time = 25000, }; static int olpc_ec_probe(struct platform_device *pdev)