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: 203229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1404dyc; Mon, 19 Feb 2024 11:35:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjRZJqLjkFJxuQDM7S+lAM/zuyGioOLm33Vj66plGbUG7yoxz118Yw+DKcGPY1VLBNBLNHwENARbOwJ2odJPL9m+HDng== X-Google-Smtp-Source: AGHT+IG5gzpmIpSOgmk5h5pqAu9GuVjVM7qMSCXNmPMUPtCY7DU3vRuliT3VsLnjFlwR+C19O9Bd X-Received: by 2002:a05:6870:1704:b0:21e:f544:2e50 with SMTP id h4-20020a056870170400b0021ef5442e50mr2385192oae.31.1708371324347; Mon, 19 Feb 2024 11:35:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708371324; cv=pass; d=google.com; s=arc-20160816; b=qDnYA9WX5j8J7HZXxiLYNcSP7teBZ+L0WEApLDlmx9hEEUETKQty1xxDbukwmNqyxw yR5DAFoXA1MaV3npiN+B9BSdMBg4TFMWMrW3lydwiFv8LEEP/d5hD0uUYGnk75ZqPfpe ns7GTNaiOS+d1gkmkCxdLlUbm0u6BxgIjXWsiOYaKQvT0TAHu1PRuJCX0lZw0AFBP357 mlyjKlp9qoxh6oCvBOQQAv0uUh263dQLkiryDOFjxhGUIZ1nSBaNxghYP++gu8BcOtRN TJTWY92FQiM7mf4ch1qKpSjBLF58i34o+4PXovJeqDkg/HWRv2GgHuFDkFYDh18KyOxl Csog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=oVjnF+FrBJVtsVP/rUh6UyBaIZsbqK/1qNICkAUQNLY=; fh=qrLD1Bzw/v8uOtvD8TPeCBb7psUcqsm97yGxLmHNFfU=; b=qZeQ4EycumH7FVov8cJKu5Her22kQZfYrN84TNNufeambCWpwLZR4OOZObKq8jfQqb p1H2elX2B1vOsRPjm/zzOXAJ6bwK/pRqUifuqUIuppr/FKMpZ5f6IQkGeoVQ+Bce4TJK NDNyBx2osUeWYZi059ancJlk6nHOwb+mzEscA8PFBWw6qC8iMSTVq1YxMhTbECWTWDVj eHu7VxX5IA0MuFMpvenD6YQxBYy1GyB6va7xdLREGvfU4259apiMHfGPSuPCC9jGEVrd LR921BobpV5p6FuVZUsDZ+DC+BPn4tZrEPWphmcuYzzn9L29TkHmKGbXs9s3HzmftO+j qkqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DeGCVxyw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71873-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71873-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ca17-20020a056a02069100b005dc892e61d3si5191100pgb.657.2024.02.19.11.35.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 11:35:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71873-ouuuleilei=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=DeGCVxyw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71873-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71873-ouuuleilei=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 7B57528460A for ; Mon, 19 Feb 2024 19:35:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D808E53E0C; Mon, 19 Feb 2024 19:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DeGCVxyw" 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 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-kernel@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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791357169543554671 X-GMAIL-MSGID: 1791357169543554671 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);