Workqueue and kernel panic on device disconnect

2011-10-25 Thread Frank Schäfer
Hi,

I'm trying to use a workqueue in a usb driver for polling the states of 
the device buttons.
That works fine, but when I disconnect the device, the kernel sometimes 
explodes.
The machine turns off immediately, without saving a backtrace (I will 
try to make a photo tomorrow)

The code:



static struct delayed_work poll_work;

static const struct usb_device_id device_table[] = {
 {USB_DEVICE(0x1234, 0x5678)},
 {}
};

static void poll(struct work_struct *work)
{
 schedule_delayed_work(&poll_work,
   msecs_to_jiffies(100));
}

MODULE_DEVICE_TABLE(usb, device_table);

static int test_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
{
 INIT_DELAYED_WORK(&poll_work, poll);
 schedule_delayed_work(&poll_work,
   msecs_to_jiffies(100));
 return 0;
}

static void test_disconnect(struct usb_interface *intf)
{
 cancel_delayed_work_sync(&poll_work);
}

static struct usb_driver test_driver = {
 .name   = MODULE_NAME,
 .id_table   = device_table,
 .probe  = test_probe,
 .disconnect = test_disconnect,
};

static int __init test_mod_init(void)
{
 return usb_register(&test_driver);
}

static void __exit test_mod_exit(void)
{
 usb_deregister(&test_driver);
}

module_init(test_mod_init);
module_exit(test_mod_exit);


What am I doing wrong ?
Is there anything else I have to do in addition to calling 
cancel_delayed_work_sync() in the disconnect fcn ?

Thanks,
Frank Schaefer


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Fix procmail rule in ML wikipage

2011-10-25 Thread chandanrmail
The procmail rule for "netdev:Linux network development list" has a
typo. The "condition" should be as shown below:

* ^X-Mailing-List:.*netdev@vger\.kernel\.org

Regards,
chandan r

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Purpose of using __be16 inside a data structure?

2011-10-25 Thread Jonathan Neuschäfer
On Mon, Oct 24, 2011 at 12:54:41PM -0700, Kevin O'Gorman wrote:
> On Tue, Aug 9, 2011 at 12:25 AM, 陳國成  wrote:
> 
> > Hi all,
> >
> > Please tell me the difference between using unsigned short and __be16 to
> > declear a variable in a data structure.
[...]
> accomplishes this goal.  From the name, I expect this to be a 16-bit type.
> It may have other attributes, such as a specific endianness (unusual except

Yes, it's for 16-bit big-endian data.

--
Jonathan Neuschäfer

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux 0.02 version download

2011-10-25 Thread Shaz
On Tue, Oct 25, 2011 at 2:52 PM, Adam Lee  wrote:
> On Tue, Oct 25, 2011 at 10:04:06AM +0200, Christophe Lucas wrote:
>> Le 25/10/2011 09:46, Javier Martinez Canillas a écrit :
>> > On Tue, Oct 25, 2011 at 9:36 AM, bob  wrote:
>> >> He's probably doing os dev and wants something simple to learn. Stick with
>> >> 0.01 as 0.02 source is lost. Sad face.
>> >
>> > Yes I know, but I recommend either use a newer kernel or use an
>> > operating system that was written for teaching like:
>> >
>> > http://pdos.csail.mit.edu/6.828/2011/xv6.html
>> >
>> > I don't want to imagine how hard could be compiling a 0.01 kernel with
>> > GCC 4.5 and find a rootfs that is suitable for it.
>>
>> Hello,
>>
>> I know it is in french(sorry), but you can also use :
>>
>>       http://sos.enix.org/fr/PagePrincipale
>>       http://sos.enix.org/fr/SOSDownload#TOC_0_2_25
>>
>> Which is a articles series published in a linux magazin in France. It
>> becomes from boot to block-devices.
>>
>
> I found this: http://mirrors.kernel.org/oldlinux/Linux.old/kernel/
>
> 0.00/                   20-Jan-2005 07:06
> 0.1x/                   04-May-2004 14:09
> 0.95/                   20-Mar-2004 13:10
> 0.96/                   20-Jan-2004 11:46
> 0.97/                   20-Jan-2004 11:46
> 0.98/                   20-Jan-2004 11:46
> 0.99/                   20-Jan-2004 11:46
> 1.00/                   20-Jan-2004 11:46
> Historic/               20-Mar-2003 22:38
>
> 0.02 lost. If you wanna start from oldlinux, 0.11 will be a good choice,
> and there is a book about this: http://mirrors.kernel.org/oldlinux/

Try oskit as it is good for learning:

http://www.cs.utah.edu/flux/oskit/

Take care.

-- 
Shahbaz Khan

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux 0.02 version download

2011-10-25 Thread Adam Lee
On Tue, Oct 25, 2011 at 10:04:06AM +0200, Christophe Lucas wrote:
> Le 25/10/2011 09:46, Javier Martinez Canillas a écrit :
> > On Tue, Oct 25, 2011 at 9:36 AM, bob  wrote:
> >> He's probably doing os dev and wants something simple to learn. Stick with
> >> 0.01 as 0.02 source is lost. Sad face.
> >
> > Yes I know, but I recommend either use a newer kernel or use an
> > operating system that was written for teaching like:
> >
> > http://pdos.csail.mit.edu/6.828/2011/xv6.html
> >
> > I don't want to imagine how hard could be compiling a 0.01 kernel with
> > GCC 4.5 and find a rootfs that is suitable for it.
> 
> Hello,
> 
> I know it is in french(sorry), but you can also use :
> 
>   http://sos.enix.org/fr/PagePrincipale
>   http://sos.enix.org/fr/SOSDownload#TOC_0_2_25
> 
> Which is a articles series published in a linux magazin in France. It 
> becomes from boot to block-devices.
> 

I found this: http://mirrors.kernel.org/oldlinux/Linux.old/kernel/

0.00/   20-Jan-2005 07:06
0.1x/   04-May-2004 14:09
0.95/   20-Mar-2004 13:10
0.96/   20-Jan-2004 11:46
0.97/   20-Jan-2004 11:46
0.98/   20-Jan-2004 11:46
0.99/   20-Jan-2004 11:46
1.00/   20-Jan-2004 11:46
Historic/   20-Mar-2003 22:38

0.02 lost. If you wanna start from oldlinux, 0.11 will be a good choice,
and there is a book about this: http://mirrors.kernel.org/oldlinux/

-- 
Regards,
Adam Lee
--
E-mail: adam8...@gmail.com
Website: http://www.adam8157.info
--

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux 0.02 version download

2011-10-25 Thread Christophe Lucas
Le 25/10/2011 09:46, Javier Martinez Canillas a écrit :
> On Tue, Oct 25, 2011 at 9:36 AM, bob  wrote:
>> He's probably doing os dev and wants something simple to learn. Stick with
>> 0.01 as 0.02 source is lost. Sad face.
>
> Yes I know, but I recommend either use a newer kernel or use an
> operating system that was written for teaching like:
>
> http://pdos.csail.mit.edu/6.828/2011/xv6.html
>
> I don't want to imagine how hard could be compiling a 0.01 kernel with
> GCC 4.5 and find a rootfs that is suitable for it.
>
> Best regards,
>

Hello,

I know it is in french(sorry), but you can also use :

http://sos.enix.org/fr/PagePrincipale
http://sos.enix.org/fr/SOSDownload#TOC_0_2_25

Which is a articles series published in a linux magazin in France. It 
becomes from boot to block-devices.

Best regards,
-- 
 Christophe

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux 0.02 version download

2011-10-25 Thread Javier Martinez Canillas
On Tue, Oct 25, 2011 at 9:36 AM, bob  wrote:
> He's probably doing os dev and wants something simple to learn. Stick with
> 0.01 as 0.02 source is lost. Sad face.

Yes I know, but I recommend either use a newer kernel or use an
operating system that was written for teaching like:

http://pdos.csail.mit.edu/6.828/2011/xv6.html

I don't want to imagine how hard could be compiling a 0.01 kernel with
GCC 4.5 and find a rootfs that is suitable for it.

Best regards,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
Barcelona, Spain

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux 0.02 version download

2011-10-25 Thread bob
He's probably doing os dev and wants something simple to learn. Stick with
0.01 as 0.02 source is lost. Sad face.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Is there a tool which can generate a small and simple source tree after config?

2011-10-25 Thread Javier Martinez Canillas
On Sun, Oct 23, 2011 at 6:29 PM, jiangtao.jit  wrote:
> Hi:
>

Hi jiangtao,

> While reading the kernel code
> 1. the huge amount of files make me scared
>    there are too many alike functions in different files
>    sometimes I can't figure out which one was really compiled
> 2. too many macros in the definition of a struct or functions declaration
>    confused me a lot
>    I tried to follow the generated file autoconf.h to guess the final face
>    but it's really a difficult thing
>
> Is there a tool which can generate a small and simple source tree after 
> config?
> not pre-processor

Not that I'm aware of.

> just generate a small source tree contains the files and dirs which really 
> will be compiled
> and no macros like CONFIG_SMP etc.
> according to the configuration
>
> or some other way to understand the architecture of the final working source 
> tree?
>

The Linux kernel is a very complex beast yet it is highly modularized.
I recommend you to focus on the specific subsystem that you need to
work and don't worry about the rest.

To know if a specific file is included in your kernel I usually do
this (it works for me but I'm not sure if is the right way to do it):

For example if I want to know if the driver to support nand memories
on ARM OMAP platforms is included in my kernel.

1- Find the file that implements the driver (drivers/mtd/nand/omap2.c)

2- See which Kconfig symbol determines its compilation:

$ fgrep omap2 drivers/mtd/nand/Makefile
obj-$(CONFIG_MTD_NAND_OMAP2)+= omap2.o

3- Look if that symbol is included in my config file:

$ fgrep MTD_NAND_OMAP2 .config
CONFIG_MTD_NAND_OMAP2=y

Then I know that my kernels includes that file.


Hope it helps,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
Barcelona, Spain

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux 0.02 version download

2011-10-25 Thread Javier Martinez Canillas
On Tue, Oct 25, 2011 at 4:40 AM, Venkateswarlu P
 wrote:
> I want to download  Linux 0.02 version
> I anybody knows plese send the link
> I already tried in the google
>

Hi Venkateswarlu,

Why do you need such an ancient Linux kernel? If you want to learn
from the source code I recommend you a more newer one since people can
help you if you have questions about the code.


Best regards,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
Barcelona, Spain

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Is there a way to build a cross reference with kernel file

2011-10-25 Thread Javier Martinez Canillas
Hello Jimmy,

On Mon, Oct 24, 2011 at 5:00 PM, Jimmy Pan  wrote:
> It seems we can use ctags, while, I don't really know how to implement it.
> I don't want to use the online cross reference every time...
> Thanks.
>

Emacs + etags + cscope is for my the best approach to navigate the kernel.

A few months ago I wrote a blog post about this, you could take a look:

http://martinezjavier.blogspot.com/2011/07/emacs-configuration-for-linux-kernel.html

Hope it helps,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
Barcelona, Spain

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies