From patchwork Mon Feb 19 19:34:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 774195 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 29E0F50A78; Mon, 19 Feb 2024 19:34:12 +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=1708371253; cv=none; b=ksqFWd6i0NkpRhtL5JPK5ugdmwnHGumfZu9+tqG8b4JL9z2iK/xZfilbLOPl2ljJ0XpeVl/qZW4UdK2I3iXSv9pObi9ZDBWVsdSUfgUlCIupAuJ9Ks5lQUBQItt3uIC5EEdrobugC5/fbfBfIHl++4Gq2Irlytk6IEHJUzZfuNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708371253; c=relaxed/simple; bh=lCGyYVaCVOf3gQs3XdEu34QPoSoXTjqha9Jp4mNXsWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LQQxGZAson9tLJ+jRHZ7v90WSzqsHCSJECkL2gNCrv8DpedTU3bcygaqy4IoajiS9rHK5oAtJqBOFdrVJ0EKdRuWi6d2XL1Ksy8edxJnACnuSbdPElR5tXTtf4xxkz28xp66v26LppfcO/X/6yqZ1brIdOHbOSu2jciuJsI0CQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DeGCVxyw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DeGCVxyw" Received: by smtp.kernel.org (Postfix) with ESMTPS id A8C1FC433C7; Mon, 19 Feb 2024 19:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708371252; bh=lCGyYVaCVOf3gQs3XdEu34QPoSoXTjqha9Jp4mNXsWk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=DeGCVxyw9C52uhoRbb+oWw9h1JhBxUHGoaR2GMaJvR0M5vX9CdLo6WPLupICZzZay FuJCKFpy68Y6q9LpawECEXFcEa706rcZHfXH30TlAXsRuSyf+uFWE2Zzmdubk0mbAU VOPBJoyt4NN5i4sZibfeUfXpwNVeYeiDcUTpY9DV7UR6dN/7TRIJQ826YgsjuO6NG3 A1XdUNhORdPzo1et+4lMM40GThfQCcNH1X+XaDc2bN4QacRgSUJgfG85cuPiUYQBlY Dqd23zDt74EgF4ICW98KlbVsNweWZ+E8gZZRe+g6qG3ta/l45RsVhqdw9lHoOcq6We yN7s3Xpld+BUQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B628C54764; Mon, 19 Feb 2024 19:34:12 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:34:12 +0800 Subject: [PATCH v5 1/5] mmc: host: replace 1st argument to struct device * for mmc_of_parse_clk_phase() Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-b4-mmc-hi3798mv200-v5-1-f506c55f8e43@outlook.com> References: <20240220-b4-mmc-hi3798mv200-v5-0-f506c55f8e43@outlook.com> In-Reply-To: <20240220-b4-mmc-hi3798mv200-v5-0-f506c55f8e43@outlook.com> To: Ulf Hansson , Jaehoon Chung , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Igor Opaniuk , tianshuliang , David Yang , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708371252; l=2402; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=QAW8e5TrZ1Wa3d94NS3Kz0rYsucTN1azHbr8zMpleXA=; b=romLaDmHClMMiz7eLL6V6AorI2aKru4zOBfTXM4hJJTz3XpCA5WBqxB9wiFheEET0qeeffQxu KKcqk5z8WeqAyciE6chD5VD+kaiVFP/CB+rYF8+X3Ns6rk9pU6pLoc4 X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: From: Yang Xiwen Parsing dt usaully happens very early, sometimes even bofore struct mmc_host is allocated (e.g. dw_mci_probe() and dw_mci_parse_dt() in dw_mmc.c). Looking at the source of mmc_of_parse_clk_phase(), it's actually not mandatory to have a initialized mmc_host first, instead we can pass struct device * to it directly. Also fix the only current user (sdhci-of-aspeed.c). Signed-off-by: Yang Xiwen --- drivers/mmc/core/host.c | 4 +--- drivers/mmc/host/sdhci-of-aspeed.c | 2 +- include/linux/mmc/host.h | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index cf396e8f34e9..8b2844ac5dc5 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -234,10 +234,8 @@ static void mmc_of_parse_timing_phase(struct device *dev, const char *prop, } void -mmc_of_parse_clk_phase(struct mmc_host *host, struct mmc_clk_phase_map *map) +mmc_of_parse_clk_phase(struct device *dev, struct mmc_clk_phase_map *map) { - struct device *dev = host->parent; - mmc_of_parse_timing_phase(dev, "clk-phase-legacy", &map->phase[MMC_TIMING_LEGACY]); mmc_of_parse_timing_phase(dev, "clk-phase-mmc-hs", diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c index 42d54532cabe..430c1f90037b 100644 --- a/drivers/mmc/host/sdhci-of-aspeed.c +++ b/drivers/mmc/host/sdhci-of-aspeed.c @@ -435,7 +435,7 @@ static int aspeed_sdhci_probe(struct platform_device *pdev) goto err_sdhci_add; if (dev->phase_desc) - mmc_of_parse_clk_phase(host->mmc, &dev->phase_map); + mmc_of_parse_clk_phase(&pdev->dev, &dev->phase_map); ret = sdhci_add_host(host); if (ret) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 2f445c651742..5894bf912f7b 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -539,7 +539,7 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra); int mmc_add_host(struct mmc_host *); void mmc_remove_host(struct mmc_host *); void mmc_free_host(struct mmc_host *); -void mmc_of_parse_clk_phase(struct mmc_host *host, +void mmc_of_parse_clk_phase(struct device *dev, struct mmc_clk_phase_map *map); int mmc_of_parse(struct mmc_host *host); int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask);