From patchwork Fri Dec 6 17:08:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 180937 Delivered-To: patches@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1054268ile; Fri, 6 Dec 2019 09:08:39 -0800 (PST) X-Received: by 2002:a2e:808a:: with SMTP id i10mr8838807ljg.151.1575652119502; Fri, 06 Dec 2019 09:08:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575652119; cv=none; d=google.com; s=arc-20160816; b=kfvf5ybNMrUCxUntmgE73KeTQkJNZwIW7QgK5z5V5oNBN9n2gTnqF222GMAW/O3nAY 5TXY41+IXErtSII0moLHaQ+eTz1dnRCNUpMelsdc9ccEA0hj6pHNnLp/mZnqHZKtEw2W M5GNsHZ2B3QpXGf+6XeA7NS8zYeUoDPOTD8BWoJmcUM+YDP2I4AiuRdjpXQGyDRMGcep 3ZySbqPgpHSuKAk/B6wsHDT2hnVrSjVSo0t7kHAVLXTkzL6R9LUC66eDuY/xZ27qoZMa haaN8Ut1IvJVQbqzK7vU4TBclDPTkxfc6AQuiI1Pa/a8z4LA78IprfEbqR7EwF1rhbiV jajw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Bena7hxM6Q5CJen1XKF9/qXFjbtAx0rdagpDLN6ovkc=; b=jx4JSqXu7azfU7JrFU9hSTZBwsTFy42yuu0UCMAEEaruYINQi8vqFP11XSjs8Z4UoB iUjCX/HDLTspMHhfc95zAM18EXX6jgThwVqmV7hYgihIleAybq0sIBDVRUwnYSPkNFiv WIT+O2VfqUz82TIlAIgGOWaWljyF34s7/WiickNjr2EUXLQZ3oxykfIQklcMMXa0iCgY 0wEfHVSQ29j/Ac/zv9P0YbVHue3WtrTCM9rrNuFz0SKmXf/rly28CO91LPDTSEsdoU56 djeZ3bRnHK8+tCuM3ubmCZPeZlnGNRlbd073a4MpkgB+alcEUu9tiIVBo8PvDyN9edip C9Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X9+uU+AY; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id r22sor9721745ljk.30.2019.12.06.09.08.39 for (Google Transport Security); Fri, 06 Dec 2019 09:08:39 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X9+uU+AY; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bena7hxM6Q5CJen1XKF9/qXFjbtAx0rdagpDLN6ovkc=; b=X9+uU+AYohCgYCEkPNcJ5fhTjP243QbHdbgFzdpvm7JZMjhzz7TPWGnPWgcRm69nGz jsvzcimEHNE5dwSluVSH6tk2OnrsVGfoHOaIlFpN3nlEGAXx3qTfRKj7q7knpSMLJ0pJ qky1f5fry4paJxZLbulff8VP3rb/8yDaceyR9hRoc5+10MW0CW+ezcawH2lomDLs94GD rSBR3tfVGbgCRFvFlC0osU4As2yBRTqMsHz49weRtD7FanceXxm3VI2QLzr5iPOYZf/G twvactJN9GSLPbml17ZFHwSMwybk0VDyJYaEpjlY3iJa6sVXuNBePPSKzMsvgp/j+hkZ kcvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Bena7hxM6Q5CJen1XKF9/qXFjbtAx0rdagpDLN6ovkc=; b=n7YTazJzVago87/OrREYzrBLmUhB0AoZtOPQCZq3lz+418ZHPVX5ODtGRmh7tiJNRF Msi+GejFn8LF2UJo0wygi8fSqb1qzD8cytE6OhQFQjN2/vfB5OodCeIFJwUdXVFYmNaR 2xDXTV53ktSVPAITCIg8DNv1qG8B0tOWT7suW1ZnQ/b0O5HAskqdSM8SW4uyxWY74jyL xeTsXmWhqiHL19pbOeSJpV9tcly/0zjky9t+kwhgSk2xkig61Q+n/2b+eR21LFdg/n7y kAzjdtZSoZM5j8h+ww5ykXr4xzOxXb971xsK6fhvQ62wpv8+kF7lmdZNeHkWOKqfR8uI zm1g== X-Gm-Message-State: APjAAAWN/JBLKUgtTLKYvchJuoESmMtVNF/J4FSuF8V7e+pxeEhbN92m jsfoPeBizzxqIGGCbsBLUwsoaZ+T X-Google-Smtp-Source: APXvYqyzRis2mN3JfJuOhE7couVt+BvfwzvIsTBrVXasuhhX9uFysTzSF44YDY3ZqVA+ggR5Nir32Q== X-Received: by 2002:a2e:9b55:: with SMTP id o21mr7778784ljj.147.1575652118999; Fri, 06 Dec 2019 09:08:38 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id z9sm6905283ljm.40.2019.12.06.09.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 09:08:38 -0800 (PST) From: Ulf Hansson To: linux-gpio@vger.kernel.org, Linus Walleij Cc: linux-mmc@vger.kernel.org, Ulf Hansson , Masahiro Yamada Subject: [PATCH 9/9] mmc: uniphier-sd: Convert to pinctrl_select_default_state() Date: Fri, 6 Dec 2019 18:08:21 +0100 Message-Id: <20191206170821.29711-10-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191206170821.29711-1-ulf.hansson@linaro.org> References: <20191206170821.29711-1-ulf.hansson@linaro.org> Let's drop the boilerplate code for managing the default pinctrl state and convert into using the new pinctrl_select_default_state(). Cc: Masahiro Yamada Signed-off-by: Ulf Hansson --- drivers/mmc/host/uniphier-sd.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c index 0c72ec5546c3..a1683c49cb90 100644 --- a/drivers/mmc/host/uniphier-sd.c +++ b/drivers/mmc/host/uniphier-sd.c @@ -59,7 +59,6 @@ struct uniphier_sd_priv { struct tmio_mmc_data tmio_data; struct pinctrl *pinctrl; - struct pinctrl_state *pinstate_default; struct pinctrl_state *pinstate_uhs; struct clk *clk; struct reset_control *rst; @@ -500,13 +499,12 @@ static int uniphier_sd_start_signal_voltage_switch(struct mmc_host *mmc, { struct tmio_mmc_host *host = mmc_priv(mmc); struct uniphier_sd_priv *priv = uniphier_sd_priv(host); - struct pinctrl_state *pinstate; + struct pinctrl_state *pinstate = NULL; u32 val, tmp; switch (ios->signal_voltage) { case MMC_SIGNAL_VOLTAGE_330: val = UNIPHIER_SD_VOLT_330; - pinstate = priv->pinstate_default; break; case MMC_SIGNAL_VOLTAGE_180: val = UNIPHIER_SD_VOLT_180; @@ -521,7 +519,10 @@ static int uniphier_sd_start_signal_voltage_switch(struct mmc_host *mmc, tmp |= FIELD_PREP(UNIPHIER_SD_VOLT_MASK, val); writel(tmp, host->ctl + UNIPHIER_SD_VOLT); - pinctrl_select_state(priv->pinctrl, pinstate); + if (pinstate) + pinctrl_select_state(priv->pinctrl, pinstate); + else + pinctrl_select_default_state(mmc_dev(mmc)); return 0; } @@ -533,11 +534,6 @@ static int uniphier_sd_uhs_init(struct tmio_mmc_host *host, if (IS_ERR(priv->pinctrl)) return PTR_ERR(priv->pinctrl); - priv->pinstate_default = pinctrl_lookup_state(priv->pinctrl, - PINCTRL_STATE_DEFAULT); - if (IS_ERR(priv->pinstate_default)) - return PTR_ERR(priv->pinstate_default); - priv->pinstate_uhs = pinctrl_lookup_state(priv->pinctrl, "uhs"); if (IS_ERR(priv->pinstate_uhs)) return PTR_ERR(priv->pinstate_uhs);