From patchwork Wed Aug 18 13:31:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 177102 Return-path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on void.printf.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.9 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.2.5 Envelope-to: chris@printf.net Delivery-date: Wed, 18 Aug 2010 14:31:08 +0100 Received: from lists.laptop.org ([18.85.2.145] helo=mail.laptop.org) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1OlijU-0005qg-FN for chris@printf.net; Wed, 18 Aug 2010 14:31:08 +0100 Received: by mail.laptop.org (Postfix) id 0938224752; Wed, 18 Aug 2010 09:30:50 -0400 (EDT) Delivered-To: cjb@laptop.org Received: from spam.laptop.org (spam.laptop.org [18.85.46.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.laptop.org (Postfix) with ESMTPS id E5CA124751 for ; Wed, 18 Aug 2010 09:30:49 -0400 (EDT) X-ASG-Debug-ID: 1282138266-0b740a040001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id EebAGFfbxLrG4RE9 for ; Wed, 18 Aug 2010 09:31:06 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752815Ab0HRNbF (ORCPT ); Wed, 18 Aug 2010 09:31:05 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:59454 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751231Ab0HRNbD (ORCPT ); Wed, 18 Aug 2010 09:31:03 -0400 Received: by eyg5 with SMTP id 5so306238eyg.19 for ; Wed, 18 Aug 2010 06:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=2VPWsNQxaobQyg232wLDxWbjeWZ3RL0OSb//TTS685M=; b=UdaOR1N73uao27GFRMsUIYrZrczLXJuefIIlrI0HGmzW5k7DB/3QajDsiNYg7ADtx9 /4dcwW5V3l3HgZnGHDvQe8DjKBv/af0ontoUwNLXQclCAHE4pAJpinKdnFbM9op/MmZ6 uNMulEOu26hK0Ogkp4uL6xt+47f81o7V5T+d8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=BCDfUjxgM+keMjkq07mvHFsWGMkDnVComejS24Z63YrTrMjdoHCKMlpLLW+CvbTDsL cZtBDjn2eOAn2XjbDMHQEDpILr8GnV7Ntyb3n8DetjNB0oMDQCUy9tIouRLwJ69oGhfR IeFRMrA5l1uR2s9r9cPRaiiiGiuA0hZCySggc= Received: by 10.213.32.141 with SMTP id c13mr304985ebd.44.1282138261670; Wed, 18 Aug 2010 06:31:01 -0700 (PDT) Received: from localhost.localdomain (starua.cc.colocall.com [62.149.23.157]) by mx.google.com with ESMTPS id v59sm474512eeh.22.2010.08.18.06.30.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 18 Aug 2010 06:31:00 -0700 (PDT) From: Andy Shevchenko To: linux-kernel@vger.kernel.org Cc: Andy Shevchenko , Adrian Hunter , linux-mmc@vger.kernel.org X-ASG-Orig-Subj: [PATCH] mmc: make dev_to_mmc_card() macro public Subject: [PATCH] mmc: make dev_to_mmc_card() macro public Date: Wed, 18 Aug 2010 16:31:18 +0300 Message-Id: <1282138278-22304-1-git-send-email-ext-andriy.shevchenko@nokia.com> X-Mailer: git-send-email 1.6.3.3 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Barracuda-Connect: vger.kernel.org[209.132.180.67] X-Barracuda-Start-Time: 1282138266 X-Barracuda-URL: http://18.85.46.23:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at laptop.org X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.5 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.38323 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 5dd8576..82d39bd 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c @@ -1935,12 +1935,10 @@ static ssize_t mmc_test_show(struct device *dev, static ssize_t mmc_test_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct mmc_card *card; + struct mmc_card *card = dev_to_mmc_card(dev); struct mmc_test_card *test; int testcase; - card = container_of(dev, struct mmc_card, dev); - testcase = simple_strtol(buf, NULL, 10); test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 7cd9749..27326c4 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -22,7 +22,6 @@ #include "sdio_cis.h" #include "bus.h" -#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev) #define to_mmc_driver(d) container_of(d, struct mmc_driver, drv) static ssize_t mmc_type_show(struct device *dev, diff --git a/drivers/mmc/core/bus.h b/drivers/mmc/core/bus.h index 1817876..7813954 100644 --- a/drivers/mmc/core/bus.h +++ b/drivers/mmc/core/bus.h @@ -14,7 +14,7 @@ #define MMC_DEV_ATTR(name, fmt, args...) \ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ { \ - struct mmc_card *card = container_of(dev, struct mmc_card, dev); \ + struct mmc_card *card = dev_to_mmc_card(dev); \ return sprintf(buf, fmt, args); \ } \ static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL) diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 6b75250..71acf19 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -173,6 +173,8 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) (dev_name(&(c)->dev)) +#define dev_to_mmc_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)