From patchwork Wed Mar 2 16:45:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 8483671 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 1F3E2C0553 for ; Wed, 2 Mar 2016 16:45:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E1D020383 for ; Wed, 2 Mar 2016 16:45:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E23920373 for ; Wed, 2 Mar 2016 16:45:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754481AbcCBQpU (ORCPT ); Wed, 2 Mar 2016 11:45:20 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35057 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754461AbcCBQpS (ORCPT ); Wed, 2 Mar 2016 11:45:18 -0500 Received: by mail-wm0-f41.google.com with SMTP id l68so94410079wml.0 for ; Wed, 02 Mar 2016 08:45:17 -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=Zot+8yhzV6xPIiTerylL8BktSXS63btaiBrH7/4SaV+UJvygw+Fy7oVb122SC144SC E718uZGugSkNaTH7Aib8aiSWgplTcwpLF8dhfsCOEqbLxIxrRHeoZOga7m2en0BnXwC/ 7SgLowmsPdtHsxaY+VUCYXvpQ/7EeZ3bn7U+g= 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=baRDYO9+cR0Txz16KNDRDby3/1VZc51jJ4zh0BHFHRSoAN0aN1doNxn+xxdgLX5afF HD5pukfMVZ4Q+gzLC01qkXZWrRmCd9zo3hEEHGJTONiGtyo3FgfnYoaZFRhu13A7VVs7 PQtecFoPY3GPDXMp/wkixq3/syo63bm7Uc9q9+47ZIJoucnRDOTPJzAj7huUvw12yCdG tXlrHctnHmXD+HESypoAdtlv3qaScCdpt0XA7q5iMr9cgjR2uk9MAfIjhlSUebsWbP/7 tFK1oANUUagXloFhVYYEsbC57ii+loG5At+7z/M07blhA0DVXUpUy743PPscuRtZPs+Q I54w== X-Gm-Message-State: AD7BkJJX75/SdsvjTYKFNIUpg3vXgAt62L2HXCanOwM1Rfz4Clsojl/+4YpUTbo9n30HBw/Z X-Received: by 10.194.58.12 with SMTP id m12mr30585166wjq.22.1456937116525; Wed, 02 Mar 2016 08:45:16 -0800 (PST) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id 63sm5015317wms.1.2016.03.02.08.45.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Mar 2016 08:45:15 -0800 (PST) From: Srinivas Kandagatla To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mfuzzey@parkeon.com, Srinivas Kandagatla Subject: [PATCH v2 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Wed, 2 Mar 2016 16:45:10 +0000 Message-Id: <1456937110-27286-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456937078-27241-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1456937078-27241-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=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 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);