From patchwork Thu Apr 14 13:02:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 65819 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp584730qge; Thu, 14 Apr 2016 06:02:28 -0700 (PDT) X-Received: by 10.98.17.78 with SMTP id z75mr21258310pfi.40.1460638945922; Thu, 14 Apr 2016 06:02:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w29si7412325pfa.53.2016.04.14.06.02.25; Thu, 14 Apr 2016 06:02:25 -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 S1754398AbcDNNCY (ORCPT + 2 others); Thu, 14 Apr 2016 09:02:24 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38579 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753800AbcDNNCX (ORCPT ); Thu, 14 Apr 2016 09:02:23 -0400 Received: by mail-wm0-f48.google.com with SMTP id u206so124618063wme.1 for ; Thu, 14 Apr 2016 06:02:22 -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=Ke5/mv8ouPlrhOGjvB01lHejzFHNOkFAgv8B3z4g/A754+DX0f2AWRq2VV5eirgduZ rGaJnaKEm7XaIPLkwAs2TCGGHfDfrWHp1LeqtJtRUPuEKgPPLwF3j6S3ayInJ34bDR0Z h3nxVCLY5QPog2FDfbTecQJOxhAAjgiJKdGnw= 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=UsVc2vBupmetKPGJ+UaAYkK+2xxzDHr6PpRdCKqp9WO1qlwO1TAOXpVAKP1+2/WN1K l3UEyZvh2J3lAj06DRZMTtwvfqFtMJ4eW+Sv9OBhcp/DSnKKUMA9uxbELZdTWtp8qZVA ixn4Gt5ytojVRHY6yxKk04pIArOoHSoHWWQjdawHj3ORRfRd7waxJiTZwN9jiW8+5ZY7 ZL0dUZKUPM4L32LkrSFuMEECyAVGpz9Ist738U06aZrJz6eW5YQOWIDArBY2Nkhh04O1 hX9ye/pzZrbE26de9I+rKXpj+ynRwehMWTnCDaUh7jrtgkKMot4oVUPTMSiNaWKA3E12 CXew== X-Gm-Message-State: AOPr4FU7Lu2z4NhGS/tKhHFyR6/S1RfrQNpLjMgd/fTGlAk5Ekzypn7yXVzhYUvZa4QgAzi6 X-Received: by 10.28.126.210 with SMTP id z201mr16328308wmc.74.1460638941904; Thu, 14 Apr 2016 06:02:21 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id g78sm33438402wme.21.2016.04.14.06.02.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Apr 2016 06:02:21 -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 v4 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Thu, 14 Apr 2016 14:02:14 +0100 Message-Id: <1460638936-26990-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460638936-26990-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1460638936-26990-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);