From patchwork Tue Jan 19 10:58:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 8060571 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 C0BC1BEEE5 for ; Tue, 19 Jan 2016 10:59:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DCA4B2013D for ; Tue, 19 Jan 2016 10:59:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BD74200F2 for ; Tue, 19 Jan 2016 10:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932921AbcASK7H (ORCPT ); Tue, 19 Jan 2016 05:59:07 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:34746 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932808AbcASK7F (ORCPT ); Tue, 19 Jan 2016 05:59:05 -0500 Received: by mail-wm0-f50.google.com with SMTP id u188so138062938wmu.1 for ; Tue, 19 Jan 2016 02:59:04 -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=GWGA9+elBoxqadCkc2gyflAZCeQf+7sFxsKoHKOjDbc=; b=NXTkH0uxy2eo0zXYBpTimI01/LIlOmhvtRtgdATb54P4mzcfsWLI0QUbW92UP6lZG4 vRVpHqd3Q5SfUqSmUAnQpDbL3ovX1pSfhzFV/oLuA4t9fljwFuZvxopO2Fak+N9edIOf kFc6nY9oILsrV7eUjS0XDNexT23imUcrzAPBM= 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=GWGA9+elBoxqadCkc2gyflAZCeQf+7sFxsKoHKOjDbc=; b=MTe70HbqkPuIRc6x0lI1MhMsC0uGWLV3PuicvreKM6wpqGpxxV2qprl6vSOF6cY9eF lQlCf05AzSQPuTn5zqvvMxVnftCK3juL/qcXBp8ZwmtaCEk2W6evHujyGzUBgNBAhVwd thcVsNu35qM3Ve1DeCfasEhdNuy4e3PvOEi8evTKW3xK4XUrIDkI7RKD/W77DkWLEH/n 8WwllD3a4hKDnYA8fMQ84I1bFpDsVQCyJP7D3YwFe9AaOP6I8Fen6y2EEj1UywPLfr5N 1vShtRyGfYJ0dtj0qJLaoAmCI2sAJ8XNfqidcBuX1y0tXK/oywwvVBXKqZXDSAsh3nbo qd9w== X-Gm-Message-State: ALoCoQkj+ghz0INLbsiZNkxmARIPvoqY7k4vTXcmCspdj5mheiDQvjpaEP43brbhr+jV5NlyT5PBRKY4rfQ1oEVugx8bOV+9CA== X-Received: by 10.194.201.134 with SMTP id ka6mr29531949wjc.116.1453201144041; Tue, 19 Jan 2016 02:59:04 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id qs1sm27962889wjc.2.2016.01.19.02.59.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 02:59:03 -0800 (PST) From: Srinivas Kandagatla To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Srinivas Kandagatla Subject: [RFC PATCH 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Date: Tue, 19 Jan 2016 10:58:59 +0000 Message-Id: <1453201139-2474-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453201052-2347-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1453201052-2347-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 d10538b..c091f98 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) { @@ -42,8 +44,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); @@ -55,16 +56,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); @@ -76,8 +75,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); gpiod_put_array(pwrseq->reset_gpios);