From patchwork Thu Feb 29 01:36:19 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: 208155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp117251dyb; Wed, 28 Feb 2024 17:38:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVqgk/Dyx0htPEhzKeYmW6j+KJ15E04Ochz5qYsKx0cI6HRqx1GO8/zOAObR5KDujo6MC0PQ+QtVTv6IkpaOkA3ts4C5g== X-Google-Smtp-Source: AGHT+IG4BJBftTFu8TD/goSQgjiWRnsPH9ohcZ04VM/W0Xxz5JAho27ZjCZE06oTNVf9Bc4aY55M X-Received: by 2002:a05:6358:6f12:b0:17b:c624:b0a1 with SMTP id r18-20020a0563586f1200b0017bc624b0a1mr930765rwn.23.1709170688947; Wed, 28 Feb 2024 17:38:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709170688; cv=pass; d=google.com; s=arc-20160816; b=n39k97iBTbgwZda60UyinB1ACtwmWiOebRhIKx0F9C9zQLNzoKrQjZSeKVNzX67WKq saVC2oU00qlIVo0Vf4PpPbDrdhXx5Bmi1VaxG6Q8NPk0F8pTVBPgfQ9+Q4TIfdB2gExK htJFFkhEBlUC1dd/ZE0dP4rU9MNGvgWoHGMM4iOUz3xFifrgX8Xl0qTqk7e1+aXKmUXR W/M6H94k7LaabsNL30gkuqbSgYNd8hdY0KSMjmXBDARUVI0mf4kDI0/HIhBcWc2K6T8X IUlb+CFjaiFM98CdFZgG5KGewHKjR7tjitScWKY0pAXx4cmfwx0AxG5x1GGQstanMce6 +zAg== 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=vZalForvHei8jpe6YNnnfmD+IMTFeygGcVOhhwDaDy8=; fh=ScmKGkB+o6eWxKvOBe0xvbxfQnJ1f7X2wms+WF2DLho=; b=fUouDck3+4WFJRCRh2oXOWKvGJK2Y5Uy7M7P/XoQeGf3yWMB+JG7vfEVaZ9GIoj7pf tS7am5o7SjSRguWiLV3ZQtIVT2mIaay5YCSFCQFDZXr1K7ybyoeN9nW/d1khtTLTCiAG hVtUs2e2Z/Lf2sSClS1pfcoH9Xr3WCorkMrg67OImYrCnG/KJSndHPdBtRpq1Ug5S0fZ 6wZwMaF0Tlt8FVUrqn1gtKDqfWY8WRpmyI4jpUcyL8H6NaVfsu31vOXRGyYy39QmDsos vS+qDK1AYHPeKVpbBTw0xjdMqff+kw2ddL48XPh0CKyWJmMBobBjdhNp3Vr4ENU9pRZW W6sA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OhUHDyUy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86001-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86001-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 c26-20020a634e1a000000b005e270acf8f3si294956pgb.748.2024.02.28.17.38.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 17:38:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86001-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=OhUHDyUy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86001-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86001-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 B7D4A285E8E for ; Thu, 29 Feb 2024 01:38:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AF0A38DEA; Thu, 29 Feb 2024 01:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OhUHDyUy" 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 435DA2D602; Thu, 29 Feb 2024 01:36:57 +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=1709170617; cv=none; b=ThUdJafhyibKk7/lPnx+denVNvnkzUe/obzH15l0CjvzY2HVVLrGL++MDP5f1Jhd9MU0i7yAaNVRZj1hgZ7Hb1KzTVmhnjH13Mn1xUyDq1yrSJeS4bkueHFQHEufhl58bqdiK/8mZLCdieuzs5ivQGQl8RhOd0LjvRk2gbk5M/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709170617; c=relaxed/simple; bh=heYg83dxzIz5cujo+bOCWW+22F7pnM8vLF2xYH8yigk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=efBUfkuc68SDMf3twRImkSqCnmXWDk2JySPQRIVeoF1hGOYcUHLKnpB/O8pDgwxItzaply8rDwjLmPA5sQbjQBgsGBWc89/FuqJWy1GYHXA8aEN7O1uggfXuMBged2rxDPlRNSr48HC+IzvijTKAJqPq5HFwXppAUVYZp3p4Zds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OhUHDyUy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id BFD53C43394; Thu, 29 Feb 2024 01:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709170616; bh=heYg83dxzIz5cujo+bOCWW+22F7pnM8vLF2xYH8yigk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=OhUHDyUyRYJzCuZTlPrer0GidchvAM55tHRU0ATq7RVF5pjhTjq6+W9lyhigwGhj9 10b/eRTZgLZWGVz1m1DquvMHD83P8aF5PSaI3SCwqrYAp2i/rT36sKrJ4ArJPbBf7c BykBqeEyjeqFWYTld21qeIxVGMKmYhT3fVF8+0fbVY6liowQtJ+geAvjla9LTxED0w G2VAMt/srRuDrj1Yw2cD/0o1nZNtmP/dlZfeIRiJFDdDfuaesol5yhPct1fP4Jbsq5 MOOJNLiGXbaRnh6v4rXW+XzlWhtNcSXxTBu55wU+j1Bsv5sagpF5hwQ7TJX3frwcEc ZkrwFwaPmgYAA== 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 A5BB4C5478C; Thu, 29 Feb 2024 01:36:56 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Thu, 29 Feb 2024 09:36:19 +0800 Subject: [PATCH v7 1/5] mmc: host: mmc_of_parse_clk_phase(): Pass struct device * instead of mmc_host * Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240229-b4-mmc-hi3798mv200-v7-1-10c03f316285@outlook.com> References: <20240229-b4-mmc-hi3798mv200-v7-0-10c03f316285@outlook.com> In-Reply-To: <20240229-b4-mmc-hi3798mv200-v7-0-10c03f316285@outlook.com> To: Ulf Hansson , Jaehoon Chung , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Adrian Hunter , Andrew Jeffery , Joel Stanley Cc: Igor Opaniuk , tianshuliang , David Yang , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Yang Xiwen , Paul Menzel X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709170614; l=2509; i=forbidden405@outlook.com; s=20240228; h=from:subject:message-id; bh=JGOc4wQUSQd78IPQsA2tfrngj58AF1LgtdpM/cwsBoQ=; b=UVqVEYvRkoStMPjWxXuTEvzYTOUu7ddzRxFdip+h1ByO1Lh/wnpwRKTzYHt0P28BTnNQp+I4P n0y12Yz5P4NAAvWU9ov7tXym7NsiWsqVYUyaE1QKyGF0JLrPccJdHg3 X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=KAWv6ZzFsT54MGllOczJgFiWB+DuayEmyn24iiVVThU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20240228 with auth_id=136 X-Original-From: Yang Xiwen Reply-To: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792195364017220100 X-GMAIL-MSGID: 1792195364017220100 From: Yang Xiwen Parsing dt usually happens very early, sometimes even before 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 an initialized mmc_host first, instead we can pass struct device * to it directly. Also fix the only current user (sdhci-of-aspeed.c). Reviewed-by: Paul Menzel Acked-by: Andrew Jeffery 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);