From patchwork Thu Dec 7 16:26:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 175275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4900909vqy; Thu, 7 Dec 2023 08:27:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/T6wtdNRFxbJGdsPJHb37jUr43cl5tgNaYW3Iy8WQENHYC6VKaM5F9e9Eh2/EqC6lwkiM X-Received: by 2002:a17:903:1d0:b0:1d0:b6b9:2504 with SMTP id e16-20020a17090301d000b001d0b6b92504mr2346338plh.66.1701966423267; Thu, 07 Dec 2023 08:27:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701966423; cv=none; d=google.com; s=arc-20160816; b=daEpD5dYKjs0vu2M+7UY2lER6y8n7iYrCAjev/RaSdZqTipH8sx5843c/nC5II444M E7CnE8PLJp/UsWrEPlmeTxKsjvoQnvWy+2c1siwzjQZmKuxVs0m8OCMDMmg0tHeuKcoJ dQhRny2TrMAYkn4tWLIjCoY2vVmPv0qCxSfhzHjpKzdG3UNXkYSXZRFtFpbuA30/46LP vakMRM+x6CZ+jYQQg4gyMpunLcX1YQFMeKsN6PTxcnz2XzeD0BFPh+eRLfIqejzYFsc8 FHYJMeq6yA363Aa1o41QqPIi7rBbkHIkXJe8fkAqtIVMrHvzALkBQb1CfWKzQ0SEH8q0 wtwA== 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; bh=LrIilKopCy+JlhjKJ757AT5TowHvKtEtJSE0B1E87zw=; fh=7wHkuBVF8JoMvNinpa+GBBLyktbNyfNyBSxEZSIo6U0=; b=PbNxZ61VkNxQW5MiuKE3yxX2E3Y+OCR3MTbkv+5DBVIykuB2kTwB6N5C8VIZoC4kfu AozhNCyHSqAZVDPjPLtWtkx0fRMfVh6zcl+aU+13oxdjzkKEfBrhfBs6yYWxi4tWPwz/ I3ZXfJC7/wiRL5x8FYOZa54aB/+MssTmFkdOJCoJ3kgcSRJNa5mom89+CAedAApwtrX5 GWeTymegrBqiBcA9LaxfNR7Pcx+zfqVFteIalvP2Pe6BAvBLjgr01nzNzOnTKifpvTWp pQVoegwjLS9YIMhJhXlN0IdSTHz57l9SAikB7b2crZxoa8+cfLzwT3gzlJSf1k/xjdH5 yu7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id i7-20020a170902c94700b001cc4770b9aesi1438522pla.419.2023.12.07.08.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 08:27:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 57C6080323E4; Thu, 7 Dec 2023 08:27:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232851AbjLGQ0k (ORCPT + 99 others); Thu, 7 Dec 2023 11:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbjLGQ0g (ORCPT ); Thu, 7 Dec 2023 11:26:36 -0500 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E10512D; Thu, 7 Dec 2023 08:26:42 -0800 (PST) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-1f5da5df68eso730575fac.2; Thu, 07 Dec 2023 08:26:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701966401; x=1702571201; 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=LrIilKopCy+JlhjKJ757AT5TowHvKtEtJSE0B1E87zw=; b=Wyh8DiYYuwiHoQduTHsez1N3CuY3h5RCHvQSV5/7bgH4l/UlK8zRO90nxxS9pVfV4X gW0iViKI0vhjFNLM8QU6UOZnPuqXwJ2Fi1gTbNXTsJCwIHGPNWHy40FnTUMFhYQs5/d9 YKZWpdIcMHuPtYYKRIPjDuyw+y6LhD5DeItYqIYJNGiobhfrQ8hIEDdYLmch1hGPBl1h o1zpLCcBYyx+Ar5Rocfqmcw4nMm/+4YzHl0o2jTDR2xR4wPz4UCU/AcNTxOTTk3WdCLC +JQavcMqozm2jcCWuUV1unX+0QvM39mbk1sAVN1Q3cpL55zHpUkPIfKzSmbdjBfVvyua B0Uw== X-Gm-Message-State: AOJu0YzJXTFavB375NNHGxT1upLXQwuZevuXMHlt6OB8ENe/1uAJkIzZ 2kJ43OKRoUw66tZrUtUB5412bMP60A== X-Received: by 2002:a05:6871:2b29:b0:1fa:d948:5992 with SMTP id dr41-20020a0568712b2900b001fad9485992mr2835849oac.54.1701966401694; Thu, 07 Dec 2023 08:26:41 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id my14-20020a056870698e00b001fb044ebdfdsm26453oab.13.2023.12.07.08.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 08:26:39 -0800 (PST) Received: (nullmailer pid 2651545 invoked by uid 1000); Thu, 07 Dec 2023 16:26:37 -0000 From: Rob Herring To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 2/2] serial: esp32_uart: Use device_get_match_data() Date: Thu, 7 Dec 2023 10:26:31 -0600 Message-ID: <20231207162632.2650356-2-robh@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231207162632.2650356-1-robh@kernel.org> References: <20231207162632.2650356-1-robh@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 07 Dec 2023 08:27:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784641144156694151 X-GMAIL-MSGID: 1784641144156694151 Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Error checking for matching was not necessary as matching is always successful if we're already in probe and the match tables always have data pointers. Signed-off-by: Rob Herring --- drivers/tty/serial/esp32_uart.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/esp32_uart.c b/drivers/tty/serial/esp32_uart.c index 6e12955d1315..6fc61f323355 100644 --- a/drivers/tty/serial/esp32_uart.c +++ b/drivers/tty/serial/esp32_uart.c @@ -9,7 +9,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -678,16 +679,11 @@ static struct uart_driver esp32_uart_reg = { static int esp32_uart_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - static const struct of_device_id *match; struct uart_port *port; struct esp32_port *sport; struct resource *res; int ret; - match = of_match_device(esp32_uart_dt_ids, &pdev->dev); - if (!match) - return -ENODEV; - sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); if (!sport) return -ENOMEM; @@ -728,7 +724,7 @@ static int esp32_uart_probe(struct platform_device *pdev) port->flags = UPF_BOOT_AUTOCONF; port->has_sysrq = 1; port->fifosize = ESP32_UART_TX_FIFO_SIZE; - port->private_data = (void *)match->data; + port->private_data = (void *)device_get_match_data(&pdev->dev); esp32_uart_ports[port->line] = sport;