From patchwork Wed Jan 20 10:46:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 60026 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp3095799lbb; Wed, 20 Jan 2016 02:46:31 -0800 (PST) X-Received: by 10.66.156.134 with SMTP id we6mr51276785pab.92.1453286791781; Wed, 20 Jan 2016 02:46:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id af6si16845503pad.226.2016.01.20.02.46.31; Wed, 20 Jan 2016 02:46:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935168AbcATKqa (ORCPT + 29 others); Wed, 20 Jan 2016 05:46:30 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35872 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935140AbcATKqT (ORCPT ); Wed, 20 Jan 2016 05:46:19 -0500 Received: by mail-wm0-f43.google.com with SMTP id l65so173553281wmf.1 for ; Wed, 20 Jan 2016 02:46:19 -0800 (PST) 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=QmeulDQqtCixatnFZQBvBpZZzpQtraeg6yaK8wT3Tac=; b=dUK20VhwqbnMnc2ItIjM1JEJSQ99HLXv2f44YRPjfKI2LonA89bbW0BqpwUs2Lp1sl UXHVpVLIbxD/Ts9ti8cEWTfPYt5c7azOHE/wxqzGz+6yPS3qLX/AGp9Man9U6OuwGZI5 fWi66pqHpeBiSXtMV+jcy4pxfn8gDtjczbeiE= 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=QmeulDQqtCixatnFZQBvBpZZzpQtraeg6yaK8wT3Tac=; b=Bhw0qmb0L3TNnbOeBuFhk7l79cgiQUkDnT7tJ/O5QkxBQTSroqyhM6YXAk7lNLYpiR opugwo9X1jdipyLAn89Uvdee9pUfaQkcSe/iMobhP6BtcujVd/Ij8VsdCy4Fsnpogizb akLQ/jjbyffIkKV8Ba+IgTZo6tUYJOaBf9IpRivF67fOPamPQ/zdzBABHkfDuTzLbHgn JFcIUTF8wWr7IVQ9a1baN0i56bfVdKHrx3AxaOlmh+abSJjV679BkTVt0GDaJNdc7CIz ZEaaxZe4jw+WGaENdt7beZpjz6IWUJ457NsmUI8oI5jDgN1YMm5A19ZWiqz3BhlMUHuA /M8w== X-Gm-Message-State: AG10YOQBMDsSlzAWAHCcwMdtHCCUtdXkGRpVu79m2EojyJ968jK9BQ5UEIJ22SwI0lMdPxmu X-Received: by 10.28.186.85 with SMTP id k82mr3393722wmf.77.1453286778754; Wed, 20 Jan 2016 02:46:18 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id dl8sm32720950wjb.29.2016.01.20.02.46.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jan 2016 02:46:18 -0800 (PST) From: Srinivas Kandagatla To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Srinivas Kandagatla Subject: [PATCH v1 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Wed, 20 Jan 2016 10:46:10 +0000 Message-Id: <1453286770-9660-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453286730-9616-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1453286730-9616-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) -- 1.9.1 diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index 2b16263..3e07533 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -26,6 +26,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) { @@ -42,8 +44,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); @@ -55,16 +56,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); @@ -76,8 +75,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); gpiod_put_array(pwrseq->reset_gpios);