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: 60695 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp373601lbb; Thu, 28 Jan 2016 02:03:30 -0800 (PST) X-Received: by 10.98.13.85 with SMTP id v82mr3166460pfi.158.1453975410474; Thu, 28 Jan 2016 02:03:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si15911335pat.170.2016.01.28.02.03.30; Thu, 28 Jan 2016 02:03:30 -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 S1161066AbcA1KD2 (ORCPT + 30 others); Thu, 28 Jan 2016 05:03:28 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36567 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966410AbcA1KDP (ORCPT ); Thu, 28 Jan 2016 05:03:15 -0500 Received: by mail-wm0-f42.google.com with SMTP id p63so16936574wmp.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=OKLbmohM702iaEZLgTMES80pFjruC6W9SwOKxohqMWsnW/2W0ftfni2KE4Z/fCZUF8 debyHK1mAeQF6VM17Vb3ZUkmIoimI/K3n19ss8uZ6zIlvx5z0SAxURa+sTodFQYNIEG0 UgshlUT/hHhJF6gDEzBS9hSq7sU/pSM5wOiOTpWKY+AJ1Ik7/HJopoShISodZz1lrOFj FZoZN8Kt/7pGu/Ecj0trZZsy8SG4ZgzTo6+/wK7PNrS3Gu1uWkymfDzBYN70SUL7yEy3 Efwge+4fWp+NsfN0qjoZNQ4kJ/e6P8jNZ6mVw6rAELxLyynHRUFqsaLv9CoLRwQJeptA PD4g== X-Gm-Message-State: AG10YORFzK6BVSNS8oJWPGEmhA+RXYyUUxSwmE0vun/n0QU/TgP1EQFe5P7CEHyIu7UdlYcJ 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-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 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);