From patchwork Sat May 20 15:17:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp424099vqo; Sat, 20 May 2023 08:26:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ZeYXyR/J7rJ5XdRYet0fH7yAGurj8Pr3G1xFlfYM67/2u/Sknw2hbGmGaKonlxDiq3YtU X-Received: by 2002:a17:903:32c3:b0:1ab:8f4:af2b with SMTP id i3-20020a17090332c300b001ab08f4af2bmr7124649plr.38.1684596378385; Sat, 20 May 2023 08:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684596378; cv=none; d=google.com; s=arc-20160816; b=zY1sLtTPBKsJBnMTAkZumb4sdIi9xdLbtE9JcWaVtvwUYSwamXmMRQFCCa45CLxpfz Sj7683657IJ9RpRujeszJFUJQbNMbC4eZF2FxBCL++OyYgGFrsShePM3/ME/1tCJrWom ObowSrG/0NIlDFj1pumEW+KHFObqFLQO0BCh2l4dirpz3viN8ZXSZLmt8Mag+FVn+C+P b/+IXoohKfZCDsf0ZwEpNUVkhEHMnYZA31fytoL1cl91bFLTKzGqB33Zct+fwGBb5bNu cxBWwIL1MPcK7HXtG2igzH+StQFp8zCJE865Yl9BHhe9L8Qcbj2oWfDbOwIRNe8K5J5+ GJZA== 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=NYS0+POCoqp3fqggV8ajYmceozpIyaDAzScoVhfOmvk=; b=c0pdFeZFFaaxdMnYBY03rwoSxQey4tX4zTNpVAyAERYR7QYnV6bbaNAFGLB+ubobRn KloDxPpATMp7T7/1lIn8GO6l3waTuS7s8AEKPvq566E7/lwN+sQ0puCOGa7jQtwyp/NR K60pgnboXOgsevxaBxV19ZpmMYQFAivDI1lKmnMGWe5VM/cMLik8tW1g9LgBhlqlXu8D tHQOO8bftY6Ap+19XaTObn0ECEd9NAtrsunW4Fs9n/ZnOAXhVVROzO/8P7b8bjNXZROF ewFnRakFLT+Np/yrkcJcTIPSWiHDxCGGToF8MaNQKjJ1Xm0HvGoQGJEkefqAHXzLnfoX VwzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=c5vX2GpY; 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 l15-20020a170903120f00b001aae82caf71si1645941plh.211.2023.05.20.08.26.06; Sat, 20 May 2023 08:26:18 -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=c5vX2GpY; 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 S231627AbjETPRu (ORCPT + 99 others); Sat, 20 May 2023 11:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231626AbjETPRs (ORCPT ); Sat, 20 May 2023 11:17:48 -0400 Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6DF2FE for ; Sat, 20 May 2023 08:17:47 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0OL2qxEf9KkqR0OL3qE16C; Sat, 20 May 2023 17:17:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684595865; bh=NYS0+POCoqp3fqggV8ajYmceozpIyaDAzScoVhfOmvk=; h=From:To:Cc:Subject:Date; b=c5vX2GpYoQNcaWitUgGn3tivkOqJmcaiO0iuBAdXG/MnjO3qH054AmA+C/wZ+dCHN Ze7m2ICI3C+0CHlL9VUY1aifbWkBESuetxWtC6oj2c9jfhbHJemxIcg6ibupNyMXDr wE336W9rOvgvhUZJn7lnE4yKOKdZXXKVrBJ+xe0ExGMWAxZot0Dm+9h3GqrCiCWqMe uFRMYpYz2Ee0NgkQLPJAEB1yK3QvQHJjS322ZlWf6m30Taxy7g80uyx9vxPfmR+o2q 1NjtWgePMGXiN8O9Pq4cUwGQT5sBgxoerF6WFrQJ3MbKYMkGsatlFbn4yPKKYb/KNR 4/O+QYx2GOBhg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 17:17:45 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: hci_ll: Use the devm_clk_get_optional() helper Date: Sat, 20 May 2023 17:17:43 +0200 Message-Id: <2035c65977818626011f512d17cd018b6d877925.1684595848.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_H2,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?1766427332225539871?= X-GMAIL-MSGID: =?utf-8?q?1766427332225539871?= Use devm_clk_get_optional() instead of hand writing it. This is slightly less verbose and improves the semantic. This also simplifies ll_open() because clk_prepare_enable() already handles NULL clk. Signed-off-by: Christophe JAILLET --- drivers/bluetooth/hci_ll.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 4a0b5c3160c2..de463d8bf265 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -129,8 +129,7 @@ static int ll_open(struct hci_uart *hu) if (hu->serdev) { struct ll_device *lldev = serdev_device_get_drvdata(hu->serdev); - if (!IS_ERR(lldev->ext_clk)) - clk_prepare_enable(lldev->ext_clk); + clk_prepare_enable(lldev->ext_clk); } return 0; @@ -703,8 +702,8 @@ static int hci_ti_probe(struct serdev_device *serdev) if (IS_ERR(lldev->enable_gpio)) return PTR_ERR(lldev->enable_gpio); - lldev->ext_clk = devm_clk_get(&serdev->dev, "ext_clock"); - if (IS_ERR(lldev->ext_clk) && PTR_ERR(lldev->ext_clk) != -ENOENT) + lldev->ext_clk = devm_clk_get_optional(&serdev->dev, "ext_clock"); + if (IS_ERR(lldev->ext_clk)) return PTR_ERR(lldev->ext_clk); of_property_read_u32(serdev->dev.of_node, "max-speed", &max_speed);