From patchwork Mon Nov 13 00:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 164292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp931926vqg; Sun, 12 Nov 2023 16:52:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVpAxTAE9VrQizFBpTJ1X0aim0YLL8lAmnLS3xcP9/pbURcOaFnH1wjylM6qc/WF7a2+fw X-Received: by 2002:a05:6358:8a6:b0:168:d0d4:d8e6 with SMTP id m38-20020a05635808a600b00168d0d4d8e6mr8016390rwj.16.1699836753256; Sun, 12 Nov 2023 16:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699836753; cv=none; d=google.com; s=arc-20160816; b=umYwxZGBS0VpknC58kY+hByTiPfNY6LC/f0rmUDjSEnLYN/NrywmZh7EEESxQ+XG0e y1HyS2RKP9fF6pYyBGXwojDiRkESW/JRMcdC3EGcGMsrjUxApe6MxEjeCsbv+kbo+s1Z tPUubE73jKlwutLIl4IGba7trWM6k/J91mrFJxy7Lr7HjOFNT5n2WsjVOHrcOI4M+/vv 5KXjbwpMYb2Brgc7MnbIyUdchBydWL/LXUaUVK1wsHaXxEV3bCv/Ky/SkYw36X0N+HP+ ux2+w38Td9ccByURRuyavp3rmNmUUtKnnSpEtLPjHb4sPagQib1Q6XPTH+/ZEwmXznDx y8Lg== 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=EzZ1VatqfWxQhDUcF9TinY3eHHdZUFg/2GJwAA3DgHY=; fh=OlWmP2uhTrj9jFj06aj7UbYW3kh4GkDA9IAtXFWUw6M=; b=0CjhSahBqd9OD0e/qQpmeYYrqMwU2TPMh8mNw3CEunpwqSJaRfdRF/hb3NVj5LcVRQ rnpsxK2e5HT/fcNkg3xuLxSicGDiWnIWe39paCxcHAHqje6n+knlDKEVJ9aW12Wzqw7c 3elsz5Uhg5nhPgeAVtrBdbSZVbXIJL0/GmDGKkCxnjOTCOJk94/01HRjoluPBaaJ6Si3 V6jBjnHK3SppaiJdUJ1byrcxqBeuwEE3PXDfOKnS/gu35wyWuNU/zhOteRER9RBDXwoF VEpDiVGqZ4RdrezSQu69EkN/ySUgop3WCfipJLFNXrJSLjlz8gAAU/gx3rgA4nVDJAsy 7PoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=lssJOrV5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c7-20020a631c07000000b005bd30867387si4674878pgc.226.2023.11.12.16.52.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Nov 2023 16:52:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=lssJOrV5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5840A8057E12; Sun, 12 Nov 2023 16:52:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjKMAwa (ORCPT + 31 others); Sun, 12 Nov 2023 19:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbjKMAw3 (ORCPT ); Sun, 12 Nov 2023 19:52:29 -0500 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 420991FE5 for ; Sun, 12 Nov 2023 16:52:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=EzZ1VatqfWxQhDUcF9TinY3eHHdZUFg/2GJwAA3DgHY=; b=lssJOr V5zSCoLdklIpXZWXwZ/QOafV4vonzgf+MLfzqzEiJwV+MN8DKruO5DHyq7R9Q5YF /8RDWLWV9MQvwqtG+xv2abqUKYH9StEFG6SWLMddiYnZZccoq72G2wx1ZB/ArU8r vX01/0oV0w3XppLRQG2A+W5n9mCNPkFzgvFuZbGlRkV8Gw7DMlhW5zhfF8LCD23P 4n+MnufLWa7ZhqEejG707kTzST/8uoqZUqsG5tTlwt4ssUQSjzXHQTHR2iYp/Zzi eZBp64D6wPExVXdDTXQkncXf7Oj9lmxOsYxyiyA0G/Sv4aE6YXRIuRrJFV7dolxv RH69LKgxyneanKhg== Received: (qmail 4084423 invoked from network); 13 Nov 2023 01:52:24 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 13 Nov 2023 01:52:24 +0100 X-UD-Smtp-Session: l3s3148p1@3s43Ff4J88AMv8XD From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Geert Uytterhoeven , Johan Hovold , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v5 1/3] gnss: ubx: use new helper to remove open coded regulator handling Date: Sun, 12 Nov 2023 19:51:49 -0500 Message-Id: <20231113005152.10656-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> References: <20231113005152.10656-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 12 Nov 2023 16:52:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782408023454745950 X-GMAIL-MSGID: 1782408023454745950 v_bckp shall always be enabled as long as the device exists. We now have a regulator helper for that, use it. Signed-off-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven --- drivers/gnss/ubx.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c index c951be202ca2..9b76b101ba5e 100644 --- a/drivers/gnss/ubx.c +++ b/drivers/gnss/ubx.c @@ -17,7 +17,6 @@ #include "serial.h" struct ubx_data { - struct regulator *v_bckp; struct regulator *vcc; }; @@ -87,30 +86,16 @@ static int ubx_probe(struct serdev_device *serdev) goto err_free_gserial; } - data->v_bckp = devm_regulator_get_optional(&serdev->dev, "v-bckp"); - if (IS_ERR(data->v_bckp)) { - ret = PTR_ERR(data->v_bckp); - if (ret == -ENODEV) - data->v_bckp = NULL; - else - goto err_free_gserial; - } - - if (data->v_bckp) { - ret = regulator_enable(data->v_bckp); - if (ret) - goto err_free_gserial; - } + ret = devm_regulator_get_enable_optional(&serdev->dev, "v-bckp"); + if (ret < 0 && ret != -ENODEV) + goto err_free_gserial; ret = gnss_serial_register(gserial); if (ret) - goto err_disable_v_bckp; + goto err_free_gserial; return 0; -err_disable_v_bckp: - if (data->v_bckp) - regulator_disable(data->v_bckp); err_free_gserial: gnss_serial_free(gserial); @@ -120,11 +105,8 @@ static int ubx_probe(struct serdev_device *serdev) static void ubx_remove(struct serdev_device *serdev) { struct gnss_serial *gserial = serdev_device_get_drvdata(serdev); - struct ubx_data *data = gnss_serial_get_drvdata(gserial); gnss_serial_deregister(gserial); - if (data->v_bckp) - regulator_disable(data->v_bckp); gnss_serial_free(gserial); }