From patchwork Tue Nov 22 10:21:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 24256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2119425wrr; Tue, 22 Nov 2022 02:26:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf41SxMm56bffoXhoEhhVd/IUho8qaYmHYqxEre6Y1VGzZHBT9lIimAqyypDMGJNd916RlLI X-Received: by 2002:a17:906:8a6d:b0:7ad:d18f:c2d6 with SMTP id hy13-20020a1709068a6d00b007add18fc2d6mr19593459ejc.271.1669112788217; Tue, 22 Nov 2022 02:26:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112788; cv=none; d=google.com; s=arc-20160816; b=wC/PMLtSQiaJjgWoLLr/KA0+a9YA0ICX96xAfwfxtxbAIRAkklZNX4/q4GiDK3uZXS 3GZ6f/BkXWmoNfN4Zv49IcDtUCd2xeOWVX1aYHQwlBZEVSeyq10RyT01ffdv98YXUHEv r3X/TzkCSrAjQKRWlY1cFEH2q73x7cpN3jM5aCx4gHb7V0qhiA228ilOrHGryzfMvO6C GQjuixkmIO2XHzyr+SfGy6yIDE0I7OtlXNou0IXpMzZO8RQ0DgIXicg8jjCvHYGFrJUk bT8u6r0zVuDY7+BntTLV8opcFkhWN4unleleOHb1PG0j28MOD4ZJ9XEANHjd6eZKVcBK pQeQ== 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=M3G5fO4wTgQLmAcQSoo34y5bVfGZW9g4LW34a2D3VvA=; b=Cemx8dGQEXkTmhLKH2f6EOWA+B2pKU/7cHEZ+5As21UInEjJrn8cZ1S3a1kd99gZHf p7xsAXo7KYv7gN57CQ34rxmA+IR95pHH1n2jx9fvXPnOFszxOytHiCuqn0gs2p7wzZ65 jp0rMRLD9gJQxBznfASkS/8EsnnFAZSN+amvCpVMPtCBv/PoKKweGCMqyIAvcz90rTiS wUIZVKwnIPB+/7Lkocc3u/1nd0/rQEs0OlG8QphcBF/zPUaIJhTX45sYJlCF4sCsqmZ+ Fb5Z1yOOUNZFHf9XfzMIGcDur+BwyYq3esZHQ4h6DT31+mPgfud8jjy8mMYXx+frLHFc jm5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=KJyK8MfS; 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 k12-20020a170906054c00b007ae10525563si9962165eja.991.2022.11.22.02.26.03; Tue, 22 Nov 2022 02:26:28 -0800 (PST) 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=@bgdev-pl.20210112.gappssmtp.com header.s=20210112 header.b=KJyK8MfS; 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 S233174AbiKVKYI (ORCPT + 99 others); Tue, 22 Nov 2022 05:24:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233080AbiKVKWM (ORCPT ); Tue, 22 Nov 2022 05:22:12 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24757E03B for ; Tue, 22 Nov 2022 02:21:55 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id p16so10366745wmc.3 for ; Tue, 22 Nov 2022 02:21:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M3G5fO4wTgQLmAcQSoo34y5bVfGZW9g4LW34a2D3VvA=; b=KJyK8MfSWfrc4rC2Zkedu9dXmu7sCfaGzpAr/Fb2RwQf+OEOysG8VS/C1CdLRuu8oU FkjQ5bQiMByI94zbTMKQB6WG3DPe93S7NyYzXMES+UPGNu+8CS4bnqSQhoZqJO8Cu2UF l6z0ay3iLonF8ILw4uB6Qbs3owHDZ6547HxsQUrHmYxicToSx5IJ/IzHlZIxHog2JtCD A/dkTVnlWljJHmXfF2oPAGqnKoijFOV/Kd2dfhM2JeA4YphuJ57UGQaL7sWREcKmc/yr /byQ+DSr1pfCMqfdWOMPUonOp6AJIn2MZB6WAFPLrq2vUOUaQuDhlEQgcVy2Q3081PL1 A6dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M3G5fO4wTgQLmAcQSoo34y5bVfGZW9g4LW34a2D3VvA=; b=FVtuf2Gl+y2oKXexLEFAox2xZfmd+MUtD5i/F1QrnipTgzDHqnWgnF6pfyWe7KarmP YJmr2JNC/o5xZEyYuz2lI90ORsFM9dXeFYN10hyDi3llvWMCd8mBeLyup6kpdVtptgxf 7ysk2t819l+CBQw+aZP6TfX36L97kfvO2UVUZ+xtnedxlZNntQpUnY4j3DOjkoItHr7q NzGkfgXarzbqA+2iF6QT71YIZ8r/FGqk3hdg+STJzWqmwK7gPHmeY+Av2DxzOgRXyWSr NpOiSP89HekxlxAB/R8uZ66ALNL4RqmKUVMs2txNS1SN36aSqxUNhr3hOI4THLYUfWHC yQow== X-Gm-Message-State: ANoB5pmKtQw/Wi270hlWpkOxTlGa6P/2rnWdgfnaGS1SC3dDqIIyX3RV e4nH6LTkYMIKzIPB3JQG8T0cGg== X-Received: by 2002:a1c:f616:0:b0:3cf:b1c2:c911 with SMTP id w22-20020a1cf616000000b003cfb1c2c911mr8610482wmc.16.1669112513688; Tue, 22 Nov 2022 02:21:53 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:e011:9e81:66f1:3415]) by smtp.gmail.com with ESMTPSA id o3-20020a5d4083000000b002366e8eee11sm13432873wrp.101.2022.11.22.02.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 02:21:53 -0800 (PST) From: Bartosz Golaszewski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Jiri Slaby , Srinivas Kandagatla , Vinod Koul , Alex Elder , =?utf-8?q?Ilp?= =?utf-8?q?o_J=C3=A4rvinen?= Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 13/15] tty: serial: qcom-geni-serial: use devres for uart port management Date: Tue, 22 Nov 2022 11:21:23 +0100 Message-Id: <20221122102125.142075-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221122102125.142075-1-brgl@bgdev.pl> References: <20221122102125.142075-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750191611078507105?= X-GMAIL-MSGID: =?utf-8?q?1750191611078507105?= From: Bartosz Golaszewski Shrink and simplify the probe() and remove() code by using the managed variant of uart_add_one_port. Signed-off-by: Bartosz Golaszewski --- drivers/tty/serial/qcom_geni_serial.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 82242a40a95a..53d09da0854a 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1454,7 +1454,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) uport->private_data = &port->private_data; platform_set_drvdata(pdev, port); - ret = uart_add_one_port(drv, uport); + ret = devm_uart_add_one_port(&pdev->dev, drv, uport); if (ret) return ret; @@ -1463,7 +1463,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) IRQF_TRIGGER_HIGH, port->name, uport); if (ret) { dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); - uart_remove_one_port(drv, uport); return ret; } @@ -1480,7 +1479,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->wakeup_irq); if (ret) { device_init_wakeup(&pdev->dev, false); - uart_remove_one_port(drv, uport); return ret; } } @@ -1490,12 +1488,8 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) static int qcom_geni_serial_remove(struct platform_device *pdev) { - struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); - struct uart_driver *drv = port->private_data.drv; - dev_pm_clear_wake_irq(&pdev->dev); device_init_wakeup(&pdev->dev, false); - uart_remove_one_port(drv, &port->uport); return 0; }