From patchwork Sat Jun 17 07:05:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 109428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1832634vqr; Sat, 17 Jun 2023 00:32:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42fbTegBMmWC6VCxWGrZ+V0Sf0jCkwHGcOAoydMC1ch5LiG//qJ0PZcw/xR56GqYMAc2U3 X-Received: by 2002:a05:6808:1a08:b0:39a:bd3b:9cb3 with SMTP id bk8-20020a0568081a0800b0039abd3b9cb3mr5219342oib.23.1686987128947; Sat, 17 Jun 2023 00:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686987128; cv=none; d=google.com; s=arc-20160816; b=EYm22u/2KPud2zcgp/MkwGO5AZp6kckqflVX1nho49IDbIkEUx2vHFwMYUMXkYkGYV REZTt2CjE9hU8J7HaPnU8CXvFacVtiqKYQBeyTPQG/S/bptISfmJyT9e3OJ+Luv6P7Ph SfyzlKSOJtAy/2TBo9c+MZWnxxrfd5+s2NIRNNdYvvIN0nJMCVJ1aabuOyUtbsXHlkKX /fS6uPj2Ok5T8xOOPhbQ56is+zh1S+Jqa+a1t01gH79wfTanQwlhSo9EgEFKpg3umcK2 BKGC98kWu/q83AlU+Ks7bpwlnh0F5GWIcB9ud/vMG4WjBYqtwoB0AtkDpSNXneJp8LuA jd7w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=WaC9vyc9s/L0ETpLjq5kGLLrHASUjYwQHKod4eCpJlU=; b=s0tEYT2mABtV/8fGP7MxFmRBOhbKNECVPlR+BF//Z09xvL/vqxzBu8EjEkzysRKjIZ lIxl4ojUpHLcSLGDf0Vo1ij+gnBi2gDLXKah3GLA3kBBXQzC0fH33rOf2extP54rExpp L89ssQcsXFa7hYfTyqJZpeLcnJMnyUB3p/0/g64B3a5a8fLF8s2raEbY9e5QRw/a5cnE 5AEYPw68/wSHZjt6WNUhNrjSoy0/kiopLO7fyy2Ny+AltudeL5dj/6zCzU9GH2V1B8ee FIBfPpU3UD9DDeFfdZEAsQmVwOL4X0E/3gUsEASgpUgq4JkCHenjDGfQIfJpq7NQe2Zk 7rGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=GFs52UZq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090a86c700b0025bcbba10c6si3383956pjv.85.2023.06.17.00.31.56; Sat, 17 Jun 2023 00:32:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=GFs52UZq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232856AbjFQHFx (ORCPT + 99 others); Sat, 17 Jun 2023 03:05:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbjFQHFv (ORCPT ); Sat, 17 Jun 2023 03:05:51 -0400 Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CB4319A1 for ; Sat, 17 Jun 2023 00:05:48 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id AQ0GqVBftuHEfAQ0GqXvsF; Sat, 17 Jun 2023 09:05:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686985545; bh=WaC9vyc9s/L0ETpLjq5kGLLrHASUjYwQHKod4eCpJlU=; h=From:To:Cc:Subject:Date; b=GFs52UZqJ5HBgxIzvwFp6LVefUM8MKHIcQqzw6/CZrHwJ72SKuFYKHijoq+Gp75kO 92YzOja+1G0FOSvOskZ2cEPt5n72zmOftpEijMX/XEQ8AuStFeQpdob9kTdmKRKaZy siSRXW0KnjOOSVPna4alpFFswLOvsqBLtFgA/iNbOUSFQdhtx14iexQp2II5lPmv9/ qP+dPHcVHJyAztJp5CaynhGuGFAroQ/w4ESOFEfpuFwTodR0dvhxLKShaplrDD2+Eb brXe1lwGXq9qjvkn/SlNpTLFinjsom07z2m7/zIv69yIjIzuElqY7NKY0wNmj6SW7x aNO1oy8jqKPuQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 17 Jun 2023 09:05:45 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Samuel Holland , Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-input@vger.kernel.org Subject: [PATCH] Input: pinephone-keyboard - Use devm_regulator_get_enable() Date: Sat, 17 Jun 2023 09:05:42 +0200 Message-Id: <78d7a4719ed7c372a7aa62afb66d4f1561799b5f.1686985515.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 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_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768934216049528002?= X-GMAIL-MSGID: =?utf-8?q?1768934216049528002?= Use devm_regulator_get_enable() instead of hand writing it. It saves some line of code. Signed-off-by: Christophe JAILLET --- drivers/input/keyboard/pinephone-keyboard.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/input/keyboard/pinephone-keyboard.c b/drivers/input/keyboard/pinephone-keyboard.c index 038ff3549a7a..147b1f288a33 100644 --- a/drivers/input/keyboard/pinephone-keyboard.c +++ b/drivers/input/keyboard/pinephone-keyboard.c @@ -318,40 +318,22 @@ static void ppkb_close(struct input_dev *input) ppkb_set_scan(client, false); } -static void ppkb_regulator_disable(void *regulator) -{ - regulator_disable(regulator); -} - static int ppkb_probe(struct i2c_client *client) { struct device *dev = &client->dev; unsigned int phys_rows, phys_cols; struct pinephone_keyboard *ppkb; - struct regulator *vbat_supply; u8 info[PPKB_MATRIX_SIZE + 1]; struct device_node *i2c_bus; int ret; int error; - vbat_supply = devm_regulator_get(dev, "vbat"); - error = PTR_ERR_OR_ZERO(vbat_supply); + error = devm_regulator_get_enable(dev, "vbat"); if (error) { dev_err(dev, "Failed to get VBAT supply: %d\n", error); return error; } - error = regulator_enable(vbat_supply); - if (error) { - dev_err(dev, "Failed to enable VBAT: %d\n", error); - return error; - } - - error = devm_add_action_or_reset(dev, ppkb_regulator_disable, - vbat_supply); - if (error) - return error; - ret = i2c_smbus_read_i2c_block_data(client, 0, sizeof(info), info); if (ret != sizeof(info)) { error = ret < 0 ? ret : -EIO;