2 * This file contains work-arounds for many known sdio hardware
5 * Copyright (c) 2011 Pierre Tardy <tardyp@gmail.com>
6 * Inspired from pci fixup code:
7 * Copyright (c) 1999 Martin Mares <mj@ucw.cz>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/mmc/card.h>
14 #include <linux/mod_devicetable.h>
17 * The world is not perfect and supplies us with broken mmc/sdio devices.
18 * For at least a part of these bugs we need a work-around
22 u16 vendor, device; /* You can use SDIO_ANY_ID here of course */
23 void (*vendor_fixup)(struct mmc_card *card, int data);
28 * This hook just adds a quirk unconditionnally
30 static void __maybe_unused add_quirk(struct mmc_card *card, int data)
36 * This hook just removes a quirk unconditionnally
38 static void __maybe_unused remove_quirk(struct mmc_card *card, int data)
40 card->quirks &= ~data;
43 static const struct mmc_fixup mmc_fixup_methods[] = {
47 void mmc_fixup_device(struct mmc_card *card)
49 const struct mmc_fixup *f;
51 for (f = mmc_fixup_methods; f->vendor_fixup; f++) {
52 if ((f->vendor == card->cis.vendor
53 || f->vendor == (u16) SDIO_ANY_ID) &&
54 (f->device == card->cis.device
55 || f->device == (u16) SDIO_ANY_ID)) {
56 dev_dbg(&card->dev, "calling %pF\n", f->vendor_fixup);
57 f->vendor_fixup(card, f->data);
61 EXPORT_SYMBOL(mmc_fixup_device);