[PATCH/RFC 2/2] mtd: m25p80: Call a platform power method in the driver

Stanimir Varbanov svarbanov at mm-sol.com
Sun Aug 28 06:29:13 EDT 2011


Hi, Baruch

Thanks for the comments !

Baruch Siach wrote:
> Hi Stanimir,
> 
> On Thu, Aug 25, 2011 at 04:29:12PM +0300, Stanimir Varbanov wrote:
>> On some devices the flash chip could be powered off when m25p driver
>> is probed. To avoid erroneous detection the power of the chip must be
>> turn on, add a power function in m25p_probe to switch on the power by
>> platform data. The power will be turned off at the probe end.
> 
> [snip]
> 
>> +	/* power on device while probing */
>> +	m25p_power(data, 1);
> 
> [snip]
> 
>> +out:
>> +	m25p_power(data, 0);
> 
> Shouldn't you power off in m25p_remove() as well?
> 

IMO, no, because m25p_power(off) is called from m25p_put_device(). Then 
m25p_put_device() is called from mtdchar::mtd_close(). m25p_remove must
fail if user didn't close mtdchar /dev/mtdX device.

The motivation to use power on/off in m25p_probe is because the flash 
chip might be not powered when driver probe is called. The chip is powered
on on the probe begging and powered off after JEDEC probe pass.

> baruch
> 

regards,
Stan



More information about the linux-mtd mailing list