From patchwork Tue Oct 14 11:45:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 38710 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B3C920549 for ; Tue, 14 Oct 2014 11:45:43 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id a1sf5173672wgh.5 for ; Tue, 14 Oct 2014 04:45:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=tH3/a2ilMy9ymmsnNtnszHybEo9hvg5rt2yxjLzLdAU=; b=Ui8htZeUvBaSRmb/wOOS0UPZabrJ6gDepUcQjXf3dTrvJtOrmya+OlsztuKOkQirYP 2xaniwERmdhDrIee6vMUnKDiSfCRhy6SC/rqV3H4b5IXOLt+CymhbohCpFW7JRTApsla i1DPezJCZnynGpV3q0L2PHaHUiNusfAPe8WbgaRUVGmoZOXRtrDYgfzZKeyvCWhcHo80 pef7vF954neYrJa7gCsghBkBi8DuCOp5RWxQrlSJhezdC/SgN2jCB/0Ha1gMOOKkm5s4 8reSRjoRkO2dZjUYQkqXDqr7qtrWzvxPnRj+rQiQnHpMALe3swNl36GctOSPJvPPchVC 6e6A== X-Gm-Message-State: ALoCoQmmby0QxCik1/AxLXjuzPaJAidG6lq9FqWcF2yFejUvb3AY5EcEXqey2a06zYBoyBDDuyZL X-Received: by 10.112.63.103 with SMTP id f7mr428579lbs.9.1413287142410; Tue, 14 Oct 2014 04:45:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.130 with SMTP id l2ls543975lag.45.gmail; Tue, 14 Oct 2014 04:45:41 -0700 (PDT) X-Received: by 10.112.144.228 with SMTP id sp4mr4742674lbb.58.1413287141643; Tue, 14 Oct 2014 04:45:41 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id v2si25965006lav.132.2014.10.14.04.45.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 04:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so8007084lbv.10 for ; Tue, 14 Oct 2014 04:45:41 -0700 (PDT) X-Received: by 10.152.87.98 with SMTP id w2mr4675012laz.27.1413287141449; Tue, 14 Oct 2014 04:45:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp377718lbz; Tue, 14 Oct 2014 04:45:41 -0700 (PDT) X-Received: by 10.152.18.166 with SMTP id x6mr4813107lad.18.1413287140824; Tue, 14 Oct 2014 04:45:40 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id ao5si26097155lbc.58.2014.10.14.04.45.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Oct 2014 04:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id mk6so8315026lab.15 for ; Tue, 14 Oct 2014 04:45:40 -0700 (PDT) X-Received: by 10.152.120.133 with SMTP id lc5mr4851034lab.62.1413287140643; Tue, 14 Oct 2014 04:45:40 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id xh2sm5520440lbb.7.2014.10.14.04.45.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Oct 2014 04:45:39 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson Subject: [PATCH 6/7] mmc: block: Use dev_set|get_drvdata() Date: Tue, 14 Oct 2014 13:45:19 +0200 Message-Id: <1413287120-10914-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413287120-10914-1-git-send-email-ulf.hansson@linaro.org> References: <1413287120-10914-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In most of the cases mmc_get|set_drvdata() didn't simplify code, which should be the primary reason for such macros. Let's remove them and convert to the common device_driver macros, dev_set|get_drvdata() instead. Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 21 ++++++++++----------- include/linux/mmc/card.h | 2 -- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 53164e4..ab33e2d 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -112,7 +112,7 @@ struct mmc_blk_data { /* * Only set in main mmc_blk_data associated - * with mmc_card with mmc_set_drvdata, and keeps + * with mmc_card with dev_set_drvdata, and keeps * track of the current selected device partition. */ unsigned int part_curr; @@ -642,7 +642,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *card, struct mmc_blk_data *md) { int ret; - struct mmc_blk_data *main_md = mmc_get_drvdata(card); + struct mmc_blk_data *main_md = dev_get_drvdata(&card->dev); if (main_md->part_curr == md->part_type) return 0; @@ -1004,7 +1004,8 @@ static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host, err = mmc_hw_reset(host); /* Ensure we switch back to the correct partition */ if (err != -EOPNOTSUPP) { - struct mmc_blk_data *main_md = mmc_get_drvdata(host->card); + struct mmc_blk_data *main_md = + dev_get_drvdata(&host->card->dev); int part_err; main_md->part_curr = main_md->part_type; @@ -2093,7 +2094,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, /* * !subname implies we are creating main mmc_blk_data that will be - * associated with mmc_card with mmc_set_drvdata. Due to device + * associated with mmc_card with dev_set_drvdata. Due to device * partitions, devidx will not coincide with a per-physical card * index anymore so we keep track of a name index. */ @@ -2452,7 +2453,7 @@ static int mmc_blk_probe(struct device *dev) if (mmc_blk_alloc_parts(card, md)) goto out; - mmc_set_drvdata(card, md); + dev_set_drvdata(dev, md); if (mmc_add_disk(md)) goto out; @@ -2485,7 +2486,7 @@ static int mmc_blk_probe(struct device *dev) static int mmc_blk_remove(struct device *dev) { struct mmc_card *card = mmc_dev_to_card(dev); - struct mmc_blk_data *md = mmc_get_drvdata(card); + struct mmc_blk_data *md = dev_get_drvdata(dev); mmc_blk_remove_parts(card, md); pm_runtime_get_sync(&card->dev); @@ -2496,7 +2497,7 @@ static int mmc_blk_remove(struct device *dev) pm_runtime_disable(&card->dev); pm_runtime_put_noidle(&card->dev); mmc_blk_remove_req(md); - mmc_set_drvdata(card, NULL); + dev_set_drvdata(dev, NULL); return 0; } @@ -2504,8 +2505,7 @@ static int mmc_blk_remove(struct device *dev) static int _mmc_blk_suspend(struct device *dev) { struct mmc_blk_data *part_md; - struct mmc_card *card = mmc_dev_to_card(dev); - struct mmc_blk_data *md = mmc_get_drvdata(card); + struct mmc_blk_data *md = dev_get_drvdata(dev); if (md) { mmc_queue_suspend(&md->queue); @@ -2530,8 +2530,7 @@ static int mmc_blk_suspend(struct device *dev) static int mmc_blk_resume(struct device *dev) { struct mmc_blk_data *part_md; - struct mmc_card *card = mmc_dev_to_card(dev); - struct mmc_blk_data *md = mmc_get_drvdata(card); + struct mmc_blk_data *md = dev_get_drvdata(dev); if (md) { /* diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index cf54afe..64f4136 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -510,8 +510,6 @@ static inline int mmc_card_broken_irq_polling(const struct mmc_card *c) #define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev) #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) -#define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) -#define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d) extern int mmc_register_driver(struct device_driver *); extern void mmc_unregister_driver(struct device_driver *);