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: 628022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46E62C4332F for ; Tue, 22 Nov 2022 10:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232772AbiKVKXw (ORCPT ); Tue, 22 Nov 2022 05:23:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbiKVKWL (ORCPT ); Tue, 22 Nov 2022 05:22:11 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBBA6158 for ; Tue, 22 Nov 2022 02:21:55 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso925974wmb.0 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=kGWM3bQrvUhml+pI2oso4eJxXRiGboYPpnKdCfgPRxoyJsEP4qTywYf+kkmpKXiewV 9REFfg6lhF69CaF//LzXTx1Tpr8p2LTrVSms7HmDmr6wlPeOtjrny8rrP6IPqzDHfBDF wbWU9Z+4rcmS+PPL0ppXOIzoZA5qvuwZ3MA1sNxJGZOtBlkBbEwLncPONl6+pF1wLCGD hL0IYE/CjSCas//Zj4G0c5GnS2aLRSRSg6FJkq461tN2URgUxJju5K23vNOQSxdGtLUI I464PxZWW+CxkGwSc8T5eT0v4wUb0h86Sn2ZahOgMyoLQFkZo3Y4soiyadhinDX1aEmU Ot8g== X-Gm-Message-State: ANoB5pmOcV5qR11s4v1fANv9co6MeD4PcasP19NibOVdIlIc/gei2qMw XIoXMN0eFjgMFzZWgqmOFGpTvw== X-Google-Smtp-Source: AA0mqf7UtJVhOpuxEfqOmfdJ7uiz6mBk4TYK5xLxPVNQC24s+U4cvUEeWY4TYjct7XiOmHDXomcxgg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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; }