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: 8836061 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 593F8C0553 for ; Thu, 14 Apr 2016 13:02:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F41AD20295 for ; Thu, 14 Apr 2016 13:02:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 227B92027D for ; Thu, 14 Apr 2016 13:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754398AbcDNNCY (ORCPT ); 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 X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 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);