X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=Documentation%2FDocBook%2Fvideobook.tmpl;h=2c92b183687269081c4906157b7a1ce95c8b1a5e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=b942a25a47536a38ad01fc1b92da619427db606f;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl index b942a25a4..2c92b1836 100644 --- a/Documentation/DocBook/videobook.tmpl +++ b/Documentation/DocBook/videobook.tmpl @@ -232,7 +232,6 @@ static int radio_open(stuct video_device *dev, int flags) if(users) return -EBUSY; users++; - MOD_INC_USE_COUNT; return 0; } @@ -248,7 +247,6 @@ static int radio_open(stuct video_device *dev, int flags) static int radio_close(struct video_device *dev) { users--; - MOD_DEC_USE_COUNT; } @@ -733,13 +731,14 @@ static int io = 0x300; static int io = -1; +#endif MODULE_AUTHOR("Alan Cox"); MODULE_DESCRIPTION("A driver for an imaginary radio card."); -MODULE_PARM(io, "i"); +module_param(io, int, 0444); MODULE_PARM_DESC(io, "I/O address of the card."); -int init_module(void) +static int __init init(void) { if(io==-1) { @@ -750,25 +749,26 @@ int init_module(void) return myradio_init(NULL); } -void cleanup_module(void) +static void __exit cleanup(void) { video_unregister_device(&my_radio); release_region(io, MY_IO_SIZE); } -#endif +module_init(init); +module_exit(cleanup); In this example we set the IO base by default if the driver is compiled into - the kernel where you cannot pass a parameter. For the module we require the + the kernel: you can still set it using "my_radio.irq" if this file is called my_radio.c. For the module we require the user sets the parameter. We set io to a nonsense port (-1) so that we can tell if the user supplied an io parameter or not. We use MODULE_ defines to give an author for the card driver and a description. We also use them to declare that io is an integer and it is the - address of the card. + address of the card, and can be read by anyone from sysfs. The clean-up routine unregisters the video_device we registered, and frees @@ -954,7 +954,6 @@ static int camera_open(stuct video_device *dev, int flags) if(request_irq(irq, camera_irq, 0, "camera", dev)<0) return -EBUSY; users++; - MOD_INC_USE_COUNT; return 0; } @@ -963,7 +962,6 @@ static int camera_close(struct video_device *dev) { users--; free_irq(irq, dev); - MOD_DEC_USE_COUNT; }