> > > > Furthermore if this is just a hook to do reference counting. > > > > > > Well, what this put() does depends on the class of engine. For SW and > > > on-die ECC it can be a NOOP (that's true only if you keep the approach > > > where you have a single instance shared by everyone for SW-based ECC > > > engines). > > > For HW-controller-side ECC engines, you'll have to call device_get() on > > > the parent device in your nand_get_hw_ecc_engine() function while you > > > hold the lock protecting the ECC engine list. And device_put() will be > > > called in nand_put_hw_ecc_engine(). > > > > > > I see. > > > > Then I prefer keeping the logic in the core, not in the engine driver > > and propose a > > > > void nand_ecc_put_engine(struct nand_ecc_engine *engine) > > > > which will do nothing for on-die/sw engines and drop the reference for > > hw engines. I will also rename the "find_ecc_engine" to "get_engine" so > > that the call to the "put" helper has more meaning. > > Ack for most of it. One thing I'd like to clarify: it's probably better > to have a separate function called nand_ecc_put_hw_engine() which you'll > call from nand_ecc_put_engine() when you're dealing with an > HW ECC engine rather than calling put_device() directly from > nand_ecc_put_engine(). This way you keep the code for HW ECC engine > well isolated. > > Same goes for the nand_ecc_get_engine() path, just delegate to > nand_ecc_get_hw_engine() when ->provider == HW_ECC. Ack. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/