* mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled
@ 2010-12-22 11:59 viresh kumar
2011-01-04 18:01 ` Chris Ball
0 siblings, 1 reply; 4+ messages in thread
From: viresh kumar @ 2010-12-22 11:59 UTC (permalink / raw)
To: linux-mmc; +Cc: Shiraz HASHIM
Hello,
I am using mmc_test.c driver present in drivers/mmc/test.c
Whenever i insert my card after booting linux i get this error:
"mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled"
I debugged a bit and found something strange. In file drivers/mmc/core/bus.c
following code is present.
int mmc_add_card(struct mmc_card *card)
{
...
ret = device_add(&card->dev);
if (ret)
return ret;
#ifdef CONFIG_DEBUG_FS
mmc_add_card_debugfs(card);
#endif
...
}
After device_add is called mmc_test_register_file_test routine (present in mmc_test.c) is
called and it tries to add "test" file inside card->debugfs_root directory.
But this directory is not actually present till the time mmc_add_card_debugfs() is called,
which actually creates it.
reversing the sequence of above routines seems to solve this issue.
I am not sure if i am doing something wrong or it is actually a bug.
--
viresh
ST Microelectronics
India.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled 2010-12-22 11:59 mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled viresh kumar @ 2011-01-04 18:01 ` Chris Ball 2011-01-05 3:37 ` viresh kumar 0 siblings, 1 reply; 4+ messages in thread From: Chris Ball @ 2011-01-04 18:01 UTC (permalink / raw) To: viresh kumar; +Cc: linux-mmc, Shiraz HASHIM Hi Viresh, On Wed, Dec 22, 2010 at 05:29:47PM +0530, viresh kumar wrote: > I am using mmc_test.c driver present in drivers/mmc/test.c > > Whenever i insert my card after booting linux i get this error: > "mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled" > > I debugged a bit and found something strange. In file drivers/mmc/core/bus.c > following code is present. > > int mmc_add_card(struct mmc_card *card) > { > ... > > ret = device_add(&card->dev); > if (ret) > return ret; > > #ifdef CONFIG_DEBUG_FS > mmc_add_card_debugfs(card); > #endif > > ... > } > > After device_add is called mmc_test_register_file_test routine (present in mmc_test.c) is > called and it tries to add "test" file inside card->debugfs_root directory. > > But this directory is not actually present till the time mmc_add_card_debugfs() is called, > which actually creates it. > > reversing the sequence of above routines seems to solve this issue. > I am not sure if i am doing something wrong or it is actually a bug. Thanks, I've reproduced this now. It's a bug. The reason I hadn't seen it before is that my workflow is always to insert a card, then rmmod mmc_block && modprobe mmc_test -- this works because the debugfs dir is created late on the initial insertion, but still before mmc_test loads. I compiled a kernel with MMC and mmc_test built in, and no mmc_block support, and hit your bug. Here's your patch: could you send a Signed-off-by: line for it, please? From: Viresh Kumar <viresh.kumar@st.com> Date: Tue, 4 Jan 2011 12:55:14 -0500 Subject: [PATCH] mmc: register debugfs dir before calling card probe function This way, the probe function may register debugfs files if it wants to. This fixes a bug with mmc_test where mmc_test_register_file_test() is called before the card's debugfs dir exists, and so it fails. --- drivers/mmc/core/bus.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index af8dc6a..63667a8 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -303,14 +303,14 @@ int mmc_add_card(struct mmc_card *card) type, card->rca); } - ret = device_add(&card->dev); - if (ret) - return ret; - #ifdef CONFIG_DEBUG_FS mmc_add_card_debugfs(card); #endif + ret = device_add(&card->dev); + if (ret) + return ret; + mmc_card_set_present(card); return 0; -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled 2011-01-04 18:01 ` Chris Ball @ 2011-01-05 3:37 ` viresh kumar 2011-01-05 3:48 ` Chris Ball 0 siblings, 1 reply; 4+ messages in thread From: viresh kumar @ 2011-01-05 3:37 UTC (permalink / raw) To: Chris Ball; +Cc: linux-mmc@vger.kernel.org, Shiraz HASHIM On 01/04/2011 11:31 PM, Chris Ball wrote: > Thanks, I've reproduced this now. It's a bug. The reason I hadn't seen > it before is that my workflow is always to insert a card, then rmmod > mmc_block && modprobe mmc_test -- this works because the debugfs dir is > created late on the initial insertion, but still before mmc_test loads. > I compiled a kernel with MMC and mmc_test built in, and no mmc_block > support, and hit your bug. > > Here's your patch: could you send a Signed-off-by: line for it, please? > Chris, Actually i am bit new to LKML and i don't know if i should send the patch again with signed-off or simply send a signed-off: in a similar way as we send Acked-by:. Please tell me if i need to resend patch. > From: Viresh Kumar <viresh.kumar@st.com> > Date: Tue, 4 Jan 2011 12:55:14 -0500 > Subject: [PATCH] mmc: register debugfs dir before calling card probe function > > This way, the probe function may register debugfs files if it wants to. > > This fixes a bug with mmc_test where mmc_test_register_file_test() is > called before the card's debugfs dir exists, and so it fails. > --- > drivers/mmc/core/bus.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c > index af8dc6a..63667a8 100644 > --- a/drivers/mmc/core/bus.c > +++ b/drivers/mmc/core/bus.c > @@ -303,14 +303,14 @@ int mmc_add_card(struct mmc_card *card) > type, card->rca); > } > > - ret = device_add(&card->dev); > - if (ret) > - return ret; > - > #ifdef CONFIG_DEBUG_FS > mmc_add_card_debugfs(card); > #endif > > + ret = device_add(&card->dev); > + if (ret) > + return ret; > + > mmc_card_set_present(card); > > return 0; Signed-off-by: Viresh Kumar <viresh.kumar@st.com> -- viresh ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled 2011-01-05 3:37 ` viresh kumar @ 2011-01-05 3:48 ` Chris Ball 0 siblings, 0 replies; 4+ messages in thread From: Chris Ball @ 2011-01-05 3:48 UTC (permalink / raw) To: viresh kumar; +Cc: linux-mmc@vger.kernel.org, Shiraz HASHIM Hi Viresh, On Wed, Jan 05, 2011 at 09:07:07AM +0530, viresh kumar wrote: > Actually i am bit new to LKML and i don't know if i should send the patch again > with signed-off or simply send a signed-off: in a similar way as we send > Acked-by:. Please tell me if i need to resend patch. No need to resend, you did everything right. I've pushed the patch with your S-o-b to mmc-next for .38 now, thanks! -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-05 3:48 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-12-22 11:59 mmc_test mmc0:0001: Can't create file. Perhaps debugfs is disabled viresh kumar 2011-01-04 18:01 ` Chris Ball 2011-01-05 3:37 ` viresh kumar 2011-01-05 3:48 ` Chris Ball
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.