Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1898447lql; Wed, 13 Mar 2024 11:11:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgwzqa/qGMt0hEYc9r+66QXCz8i0kJxCxz5KxFP2XSwQGpC9zOWe2+HLSWajQFygMer7YWw3gzriPy2Lb/ZLbI7sUGIaQlJ6kLeRSPlQ== X-Google-Smtp-Source: AGHT+IF2bb84Aqic+tXKLfv1fka69Vdh8UwzJ0blZ4eEp4pJqryOMaIGM3FwQksYijqU5w7rIO7t X-Received: by 2002:a05:6358:7301:b0:17b:b52c:c121 with SMTP id d1-20020a056358730100b0017bb52cc121mr826707rwg.13.1710353466019; Wed, 13 Mar 2024 11:11:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710353465; cv=pass; d=google.com; s=arc-20160816; b=cpu4bitMt6T9FeyfFjZuHMRtMlAqxSHcuYfO/21zz49VN760P8WIH7SBvRWSuPSHRP WXwDLD5ucSItWS10o5mes3JGapB824EWp3T1Nhhi/1DycxWDAkG2MSgg6e69YYqKcGrK j/sKGs9dYRtyX7kJe5L8iDagfgYpw97obr8qx9m6Z4XFKhbJURPgFlQ7KQu463wFHx3A sUdh/qO1b/evYAh+rf+Gkin/zGk5G1uICDGXuY6fpxZPlq7ibgW8zOMiGi/9nyOWUDkF RKTMekG0eBGQduambFSnWP9cyzc28oKFuHsNPGNwOeKeXLZ8gsHLH0LM2EFs9ARIopYb iu0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Lp4XH6KqUNj5NQb7RQqtGpUWH9xKbM0N7I2daK+bxus=; fh=VZpkdDUyG/Yt306PzuTRLnbaFWKfMnQAbVp85IaNvgk=; b=rwAbqPvb4JAdzQrDF+Aa1NXR7GKvqttJkDpXBEGwZpHCox26L1P/ahjM81rq/dUxK/ I+wP1VSUaeoxKBzYF5s464aSTPONhDAwcY8u0L5mQeq+6o6K4Dd/x1ZX/bpYHBstZnSo Ayh3qSwbsK9ZuybFKZkIabR0aGIoDg2DyrukuKiMUH4zyaGK0B0h7EI+ODdo2aipQT9w flqr7HB8c3Jcp2qY8i/7vp1A5VRG2Cs9OLTvm77ke8iRUOG8PhJUP+/CkbCI7EwfQiVx 6T3+ItQbnzkib6GHmqBZBcYmWbhdLrSK4CAyNbqzWAaCHGVvo2RYn833BkQxAu4FDc4f KmbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VkzZMD4C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102151-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102151-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c1-20020a63a441000000b005d8b7053276si9841065pgp.160.2024.03.13.11.11.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102151-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VkzZMD4C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102151-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102151-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AAE552850C6 for ; Wed, 13 Mar 2024 18:11:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B06776034; Wed, 13 Mar 2024 17:02:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VkzZMD4C" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7895075811; Wed, 13 Mar 2024 17:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710349367; cv=none; b=DDIXRiBUAGTeyYVTILSs/gAtNAdxNngCKk2jDKiL7bg6ckQUNsNqxbl6H+QR9s5aLnnXIR3OPYNOV88IdWEmy8mN39vrcKvEoZEJnkraFnQawilP3p2ajgBWNBXX0Knv09rQ4Z0UrMr588fK/aUlFfZ4Y5jqEHbYcawOGFou3GI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710349367; c=relaxed/simple; bh=ZVWAyljY+AhMX/8zChvX3ogQPcRmys9NtaHqrY/ZiWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WGHR8G67zDEcr4ms9R93t+91z7S0UKrMrSRFU8qorXG4Vx7loc+6oWOt0nKbDIojRy3763qYOxwn04XpC8jxoBSfm/9WUNMIKmMKPMzEty4uLR77tnqrr9jFD/1CbU/At+bsKwSyqYBcoZXjosm1I1hmVmWWL1NW81t1ZZHDX0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VkzZMD4C; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0CB9C433B1; Wed, 13 Mar 2024 17:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710349367; bh=ZVWAyljY+AhMX/8zChvX3ogQPcRmys9NtaHqrY/ZiWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkzZMD4C+vcNXWkHmWKu9RWcJgkiKZiaymkZQbpIwsp+tv4L3eY/5WNvjIs59rKg5 7DE6l24GS82KqrKIwoiACjaEEGSL0JBhpsDOaHXzkUKo/Oa2vACbPVpOgHOwXIGKxZ GMIfcsTdWkhtl782IsuhuvLNgbXremwG6xHuPHsb+eMLGdI5J93Em5aHfVDQH80VIB epZoM3kOlShl8vkfM6/WQ27/SsLHCTyPP40txrzRKSjPkXxSHhOqGzsZzJ12/Cz8sG T2tqzXDb99xkYrh88ra3SzxedFt3ta+iKIyHv+/JJpI/dkGrPFpwi4n7Q0NNCzEtnH S/J0ayLo6TxnA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andy Shevchenko , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 5.4 30/51] serial: max310x: Make use of device properties Date: Wed, 13 Mar 2024 13:01:51 -0400 Message-ID: <20240313170212.616443-31-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313170212.616443-1-sashal@kernel.org> References: <20240313170212.616443-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.272-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.272-rc1 X-KernelTest-Deadline: 2024-03-15T17:02+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Andy Shevchenko [ Upstream commit c808fab604ca62cff19ee6b261211483830807aa ] Device property API allows to gather device resources from different sources, such as ACPI. Convert the drivers to unleash the power of device property API. Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20201007084635.594991-1-andy.shevchenko@gmail.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b35f8dbbce81 ("serial: max310x: prevent infinite while() loop in port startup") Signed-off-by: Sasha Levin --- drivers/tty/serial/max310x.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index bbf45c0626681..8d42c537ee5ea 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -15,8 +15,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -271,7 +271,7 @@ struct max310x_one { container_of(_port, struct max310x_one, port) struct max310x_port { - struct max310x_devtype *devtype; + const struct max310x_devtype *devtype; struct regmap *regmap; struct clk *clk; #ifdef CONFIG_GPIOLIB @@ -1262,7 +1262,7 @@ static int max310x_gpio_set_config(struct gpio_chip *chip, unsigned int offset, } #endif -static int max310x_probe(struct device *dev, struct max310x_devtype *devtype, +static int max310x_probe(struct device *dev, const struct max310x_devtype *devtype, struct regmap *regmap, int irq) { int i, ret, fmin, fmax, freq; @@ -1488,7 +1488,7 @@ static struct regmap_config regcfg = { #ifdef CONFIG_SPI_MASTER static int max310x_spi_probe(struct spi_device *spi) { - struct max310x_devtype *devtype; + const struct max310x_devtype *devtype; struct regmap *regmap; int ret; @@ -1500,18 +1500,9 @@ static int max310x_spi_probe(struct spi_device *spi) if (ret) return ret; - if (spi->dev.of_node) { - const struct of_device_id *of_id = - of_match_device(max310x_dt_ids, &spi->dev); - if (!of_id) - return -ENODEV; - - devtype = (struct max310x_devtype *)of_id->data; - } else { - const struct spi_device_id *id_entry = spi_get_device_id(spi); - - devtype = (struct max310x_devtype *)id_entry->driver_data; - } + devtype = device_get_match_data(&spi->dev); + if (!devtype) + devtype = (struct max310x_devtype *)spi_get_device_id(spi)->driver_data; regcfg.max_register = devtype->nr * 0x20 - 1; regmap = devm_regmap_init_spi(spi, ®cfg); @@ -1536,7 +1527,7 @@ MODULE_DEVICE_TABLE(spi, max310x_id_table); static struct spi_driver max310x_spi_driver = { .driver = { .name = MAX310X_NAME, - .of_match_table = of_match_ptr(max310x_dt_ids), + .of_match_table = max310x_dt_ids, .pm = &max310x_pm_ops, }, .probe = max310x_spi_probe, -- 2.43.0