Re: [PATCH 4/4] mmc: add MMC_QUIRK_NONSTD_FUNC_IF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pierre,

On Wed, Jan 5, 2011 at 2:28 PM, Pierre Tardy <tardyp@xxxxxxxxx> wrote:
> Well... TI is selling quirky hw, would make sense that you handle this. :-)

Heh I'd happily take over - just say the word :)

> Subject: [PATCH] mmc: add per device quirk placeholder
>
> Some cards have quirks valid for every platforms
> using current platform quirk hooks leads to a lot
> of code and debug duplication.
>
> So we inspire a bit from what exists in PCI subsystem
> and do out own per vendorid/deviceid quirk
> We still drop the complexity of the pci quirk system
> (with special section tables, and so on)
> That can be added later if needed.

I like the idea. It would allow us to handle card quirks without
involving board code (and obviously we can't rely on drivers for that
because that may be too late).

> +struct mmc_fixup {
> +       u16 vendor, device;     /* You can use SDIO_ANY_ID here of course */
> +       void (*hook)(struct mmc_card *card);

Do we really need to hook up code with quirky cards ? why not just
directly indicate the exact MMC_QUIRK_* instead (just like USB is
doing) ? that may simplify the whole thing.

So instead of the ->hook() function pointer, we can just put a uint
quirks member,

> +};
> +
> +static const struct mmc_fixup mmc_fixup_methods[] = {
> +       { 0 }

Fill it up here,

> +};
> +
> +void mmc_fixup_device(struct mmc_card *card)
> +{
> +       const struct mmc_fixup *f;
> +
> +       for (f = mmc_fixup_methods; f->hook; f++) {
> +               if ((f->vendor == card->cis.vendor || f->vendor == (u16) SDIO_ANY_ID) &&
> +                   (f->device == card->cis.device || f->device == (u16) SDIO_ANY_ID)) {
> +                       dev_dbg(&card->dev, "calling %pF\n", f->hook);
> +                       f->hook(card);

And then here instead of calling a dedicated ->hook() function, we can
just do something like this:

card->quirks |= f->quirks;

This way we don't need to add a function for every quirky card.

And if we will happen to need it in the future we can always bring it
back in, but right now we really only need to specify the relevant
QUIRK(s).

Thanks,
Ohad.
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux