From patchwork Tue Jan 19 10:58:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 59977 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2499521lbb; Tue, 19 Jan 2016 02:59:08 -0800 (PST) X-Received: by 10.66.140.39 with SMTP id rd7mr43190698pab.86.1453201148292; Tue, 19 Jan 2016 02:59:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si46903750pfq.145.2016.01.19.02.59.08; Tue, 19 Jan 2016 02:59:08 -0800 (PST) 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; 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932921AbcASK7H (ORCPT + 2 others); Tue, 19 Jan 2016 05:59:07 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:34746 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932808AbcASK7F (ORCPT ); Tue, 19 Jan 2016 05:59:05 -0500 Received: by mail-wm0-f50.google.com with SMTP id u188so138062938wmu.1 for ; Tue, 19 Jan 2016 02:59:04 -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=GWGA9+elBoxqadCkc2gyflAZCeQf+7sFxsKoHKOjDbc=; b=NXTkH0uxy2eo0zXYBpTimI01/LIlOmhvtRtgdATb54P4mzcfsWLI0QUbW92UP6lZG4 vRVpHqd3Q5SfUqSmUAnQpDbL3ovX1pSfhzFV/oLuA4t9fljwFuZvxopO2Fak+N9edIOf kFc6nY9oILsrV7eUjS0XDNexT23imUcrzAPBM= 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=GWGA9+elBoxqadCkc2gyflAZCeQf+7sFxsKoHKOjDbc=; b=MTe70HbqkPuIRc6x0lI1MhMsC0uGWLV3PuicvreKM6wpqGpxxV2qprl6vSOF6cY9eF lQlCf05AzSQPuTn5zqvvMxVnftCK3juL/qcXBp8ZwmtaCEk2W6evHujyGzUBgNBAhVwd thcVsNu35qM3Ve1DeCfasEhdNuy4e3PvOEi8evTKW3xK4XUrIDkI7RKD/W77DkWLEH/n 8WwllD3a4hKDnYA8fMQ84I1bFpDsVQCyJP7D3YwFe9AaOP6I8Fen6y2EEj1UywPLfr5N 1vShtRyGfYJ0dtj0qJLaoAmCI2sAJ8XNfqidcBuX1y0tXK/oywwvVBXKqZXDSAsh3nbo qd9w== X-Gm-Message-State: ALoCoQkj+ghz0INLbsiZNkxmARIPvoqY7k4vTXcmCspdj5mheiDQvjpaEP43brbhr+jV5NlyT5PBRKY4rfQ1oEVugx8bOV+9CA== X-Received: by 10.194.201.134 with SMTP id ka6mr29531949wjc.116.1453201144041; Tue, 19 Jan 2016 02:59:04 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id qs1sm27962889wjc.2.2016.01.19.02.59.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 02:59:03 -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: [RFC PATCH 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Tue, 19 Jan 2016 10:58:59 +0000 Message-Id: <1453201139-2474-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453201052-2347-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1453201052-2347-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(-) -- 1.9.1 -- 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 d10538b..c091f98 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);