From patchwork Thu Jan 28 10:03:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 8148201 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F9059F818 for ; Thu, 28 Jan 2016 10:03:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB47020251 for ; Thu, 28 Jan 2016 10:03:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18727201F2 for ; Thu, 28 Jan 2016 10:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964930AbcA1KD1 (ORCPT ); Thu, 28 Jan 2016 05:03:27 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:38706 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966846AbcA1KDP (ORCPT ); Thu, 28 Jan 2016 05:03:15 -0500 Received: by mail-wm0-f42.google.com with SMTP id p63so16886530wmp.1 for ; Thu, 28 Jan 2016 02:03:14 -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=SB8w1eqHz9AwGY0r8qwauKAhxfxqMnDp25Bh0xkKx4o=; b=XcNDbKK884FgQm1gcmcoVR0kGOJ+2fnwp6YvlSkrGJhaH7Y/jS/gpkXM5YewBDFekD Uji/h7DFPejv6eXQT43EnldFYNX3qA/JHWo8hr2dztok+u+MLU+9A1/0R2FDL0+D9iU/ FRbJDti0h1rTWP0J1oXJUDFuswlvRwLaTljZM= 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=SB8w1eqHz9AwGY0r8qwauKAhxfxqMnDp25Bh0xkKx4o=; b=M2g8WIiAny4SmQyekt9oqgnXPzgIzRUgYNUiPOs0dcuypbPQiAq2nJb1zvugX2dVa/ eURYt723Iebk5NLDOqlO+U3d38PR2wFY0i4LoeQei7AcWwj3ec0X5HiBEuS93CZ30/Ds Kfy/I57qNGbgWyp0ccKxZzN7Y9lu/ePLcgLRcoR5ZQbjG5pueGWChDbRPwlAQJe0Of93 Y2p85bPz9ZTG2mTR2Fi7GiprnIG/ewtoygh7ZUw8BJtWvGovYe3pFQy6f4XjNw7+fHE+ XZJLVh3TK94IK6ZW81dkkbz9WOZ8GfKpHRbnoxMgNN83lDOet7MFPbRyZQbT1zG7+nDv KrKA== X-Gm-Message-State: AG10YOQw4j9gfILp/GKefYBQLkrgNKmgo2bGYPPkEd5irex2m3wfw9T/YsTAtSk6tVioqafU X-Received: by 10.28.107.81 with SMTP id g78mr2032316wmc.16.1453975394188; Thu, 28 Jan 2016 02:03:14 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id x2sm10249034wjf.13.2016.01.28.02.03.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jan 2016 02:03:13 -0800 (PST) From: Srinivas Kandagatla To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mfuzzey@parkeon.com, linux-arm-kernel@lists.infradead.org, Srinivas Kandagatla Subject: [PATCH v2 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Thu, 28 Jan 2016 10:03:07 +0000 Message-Id: <1453975387-13467-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453975315-13424-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1453975315-13424-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 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index aba786d..03573e1 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) { @@ -45,8 +47,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); @@ -58,16 +59,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); @@ -79,8 +78,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);