Reference counting of MMC host driver modules

From: Enrik Berkhan
Date: Fri Jan 09 2009 - 12:15:26 EST


Hi,

I've noticed recently that the MMC/SD block driver does not reference count the MMC/SD host driver module that it uses via the MMC/SD core layer. Thus, I can rmmod my host driver module while, for example, a partition on a SD card is mounted.

Assuming this does not happen intentionally, what would be the correct fix? Is a try_module_get(card->host->parent->driver->owner) in mmc_blk_alloc() in drivers/mmc/card/block.c the right thing to do? If so, I could provide a patch fixing the issue. If not, please give me advice how to do it better :) (May be I'm missing something that has to do with hotplugging, as the devices I'm using are non-removeable).

Or am I possibly doing something wrong in my host driver and this problem is not present for others at all?

Enrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/