Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp793792rdf; Fri, 3 Nov 2023 15:56:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoXYz8gbLOPMJSpQ4utWgwMfZMMagCuuGoi0og94rPPtOc+2K/2hlS5/kfXsUW+tpGYiQ3 X-Received: by 2002:a17:903:2310:b0:1b9:de75:d5bb with SMTP id d16-20020a170903231000b001b9de75d5bbmr28917370plh.7.1699052195834; Fri, 03 Nov 2023 15:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699052195; cv=none; d=google.com; s=arc-20160816; b=PFYHkYl7jlQRKq53Zq3bMEERO1NampfDDCnb8dqy5m+d8oHgOmbu6Q8+/NqBm6rMQj fhZEbkaZJClpSYDg0XVeB9TyFT4lEBI73kYtYGbs261k8MCsoh1Dmm34nG8xRg5qN3jM wV8d7TrtFdjJSa2KY3MDChfmJea7bKzXuSci8Kl1tLcCWabW811+WMuJI+zpZGrAoeVi DD94DxeiSvOpKiIowAeKGwhg1JjMVGQkENRp0tVuaM3QL6Duyq8ZE98p2S243BCHqoc4 A0AuOY07oCP2ubh2CfjVaKA9TJ5RRV8/ocRER2cZWftuux9XgoKTxBUcLw9NyFnUJ+lw tKAw== 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=q27pBwY1Cnz1mYyRwyUutPkefMsGVVgL0+DH0PlJ32IShq5Iu4SuYhEAL80CGrQ/SI 0pbcvdLLqIsZf3X0qVwZEbOknNCKV/tTm8DXM62RWwGNK8glklQn6dhIXX3wNucqMS+E pr7xIk43Z+hNe54M73mmH88Dspcw3zTCVQ05zMq2havjRmtw2UHU20zrZfUk+GE4KYPV o8qTsxsRmivTpb6d97xPVjsCzWfq0pzCXM5uxAdO6Pnshivag8nJNsYXTpJTZZmBdYUa jMHhl9MOOnKUMCgHBjjZxglHyvjHz+6CqGstThUk1/keLCmsqMKXdtZ46DmsjeAwC0FB iqoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=Dbc1D6qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f20-20020a170903105400b001ca30930607si2191436plc.167.2023.11.03.15.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 15:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=Dbc1D6qv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 34EA1802F089; Fri, 3 Nov 2023 15:56:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377891AbjKCW4X (ORCPT + 99 others); Fri, 3 Nov 2023 18:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377580AbjKCW4T (ORCPT ); Fri, 3 Nov 2023 18:56:19 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B17AD61 for ; Fri, 3 Nov 2023 15:56:14 -0700 (PDT) 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=Dbc1D6 qvB92mHgNIf3tzBjiEz1qCDq1h+F791hzbugl3cDUdO1dEMWZ2ZWPmMqyqQd7kWU kKAUzv0Z9BksWJ6ikepqVbtyyRXHYBU7qXyb3YvE+0/QraUgMmJgw5UvMYPc9l2V 49XdF/TPBJHY0xCiLHdGz2cfvXeaHObf8arwfSYkz4cArY9JrBlfMNsuWkqmnuRy 6Bklv7iO2GFwDHdmoMjCQueMkZTOntJwB6Iol/9O5g1DiiaDLlIpQ5JR6VXq1rhf eoBgFcGlun9OUf28p2PqSvhk/N2yLCb5XgsgBt61Kb70aOTs3buPFlnkzJmbD86S WkdPvqBPoP11ogJg== Received: (qmail 1327867 invoked from network); 3 Nov 2023 23:56:12 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 3 Nov 2023 23:56:12 +0100 X-UD-Smtp-Session: l3s3148p1@cWotaUcJAs5ehhrK 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 v4 1/3] gnss: ubx: use new helper to remove open coded regulator handling Date: Fri, 3 Nov 2023 23:55:58 +0100 Message-Id: <20231103225601.6499-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231103225601.6499-1-wsa+renesas@sang-engineering.com> References: <20231103225601.6499-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 15:56:33 -0700 (PDT) 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); } -- 2.35.1