From patchwork Sat Apr 16 10:40:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Warkentin X-Patchwork-Id: 712251 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3GA2cuG031227 for ; Sat, 16 Apr 2011 10:02:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758927Ab1DPKCi (ORCPT ); Sat, 16 Apr 2011 06:02:38 -0400 Received: from exprod5og110.obsmtp.com ([64.18.0.20]:41661 "EHLO exprod5og110.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802Ab1DPKCh (ORCPT ); Sat, 16 Apr 2011 06:02:37 -0400 Received: from DE01MGRG01.AM.MOT-MOBILITY.COM ([192.54.82.14]) (using TLSv1) by exprod5ob110.postini.com ([64.18.4.12]) with SMTP ID DSNKTalpPLaJ75q4uyEV7YUM3h6UUV7pj98k@postini.com; Sat, 16 Apr 2011 03:02:37 PDT Received: from DE01MGRG01.AM.MOT-MOBILITY.COM ([10.22.94.168]) by DE01MGRG01.AM.MOT-MOBILITY.COM (8.14.3/8.14.3) with ESMTP id p3GA2xj2006158 for ; Sat, 16 Apr 2011 06:03:00 -0400 (EDT) Received: from mail-yi0-f42.google.com (mail-yi0-f42.google.com [209.85.218.42]) by DE01MGRG01.AM.MOT-MOBILITY.COM (8.14.3/8.14.3) with ESMTP id p3GA2x6X006150 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=OK) for ; Sat, 16 Apr 2011 06:02:59 -0400 (EDT) Received: by yib12 with SMTP id 12so2355953yib.15 for ; Sat, 16 Apr 2011 03:02:35 -0700 (PDT) Received: by 10.150.103.6 with SMTP id a6mr1538960ybc.349.1302948154940; Sat, 16 Apr 2011 03:02:34 -0700 (PDT) Received: from localhost.localdomain (dyngate-ca119-13.motorola.com [144.189.96.13]) by mx.google.com with ESMTPS id b3sm3471881ana.24.2011.04.16.03.02.33 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 16 Apr 2011 03:02:34 -0700 (PDT) From: Andrei Warkentin To: linux-mmc@vger.kernel.org Cc: arindam.nath@amd.com, Andrei Warkentin , cjb@laptop.org Subject: [patchv3 1/5] MMC: Add/remove quirks conditional support. Date: Sat, 16 Apr 2011 05:40:54 -0500 Message-Id: <1302950458-1969-2-git-send-email-andreiw@motorola.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1302741523-22276-1-git-send-email-andreiw@motorola.com> References: <1302741523-22276-1-git-send-email-andreiw@motorola.com> X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 16 Apr 2011 10:02:39 +0000 (UTC) Conditional add/remove quirks for MMC and SD. Cc: cjb@laptop.org Signed-off-by: Andrei Warkentin --- include/linux/mmc/card.h | 40 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 36 insertions(+), 4 deletions(-) diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 72a9868..6a4ed2a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -233,16 +233,14 @@ struct mmc_fixup { card->cid.month) /* - * This hook just adds a quirk unconditionally. + * Unconditionally quirk add/remove. */ + static inline void __maybe_unused add_quirk(struct mmc_card *card, int data) { card->quirks |= data; } -/* - * This hook just removes a quirk unconditionally. - */ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data) { card->quirks &= ~data; @@ -264,6 +262,40 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data) #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) #define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) +/* + * Quirk add/remove for MMC products. + */ + +static inline void __maybe_unused add_quirk_mmc(struct mmc_card *card, int data) +{ + if (mmc_card_mmc(card)) + card->quirks |= data; +} + +static inline void __maybe_unused remove_quirk_mmc(struct mmc_card *card, + int data) +{ + if (mmc_card_mmc(card)) + card->quirks &= ~data; +} + +/* + * Quirk add/remove for SD products. + */ + +static inline void __maybe_unused add_quirk_sd(struct mmc_card *card, int data) +{ + if (mmc_card_sd(card)) + card->quirks |= data; +} + +static inline void __maybe_unused remove_quirk_sd(struct mmc_card *card, + int data) +{ + if (mmc_card_sd(card)) + card->quirks &= ~data; +} + static inline int mmc_card_lenient_fn0(const struct mmc_card *c) { return c->quirks & MMC_QUIRK_LENIENT_FN0;