From patchwork Wed Apr 13 17:54:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 65751 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp149532qge; Wed, 13 Apr 2016 10:55:46 -0700 (PDT) X-Received: by 10.66.101.67 with SMTP id fe3mr14759639pab.43.1460570146708; Wed, 13 Apr 2016 10:55:46 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be6si2456261pad.31.2016.04.13.10.55.46; Wed, 13 Apr 2016 10:55:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754675AbcDMRzp (ORCPT + 2 others); Wed, 13 Apr 2016 13:55:45 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35054 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754615AbcDMRys (ORCPT ); Wed, 13 Apr 2016 13:54:48 -0400 Received: by mail-wm0-f44.google.com with SMTP id a140so114242887wma.0 for ; Wed, 13 Apr 2016 10:54:47 -0700 (PDT) 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=K+nmFRzfbhL8gfmz4WEKP4t/1MXKc+FGwZdqEFBP5kg=; b=WU02xgFiZMTZ1X6Ox/wcXLovKYQkkFrxhWY/7aYM+eYZm5EGs1xaaTU6MFSb/7XAxe E+umr6P5qo0wog1gUQnYR5HoZfDdNKHwNux5c7KkvTvHygsnropqvziOieZQXkDegpbU QnX+zqDkH83MFA/xJnvgk27zaDKIoaQpzTSLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K+nmFRzfbhL8gfmz4WEKP4t/1MXKc+FGwZdqEFBP5kg=; b=VB+R9G2Jx65scVOfsiEm7dqd340TMVvKpY2mGCYaO86m7EA8canO1FAgzt8SyTzFmK 5DM+I5AcsU+hdJVqmXh+mWKY01gaPNfdIZmnmcZ7uoCPZ4I+ZUh8LkGQFFJDMeAfMx5B VJNTk9nVT5VArryu/ROWvf4xKcflt8blu30N+1+Bhhyzj/7ebH4md9sedGPDJ7hEpbRv Y0hulBGQyFd4nJtMrqVY9V2dH9ArjAnNP+80HuDVYHQBz3ZJSeL8G9XCEms0eVf0sEfV nVWGDd6slzIbW1osHyzdb4oDhWNWOomn6xAFJKJ9TpGm8U2MouKq1PiAC245IqFFwdtx erOg== X-Gm-Message-State: AOPr4FUTFUVUrlVaLoH/wKmMXAdZNg18jyBJAjIH+gatOovqpaFHoHqIGyFGN+qLF/2AQpbA X-Received: by 10.194.243.226 with SMTP id xb2mr11204224wjc.35.1460570087135; Wed, 13 Apr 2016 10:54:47 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id by7sm39750289wjc.18.2016.04.13.10.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Apr 2016 10:54:46 -0700 (PDT) From: Srinivas Kandagatla To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Srinivas Kandagatla , linux-kernel@vger.kernel.org, mfuzzey@parkeon.com Subject: [PATCH v3 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Wed, 13 Apr 2016 18:54:39 +0100 Message-Id: <1460570081-1679-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460570081-1679-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1460570081-1679-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org This patch adds to_pwrseq_simple() macro to make the code more readable. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/core/pwrseq_simple.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index bc173e1..f94271b 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -25,6 +25,8 @@ struct mmc_pwrseq_simple { struct gpio_descs *reset_gpios; }; +#define to_pwrseq_simple(p) container_of(p, struct mmc_pwrseq_simple, pwrseq) + static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, int value) { @@ -44,8 +46,7 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq, static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) { - struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, - struct mmc_pwrseq_simple, pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); if (!IS_ERR(pwrseq->ext_clk) && !pwrseq->clk_enabled) { clk_prepare_enable(pwrseq->ext_clk); @@ -57,16 +58,14 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host) static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host) { - struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, - struct mmc_pwrseq_simple, pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); mmc_pwrseq_simple_set_gpios_value(pwrseq, 0); } static void mmc_pwrseq_simple_power_off(struct mmc_host *host) { - struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, - struct mmc_pwrseq_simple, pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); mmc_pwrseq_simple_set_gpios_value(pwrseq, 1); @@ -78,8 +77,7 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host) static void mmc_pwrseq_simple_free(struct mmc_host *host) { - struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq, - struct mmc_pwrseq_simple, pwrseq); + struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq); if (!IS_ERR(pwrseq->reset_gpios)) gpiod_put_array(pwrseq->reset_gpios);