how to build Documentation/DocBook/
I have fresh kernel downloaded by git and I want to know how to build Documentation/DocBook/ as pdf I have tried make pdfdocs output but I got those warnings Warning(.//include/linux/init.h): no structured comments found Warning(.//kernel/sys.c): no structured comments found Warning(.//drivers/dma-buf/seqno-fence.c): no structured comments found Warning(.//drivers/dma-buf/reservation.c): no structured comments found Warning(.//include/linux/reservation.h): no structured comments found Warning(.//include/linux/hsi/hsi.h:150): Excess struct/union/enum/typedef member 'e_handler' description in 'hsi_client' Warning(.//include/linux/hsi/hsi.h:150): Excess struct/union/enum/typedef member 'pclaimed' description in 'hsi_client' Warning(.//include/linux/hsi/hsi.h:150): Excess struct/union/enum/typedef member 'nb' description in 'hsi_client' make[1]: *** [Documentation/DocBook/kernel-hacking.pdf] Error 9 make: *** [pdfdocs] Error 2 and the file output look like this DOCPROC Documentation/DocBook/z8530book.xml PDF Documentation/DocBook/z8530book.pdf Using catalogs: /etc/sgml/catalog Using stylesheet: /usr/share/docbook-utils/docbook-utils.dsl#print Working on: /home/oddcoder/linux/Documentation/DocBook/z8530book.xml Done. DOCPROC Documentation/DocBook/device-drivers.xml PDF Documentation/DocBook/device-drivers.pdf Using catalogs: /etc/sgml/catalog Using stylesheet: /usr/share/docbook-utils/docbook-utils.dsl#print Working on: /home/oddcoder/linux/Documentation/DocBook/device-drivers.xml Done. DOCPROC Documentation/DocBook/kernel-hacking.xml PDF Documentation/DocBook/kernel-hacking.pdf Using catalogs: /etc/sgml/catalog Using stylesheet: /usr/share/docbook-utils/docbook-utils.dsl#print Working on: /home/oddcoder/linux/Documentation/DocBook/kernel-hacking.xml This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) restricted \write18 enabled. entering extended mode (/home/oddcoder/linux/Documentation/DocBook/kernel-hacking.tex JadeTeX 2003/04/27: 3.13 (/usr/share/texlive/texmf-dist/tex/latex/psnfss/t1ptm.fd) Elements will be labelled Jade begin document sequence at 20 No file kernel-hacking.aux. (/usr/share/texmf/tex/latex/tipa/t3ptm.fd) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd) (/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty) (/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) (/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty)) (/usr/share/texlive/texmf-dist/tex/latex/psnfss/t1phv.fd) [1.0.30{/var/lib/texm f/fonts/map/pdftex/updmap/pdftex.map}] (/usr/share/texlive/texmf-dist/tex/latex/psnfss/ts1ptm.fd) [2.0.30] Package Fancyhdr Warning: \fancyfoot's `E' option without twoside option is use less on input line 315. LaTeX Warning: Reference `0:introduction' on page iii undefined on input line 3 72. LaTeX Warning: Reference `0:basic-players' on page iii undefined on input line 406. LaTeX Warning: Reference `0:basics-usercontext' on page iii undefined on input line 432. LaTeX Warning: Reference `0:basics-hardirqs' on page iii undefined on input lin e 457. LaTeX Warning: Reference `0:basics-softirqs' on page iii undefined on input lin e 482. LaTeX Warning: Reference `0:basic-rules' on page iii undefined on input line 51 6. LaTeX Warning: Reference `0:ioctls' on page iii undefined on input line 550. LaTeX Warning: Reference `0:deadlock-recipes' on page iii undefined on input li ne 584. LaTeX Warning: Reference `0:common-routines' on page iii undefined on input lin e 618. (/usr/share/texlive/texmf-dist/tex/latex/psnfss/t1pcr.fd) LaTeX Warning: Reference `0:routines-printk' on page iii undefined on input lin e 655. LaTeX Warning: Reference `0:routines-copy' on page iii undefined on input line 705. LaTeX Warning: Reference `0:routines-kmalloc' on page iii undefined on input li ne 746. LaTeX Warning: Reference `0:routines-current' on page iii undefined on input li ne 782. LaTeX Warning: Reference `0:routines-udelay' on page iii undefined on input lin e 829. LaTeX Warning: Reference `0:routines-endian' on page iii undefined on input lin e 880. LaTeX Warning: Reference `0:routines-local-irqs' on page iii undefined on input line 921. LaTeX Warning: Reference `0:routines-softirqs' on page iii undefined on input l ine 962. LaTeX Warning: Reference `0:routines-processorids' on page iii undefined on inp ut line 998. LaTeX Warning: Reference `0:routines-init' on page iii undefined on input line 1041. LaTeX Warning: Reference `0:routines-init-again' on page iii undefined on input line 1082. LaTeX Warning: Reference `0:routines-moduleexit' on page iii undefined on input line 1118. LaTeX Warning: Reference `0:routines-module-use-counters' on
Re: how to build Documentation/DocBook/
On 17 July 2015 at 13:40, Ahmed Soliman ahmedsoliman0x...@gmail.com wrote: I have fresh kernel downloaded by git and I want to know how to build Documentation/DocBook/ as pdf I have tried make pdfdocs output but I got those warnings Warning(.//include/linux/init.h): no structured comments found Warning(.//kernel/sys.c): no structured comments found Warning(.//drivers/dma-buf/seqno-fence.c): no structured comments found Warning(.//drivers/dma-buf/reservation.c): no structured comments found Warning(.//include/linux/reservation.h): no structured comments found Warning(.//include/linux/hsi/hsi.h:150): Excess struct/union/enum/typedef member 'e_handler' description in 'hsi_client' Warning(.//include/linux/hsi/hsi.h:150): Excess struct/union/enum/typedef member 'pclaimed' description in 'hsi_client' Warning(.//include/linux/hsi/hsi.h:150): Excess struct/union/enum/typedef member 'nb' description in 'hsi_client' make[1]: *** [Documentation/DocBook/kernel-hacking.pdf] Error 9 make: *** [pdfdocs] Error 2 and the file output look like this Which Kernel version are you using? It looks like your error has been fixed by: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9e39dc1e563e8d390bae42ee80e1e665c18b7de2 Unfortunately. make pdfdocs fails when building DocBook/scsi.pdf in the latest stable release (4.1.2) Luis ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
dev_* mesage
What is the difference between dev_* (like dev_err) and pr_* (like pr_err)? In which situations we use them? ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: dev_* mesage
On 17 July 2015 at 16:06, roni ronit.li...@gmail.com wrote: What is the difference between dev_* (like dev_err) and pr_* (like pr_err)? In which situations we use them? dev_*() is prefered when you have a struct device object. Luis ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
On Fri, Jul 17, 2015 at 1:25 PM, Navy nav...@126.com wrote: Hello, Goto is recommend in linux kernel programming, but it is despised in many other situation. There are four rationable for using goto in Documentation/CodingStyle. Do you have some viewpoints about why goto or why not goto? I'm glad to get your point. Check the file drivers/staging/dgap/dgap.c there is a function called dgap_init_one() which is using 6 goto statements. Please try to convert that file without using goto and i hope you will understand practically why goto. regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
goto???
Hello, Goto is recommend in linux kernel programming, but it is despised in many other situation. There are four rationable for using goto in Documentation/CodingStyle. Do you have some viewpoints about why goto or why not goto? I'm glad to get your point. Thank you. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
On Fri, Jul 17, 2015 at 2:18 PM, Martin Knappe kohaerenzstif...@posteo.de wrote: Very easy: Looks good. :) But for me, now while reading the code I have to keep a note of the value of cleanupState variable and the error path becomes confusing. And besides in your opinion now which code is more readable, the original code or this one? regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
On Fri, Jul 17, 2015 at 8:55 AM, Navy nav...@126.com wrote: Hello, Goto is recommend in linux kernel programming, but it is despised in many other situation. There are four rationable for using goto in Documentation/CodingStyle. Do you have some viewpoints about why goto or why not goto? I'm glad to get your point. Thank you. Bit of kernel History here, read what Linus said about goto http://koblents.com/Ches/Links/Month-Mar-2013/20-Using-Goto-in-Linux-Kernel-Code/ Thank you Warm Regards Anuz ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
Hi! On Fre, 2015-07-17 at 15:55 +0800, Navy wrote: [...] Goto is recommend in linux kernel programming, but it is despised in many other situation. There are four rationable for using goto in goto is (usually totally) forbidden for beginners/inexperienced programmers because some of us are old enough to have started programming with Basic on the C64 (no functions there - just goto and gosub) and know what may happen in the long run if you write more than a hello-world.c ... My usual answer to when may or should I use 'goto' is: You will know when it's time - before that, simply don't use it. Documentation/CodingStyle. Do you have some viewpoints about why goto or why not goto? I'm glad to get your point. It mainly depends *how* you use it - see the patterns in the kernel for not so bad ones;-) And - as others wrote - rewrite the code without 'goto' and look into it after 3 months and decide which version is more readable/understandable. BTW that holds for all programming style advices (starting from when should i factor out a function over how large should a function should be and too few or too many comments to ...). It is like everywhere else: If the guideline is trivial to check, it is probably silly anyways. The big goal in (99,9% of) software development is: You want source code to be as easy to read and understand as possible - and nothing else! Coding style guidelines are just that: guidelines in that direction but never necessary nor sufficient to guarantee that (so the occasional violation for good reason - which one writes into a comment;-) - is not evil). Bernd -- I dislike type abstraction if it has no real reason. And saving on typing is not a good reason - if your typing speed is the main issue when you're coding, you're doing something seriously wrong. - Linus Torvalds ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
On 17 July 2015 at 11:00, Bernd Petrovitsch be...@petrovitsch.priv.at wrote: Hi! On Fre, 2015-07-17 at 15:55 +0800, Navy wrote: [...] Goto is recommend in linux kernel programming, but it is despised in many other situation. There are four rationable for using goto in goto is (usually totally) forbidden for beginners/inexperienced programmers because some of us are old enough to have started programming with Basic on the C64 (no functions there - just goto and gosub) and know what may happen in the long run if you write more than a hello-world.c ... My usual answer to when may or should I use 'goto' is: You will know when it's time - before that, simply don't use it. Documentation/CodingStyle. Do you have some viewpoints about why goto or why not goto? I'm glad to get your point. It mainly depends *how* you use it - see the patterns in the kernel for not so bad ones;-) And - as others wrote - rewrite the code without 'goto' and look into it after 3 months and decide which version is more readable/understandable. BTW that holds for all programming style advices (starting from when should i factor out a function over how large should a function should be and too few or too many comments to ...). It is like everywhere else: If the guideline is trivial to check, it is probably silly anyways. The big goal in (99,9% of) software development is: You want source code to be as easy to read and understand as possible - and nothing else! Coding style guidelines are just that: guidelines in that direction but never necessary nor sufficient to guarantee that (so the occasional violation for good reason - which one writes into a comment;-) - is not evil). Bernd This is an interesting article about the history of goto being considered harmful; and how Dijkstra’s paper about it was misunderstood. http://videlalvaro.github.io/2015/02/programming-myths.html Luis ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
On Fri, Jul 17, 2015 at 2:52 PM, Martin Knappe kohaerenzstif...@posteo.de wrote: I'm just messing ... I guess I felt a bit challenged by your try to write that without using goto Hey, it was not a challenge. main thing is the readability. But going by your general rules how will you modify this same function of dgap? I think I can get rid of multiple return only if i modify the code into a series of if - else . or anything simple? regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
Very easy: static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int rc = 0; int cleanupState = 0; struct board_t *brd; void cleanup() { if (cleanupState 4) { dgap_tty_free(brd); } if (cleanupState 3) { dgap_free_irq(brd); dgap_tty_unregister(brd); } if (cleanupState 2) { dgap_tty_unregister(brd); } if (cleanupState 1) { dgap_free_flipbuf(brd); } if (cleanupState 0) { dgap_cleanup_nodes(); dgap_unmap(brd); kfree(brd); } } if (dgap_numboards = MAXBOARDS) return -EPERM; rc = pci_enable_device(pdev); if (rc) return -EIO; brd = dgap_found_board(pdev, ent-driver_data, dgap_numboards); if (IS_ERR(brd)) return PTR_ERR(brd); rc = dgap_firmware_load(pdev, ent-driver_data, brd); cleanupState++; if (rc) { cleanup(); return rc; } rc = dgap_alloc_flipbuf(brd); if (rc) { cleanup(); return rc; } rc = dgap_tty_register(brd); cleanupState++; if (rc) { cleanup(); return rc; } rc = dgap_request_irq(brd); cleanupState++; if (rc) { cleanup(); return rc; } /* * Do tty device initialization. */ rc = dgap_tty_init(brd); cleanupState++; if (rc) { cleanup(); return rc; } rc = dgap_tty_register_ports(brd); cleanupState++; if (rc) { cleanup(); return rc; } brd-state = BOARD_READY; brd-dpastatus = BD_RUNNING; dgap_board[dgap_numboards++] = brd; return 0; } Am 17.07.2015 10:11 schrieb Sudip Mukherjee: On Fri, Jul 17, 2015 at 1:25 PM, Navy nav...@126.com wrote: Hello, Goto is recommend in linux kernel programming, but it is despised in many other situation. There are four rationable for using goto in Documentation/CodingStyle. Do you have some viewpoints about why goto or why not goto? I'm glad to get your point. Check the file drivers/staging/dgap/dgap.c there is a function called dgap_init_one() which is using 6 goto statements. Please try to convert that file without using goto and i hope you will understand practically why goto. regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
I'm just messing ... I guess I felt a bit challenged by your try to write that without using goto I use goto myself very much for function cleanup. I wouldn't normally code the way I did in that snippet. Apart from that, my general rule for any function is: 1) Only ONE return statement. 2) Only ONE cleanup label to goto in case of an error. Call that label finish, ALWAYS. Am 17.07.2015 11:13 schrieb Sudip Mukherjee: On Fri, Jul 17, 2015 at 2:18 PM, Martin Knappe kohaerenzstif...@posteo.de wrote: Very easy: Looks good. :) But for me, now while reading the code I have to keep a note of the value of cleanupState variable and the error path becomes confusing. And besides in your opinion now which code is more readable, the original code or this one? regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
Sorry, have to correct my solution. You need to add cleanupState = 0 just before the finish, like so: static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int rc = 0; int cleanupState = 0; struct board_t *brd; if (dgap_numboards = MAXBOARDS) { rc = -EPERM; goto finish; } rc = pci_enable_device(pdev); if (rc) { rc = -EIO; goto finish; } brd = dgap_found_board(pdev, ent-driver_data, dgap_numboards); if (IS_ERR(brd)) { rc = PTR_ERR(brd); goto finish; } rc = dgap_firmware_load(pdev, ent-driver_data, brd); cleanupState++; if (rc) { goto finish; } rc = dgap_alloc_flipbuf(brd); if (rc) { goto finish; } rc = dgap_tty_register(brd); cleanupState++; if (rc) { goto finish; } rc = dgap_request_irq(brd); cleanupState++; if (rc) { goto finish; } /* * Do tty device initialization. */ rc = dgap_tty_init(brd); cleanupState++; if (rc) { goto finish; } rc = dgap_tty_register_ports(brd); cleanupState++; if (rc) { goto finish; } brd-state = BOARD_READY; brd-dpastatus = BD_RUNNING; dgap_board[dgap_numboards++] = brd; //missed this one in my last post... cleanupState = 0; finish: if (cleanupState 4) { dgap_tty_free(brd); } if (cleanupState 3) { dgap_free_irq(brd); dgap_tty_unregister(brd); } if (cleanupState 2) { dgap_tty_unregister(brd); } if (cleanupState 1) { dgap_free_flipbuf(brd); } if (cleanupState 0) { dgap_cleanup_nodes(); dgap_unmap(brd); kfree(brd); } return rc; } Am 17.07.2015 11:31 schrieb Sudip Mukherjee: On Fri, Jul 17, 2015 at 2:52 PM, Martin Knappe kohaerenzstif...@posteo.de wrote: I'm just messing ... I guess I felt a bit challenged by your try to write that without using goto Hey, it was not a challenge. main thing is the readability. But going by your general rules how will you modify this same function of dgap? I think I can get rid of multiple return only if i modify the code into a series of if - else . or anything simple? regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
Like so: static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int rc = 0; int cleanupState = 0; struct board_t *brd; if (dgap_numboards = MAXBOARDS) { rc = -EPERM; goto finish; } rc = pci_enable_device(pdev); if (rc) { rc = -EIO; goto finish; } brd = dgap_found_board(pdev, ent-driver_data, dgap_numboards); if (IS_ERR(brd)) { rc = PTR_ERR(brd); goto finish; } rc = dgap_firmware_load(pdev, ent-driver_data, brd); cleanupState++; if (rc) { goto finish; } rc = dgap_alloc_flipbuf(brd); if (rc) { goto finish; } rc = dgap_tty_register(brd); cleanupState++; if (rc) { goto finish; } rc = dgap_request_irq(brd); cleanupState++; if (rc) { goto finish; } /* * Do tty device initialization. */ rc = dgap_tty_init(brd); cleanupState++; if (rc) { goto finish; } rc = dgap_tty_register_ports(brd); cleanupState++; if (rc) { goto finish; } brd-state = BOARD_READY; brd-dpastatus = BD_RUNNING; dgap_board[dgap_numboards++] = brd; finish: if (cleanupState 4) { dgap_tty_free(brd); } if (cleanupState 3) { dgap_free_irq(brd); dgap_tty_unregister(brd); } if (cleanupState 2) { dgap_tty_unregister(brd); } if (cleanupState 1) { dgap_free_flipbuf(brd); } if (cleanupState 0) { dgap_cleanup_nodes(); dgap_unmap(brd); kfree(brd); } return rc; } Am 17.07.2015 11:31 schrieb Sudip Mukherjee: On Fri, Jul 17, 2015 at 2:52 PM, Martin Knappe kohaerenzstif...@posteo.de wrote: I'm just messing ... I guess I felt a bit challenged by your try to write that without using goto Hey, it was not a challenge. main thing is the readability. But going by your general rules how will you modify this same function of dgap? I think I can get rid of multiple return only if i modify the code into a series of if - else . or anything simple? regards sudip ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Delegating printk work to UART interrupt
Hi! When i checked how kernel printing works, i mentioned that it takes messages from log_buffer in console_unlock and gives it to call_console_drivers - ... - some uart bsp function. Basically, as i see this BSP realization tries to flush all message chars in busyloop ... so it waits until FIFO_NOT_FULL bit will be dropped by UART and it will be able to push the next byte. Basically, as i see userspace printing do something different. It puts N_FIFO_BYTES and exits, next, when FIFO will be freed - interrupt will be generated, and other characters will be put into UART FIFO. Can we do something similar for kernel printing? i.e. do not busyloop sending char after char, but put N_FIFO chars and flush other in interrupt. When panic will occur we can do busyloop printing again. Is it reliable? Suppose we have several cores. Thank you. -- Alexander alexhoppus...@gmail.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
On Fri, 17 Jul 2015 10:48:53 +0200, Martin Knappe said: Very easy: On Fri, 17 Jul 2015 11:40:00 +0200, Martin Knappe said: Like so: On Fri, 17 Jul 2015 11:44:34 +0200, Martin Knappe said: Sorry, have to correct my solution. You need to add cleanupState = 0 just before the finish, like so: I think the fact we've seen 3 version inside an hour shows that it's not as Very easy as originally asserted. pgpg37muLt1ik.pgp Description: PGP signature ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: goto???
My first solution was the answer to the question how to write that function without the use of goto. I did that in less than 10 minutes and it's absolutely flawless, so yes it's VERY EASY. I posted the second solution only to show how I personally would prefer to write that function, in a way that actually DOES use gotos, too. My third solution was just a minor correction to this second solution (just one statement added), and had nothing to do with the first solution and the original question, of how to avoid gotos at all. Try to Read, Concentrate and Think ... If you don't understand what we're talking about, please be quiet. Yes it's VERY EASY to rewrite that function without using gotos (see my first post). It is and remains correct. Am 17.07.2015 23:06 schrieb valdis.kletni...@vt.edu: On Fri, 17 Jul 2015 10:48:53 +0200, Martin Knappe said: Very easy: On Fri, 17 Jul 2015 11:40:00 +0200, Martin Knappe said: Like so: On Fri, 17 Jul 2015 11:44:34 +0200, Martin Knappe said: Sorry, have to correct my solution. You need to add cleanupState = 0 just before the finish, like so: I think the fact we've seen 3 version inside an hour shows that it's not as Very easy as originally asserted. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies