diff options
276 files changed, 3510 insertions, 2625 deletions
@@ -2007,13 +2007,14 @@ S: University of Stuttgart, Germany and | |||
2007 | S: Ecole Nationale Superieure des Telecommunications, Paris | 2007 | S: Ecole Nationale Superieure des Telecommunications, Paris |
2008 | 2008 | ||
2009 | N: Jamie Lokier | 2009 | N: Jamie Lokier |
2010 | E: jamie@imbolc.ucc.ie | 2010 | E: jamie@shareable.org |
2011 | W: http://www.shareable.org/ | ||
2011 | D: Reboot-through-BIOS for broken 486 motherboards | 2012 | D: Reboot-through-BIOS for broken 486 motherboards |
2012 | D: Some parport fixes | 2013 | D: Parport fixes, futex improvements |
2013 | S: 11 Goodson Walk | 2014 | D: First instruction of x86 sysenter path :) |
2014 | S: Marston | 2015 | S: 51 Sunningwell Road |
2015 | S: Oxford | 2016 | S: Oxford |
2016 | S: OX3 0HX | 2017 | S: OX1 4SZ |
2017 | S: United Kingdom | 2018 | S: United Kingdom |
2018 | 2019 | ||
2019 | N: Mark Lord | 2020 | N: Mark Lord |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 21272e4b4a5c..495858b236b6 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -176,6 +176,18 @@ Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@s | |||
176 | 176 | ||
177 | --------------------------- | 177 | --------------------------- |
178 | 178 | ||
179 | What: Usage of invalid timevals in setitimer | ||
180 | When: March 2007 | ||
181 | Why: POSIX requires to validate timevals in the setitimer call. This | ||
182 | was never done by Linux. The invalid (e.g. negative timevals) were | ||
183 | silently converted to more or less random timeouts and intervals. | ||
184 | Until the removal a per boot limited number of warnings is printed | ||
185 | and the timevals are sanitized. | ||
186 | |||
187 | Who: Thomas Gleixner <tglx@linutronix.de> | ||
188 | |||
189 | --------------------------- | ||
190 | |||
179 | What: I2C interface of the it87 driver | 191 | What: I2C interface of the it87 driver |
180 | When: January 2007 | 192 | When: January 2007 |
181 | Why: The ISA interface is faster and should be always available. The I2C | 193 | Why: The ISA interface is faster and should be always available. The I2C |
diff --git a/Documentation/filesystems/v9fs.txt b/Documentation/filesystems/9p.txt index 24c7a9c41f0d..43b89c214d20 100644 --- a/Documentation/filesystems/v9fs.txt +++ b/Documentation/filesystems/9p.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | V9FS: 9P2000 for Linux | 1 | v9fs: Plan 9 Resource Sharing for Linux |
2 | ====================== | 2 | ======================================= |
3 | 3 | ||
4 | ABOUT | 4 | ABOUT |
5 | ===== | 5 | ===== |
@@ -9,18 +9,19 @@ v9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol. | |||
9 | This software was originally developed by Ron Minnich <rminnich@lanl.gov> | 9 | This software was originally developed by Ron Minnich <rminnich@lanl.gov> |
10 | and Maya Gokhale <maya@lanl.gov>. Additional development by Greg Watson | 10 | and Maya Gokhale <maya@lanl.gov>. Additional development by Greg Watson |
11 | <gwatson@lanl.gov> and most recently Eric Van Hensbergen | 11 | <gwatson@lanl.gov> and most recently Eric Van Hensbergen |
12 | <ericvh@gmail.com> and Latchesar Ionkov <lucho@ionkov.net>. | 12 | <ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox |
13 | <rsc@swtch.com>. | ||
13 | 14 | ||
14 | USAGE | 15 | USAGE |
15 | ===== | 16 | ===== |
16 | 17 | ||
17 | For remote file server: | 18 | For remote file server: |
18 | 19 | ||
19 | mount -t 9P 10.10.1.2 /mnt/9 | 20 | mount -t 9p 10.10.1.2 /mnt/9 |
20 | 21 | ||
21 | For Plan 9 From User Space applications (http://swtch.com/plan9) | 22 | For Plan 9 From User Space applications (http://swtch.com/plan9) |
22 | 23 | ||
23 | mount -t 9P `namespace`/acme /mnt/9 -o proto=unix,name=$USER | 24 | mount -t 9p `namespace`/acme /mnt/9 -o proto=unix,uname=$USER |
24 | 25 | ||
25 | OPTIONS | 26 | OPTIONS |
26 | ======= | 27 | ======= |
@@ -32,7 +33,7 @@ OPTIONS | |||
32 | fd - used passed file descriptors for connection | 33 | fd - used passed file descriptors for connection |
33 | (see rfdno and wfdno) | 34 | (see rfdno and wfdno) |
34 | 35 | ||
35 | name=name user name to attempt mount as on the remote server. The | 36 | uname=name user name to attempt mount as on the remote server. The |
36 | server may override or ignore this value. Certain user | 37 | server may override or ignore this value. Certain user |
37 | names may require authentication. | 38 | names may require authentication. |
38 | 39 | ||
@@ -42,7 +43,7 @@ OPTIONS | |||
42 | debug=n specifies debug level. The debug level is a bitmask. | 43 | debug=n specifies debug level. The debug level is a bitmask. |
43 | 0x01 = display verbose error messages | 44 | 0x01 = display verbose error messages |
44 | 0x02 = developer debug (DEBUG_CURRENT) | 45 | 0x02 = developer debug (DEBUG_CURRENT) |
45 | 0x04 = display 9P trace | 46 | 0x04 = display 9p trace |
46 | 0x08 = display VFS trace | 47 | 0x08 = display VFS trace |
47 | 0x10 = display Marshalling debug | 48 | 0x10 = display Marshalling debug |
48 | 0x20 = display RPC debug | 49 | 0x20 = display RPC debug |
@@ -53,11 +54,11 @@ OPTIONS | |||
53 | 54 | ||
54 | wfdno=n the file descriptor for writing with proto=fd | 55 | wfdno=n the file descriptor for writing with proto=fd |
55 | 56 | ||
56 | maxdata=n the number of bytes to use for 9P packet payload (msize) | 57 | maxdata=n the number of bytes to use for 9p packet payload (msize) |
57 | 58 | ||
58 | port=n port to connect to on the remote server | 59 | port=n port to connect to on the remote server |
59 | 60 | ||
60 | noextend force legacy mode (no 9P2000.u semantics) | 61 | noextend force legacy mode (no 9p2000.u semantics) |
61 | 62 | ||
62 | uid attempt to mount as a particular uid | 63 | uid attempt to mount as a particular uid |
63 | 64 | ||
@@ -72,7 +73,7 @@ OPTIONS | |||
72 | RESOURCES | 73 | RESOURCES |
73 | ========= | 74 | ========= |
74 | 75 | ||
75 | The Linux version of the 9P server is now maintained under the npfs project | 76 | The Linux version of the 9p server is now maintained under the npfs project |
76 | on sourceforge (http://sourceforge.net/projects/npfs). | 77 | on sourceforge (http://sourceforge.net/projects/npfs). |
77 | 78 | ||
78 | There are user and developer mailing lists available through the v9fs project | 79 | There are user and developer mailing lists available through the v9fs project |
diff --git a/Documentation/filesystems/udf.txt b/Documentation/filesystems/udf.txt index e5213bc301f7..511b4230c053 100644 --- a/Documentation/filesystems/udf.txt +++ b/Documentation/filesystems/udf.txt | |||
@@ -26,6 +26,20 @@ The following mount options are supported: | |||
26 | nostrict Unset strict conformance | 26 | nostrict Unset strict conformance |
27 | iocharset= Set the NLS character set | 27 | iocharset= Set the NLS character set |
28 | 28 | ||
29 | The uid= and gid= options need a bit more explaining. They will accept a | ||
30 | decimal numeric value which will be used as the default ID for that mount. | ||
31 | They will also accept the string "ignore" and "forget". For files on the disk | ||
32 | that are owned by nobody ( -1 ), they will instead look as if they are owned | ||
33 | by the default ID. The ignore option causes the default ID to override all | ||
34 | IDs on the disk, not just -1. The forget option causes all IDs to be written | ||
35 | to disk as -1, so when the media is later remounted, they will appear to be | ||
36 | owned by whatever default ID it is mounted with at that time. | ||
37 | |||
38 | For typical desktop use of removable media, you should set the ID to that | ||
39 | of the interactively logged on user, and also specify both the forget and | ||
40 | ignore options. This way the interactive user will always see the files | ||
41 | on the disk as belonging to him. | ||
42 | |||
29 | The remaining are for debugging and disaster recovery: | 43 | The remaining are for debugging and disaster recovery: |
30 | 44 | ||
31 | novrs Skip volume sequence recognition | 45 | novrs Skip volume sequence recognition |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index e56e842847d3..adaa899e5c90 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -230,10 +230,15 @@ only called from a process context (i.e. not from an interrupt handler | |||
230 | or bottom half). | 230 | or bottom half). |
231 | 231 | ||
232 | alloc_inode: this method is called by inode_alloc() to allocate memory | 232 | alloc_inode: this method is called by inode_alloc() to allocate memory |
233 | for struct inode and initialize it. | 233 | for struct inode and initialize it. If this function is not |
234 | defined, a simple 'struct inode' is allocated. Normally | ||
235 | alloc_inode will be used to allocate a larger structure which | ||
236 | contains a 'struct inode' embedded within it. | ||
234 | 237 | ||
235 | destroy_inode: this method is called by destroy_inode() to release | 238 | destroy_inode: this method is called by destroy_inode() to release |
236 | resources allocated for struct inode. | 239 | resources allocated for struct inode. It is only required if |
240 | ->alloc_inode was defined and simply undoes anything done by | ||
241 | ->alloc_inode. | ||
237 | 242 | ||
238 | read_inode: this method is called to read a specific inode from the | 243 | read_inode: this method is called to read a specific inode from the |
239 | mounted filesystem. The i_ino member in the struct inode is | 244 | mounted filesystem. The i_ino member in the struct inode is |
@@ -443,14 +448,81 @@ otherwise noted. | |||
443 | The Address Space Object | 448 | The Address Space Object |
444 | ======================== | 449 | ======================== |
445 | 450 | ||
446 | The address space object is used to identify pages in the page cache. | 451 | The address space object is used to group and manage pages in the page |
447 | 452 | cache. It can be used to keep track of the pages in a file (or | |
453 | anything else) and also track the mapping of sections of the file into | ||
454 | process address spaces. | ||
455 | |||
456 | There are a number of distinct yet related services that an | ||
457 | address-space can provide. These include communicating memory | ||
458 | pressure, page lookup by address, and keeping track of pages tagged as | ||
459 | Dirty or Writeback. | ||
460 | |||
461 | The first can be used independently to the others. The VM can try to | ||
462 | either write dirty pages in order to clean them, or release clean | ||
463 | pages in order to reuse them. To do this it can call the ->writepage | ||
464 | method on dirty pages, and ->releasepage on clean pages with | ||
465 | PagePrivate set. Clean pages without PagePrivate and with no external | ||
466 | references will be released without notice being given to the | ||
467 | address_space. | ||
468 | |||
469 | To achieve this functionality, pages need to be placed on an LRU with | ||
470 | lru_cache_add and mark_page_active needs to be called whenever the | ||
471 | page is used. | ||
472 | |||
473 | Pages are normally kept in a radix tree index by ->index. This tree | ||
474 | maintains information about the PG_Dirty and PG_Writeback status of | ||
475 | each page, so that pages with either of these flags can be found | ||
476 | quickly. | ||
477 | |||
478 | The Dirty tag is primarily used by mpage_writepages - the default | ||
479 | ->writepages method. It uses the tag to find dirty pages to call | ||
480 | ->writepage on. If mpage_writepages is not used (i.e. the address | ||
481 | provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is | ||
482 | almost unused. write_inode_now and sync_inode do use it (through | ||
483 | __sync_single_inode) to check if ->writepages has been successful in | ||
484 | writing out the whole address_space. | ||
485 | |||
486 | The Writeback tag is used by filemap*wait* and sync_page* functions, | ||
487 | via wait_on_page_writeback_range, to wait for all writeback to | ||
488 | complete. While waiting ->sync_page (if defined) will be called on | ||
489 | each page that is found to require writeback. | ||
490 | |||
491 | An address_space handler may attach extra information to a page, | ||
492 | typically using the 'private' field in the 'struct page'. If such | ||
493 | information is attached, the PG_Private flag should be set. This will | ||
494 | cause various VM routines to make extra calls into the address_space | ||
495 | handler to deal with that data. | ||
496 | |||
497 | An address space acts as an intermediate between storage and | ||
498 | application. Data is read into the address space a whole page at a | ||
499 | time, and provided to the application either by copying of the page, | ||
500 | or by memory-mapping the page. | ||
501 | Data is written into the address space by the application, and then | ||
502 | written-back to storage typically in whole pages, however the | ||
503 | address_space has finer control of write sizes. | ||
504 | |||
505 | The read process essentially only requires 'readpage'. The write | ||
506 | process is more complicated and uses prepare_write/commit_write or | ||
507 | set_page_dirty to write data into the address_space, and writepage, | ||
508 | sync_page, and writepages to writeback data to storage. | ||
509 | |||
510 | Adding and removing pages to/from an address_space is protected by the | ||
511 | inode's i_mutex. | ||
512 | |||
513 | When data is written to a page, the PG_Dirty flag should be set. It | ||
514 | typically remains set until writepage asks for it to be written. This | ||
515 | should clear PG_Dirty and set PG_Writeback. It can be actually | ||
516 | written at any point after PG_Dirty is clear. Once it is known to be | ||
517 | safe, PG_Writeback is cleared. | ||
518 | |||
519 | Writeback makes use of a writeback_control structure... | ||
448 | 520 | ||
449 | struct address_space_operations | 521 | struct address_space_operations |
450 | ------------------------------- | 522 | ------------------------------- |
451 | 523 | ||
452 | This describes how the VFS can manipulate mapping of a file to page cache in | 524 | This describes how the VFS can manipulate mapping of a file to page cache in |
453 | your filesystem. As of kernel 2.6.13, the following members are defined: | 525 | your filesystem. As of kernel 2.6.16, the following members are defined: |
454 | 526 | ||
455 | struct address_space_operations { | 527 | struct address_space_operations { |
456 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 528 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -469,47 +541,148 @@ struct address_space_operations { | |||
469 | loff_t offset, unsigned long nr_segs); | 541 | loff_t offset, unsigned long nr_segs); |
470 | struct page* (*get_xip_page)(struct address_space *, sector_t, | 542 | struct page* (*get_xip_page)(struct address_space *, sector_t, |
471 | int); | 543 | int); |
544 | /* migrate the contents of a page to the specified target */ | ||
545 | int (*migratepage) (struct page *, struct page *); | ||
472 | }; | 546 | }; |
473 | 547 | ||
474 | writepage: called by the VM write a dirty page to backing store. | 548 | writepage: called by the VM to write a dirty page to backing store. |
549 | This may happen for data integrity reasons (i.e. 'sync'), or | ||
550 | to free up memory (flush). The difference can be seen in | ||
551 | wbc->sync_mode. | ||
552 | The PG_Dirty flag has been cleared and PageLocked is true. | ||
553 | writepage should start writeout, should set PG_Writeback, | ||
554 | and should make sure the page is unlocked, either synchronously | ||
555 | or asynchronously when the write operation completes. | ||
556 | |||
557 | If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to | ||
558 | try too hard if there are problems, and may choose to write out | ||
559 | other pages from the mapping if that is easier (e.g. due to | ||
560 | internal dependencies). If it chooses not to start writeout, it | ||
561 | should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep | ||
562 | calling ->writepage on that page. | ||
563 | |||
564 | See the file "Locking" for more details. | ||
475 | 565 | ||
476 | readpage: called by the VM to read a page from backing store. | 566 | readpage: called by the VM to read a page from backing store. |
567 | The page will be Locked when readpage is called, and should be | ||
568 | unlocked and marked uptodate once the read completes. | ||
569 | If ->readpage discovers that it needs to unlock the page for | ||
570 | some reason, it can do so, and then return AOP_TRUNCATED_PAGE. | ||
571 | In this case, the page will be relocated, relocked and if | ||
572 | that all succeeds, ->readpage will be called again. | ||
477 | 573 | ||
478 | sync_page: called by the VM to notify the backing store to perform all | 574 | sync_page: called by the VM to notify the backing store to perform all |
479 | queued I/O operations for a page. I/O operations for other pages | 575 | queued I/O operations for a page. I/O operations for other pages |
480 | associated with this address_space object may also be performed. | 576 | associated with this address_space object may also be performed. |
481 | 577 | ||
578 | This function is optional and is called only for pages with | ||
579 | PG_Writeback set while waiting for the writeback to complete. | ||
580 | |||
482 | writepages: called by the VM to write out pages associated with the | 581 | writepages: called by the VM to write out pages associated with the |
483 | address_space object. | 582 | address_space object. If wbc->sync_mode is WBC_SYNC_ALL, then |
583 | the writeback_control will specify a range of pages that must be | ||
584 | written out. If it is WBC_SYNC_NONE, then a nr_to_write is given | ||
585 | and that many pages should be written if possible. | ||
586 | If no ->writepages is given, then mpage_writepages is used | ||
587 | instead. This will choose pages from the address space that are | ||
588 | tagged as DIRTY and will pass them to ->writepage. | ||
484 | 589 | ||
485 | set_page_dirty: called by the VM to set a page dirty. | 590 | set_page_dirty: called by the VM to set a page dirty. |
591 | This is particularly needed if an address space attaches | ||
592 | private data to a page, and that data needs to be updated when | ||
593 | a page is dirtied. This is called, for example, when a memory | ||
594 | mapped page gets modified. | ||
595 | If defined, it should set the PageDirty flag, and the | ||
596 | PAGECACHE_TAG_DIRTY tag in the radix tree. | ||
486 | 597 | ||
487 | readpages: called by the VM to read pages associated with the address_space | 598 | readpages: called by the VM to read pages associated with the address_space |
488 | object. | 599 | object. This is essentially just a vector version of |
600 | readpage. Instead of just one page, several pages are | ||
601 | requested. | ||
602 | readpages is only used for read-ahead, so read errors are | ||
603 | ignored. If anything goes wrong, feel free to give up. | ||
489 | 604 | ||
490 | prepare_write: called by the generic write path in VM to set up a write | 605 | prepare_write: called by the generic write path in VM to set up a write |
491 | request for a page. | 606 | request for a page. This indicates to the address space that |
492 | 607 | the given range of bytes is about to be written. The | |
493 | commit_write: called by the generic write path in VM to write page to | 608 | address_space should check that the write will be able to |
494 | its backing store. | 609 | complete, by allocating space if necessary and doing any other |
610 | internal housekeeping. If the write will update parts of | ||
611 | any basic-blocks on storage, then those blocks should be | ||
612 | pre-read (if they haven't been read already) so that the | ||
613 | updated blocks can be written out properly. | ||
614 | The page will be locked. If prepare_write wants to unlock the | ||
615 | page it, like readpage, may do so and return | ||
616 | AOP_TRUNCATED_PAGE. | ||
617 | In this case the prepare_write will be retried one the lock is | ||
618 | regained. | ||
619 | |||
620 | commit_write: If prepare_write succeeds, new data will be copied | ||
621 | into the page and then commit_write will be called. It will | ||
622 | typically update the size of the file (if appropriate) and | ||
623 | mark the inode as dirty, and do any other related housekeeping | ||
624 | operations. It should avoid returning an error if possible - | ||
625 | errors should have been handled by prepare_write. | ||
495 | 626 | ||
496 | bmap: called by the VFS to map a logical block offset within object to | 627 | bmap: called by the VFS to map a logical block offset within object to |
497 | physical block number. This method is use by for the legacy FIBMAP | 628 | physical block number. This method is used by the FIBMAP |
498 | ioctl. Other uses are discouraged. | 629 | ioctl and for working with swap-files. To be able to swap to |
499 | 630 | a file, the file must have a stable mapping to a block | |
500 | invalidatepage: called by the VM on truncate to disassociate a page from its | 631 | device. The swap system does not go through the filesystem |
501 | address_space mapping. | 632 | but instead uses bmap to find out where the blocks in the file |
502 | 633 | are and uses those addresses directly. | |
503 | releasepage: called by the VFS to release filesystem specific metadata from | 634 | |
504 | a page. | 635 | |
505 | 636 | invalidatepage: If a page has PagePrivate set, then invalidatepage | |
506 | direct_IO: called by the VM for direct I/O writes and reads. | 637 | will be called when part or all of the page is to be removed |
638 | from the address space. This generally corresponds to either a | ||
639 | truncation or a complete invalidation of the address space | ||
640 | (in the latter case 'offset' will always be 0). | ||
641 | Any private data associated with the page should be updated | ||
642 | to reflect this truncation. If offset is 0, then | ||
643 | the private data should be released, because the page | ||
644 | must be able to be completely discarded. This may be done by | ||
645 | calling the ->releasepage function, but in this case the | ||
646 | release MUST succeed. | ||
647 | |||
648 | releasepage: releasepage is called on PagePrivate pages to indicate | ||
649 | that the page should be freed if possible. ->releasepage | ||
650 | should remove any private data from the page and clear the | ||
651 | PagePrivate flag. It may also remove the page from the | ||
652 | address_space. If this fails for some reason, it may indicate | ||
653 | failure with a 0 return value. | ||
654 | This is used in two distinct though related cases. The first | ||
655 | is when the VM finds a clean page with no active users and | ||
656 | wants to make it a free page. If ->releasepage succeeds, the | ||
657 | page will be removed from the address_space and become free. | ||
658 | |||
659 | The second case if when a request has been made to invalidate | ||
660 | some or all pages in an address_space. This can happen | ||
661 | through the fadvice(POSIX_FADV_DONTNEED) system call or by the | ||
662 | filesystem explicitly requesting it as nfs and 9fs do (when | ||
663 | they believe the cache may be out of date with storage) by | ||
664 | calling invalidate_inode_pages2(). | ||
665 | If the filesystem makes such a call, and needs to be certain | ||
666 | that all pages are invalidated, then its releasepage will | ||
667 | need to ensure this. Possibly it can clear the PageUptodate | ||
668 | bit if it cannot free private data yet. | ||
669 | |||
670 | direct_IO: called by the generic read/write routines to perform | ||
671 | direct_IO - that is IO requests which bypass the page cache | ||
672 | and transfer data directly between the storage and the | ||
673 | application's address space. | ||
507 | 674 | ||
508 | get_xip_page: called by the VM to translate a block number to a page. | 675 | get_xip_page: called by the VM to translate a block number to a page. |
509 | The page is valid until the corresponding filesystem is unmounted. | 676 | The page is valid until the corresponding filesystem is unmounted. |
510 | Filesystems that want to use execute-in-place (XIP) need to implement | 677 | Filesystems that want to use execute-in-place (XIP) need to implement |
511 | it. An example implementation can be found in fs/ext2/xip.c. | 678 | it. An example implementation can be found in fs/ext2/xip.c. |
512 | 679 | ||
680 | migrate_page: This is used to compact the physical memory usage. | ||
681 | If the VM wants to relocate a page (maybe off a memory card | ||
682 | that is signalling imminent failure) it will pass a new page | ||
683 | and an old page to this function. migrate_page should | ||
684 | transfer any private data across and update any references | ||
685 | that it has to the page. | ||
513 | 686 | ||
514 | The File Object | 687 | The File Object |
515 | =============== | 688 | =============== |
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index d3ad2c24490a..ad3edaba4533 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c | |||
@@ -23,7 +23,6 @@ char __init inkernel_firmware[] = "let's say that this is firmware\n"; | |||
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | static struct device ghost_device = { | 25 | static struct device ghost_device = { |
26 | .name = "Ghost Device", | ||
27 | .bus_id = "ghost0", | 26 | .bus_id = "ghost0", |
28 | }; | 27 | }; |
29 | 28 | ||
@@ -92,7 +91,7 @@ static void sample_probe_async(void) | |||
92 | { | 91 | { |
93 | /* Let's say that I can't sleep */ | 92 | /* Let's say that I can't sleep */ |
94 | int error; | 93 | int error; |
95 | error = request_firmware_nowait (THIS_MODULE, | 94 | error = request_firmware_nowait (THIS_MODULE, FW_ACTION_NOHOTPLUG, |
96 | "sample_driver_fw", &ghost_device, | 95 | "sample_driver_fw", &ghost_device, |
97 | "my device pointer", | 96 | "my device pointer", |
98 | sample_probe_async_cont); | 97 | sample_probe_async_cont); |
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c index 57b956aecbc5..9e1b0e4051cd 100644 --- a/Documentation/firmware_class/firmware_sample_firmware_class.c +++ b/Documentation/firmware_class/firmware_sample_firmware_class.c | |||
@@ -172,7 +172,6 @@ static void fw_remove_class_device(struct class_device *class_dev) | |||
172 | static struct class_device *class_dev; | 172 | static struct class_device *class_dev; |
173 | 173 | ||
174 | static struct device my_device = { | 174 | static struct device my_device = { |
175 | .name = "Sample Device", | ||
176 | .bus_id = "my_dev0", | 175 | .bus_id = "my_dev0", |
177 | }; | 176 | }; |
178 | 177 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 44a25f3f51d1..f8cb55c30b0f 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -367,12 +367,17 @@ running once the system is up. | |||
367 | tty<n> Use the virtual console device <n>. | 367 | tty<n> Use the virtual console device <n>. |
368 | 368 | ||
369 | ttyS<n>[,options] | 369 | ttyS<n>[,options] |
370 | ttyUSB0[,options] | ||
370 | Use the specified serial port. The options are of | 371 | Use the specified serial port. The options are of |
371 | the form "bbbbpn", where "bbbb" is the baud rate, | 372 | the form "bbbbpnf", where "bbbb" is the baud rate, |
372 | "p" is parity ("n", "o", or "e"), and "n" is bits. | 373 | "p" is parity ("n", "o", or "e"), "n" is number of |
373 | Default is "9600n8". | 374 | bits, and "f" is flow control ("r" for RTS or |
374 | 375 | omit it). Default is "9600n8". | |
375 | See also Documentation/serial-console.txt. | 376 | |
377 | See Documentation/serial-console.txt for more | ||
378 | information. See | ||
379 | Documentation/networking/netconsole.txt for an | ||
380 | alternative. | ||
376 | 381 | ||
377 | uart,io,<addr>[,options] | 382 | uart,io,<addr>[,options] |
378 | uart,mmio,<addr>[,options] | 383 | uart,mmio,<addr>[,options] |
diff --git a/Documentation/networking/ray_cs.txt b/Documentation/networking/ray_cs.txt index 5427f8c7df95..145d27a52395 100644 --- a/Documentation/networking/ray_cs.txt +++ b/Documentation/networking/ray_cs.txt | |||
@@ -25,7 +25,7 @@ the essid= string parameter is available via the kernel command line. | |||
25 | This will change after the method of sorting out parameters for all | 25 | This will change after the method of sorting out parameters for all |
26 | the PCMCIA drivers is agreed upon. If you must have a built in driver | 26 | the PCMCIA drivers is agreed upon. If you must have a built in driver |
27 | with nondefault parameters, they can be edited in | 27 | with nondefault parameters, they can be edited in |
28 | /usr/src/linux/drivers/net/pcmcia/ray_cs.c. Searching for MODULE_PARM | 28 | /usr/src/linux/drivers/net/pcmcia/ray_cs.c. Searching for module_param |
29 | will find them all. | 29 | will find them all. |
30 | 30 | ||
31 | Information on card services is available at: | 31 | Information on card services is available at: |
diff --git a/Documentation/serial-console.txt b/Documentation/serial-console.txt index 6c689b0df2b8..9a7bc8b3f479 100644 --- a/Documentation/serial-console.txt +++ b/Documentation/serial-console.txt | |||
@@ -17,11 +17,13 @@ The format of this option is: | |||
17 | ttyX for any other virtual console | 17 | ttyX for any other virtual console |
18 | ttySx for a serial port | 18 | ttySx for a serial port |
19 | lp0 for the first parallel port | 19 | lp0 for the first parallel port |
20 | ttyUSB0 for the first USB serial device | ||
20 | 21 | ||
21 | options: depend on the driver. For the serial port this | 22 | options: depend on the driver. For the serial port this |
22 | defines the baudrate/parity/bits of the port, | 23 | defines the baudrate/parity/bits/flow control of |
23 | in the format BBBBPN, where BBBB is the speed, | 24 | the port, in the format BBBBPNF, where BBBB is the |
24 | P is parity (n/o/e), and N is bits. Default is | 25 | speed, P is parity (n/o/e), N is number of bits, |
26 | and F is flow control ('r' for RTS). Default is | ||
25 | 9600n8. The maximum baudrate is 115200. | 27 | 9600n8. The maximum baudrate is 115200. |
26 | 28 | ||
27 | You can specify multiple console= options on the kernel command line. | 29 | You can specify multiple console= options on the kernel command line. |
@@ -45,6 +47,9 @@ become the console. | |||
45 | You will need to create a new device to use /dev/console. The official | 47 | You will need to create a new device to use /dev/console. The official |
46 | /dev/console is now character device 5,1. | 48 | /dev/console is now character device 5,1. |
47 | 49 | ||
50 | (You can also use a network device as a console. See | ||
51 | Documentation/networking/netconsole.txt for information on that.) | ||
52 | |||
48 | Here's an example that will use /dev/ttyS1 (COM2) as the console. | 53 | Here's an example that will use /dev/ttyS1 (COM2) as the console. |
49 | Replace the sample values as needed. | 54 | Replace the sample values as needed. |
50 | 55 | ||
diff --git a/Documentation/sound/oss/Introduction b/Documentation/sound/oss/Introduction index 15d4fb975ac0..f04ba6bb7395 100644 --- a/Documentation/sound/oss/Introduction +++ b/Documentation/sound/oss/Introduction | |||
@@ -69,7 +69,7 @@ are available, for example IRQ, address, DMA. | |||
69 | 69 | ||
70 | Warning, the options for different cards sometime use different names | 70 | Warning, the options for different cards sometime use different names |
71 | for the same or a similar feature (dma1= versus dma16=). As a last | 71 | for the same or a similar feature (dma1= versus dma16=). As a last |
72 | resort, inspect the code (search for MODULE_PARM). | 72 | resort, inspect the code (search for module_param). |
73 | 73 | ||
74 | Notes: | 74 | Notes: |
75 | 75 | ||
diff --git a/Documentation/sound/oss/cs46xx b/Documentation/sound/oss/cs46xx index 88d6cf8b39f3..b54432709863 100644 --- a/Documentation/sound/oss/cs46xx +++ b/Documentation/sound/oss/cs46xx | |||
@@ -88,7 +88,7 @@ parameters. for a copy email: twoller@crystal.cirrus.com | |||
88 | 88 | ||
89 | MODULE_PARMS definitions | 89 | MODULE_PARMS definitions |
90 | ------------------------ | 90 | ------------------------ |
91 | MODULE_PARM(defaultorder, "i"); | 91 | module_param(defaultorder, ulong, 0); |
92 | defaultorder=N | 92 | defaultorder=N |
93 | where N is a value from 1 to 12 | 93 | where N is a value from 1 to 12 |
94 | The buffer order determines the size of the dma buffer for the driver. | 94 | The buffer order determines the size of the dma buffer for the driver. |
@@ -98,18 +98,18 @@ to not underrun the dma buffer as easily. As default, use 32k (order=3) | |||
98 | rather than 64k as some of the games work more responsively. | 98 | rather than 64k as some of the games work more responsively. |
99 | (2^N) * PAGE_SIZE = allocated buffer size | 99 | (2^N) * PAGE_SIZE = allocated buffer size |
100 | 100 | ||
101 | MODULE_PARM(cs_debuglevel, "i"); | 101 | module_param(cs_debuglevel, ulong, 0644); |
102 | MODULE_PARM(cs_debugmask, "i"); | 102 | module_param(cs_debugmask, ulong, 0644); |
103 | cs_debuglevel=N | 103 | cs_debuglevel=N |
104 | cs_debugmask=0xMMMMMMMM | 104 | cs_debugmask=0xMMMMMMMM |
105 | where N is a value from 0 (no debug printfs), to 9 (maximum) | 105 | where N is a value from 0 (no debug printfs), to 9 (maximum) |
106 | 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). | 106 | 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). |
107 | 107 | ||
108 | MODULE_PARM(hercules_egpio_disable, "i"); | 108 | module_param(hercules_egpio_disable, ulong, 0); |
109 | hercules_egpio_disable=N | 109 | hercules_egpio_disable=N |
110 | where N is a 0 (enable egpio), or a 1 (disable egpio support) | 110 | where N is a 0 (enable egpio), or a 1 (disable egpio support) |
111 | 111 | ||
112 | MODULE_PARM(initdelay, "i"); | 112 | module_param(initdelay, ulong, 0); |
113 | initdelay=N | 113 | initdelay=N |
114 | This value is used to determine the millescond delay during the initialization | 114 | This value is used to determine the millescond delay during the initialization |
115 | code prior to powering up the PLL. On laptops this value can be used to | 115 | code prior to powering up the PLL. On laptops this value can be used to |
@@ -118,19 +118,19 @@ system is booted under battery power then the mdelay()/udelay() functions fail t | |||
118 | properly delay the required time. Also, if the system is booted under AC power | 118 | properly delay the required time. Also, if the system is booted under AC power |
119 | and then the power removed, the mdelay()/udelay() functions will not delay properly. | 119 | and then the power removed, the mdelay()/udelay() functions will not delay properly. |
120 | 120 | ||
121 | MODULE_PARM(powerdown, "i"); | 121 | module_param(powerdown, ulong, 0); |
122 | powerdown=N | 122 | powerdown=N |
123 | where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) | 123 | where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) |
124 | 124 | ||
125 | 125 | ||
126 | MODULE_PARM(external_amp, "i"); | 126 | module_param(external_amp, bool, 0); |
127 | external_amp=1 | 127 | external_amp=1 |
128 | if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. | 128 | if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. |
129 | override the detection logic and force the external amp bit in the AC97 0x26 register | 129 | override the detection logic and force the external amp bit in the AC97 0x26 register |
130 | to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz | 130 | to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz |
131 | card has inverted logic, so there is a special function for these cards. | 131 | card has inverted logic, so there is a special function for these cards. |
132 | 132 | ||
133 | MODULE_PARM(thinkpad, "i"); | 133 | module_param(thinkpad, bool, 0); |
134 | thinkpad=1 | 134 | thinkpad=1 |
135 | if N is set to 1, then force enabling the clkrun functionality. | 135 | if N is set to 1, then force enabling the clkrun functionality. |
136 | Currently, when the part is being used, then clkrun is disabled for the entire system, | 136 | Currently, when the part is being used, then clkrun is disabled for the entire system, |
diff --git a/MAINTAINERS b/MAINTAINERS index 5b6a0145505d..fa92d0d3674b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -147,6 +147,18 @@ M: p_gortmaker@yahoo.com | |||
147 | L: netdev@vger.kernel.org | 147 | L: netdev@vger.kernel.org |
148 | S: Maintained | 148 | S: Maintained |
149 | 149 | ||
150 | 9P FILE SYSTEM | ||
151 | P: Eric Van Hensbergen | ||
152 | M: ericvh@gmail.com | ||
153 | P: Ron Minnich | ||
154 | M: rminnich@lanl.gov | ||
155 | P: Latchesar Ionkov | ||
156 | M: lucho@ionkov.net | ||
157 | L: v9fs-developer@lists.sourceforge.net | ||
158 | W: http://v9fs.sf.net | ||
159 | T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs.git | ||
160 | S: Maintained | ||
161 | |||
150 | A2232 SERIAL BOARD DRIVER | 162 | A2232 SERIAL BOARD DRIVER |
151 | P: Enver Haase | 163 | P: Enver Haase |
152 | M: ehaase@inf.fu-berlin.de | 164 | M: ehaase@inf.fu-berlin.de |
@@ -2212,13 +2224,6 @@ S: Maintained | |||
2212 | RISCOM8 DRIVER | 2224 | RISCOM8 DRIVER |
2213 | S: Orphan | 2225 | S: Orphan |
2214 | 2226 | ||
2215 | RTLINUX REALTIME LINUX | ||
2216 | P: Victor Yodaiken | ||
2217 | M: yodaiken@fsmlabs.com | ||
2218 | L: rtl@rtlinux.org | ||
2219 | W: www.rtlinux.org | ||
2220 | S: Maintained | ||
2221 | |||
2222 | S3 SAVAGE FRAMEBUFFER DRIVER | 2227 | S3 SAVAGE FRAMEBUFFER DRIVER |
2223 | P: Antonino Daplas | 2228 | P: Antonino Daplas |
2224 | M: adaplas@pol.net | 2229 | M: adaplas@pol.net |
@@ -2531,7 +2536,6 @@ S: Unsupported ? | |||
2531 | STRADIS MPEG-2 DECODER DRIVER | 2536 | STRADIS MPEG-2 DECODER DRIVER |
2532 | P: Nathan Laredo | 2537 | P: Nathan Laredo |
2533 | M: laredo@gnu.org | 2538 | M: laredo@gnu.org |
2534 | W: http://mpeg.openprojects.net/ | ||
2535 | W: http://www.stradis.com/ | 2539 | W: http://www.stradis.com/ |
2536 | S: Maintained | 2540 | S: Maintained |
2537 | 2541 | ||
@@ -2650,7 +2654,7 @@ S: Maintained | |||
2650 | 2654 | ||
2651 | TUN/TAP driver | 2655 | TUN/TAP driver |
2652 | P: Maxim Krasnyansky | 2656 | P: Maxim Krasnyansky |
2653 | M: maxk@qualcomm.com, max_mk@yahoo.com | 2657 | M: maxk@qualcomm.com |
2654 | L: vtun@office.satix.net | 2658 | L: vtun@office.satix.net |
2655 | W: http://vtun.sourceforge.net/tun | 2659 | W: http://vtun.sourceforge.net/tun |
2656 | S: Maintained | 2660 | S: Maintained |
@@ -2979,18 +2983,6 @@ L: rio500-users@lists.sourceforge.net | |||
2979 | W: http://rio500.sourceforge.net | 2983 | W: http://rio500.sourceforge.net |
2980 | S: Maintained | 2984 | S: Maintained |
2981 | 2985 | ||
2982 | V9FS FILE SYSTEM | ||
2983 | P: Eric Van Hensbergen | ||
2984 | M: ericvh@gmail.com | ||
2985 | P: Ron Minnich | ||
2986 | M: rminnich@lanl.gov | ||
2987 | P: Latchesar Ionkov | ||
2988 | M: lucho@ionkov.net | ||
2989 | L: v9fs-developer@lists.sourceforge.net | ||
2990 | W: http://v9fs.sf.net | ||
2991 | T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs-devel.git | ||
2992 | S: Maintained | ||
2993 | |||
2994 | VIDEO FOR LINUX | 2986 | VIDEO FOR LINUX |
2995 | P: Mauro Carvalho Chehab | 2987 | P: Mauro Carvalho Chehab |
2996 | M: mchehab@infradead.org | 2988 | M: mchehab@infradead.org |
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 6888816a1935..102454082474 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <asm/hardware/scoop.h> | 40 | #include <asm/hardware/scoop.h> |
41 | #include <asm/mach/sharpsl_param.h> | 41 | #include <asm/mach/sharpsl_param.h> |
42 | #include <asm/hardware/locomo.h> | 42 | #include <asm/hardware/locomo.h> |
43 | #include <asm/arch/mcp.h> | ||
43 | 44 | ||
44 | #include "generic.h" | 45 | #include "generic.h" |
45 | 46 | ||
@@ -66,6 +67,32 @@ struct platform_device colliescoop_device = { | |||
66 | .resource = collie_scoop_resources, | 67 | .resource = collie_scoop_resources, |
67 | }; | 68 | }; |
68 | 69 | ||
70 | static struct scoop_pcmcia_dev collie_pcmcia_scoop[] = { | ||
71 | { | ||
72 | .dev = &colliescoop_device.dev, | ||
73 | .irq = COLLIE_IRQ_GPIO_CF_IRQ, | ||
74 | .cd_irq = COLLIE_IRQ_GPIO_CF_CD, | ||
75 | .cd_irq_str = "PCMCIA0 CD", | ||
76 | }, | ||
77 | }; | ||
78 | |||
79 | static struct scoop_pcmcia_config collie_pcmcia_config = { | ||
80 | .devs = &collie_pcmcia_scoop[0], | ||
81 | .num_devs = 1, | ||
82 | }; | ||
83 | |||
84 | |||
85 | static struct mcp_plat_data collie_mcp_data = { | ||
86 | .mccr0 = MCCR0_ADM, | ||
87 | .sclk_rate = 11981000, | ||
88 | }; | ||
89 | |||
90 | |||
91 | static struct sa1100_port_fns collie_port_fns __initdata = { | ||
92 | .set_mctrl = collie_uart_set_mctrl, | ||
93 | .get_mctrl = collie_uart_get_mctrl, | ||
94 | }; | ||
95 | |||
69 | 96 | ||
70 | static struct resource locomo_resources[] = { | 97 | static struct resource locomo_resources[] = { |
71 | [0] = { | 98 | [0] = { |
@@ -159,6 +186,8 @@ static void __init collie_init(void) | |||
159 | GPDR |= GPIO_32_768kHz; | 186 | GPDR |= GPIO_32_768kHz; |
160 | TUCR = TUCR_32_768kHz; | 187 | TUCR = TUCR_32_768kHz; |
161 | 188 | ||
189 | platform_scoop_config = &collie_pcmcia_config; | ||
190 | |||
162 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); | 191 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); |
163 | if (ret) { | 192 | if (ret) { |
164 | printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); | 193 | printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); |
@@ -166,6 +195,7 @@ static void __init collie_init(void) | |||
166 | 195 | ||
167 | sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources, | 196 | sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources, |
168 | ARRAY_SIZE(collie_flash_resources)); | 197 | ARRAY_SIZE(collie_flash_resources)); |
198 | sa11x0_set_mcp_data(&collie_mcp_data); | ||
169 | 199 | ||
170 | sharpsl_save_param(); | 200 | sharpsl_save_param(); |
171 | } | 201 | } |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index bfea1bedcbf2..b008fb0cd7b7 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -737,7 +737,7 @@ config PHYSICAL_START | |||
737 | 737 | ||
738 | config HOTPLUG_CPU | 738 | config HOTPLUG_CPU |
739 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 739 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" |
740 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER | 740 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER && !X86_PC |
741 | ---help--- | 741 | ---help--- |
742 | Say Y here to experiment with turning CPUs off and on. CPUs | 742 | Say Y here to experiment with turning CPUs off and on. CPUs |
743 | can be controlled through /sys/devices/system/cpu. | 743 | can be controlled through /sys/devices/system/cpu. |
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug index 00108ba9a78d..6e97df6979e8 100644 --- a/arch/i386/Kconfig.debug +++ b/arch/i386/Kconfig.debug | |||
@@ -44,8 +44,8 @@ comment "Page alloc debug is incompatible with Software Suspend on i386" | |||
44 | depends on DEBUG_KERNEL && SOFTWARE_SUSPEND | 44 | depends on DEBUG_KERNEL && SOFTWARE_SUSPEND |
45 | 45 | ||
46 | config DEBUG_PAGEALLOC | 46 | config DEBUG_PAGEALLOC |
47 | bool "Page alloc debugging" | 47 | bool "Debug page memory allocations" |
48 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND | 48 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS |
49 | help | 49 | help |
50 | Unmap pages from the kernel linear mapping after free_pages(). | 50 | Unmap pages from the kernel linear mapping after free_pages(). |
51 | This results in a large slowdown, but helps to find certain types | 51 | This results in a large slowdown, but helps to find certain types |
diff --git a/arch/i386/boot/edd.S b/arch/i386/boot/edd.S index d8d69f2b911d..4b84ea216f2b 100644 --- a/arch/i386/boot/edd.S +++ b/arch/i386/boot/edd.S | |||
@@ -76,6 +76,8 @@ edd_mbr_sig_read: | |||
76 | popw %es | 76 | popw %es |
77 | popw %bx | 77 | popw %bx |
78 | jc edd_mbr_sig_done # on failure, we're done. | 78 | jc edd_mbr_sig_done # on failure, we're done. |
79 | cmpb $0, %ah # some BIOSes do not set CF | ||
80 | jne edd_mbr_sig_done # on failure, we're done. | ||
79 | movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR | 81 | movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR |
80 | movl %eax, (%bx) # store success | 82 | movl %eax, (%bx) # store success |
81 | incb (EDD_MBR_SIG_NR_BUF) # note that we stored something | 83 | incb (EDD_MBR_SIG_NR_BUF) # note that we stored something |
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index 6a93d75db431..ca2a0cbcac04 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -106,7 +106,7 @@ static void __init dmi_save_devices(struct dmi_header *dm) | |||
106 | struct dmi_device *dev; | 106 | struct dmi_device *dev; |
107 | 107 | ||
108 | for (i = 0; i < count; i++) { | 108 | for (i = 0; i < count; i++) { |
109 | char *d = ((char *) dm) + (i * 2); | 109 | char *d = (char *)(dm + 1) + (i * 2); |
110 | 110 | ||
111 | /* Skip disabled device */ | 111 | /* Skip disabled device */ |
112 | if ((*d & 0x80) == 0) | 112 | if ((*d & 0x80) == 0) |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 4c470e99a742..82371d83bfa9 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -1003,7 +1003,6 @@ void cpu_exit_clear(void) | |||
1003 | 1003 | ||
1004 | cpu_clear(cpu, cpu_callout_map); | 1004 | cpu_clear(cpu, cpu_callout_map); |
1005 | cpu_clear(cpu, cpu_callin_map); | 1005 | cpu_clear(cpu, cpu_callin_map); |
1006 | cpu_clear(cpu, cpu_present_map); | ||
1007 | 1006 | ||
1008 | cpu_clear(cpu, smp_commenced_mask); | 1007 | cpu_clear(cpu, smp_commenced_mask); |
1009 | unmap_cpu_to_logical_apicid(cpu); | 1008 | unmap_cpu_to_logical_apicid(cpu); |
@@ -1015,31 +1014,20 @@ struct warm_boot_cpu_info { | |||
1015 | int cpu; | 1014 | int cpu; |
1016 | }; | 1015 | }; |
1017 | 1016 | ||
1018 | static void __devinit do_warm_boot_cpu(void *p) | 1017 | static void __cpuinit do_warm_boot_cpu(void *p) |
1019 | { | 1018 | { |
1020 | struct warm_boot_cpu_info *info = p; | 1019 | struct warm_boot_cpu_info *info = p; |
1021 | do_boot_cpu(info->apicid, info->cpu); | 1020 | do_boot_cpu(info->apicid, info->cpu); |
1022 | complete(info->complete); | 1021 | complete(info->complete); |
1023 | } | 1022 | } |
1024 | 1023 | ||
1025 | int __devinit smp_prepare_cpu(int cpu) | 1024 | static int __cpuinit __smp_prepare_cpu(int cpu) |
1026 | { | 1025 | { |
1027 | DECLARE_COMPLETION(done); | 1026 | DECLARE_COMPLETION(done); |
1028 | struct warm_boot_cpu_info info; | 1027 | struct warm_boot_cpu_info info; |
1029 | struct work_struct task; | 1028 | struct work_struct task; |
1030 | int apicid, ret; | 1029 | int apicid, ret; |
1031 | 1030 | ||
1032 | lock_cpu_hotplug(); | ||
1033 | |||
1034 | /* | ||
1035 | * On x86, CPU0 is never offlined. Trying to bring up an | ||
1036 | * already-booted CPU will hang. So check for that case. | ||
1037 | */ | ||
1038 | if (cpu_online(cpu)) { | ||
1039 | ret = -EINVAL; | ||
1040 | goto exit; | ||
1041 | } | ||
1042 | |||
1043 | apicid = x86_cpu_to_apicid[cpu]; | 1031 | apicid = x86_cpu_to_apicid[cpu]; |
1044 | if (apicid == BAD_APICID) { | 1032 | if (apicid == BAD_APICID) { |
1045 | ret = -ENODEV; | 1033 | ret = -ENODEV; |
@@ -1064,7 +1052,6 @@ int __devinit smp_prepare_cpu(int cpu) | |||
1064 | zap_low_mappings(); | 1052 | zap_low_mappings(); |
1065 | ret = 0; | 1053 | ret = 0; |
1066 | exit: | 1054 | exit: |
1067 | unlock_cpu_hotplug(); | ||
1068 | return ret; | 1055 | return ret; |
1069 | } | 1056 | } |
1070 | #endif | 1057 | #endif |
@@ -1392,6 +1379,22 @@ void __cpu_die(unsigned int cpu) | |||
1392 | 1379 | ||
1393 | int __devinit __cpu_up(unsigned int cpu) | 1380 | int __devinit __cpu_up(unsigned int cpu) |
1394 | { | 1381 | { |
1382 | #ifdef CONFIG_HOTPLUG_CPU | ||
1383 | int ret=0; | ||
1384 | |||
1385 | /* | ||
1386 | * We do warm boot only on cpus that had booted earlier | ||
1387 | * Otherwise cold boot is all handled from smp_boot_cpus(). | ||
1388 | * cpu_callin_map is set during AP kickstart process. Its reset | ||
1389 | * when a cpu is taken offline from cpu_exit_clear(). | ||
1390 | */ | ||
1391 | if (!cpu_isset(cpu, cpu_callin_map)) | ||
1392 | ret = __smp_prepare_cpu(cpu); | ||
1393 | |||
1394 | if (ret) | ||
1395 | return -EIO; | ||
1396 | #endif | ||
1397 | |||
1395 | /* In case one didn't come up */ | 1398 | /* In case one didn't come up */ |
1396 | if (!cpu_isset(cpu, cpu_callin_map)) { | 1399 | if (!cpu_isset(cpu, cpu_callin_map)) { |
1397 | printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); | 1400 | printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 70dba1f0e2ee..13e739e4c84d 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -1166,19 +1166,7 @@ put_tv32 (struct compat_timeval __user *o, struct timeval *i) | |||
1166 | asmlinkage unsigned long | 1166 | asmlinkage unsigned long |
1167 | sys32_alarm (unsigned int seconds) | 1167 | sys32_alarm (unsigned int seconds) |
1168 | { | 1168 | { |
1169 | struct itimerval it_new, it_old; | 1169 | return alarm_setitimer(seconds); |
1170 | unsigned int oldalarm; | ||
1171 | |||
1172 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
1173 | it_new.it_value.tv_sec = seconds; | ||
1174 | it_new.it_value.tv_usec = 0; | ||
1175 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
1176 | oldalarm = it_old.it_value.tv_sec; | ||
1177 | /* ehhh.. We can't return 0 if we have an alarm pending.. */ | ||
1178 | /* And we'd better return too much than too little anyway */ | ||
1179 | if (it_old.it_value.tv_usec) | ||
1180 | oldalarm++; | ||
1181 | return oldalarm; | ||
1182 | } | 1170 | } |
1183 | 1171 | ||
1184 | /* Translations due to time_t size differences. Which affects all | 1172 | /* Translations due to time_t size differences. Which affects all |
diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug index bbf711bab69e..2e1019ddbb22 100644 --- a/arch/m32r/Kconfig.debug +++ b/arch/m32r/Kconfig.debug | |||
@@ -19,7 +19,7 @@ config DEBUG_STACK_USAGE | |||
19 | This option will slow down process creation somewhat. | 19 | This option will slow down process creation somewhat. |
20 | 20 | ||
21 | config DEBUG_PAGEALLOC | 21 | config DEBUG_PAGEALLOC |
22 | bool "Page alloc debugging" | 22 | bool "Debug page memory allocations" |
23 | depends on DEBUG_KERNEL && BROKEN | 23 | depends on DEBUG_KERNEL && BROKEN |
24 | help | 24 | help |
25 | Unmap pages from the kernel linear mapping after free_pages(). | 25 | Unmap pages from the kernel linear mapping after free_pages(). |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 0fc3730a294f..5407b784cd01 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -645,27 +645,7 @@ static inline void getitimer_real(struct itimerval *value) | |||
645 | 645 | ||
646 | asmlinkage unsigned int irix_alarm(unsigned int seconds) | 646 | asmlinkage unsigned int irix_alarm(unsigned int seconds) |
647 | { | 647 | { |
648 | struct itimerval it_new, it_old; | 648 | return alarm_setitimer(seconds); |
649 | unsigned int oldalarm; | ||
650 | |||
651 | if (!seconds) { | ||
652 | getitimer_real(&it_old); | ||
653 | del_timer(¤t->real_timer); | ||
654 | } else { | ||
655 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
656 | it_new.it_value.tv_sec = seconds; | ||
657 | it_new.it_value.tv_usec = 0; | ||
658 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
659 | } | ||
660 | oldalarm = it_old.it_value.tv_sec; | ||
661 | /* | ||
662 | * ehhh.. We can't return 0 if we have an alarm pending ... | ||
663 | * And we'd better return too much than too little anyway | ||
664 | */ | ||
665 | if (it_old.it_value.tv_usec) | ||
666 | oldalarm++; | ||
667 | |||
668 | return oldalarm; | ||
669 | } | 649 | } |
670 | 650 | ||
671 | asmlinkage int irix_pause(void) | 651 | asmlinkage int irix_pause(void) |
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c index 49eb2a7e65c0..a892356d5c3b 100644 --- a/arch/ppc/8xx_io/cs4218_tdm.c +++ b/arch/ppc/8xx_io/cs4218_tdm.c | |||
@@ -126,11 +126,11 @@ static int numReadBufs = 4, readbufSize = 32; | |||
126 | */ | 126 | */ |
127 | static volatile cbd_t *rx_base, *rx_cur, *tx_base, *tx_cur; | 127 | static volatile cbd_t *rx_base, *rx_cur, *tx_base, *tx_cur; |
128 | 128 | ||
129 | MODULE_PARM(catchRadius, "i"); | 129 | module_param(catchRadius, int, 0); |
130 | MODULE_PARM(numBufs, "i"); | 130 | module_param(numBufs, int, 0); |
131 | MODULE_PARM(bufSize, "i"); | 131 | module_param(bufSize, int, 0); |
132 | MODULE_PARM(numreadBufs, "i"); | 132 | module_param(numreadBufs, int, 0); |
133 | MODULE_PARM(readbufSize, "i"); | 133 | module_param(readbufSize, int, 0); |
134 | 134 | ||
135 | #define arraysize(x) (sizeof(x)/sizeof(*(x))) | 135 | #define arraysize(x) (sizeof(x)/sizeof(*(x))) |
136 | #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) | 136 | #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) |
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug index 3e31be494e54..afe0a7720a26 100644 --- a/arch/sparc64/Kconfig.debug +++ b/arch/sparc64/Kconfig.debug | |||
@@ -24,7 +24,7 @@ config DEBUG_BOOTMEM | |||
24 | bool "Debug BOOTMEM initialization" | 24 | bool "Debug BOOTMEM initialization" |
25 | 25 | ||
26 | config DEBUG_PAGEALLOC | 26 | config DEBUG_PAGEALLOC |
27 | bool "Page alloc debugging" | 27 | bool "Debug page memory allocations" |
28 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND | 28 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND |
29 | help | 29 | help |
30 | Unmap pages from the kernel linear mapping after free_pages(). | 30 | Unmap pages from the kernel linear mapping after free_pages(). |
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 2bc55af95419..2b2d029f477c 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -430,24 +430,12 @@ put_tv32(struct compat_timeval __user *o, struct timeval *i) | |||
430 | return err; | 430 | return err; |
431 | } | 431 | } |
432 | 432 | ||
433 | extern int do_setitimer(int which, struct itimerval *, struct itimerval *); | 433 | extern unsigned int alarm_setitimer(unsigned int seconds); |
434 | 434 | ||
435 | asmlinkage long | 435 | asmlinkage long |
436 | sys32_alarm(unsigned int seconds) | 436 | sys32_alarm(unsigned int seconds) |
437 | { | 437 | { |
438 | struct itimerval it_new, it_old; | 438 | return alarm_setitimer(seconds); |
439 | unsigned int oldalarm; | ||
440 | |||
441 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
442 | it_new.it_value.tv_sec = seconds; | ||
443 | it_new.it_value.tv_usec = 0; | ||
444 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
445 | oldalarm = it_old.it_value.tv_sec; | ||
446 | /* ehhh.. We can't return 0 if we have an alarm pending.. */ | ||
447 | /* And we'd better return too much than too little anyway */ | ||
448 | if (it_old.it_value.tv_usec) | ||
449 | oldalarm++; | ||
450 | return oldalarm; | ||
451 | } | 439 | } |
452 | 440 | ||
453 | /* Translations due to time_t size differences. Which affects all | 441 | /* Translations due to time_t size differences. Which affects all |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 29f3d7504da1..dd712b24ec91 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -19,11 +19,6 @@ EXPORT_SYMBOL(cpu_sysdev_class); | |||
19 | static struct sys_device *cpu_sys_devices[NR_CPUS]; | 19 | static struct sys_device *cpu_sys_devices[NR_CPUS]; |
20 | 20 | ||
21 | #ifdef CONFIG_HOTPLUG_CPU | 21 | #ifdef CONFIG_HOTPLUG_CPU |
22 | int __attribute__((weak)) smp_prepare_cpu (int cpu) | ||
23 | { | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | static ssize_t show_online(struct sys_device *dev, char *buf) | 22 | static ssize_t show_online(struct sys_device *dev, char *buf) |
28 | { | 23 | { |
29 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 24 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
@@ -44,9 +39,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf, | |||
44 | kobject_uevent(&dev->kobj, KOBJ_OFFLINE); | 39 | kobject_uevent(&dev->kobj, KOBJ_OFFLINE); |
45 | break; | 40 | break; |
46 | case '1': | 41 | case '1': |
47 | ret = smp_prepare_cpu(cpu->sysdev.id); | 42 | ret = cpu_up(cpu->sysdev.id); |
48 | if (!ret) | ||
49 | ret = cpu_up(cpu->sysdev.id); | ||
50 | if (!ret) | 43 | if (!ret) |
51 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); | 44 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); |
52 | break; | 45 | break; |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 8b1331677407..e57ac5a43246 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -401,7 +401,6 @@ config BLK_DEV_RAM_SIZE | |||
401 | 401 | ||
402 | config BLK_DEV_INITRD | 402 | config BLK_DEV_INITRD |
403 | bool "Initial RAM disk (initrd) support" | 403 | bool "Initial RAM disk (initrd) support" |
404 | depends on BLK_DEV_RAM=y | ||
405 | help | 404 | help |
406 | The initial RAM disk is a RAM disk that is loaded by the boot loader | 405 | The initial RAM disk is a RAM disk that is loaded by the boot loader |
407 | (loadlin or lilo) and that is mounted as root before the normal boot | 406 | (loadlin or lilo) and that is mounted as root before the normal boot |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index f8ce235ccfc3..c39650920bdf 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -271,7 +271,7 @@ unsigned char *DMABuffer; /* buffer for writes */ | |||
271 | static unsigned long PhysDMABuffer; /* physical address */ | 271 | static unsigned long PhysDMABuffer; /* physical address */ |
272 | 272 | ||
273 | static int UseTrackbuffer = -1; /* Do track buffering? */ | 273 | static int UseTrackbuffer = -1; /* Do track buffering? */ |
274 | MODULE_PARM(UseTrackbuffer, "i"); | 274 | module_param(UseTrackbuffer, int, 0); |
275 | 275 | ||
276 | unsigned char *TrackBuffer; /* buffer for reads */ | 276 | unsigned char *TrackBuffer; /* buffer for reads */ |
277 | static unsigned long PhysTrackBuffer; /* physical address */ | 277 | static unsigned long PhysTrackBuffer; /* physical address */ |
@@ -296,7 +296,7 @@ static int MotorOn = 0, MotorOffTrys; | |||
296 | static int IsFormatting = 0, FormatError; | 296 | static int IsFormatting = 0, FormatError; |
297 | 297 | ||
298 | static int UserSteprate[FD_MAX_UNITS] = { -1, -1 }; | 298 | static int UserSteprate[FD_MAX_UNITS] = { -1, -1 }; |
299 | MODULE_PARM(UserSteprate, "1-" __MODULE_STRING(FD_MAX_UNITS) "i"); | 299 | module_param_array(UserSteprate, int, NULL, 0); |
300 | 300 | ||
301 | /* Synchronization of FDC access. */ | 301 | /* Synchronization of FDC access. */ |
302 | static volatile int fdc_busy = 0; | 302 | static volatile int fdc_busy = 0; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index fb2d0be7cdeb..840919bba76c 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4594,7 +4594,7 @@ static void __init parse_floppy_cfg_string(char *cfg) | |||
4594 | } | 4594 | } |
4595 | } | 4595 | } |
4596 | 4596 | ||
4597 | int init_module(void) | 4597 | int __init init_module(void) |
4598 | { | 4598 | { |
4599 | if (floppy) | 4599 | if (floppy) |
4600 | parse_floppy_cfg_string(floppy); | 4600 | parse_floppy_cfg_string(floppy); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index a9bde30dadad..8bca4905d7f7 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -639,10 +639,7 @@ static int __init nbd_init(void) | |||
639 | int err = -ENOMEM; | 639 | int err = -ENOMEM; |
640 | int i; | 640 | int i; |
641 | 641 | ||
642 | if (sizeof(struct nbd_request) != 28) { | 642 | BUILD_BUG_ON(sizeof(struct nbd_request) != 28); |
643 | printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" ); | ||
644 | return -EIO; | ||
645 | } | ||
646 | 643 | ||
647 | if (nbds_max > MAX_NBD) { | 644 | if (nbds_max > MAX_NBD) { |
648 | printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, | 645 | printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, |
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index fad27a87ce35..f43a988dd413 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c | |||
@@ -218,12 +218,12 @@ static int cm206_base = CM206_BASE; | |||
218 | static int cm206_irq = CM206_IRQ; | 218 | static int cm206_irq = CM206_IRQ; |
219 | #ifdef MODULE | 219 | #ifdef MODULE |
220 | static int cm206[2] = { 0, 0 }; /* for compatible `insmod' parameter passing */ | 220 | static int cm206[2] = { 0, 0 }; /* for compatible `insmod' parameter passing */ |
221 | module_param_array(cm206, int, NULL, 0); /* base,irq or irq,base */ | ||
221 | #endif | 222 | #endif |
222 | 223 | ||
223 | MODULE_PARM(cm206_base, "i"); /* base */ | 224 | module_param(cm206_base, int, 0); /* base */ |
224 | MODULE_PARM(cm206_irq, "i"); /* irq */ | 225 | module_param(cm206_irq, int, 0); /* irq */ |
225 | MODULE_PARM(cm206, "1-2i"); /* base,irq or irq,base */ | 226 | module_param(auto_probe, bool, 0); /* auto probe base and irq */ |
226 | MODULE_PARM(auto_probe, "i"); /* auto probe base and irq */ | ||
227 | MODULE_LICENSE("GPL"); | 227 | MODULE_LICENSE("GPL"); |
228 | 228 | ||
229 | #define POLLOOP 100 /* milliseconds */ | 229 | #define POLLOOP 100 /* milliseconds */ |
diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 4760f515f591..05c9e865ecaf 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c | |||
@@ -464,8 +464,13 @@ static int sbpcd[] = | |||
464 | static __cacheline_aligned DEFINE_SPINLOCK(sbpcd_lock); | 464 | static __cacheline_aligned DEFINE_SPINLOCK(sbpcd_lock); |
465 | static struct request_queue *sbpcd_queue; | 465 | static struct request_queue *sbpcd_queue; |
466 | 466 | ||
467 | MODULE_PARM(sbpcd, "2i"); | 467 | /* You can only set the first pair, from old MODULE_PARM code. */ |
468 | MODULE_PARM(max_drives, "i"); | 468 | static int sbpcd_set(const char *val, struct kernel_param *kp) |
469 | { | ||
470 | get_options((char *)val, 2, (int *)sbpcd); | ||
471 | return 0; | ||
472 | } | ||
473 | module_param_call(sbpcd, sbpcd_set, NULL, NULL, 0); | ||
469 | 474 | ||
470 | #define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) | 475 | #define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) |
471 | 476 | ||
@@ -553,6 +558,7 @@ static unsigned char msgnum; | |||
553 | static char msgbuf[80]; | 558 | static char msgbuf[80]; |
554 | 559 | ||
555 | static int max_drives = MAX_DRIVES; | 560 | static int max_drives = MAX_DRIVES; |
561 | module_param(max_drives, int, 0); | ||
556 | #ifndef MODULE | 562 | #ifndef MODULE |
557 | static unsigned char setup_done; | 563 | static unsigned char setup_done; |
558 | static const char *str_sb_l = "soundblaster"; | 564 | static const char *str_sb_l = "soundblaster"; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index d745004281d0..abd4c5118a1b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -736,7 +736,8 @@ int ipmi_create_user(unsigned int if_num, | |||
736 | intf = ipmi_interfaces[if_num]; | 736 | intf = ipmi_interfaces[if_num]; |
737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { | 737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { |
738 | spin_unlock_irqrestore(&interfaces_lock, flags); | 738 | spin_unlock_irqrestore(&interfaces_lock, flags); |
739 | return -EINVAL; | 739 | rv = -EINVAL; |
740 | goto out_kfree; | ||
740 | } | 741 | } |
741 | 742 | ||
742 | /* Note that each existing user holds a refcount to the interface. */ | 743 | /* Note that each existing user holds a refcount to the interface. */ |
@@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int if_num, | |||
751 | 752 | ||
752 | if (!try_module_get(intf->handlers->owner)) { | 753 | if (!try_module_get(intf->handlers->owner)) { |
753 | rv = -ENODEV; | 754 | rv = -ENODEV; |
754 | goto out_err; | 755 | goto out_kref; |
755 | } | 756 | } |
756 | 757 | ||
757 | if (intf->handlers->inc_usecount) { | 758 | if (intf->handlers->inc_usecount) { |
758 | rv = intf->handlers->inc_usecount(intf->send_info); | 759 | rv = intf->handlers->inc_usecount(intf->send_info); |
759 | if (rv) { | 760 | if (rv) { |
760 | module_put(intf->handlers->owner); | 761 | module_put(intf->handlers->owner); |
761 | goto out_err; | 762 | goto out_kref; |
762 | } | 763 | } |
763 | } | 764 | } |
764 | 765 | ||
@@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int if_num, | |||
769 | *user = new_user; | 770 | *user = new_user; |
770 | return 0; | 771 | return 0; |
771 | 772 | ||
772 | out_err: | 773 | out_kref: |
773 | kfree(new_user); | ||
774 | kref_put(&intf->refcount, intf_free); | 774 | kref_put(&intf->refcount, intf_free); |
775 | out_kfree: | ||
776 | kfree(new_user); | ||
775 | return rv; | 777 | return rv; |
776 | } | 778 | } |
777 | 779 | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ede128356af2..e5247f85a446 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -378,13 +378,13 @@ MODULE_DESCRIPTION("Stallion Intelligent Multiport Serial Driver"); | |||
378 | MODULE_LICENSE("GPL"); | 378 | MODULE_LICENSE("GPL"); |
379 | 379 | ||
380 | 380 | ||
381 | MODULE_PARM(board0, "1-3s"); | 381 | module_param_array(board0, charp, NULL, 0); |
382 | MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]"); | 382 | MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]"); |
383 | MODULE_PARM(board1, "1-3s"); | 383 | module_param_array(board1, charp, NULL, 0); |
384 | MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]"); | 384 | MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]"); |
385 | MODULE_PARM(board2, "1-3s"); | 385 | module_param_array(board2, charp, NULL, 0); |
386 | MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); | 386 | MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); |
387 | MODULE_PARM(board3, "1-3s"); | 387 | module_param_array(board3, charp, NULL, 0); |
388 | MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); | 388 | MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); |
389 | 389 | ||
390 | #endif | 390 | #endif |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 29c41f4418c0..26d0116b48d4 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -216,11 +216,9 @@ static ssize_t write_mem(struct file * file, const char __user * buf, | |||
216 | 216 | ||
217 | copied = copy_from_user(ptr, buf, sz); | 217 | copied = copy_from_user(ptr, buf, sz); |
218 | if (copied) { | 218 | if (copied) { |
219 | ssize_t ret; | 219 | written += sz - copied; |
220 | 220 | if (written) | |
221 | ret = written + (sz - copied); | 221 | break; |
222 | if (ret) | ||
223 | return ret; | ||
224 | return -EFAULT; | 222 | return -EFAULT; |
225 | } | 223 | } |
226 | buf += sz; | 224 | buf += sz; |
@@ -456,11 +454,9 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf, | |||
456 | 454 | ||
457 | copied = copy_from_user(ptr, buf, sz); | 455 | copied = copy_from_user(ptr, buf, sz); |
458 | if (copied) { | 456 | if (copied) { |
459 | ssize_t ret; | 457 | written += sz - copied; |
460 | 458 | if (written) | |
461 | ret = written + (sz - copied); | 459 | break; |
462 | if (ret) | ||
463 | return ret; | ||
464 | return -EFAULT; | 460 | return -EFAULT; |
465 | } | 461 | } |
466 | buf += sz; | 462 | buf += sz; |
@@ -514,11 +510,10 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
514 | if (len) { | 510 | if (len) { |
515 | written = copy_from_user(kbuf, buf, len); | 511 | written = copy_from_user(kbuf, buf, len); |
516 | if (written) { | 512 | if (written) { |
517 | ssize_t ret; | 513 | if (wrote + virtr) |
518 | 514 | break; | |
519 | free_page((unsigned long)kbuf); | 515 | free_page((unsigned long)kbuf); |
520 | ret = wrote + virtr + (len - written); | 516 | return -EFAULT; |
521 | return ret ? ret : -EFAULT; | ||
522 | } | 517 | } |
523 | } | 518 | } |
524 | len = vwrite(kbuf, (char *)p, len); | 519 | len = vwrite(kbuf, (char *)p, len); |
@@ -563,8 +558,11 @@ static ssize_t write_port(struct file * file, const char __user * buf, | |||
563 | return -EFAULT; | 558 | return -EFAULT; |
564 | while (count-- > 0 && i < 65536) { | 559 | while (count-- > 0 && i < 65536) { |
565 | char c; | 560 | char c; |
566 | if (__get_user(c, tmp)) | 561 | if (__get_user(c, tmp)) { |
562 | if (tmp > buf) | ||
563 | break; | ||
567 | return -EFAULT; | 564 | return -EFAULT; |
565 | } | ||
568 | outb(c,i); | 566 | outb(c,i); |
569 | i++; | 567 | i++; |
570 | tmp++; | 568 | tmp++; |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index ea725a9964e2..0fb2fb9fb024 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -243,10 +243,10 @@ static int verbose = 0; | |||
243 | 243 | ||
244 | MODULE_AUTHOR("Casper Yang"); | 244 | MODULE_AUTHOR("Casper Yang"); |
245 | MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); | 245 | MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); |
246 | MODULE_PARM(ioaddr, "1-4i"); | 246 | module_param_array(ioaddr, int, NULL, 0); |
247 | MODULE_PARM(ttymajor, "i"); | 247 | module_param(ttymajor, int, 0); |
248 | MODULE_PARM(calloutmajor, "i"); | 248 | module_param(calloutmajor, int, 0); |
249 | MODULE_PARM(verbose, "i"); | 249 | module_param(verbose, bool, 0); |
250 | MODULE_LICENSE("GPL"); | 250 | MODULE_LICENSE("GPL"); |
251 | 251 | ||
252 | struct mxser_log { | 252 | struct mxser_log { |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 306ee0f091a4..bee6c47b45bd 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -65,10 +65,11 @@ | |||
65 | #include <linux/parport.h> | 65 | #include <linux/parport.h> |
66 | #include <linux/ctype.h> | 66 | #include <linux/ctype.h> |
67 | #include <linux/poll.h> | 67 | #include <linux/poll.h> |
68 | #include <asm/uaccess.h> | 68 | #include <linux/major.h> |
69 | #include <linux/ppdev.h> | 69 | #include <linux/ppdev.h> |
70 | #include <linux/smp_lock.h> | 70 | #include <linux/smp_lock.h> |
71 | #include <linux/device.h> | 71 | #include <linux/device.h> |
72 | #include <asm/uaccess.h> | ||
72 | 73 | ||
73 | #define PP_VERSION "ppdev: user-space parallel port driver" | 74 | #define PP_VERSION "ppdev: user-space parallel port driver" |
74 | #define CHRDEV "ppdev" | 75 | #define CHRDEV "ppdev" |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 119e629656b7..657c0d88f48c 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -1743,10 +1743,10 @@ static int iobase; | |||
1743 | static int iobase1; | 1743 | static int iobase1; |
1744 | static int iobase2; | 1744 | static int iobase2; |
1745 | static int iobase3; | 1745 | static int iobase3; |
1746 | MODULE_PARM(iobase, "i"); | 1746 | module_param(iobase, int, 0); |
1747 | MODULE_PARM(iobase1, "i"); | 1747 | module_param(iobase1, int, 0); |
1748 | MODULE_PARM(iobase2, "i"); | 1748 | module_param(iobase2, int, 0); |
1749 | MODULE_PARM(iobase3, "i"); | 1749 | module_param(iobase3, int, 0); |
1750 | 1750 | ||
1751 | MODULE_LICENSE("GPL"); | 1751 | MODULE_LICENSE("GPL"); |
1752 | #endif /* MODULE */ | 1752 | #endif /* MODULE */ |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index d58f82318853..35082dc12eae 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -42,16 +42,15 @@ | |||
42 | /* Whether we react on sysrq keys or just ignore them */ | 42 | /* Whether we react on sysrq keys or just ignore them */ |
43 | int sysrq_enabled = 1; | 43 | int sysrq_enabled = 1; |
44 | 44 | ||
45 | /* Loglevel sysrq handler */ | ||
46 | static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs, | 45 | static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs, |
47 | struct tty_struct *tty) | 46 | struct tty_struct *tty) |
48 | { | 47 | { |
49 | int i; | 48 | int i; |
50 | i = key - '0'; | 49 | i = key - '0'; |
51 | console_loglevel = 7; | 50 | console_loglevel = 7; |
52 | printk("Loglevel set to %d\n", i); | 51 | printk("Loglevel set to %d\n", i); |
53 | console_loglevel = i; | 52 | console_loglevel = i; |
54 | } | 53 | } |
55 | static struct sysrq_key_op sysrq_loglevel_op = { | 54 | static struct sysrq_key_op sysrq_loglevel_op = { |
56 | .handler = sysrq_handle_loglevel, | 55 | .handler = sysrq_handle_loglevel, |
57 | .help_msg = "loglevel0-8", | 56 | .help_msg = "loglevel0-8", |
@@ -59,11 +58,9 @@ static struct sysrq_key_op sysrq_loglevel_op = { | |||
59 | .enable_mask = SYSRQ_ENABLE_LOG, | 58 | .enable_mask = SYSRQ_ENABLE_LOG, |
60 | }; | 59 | }; |
61 | 60 | ||
62 | |||
63 | /* SAK sysrq handler */ | ||
64 | #ifdef CONFIG_VT | 61 | #ifdef CONFIG_VT |
65 | static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, | 62 | static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, |
66 | struct tty_struct *tty) | 63 | struct tty_struct *tty) |
67 | { | 64 | { |
68 | if (tty) | 65 | if (tty) |
69 | do_SAK(tty); | 66 | do_SAK(tty); |
@@ -75,12 +72,13 @@ static struct sysrq_key_op sysrq_SAK_op = { | |||
75 | .action_msg = "SAK", | 72 | .action_msg = "SAK", |
76 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, | 73 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, |
77 | }; | 74 | }; |
75 | #else | ||
76 | #define sysrq_SAK_op (*(struct sysrq_key_op *)0) | ||
78 | #endif | 77 | #endif |
79 | 78 | ||
80 | #ifdef CONFIG_VT | 79 | #ifdef CONFIG_VT |
81 | /* unraw sysrq handler */ | ||
82 | static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs, | 80 | static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs, |
83 | struct tty_struct *tty) | 81 | struct tty_struct *tty) |
84 | { | 82 | { |
85 | struct kbd_struct *kbd = &kbd_table[fg_console]; | 83 | struct kbd_struct *kbd = &kbd_table[fg_console]; |
86 | 84 | ||
@@ -93,10 +91,11 @@ static struct sysrq_key_op sysrq_unraw_op = { | |||
93 | .action_msg = "Keyboard mode set to XLATE", | 91 | .action_msg = "Keyboard mode set to XLATE", |
94 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, | 92 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, |
95 | }; | 93 | }; |
94 | #else | ||
95 | #define sysrq_unraw_op (*(struct sysrq_key_op *)0) | ||
96 | #endif /* CONFIG_VT */ | 96 | #endif /* CONFIG_VT */ |
97 | 97 | ||
98 | #ifdef CONFIG_KEXEC | 98 | #ifdef CONFIG_KEXEC |
99 | /* crashdump sysrq handler */ | ||
100 | static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs, | 99 | static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs, |
101 | struct tty_struct *tty) | 100 | struct tty_struct *tty) |
102 | { | 101 | { |
@@ -108,16 +107,16 @@ static struct sysrq_key_op sysrq_crashdump_op = { | |||
108 | .action_msg = "Trigger a crashdump", | 107 | .action_msg = "Trigger a crashdump", |
109 | .enable_mask = SYSRQ_ENABLE_DUMP, | 108 | .enable_mask = SYSRQ_ENABLE_DUMP, |
110 | }; | 109 | }; |
110 | #else | ||
111 | #define sysrq_crashdump_op (*(struct sysrq_key_op *)0) | ||
111 | #endif | 112 | #endif |
112 | 113 | ||
113 | /* reboot sysrq handler */ | ||
114 | static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, | 114 | static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, |
115 | struct tty_struct *tty) | 115 | struct tty_struct *tty) |
116 | { | 116 | { |
117 | local_irq_enable(); | 117 | local_irq_enable(); |
118 | emergency_restart(); | 118 | emergency_restart(); |
119 | } | 119 | } |
120 | |||
121 | static struct sysrq_key_op sysrq_reboot_op = { | 120 | static struct sysrq_key_op sysrq_reboot_op = { |
122 | .handler = sysrq_handle_reboot, | 121 | .handler = sysrq_handle_reboot, |
123 | .help_msg = "reBoot", | 122 | .help_msg = "reBoot", |
@@ -126,11 +125,10 @@ static struct sysrq_key_op sysrq_reboot_op = { | |||
126 | }; | 125 | }; |
127 | 126 | ||
128 | static void sysrq_handle_sync(int key, struct pt_regs *pt_regs, | 127 | static void sysrq_handle_sync(int key, struct pt_regs *pt_regs, |
129 | struct tty_struct *tty) | 128 | struct tty_struct *tty) |
130 | { | 129 | { |
131 | emergency_sync(); | 130 | emergency_sync(); |
132 | } | 131 | } |
133 | |||
134 | static struct sysrq_key_op sysrq_sync_op = { | 132 | static struct sysrq_key_op sysrq_sync_op = { |
135 | .handler = sysrq_handle_sync, | 133 | .handler = sysrq_handle_sync, |
136 | .help_msg = "Sync", | 134 | .help_msg = "Sync", |
@@ -139,11 +137,10 @@ static struct sysrq_key_op sysrq_sync_op = { | |||
139 | }; | 137 | }; |
140 | 138 | ||
141 | static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, | 139 | static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, |
142 | struct tty_struct *tty) | 140 | struct tty_struct *tty) |
143 | { | 141 | { |
144 | emergency_remount(); | 142 | emergency_remount(); |
145 | } | 143 | } |
146 | |||
147 | static struct sysrq_key_op sysrq_mountro_op = { | 144 | static struct sysrq_key_op sysrq_mountro_op = { |
148 | .handler = sysrq_handle_mountro, | 145 | .handler = sysrq_handle_mountro, |
149 | .help_msg = "Unmount", | 146 | .help_msg = "Unmount", |
@@ -151,28 +148,23 @@ static struct sysrq_key_op sysrq_mountro_op = { | |||
151 | .enable_mask = SYSRQ_ENABLE_REMOUNT, | 148 | .enable_mask = SYSRQ_ENABLE_REMOUNT, |
152 | }; | 149 | }; |
153 | 150 | ||
154 | /* END SYNC SYSRQ HANDLERS BLOCK */ | ||
155 | |||
156 | #ifdef CONFIG_DEBUG_MUTEXES | 151 | #ifdef CONFIG_DEBUG_MUTEXES |
157 | 152 | static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, | |
158 | static void | 153 | struct tty_struct *tty) |
159 | sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, struct tty_struct *tty) | ||
160 | { | 154 | { |
161 | mutex_debug_show_all_locks(); | 155 | mutex_debug_show_all_locks(); |
162 | } | 156 | } |
163 | |||
164 | static struct sysrq_key_op sysrq_showlocks_op = { | 157 | static struct sysrq_key_op sysrq_showlocks_op = { |
165 | .handler = sysrq_handle_showlocks, | 158 | .handler = sysrq_handle_showlocks, |
166 | .help_msg = "show-all-locks(D)", | 159 | .help_msg = "show-all-locks(D)", |
167 | .action_msg = "Show Locks Held", | 160 | .action_msg = "Show Locks Held", |
168 | }; | 161 | }; |
169 | 162 | #else | |
163 | #define sysrq_showlocks_op (*(struct sysrq_key_op *)0) | ||
170 | #endif | 164 | #endif |
171 | 165 | ||
172 | /* SHOW SYSRQ HANDLERS BLOCK */ | ||
173 | |||
174 | static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs, | 166 | static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs, |
175 | struct tty_struct *tty) | 167 | struct tty_struct *tty) |
176 | { | 168 | { |
177 | if (pt_regs) | 169 | if (pt_regs) |
178 | show_regs(pt_regs); | 170 | show_regs(pt_regs); |
@@ -184,9 +176,8 @@ static struct sysrq_key_op sysrq_showregs_op = { | |||
184 | .enable_mask = SYSRQ_ENABLE_DUMP, | 176 | .enable_mask = SYSRQ_ENABLE_DUMP, |
185 | }; | 177 | }; |
186 | 178 | ||
187 | |||
188 | static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs, | 179 | static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs, |
189 | struct tty_struct *tty) | 180 | struct tty_struct *tty) |
190 | { | 181 | { |
191 | show_state(); | 182 | show_state(); |
192 | } | 183 | } |
@@ -197,9 +188,8 @@ static struct sysrq_key_op sysrq_showstate_op = { | |||
197 | .enable_mask = SYSRQ_ENABLE_DUMP, | 188 | .enable_mask = SYSRQ_ENABLE_DUMP, |
198 | }; | 189 | }; |
199 | 190 | ||
200 | |||
201 | static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs, | 191 | static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs, |
202 | struct tty_struct *tty) | 192 | struct tty_struct *tty) |
203 | { | 193 | { |
204 | show_mem(); | 194 | show_mem(); |
205 | } | 195 | } |
@@ -210,13 +200,9 @@ static struct sysrq_key_op sysrq_showmem_op = { | |||
210 | .enable_mask = SYSRQ_ENABLE_DUMP, | 200 | .enable_mask = SYSRQ_ENABLE_DUMP, |
211 | }; | 201 | }; |
212 | 202 | ||
213 | /* SHOW SYSRQ HANDLERS BLOCK */ | 203 | /* |
214 | 204 | * Signal sysrq helper function. Sends a signal to all user processes. | |
215 | 205 | */ | |
216 | /* SIGNAL SYSRQ HANDLERS BLOCK */ | ||
217 | |||
218 | /* signal sysrq helper function | ||
219 | * Sends a signal to all user processes */ | ||
220 | static void send_sig_all(int sig) | 206 | static void send_sig_all(int sig) |
221 | { | 207 | { |
222 | struct task_struct *p; | 208 | struct task_struct *p; |
@@ -229,7 +215,7 @@ static void send_sig_all(int sig) | |||
229 | } | 215 | } |
230 | 216 | ||
231 | static void sysrq_handle_term(int key, struct pt_regs *pt_regs, | 217 | static void sysrq_handle_term(int key, struct pt_regs *pt_regs, |
232 | struct tty_struct *tty) | 218 | struct tty_struct *tty) |
233 | { | 219 | { |
234 | send_sig_all(SIGTERM); | 220 | send_sig_all(SIGTERM); |
235 | console_loglevel = 8; | 221 | console_loglevel = 8; |
@@ -243,7 +229,8 @@ static struct sysrq_key_op sysrq_term_op = { | |||
243 | 229 | ||
244 | static void moom_callback(void *ignored) | 230 | static void moom_callback(void *ignored) |
245 | { | 231 | { |
246 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0); | 232 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], |
233 | GFP_KERNEL, 0); | ||
247 | } | 234 | } |
248 | 235 | ||
249 | static DECLARE_WORK(moom_work, moom_callback, NULL); | 236 | static DECLARE_WORK(moom_work, moom_callback, NULL); |
@@ -260,7 +247,7 @@ static struct sysrq_key_op sysrq_moom_op = { | |||
260 | }; | 247 | }; |
261 | 248 | ||
262 | static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, | 249 | static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, |
263 | struct tty_struct *tty) | 250 | struct tty_struct *tty) |
264 | { | 251 | { |
265 | send_sig_all(SIGKILL); | 252 | send_sig_all(SIGKILL); |
266 | console_loglevel = 8; | 253 | console_loglevel = 8; |
@@ -272,8 +259,6 @@ static struct sysrq_key_op sysrq_kill_op = { | |||
272 | .enable_mask = SYSRQ_ENABLE_SIGNAL, | 259 | .enable_mask = SYSRQ_ENABLE_SIGNAL, |
273 | }; | 260 | }; |
274 | 261 | ||
275 | /* END SIGNAL SYSRQ HANDLERS BLOCK */ | ||
276 | |||
277 | static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs, | 262 | static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs, |
278 | struct tty_struct *tty) | 263 | struct tty_struct *tty) |
279 | { | 264 | { |
@@ -288,110 +273,99 @@ static struct sysrq_key_op sysrq_unrt_op = { | |||
288 | 273 | ||
289 | /* Key Operations table and lock */ | 274 | /* Key Operations table and lock */ |
290 | static DEFINE_SPINLOCK(sysrq_key_table_lock); | 275 | static DEFINE_SPINLOCK(sysrq_key_table_lock); |
291 | #define SYSRQ_KEY_TABLE_LENGTH 36 | 276 | |
292 | static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { | 277 | static struct sysrq_key_op *sysrq_key_table[36] = { |
293 | /* 0 */ &sysrq_loglevel_op, | 278 | &sysrq_loglevel_op, /* 0 */ |
294 | /* 1 */ &sysrq_loglevel_op, | 279 | &sysrq_loglevel_op, /* 1 */ |
295 | /* 2 */ &sysrq_loglevel_op, | 280 | &sysrq_loglevel_op, /* 2 */ |
296 | /* 3 */ &sysrq_loglevel_op, | 281 | &sysrq_loglevel_op, /* 3 */ |
297 | /* 4 */ &sysrq_loglevel_op, | 282 | &sysrq_loglevel_op, /* 4 */ |
298 | /* 5 */ &sysrq_loglevel_op, | 283 | &sysrq_loglevel_op, /* 5 */ |
299 | /* 6 */ &sysrq_loglevel_op, | 284 | &sysrq_loglevel_op, /* 6 */ |
300 | /* 7 */ &sysrq_loglevel_op, | 285 | &sysrq_loglevel_op, /* 7 */ |
301 | /* 8 */ &sysrq_loglevel_op, | 286 | &sysrq_loglevel_op, /* 8 */ |
302 | /* 9 */ &sysrq_loglevel_op, | 287 | &sysrq_loglevel_op, /* 9 */ |
303 | /* a */ NULL, /* Don't use for system provided sysrqs, | 288 | |
304 | it is handled specially on the sparc | 289 | /* |
305 | and will never arrive */ | 290 | * Don't use for system provided sysrqs, it is handled specially on |
306 | /* b */ &sysrq_reboot_op, | 291 | * sparc and will never arrive |
307 | #ifdef CONFIG_KEXEC | 292 | */ |
308 | /* c */ &sysrq_crashdump_op, | 293 | NULL, /* a */ |
309 | #else | 294 | &sysrq_reboot_op, /* b */ |
310 | /* c */ NULL, | 295 | &sysrq_crashdump_op, /* c */ |
311 | #endif | 296 | &sysrq_showlocks_op, /* d */ |
312 | #ifdef CONFIG_DEBUG_MUTEXES | 297 | &sysrq_term_op, /* e */ |
313 | /* d */ &sysrq_showlocks_op, | 298 | &sysrq_moom_op, /* f */ |
314 | #else | 299 | NULL, /* g */ |
315 | /* d */ NULL, | 300 | NULL, /* h */ |
316 | #endif | 301 | &sysrq_kill_op, /* i */ |
317 | /* e */ &sysrq_term_op, | 302 | NULL, /* j */ |
318 | /* f */ &sysrq_moom_op, | 303 | &sysrq_SAK_op, /* k */ |
319 | /* g */ NULL, | 304 | NULL, /* l */ |
320 | /* h */ NULL, | 305 | &sysrq_showmem_op, /* m */ |
321 | /* i */ &sysrq_kill_op, | 306 | &sysrq_unrt_op, /* n */ |
322 | /* j */ NULL, | 307 | /* This will often be registered as 'Off' at init time */ |
323 | #ifdef CONFIG_VT | 308 | NULL, /* o */ |
324 | /* k */ &sysrq_SAK_op, | 309 | &sysrq_showregs_op, /* p */ |
325 | #else | 310 | NULL, /* q */ |
326 | /* k */ NULL, | 311 | &sysrq_unraw_op, /* r */ |
327 | #endif | 312 | &sysrq_sync_op, /* s */ |
328 | /* l */ NULL, | 313 | &sysrq_showstate_op, /* t */ |
329 | /* m */ &sysrq_showmem_op, | 314 | &sysrq_mountro_op, /* u */ |
330 | /* n */ &sysrq_unrt_op, | 315 | /* May be assigned at init time by SMP VOYAGER */ |
331 | /* o */ NULL, /* This will often be registered | 316 | NULL, /* v */ |
332 | as 'Off' at init time */ | 317 | NULL, /* w */ |
333 | /* p */ &sysrq_showregs_op, | 318 | NULL, /* x */ |
334 | /* q */ NULL, | 319 | NULL, /* y */ |
335 | #ifdef CONFIG_VT | 320 | NULL /* z */ |
336 | /* r */ &sysrq_unraw_op, | ||
337 | #else | ||
338 | /* r */ NULL, | ||
339 | #endif | ||
340 | /* s */ &sysrq_sync_op, | ||
341 | /* t */ &sysrq_showstate_op, | ||
342 | /* u */ &sysrq_mountro_op, | ||
343 | /* v */ NULL, /* May be assigned at init time by SMP VOYAGER */ | ||
344 | /* w */ NULL, | ||
345 | /* x */ NULL, | ||
346 | /* y */ NULL, | ||
347 | /* z */ NULL | ||
348 | }; | 321 | }; |
349 | 322 | ||
350 | /* key2index calculation, -1 on invalid index */ | 323 | /* key2index calculation, -1 on invalid index */ |
351 | static int sysrq_key_table_key2index(int key) { | 324 | static int sysrq_key_table_key2index(int key) |
325 | { | ||
352 | int retval; | 326 | int retval; |
353 | if ((key >= '0') && (key <= '9')) { | 327 | |
328 | if ((key >= '0') && (key <= '9')) | ||
354 | retval = key - '0'; | 329 | retval = key - '0'; |
355 | } else if ((key >= 'a') && (key <= 'z')) { | 330 | else if ((key >= 'a') && (key <= 'z')) |
356 | retval = key + 10 - 'a'; | 331 | retval = key + 10 - 'a'; |
357 | } else { | 332 | else |
358 | retval = -1; | 333 | retval = -1; |
359 | } | ||
360 | return retval; | 334 | return retval; |
361 | } | 335 | } |
362 | 336 | ||
363 | /* | 337 | /* |
364 | * get and put functions for the table, exposed to modules. | 338 | * get and put functions for the table, exposed to modules. |
365 | */ | 339 | */ |
366 | 340 | struct sysrq_key_op *__sysrq_get_key_op(int key) | |
367 | struct sysrq_key_op *__sysrq_get_key_op (int key) { | 341 | { |
368 | struct sysrq_key_op *op_p; | 342 | struct sysrq_key_op *op_p = NULL; |
369 | int i; | 343 | int i; |
370 | 344 | ||
371 | i = sysrq_key_table_key2index(key); | 345 | i = sysrq_key_table_key2index(key); |
372 | op_p = (i == -1) ? NULL : sysrq_key_table[i]; | 346 | if (i != -1) |
347 | op_p = sysrq_key_table[i]; | ||
373 | return op_p; | 348 | return op_p; |
374 | } | 349 | } |
375 | 350 | ||
376 | static void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) { | 351 | static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p) |
377 | int i; | 352 | { |
353 | int i = sysrq_key_table_key2index(key); | ||
378 | 354 | ||
379 | i = sysrq_key_table_key2index(key); | ||
380 | if (i != -1) | 355 | if (i != -1) |
381 | sysrq_key_table[i] = op_p; | 356 | sysrq_key_table[i] = op_p; |
382 | } | 357 | } |
383 | 358 | ||
384 | /* | 359 | /* |
385 | * This is the non-locking version of handle_sysrq | 360 | * This is the non-locking version of handle_sysrq. It must/can only be called |
386 | * It must/can only be called by sysrq key handlers, | 361 | * by sysrq key handlers, as they are inside of the lock |
387 | * as they are inside of the lock | ||
388 | */ | 362 | */ |
389 | 363 | void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, | |
390 | void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, int check_mask) | 364 | int check_mask) |
391 | { | 365 | { |
392 | struct sysrq_key_op *op_p; | 366 | struct sysrq_key_op *op_p; |
393 | int orig_log_level; | 367 | int orig_log_level; |
394 | int i, j; | 368 | int i; |
395 | unsigned long flags; | 369 | unsigned long flags; |
396 | 370 | ||
397 | spin_lock_irqsave(&sysrq_key_table_lock, flags); | 371 | spin_lock_irqsave(&sysrq_key_table_lock, flags); |
@@ -401,26 +375,34 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in | |||
401 | 375 | ||
402 | op_p = __sysrq_get_key_op(key); | 376 | op_p = __sysrq_get_key_op(key); |
403 | if (op_p) { | 377 | if (op_p) { |
404 | /* Should we check for enabled operations (/proc/sysrq-trigger should not) | 378 | /* |
405 | * and is the invoked operation enabled? */ | 379 | * Should we check for enabled operations (/proc/sysrq-trigger |
380 | * should not) and is the invoked operation enabled? | ||
381 | */ | ||
406 | if (!check_mask || sysrq_enabled == 1 || | 382 | if (!check_mask || sysrq_enabled == 1 || |
407 | (sysrq_enabled & op_p->enable_mask)) { | 383 | (sysrq_enabled & op_p->enable_mask)) { |
408 | printk ("%s\n", op_p->action_msg); | 384 | printk("%s\n", op_p->action_msg); |
409 | console_loglevel = orig_log_level; | 385 | console_loglevel = orig_log_level; |
410 | op_p->handler(key, pt_regs, tty); | 386 | op_p->handler(key, pt_regs, tty); |
411 | } | 387 | } else { |
412 | else | ||
413 | printk("This sysrq operation is disabled.\n"); | 388 | printk("This sysrq operation is disabled.\n"); |
389 | } | ||
414 | } else { | 390 | } else { |
415 | printk("HELP : "); | 391 | printk("HELP : "); |
416 | /* Only print the help msg once per handler */ | 392 | /* Only print the help msg once per handler */ |
417 | for (i=0; i<SYSRQ_KEY_TABLE_LENGTH; i++) | 393 | for (i = 0; i < ARRAY_SIZE(sysrq_key_table); i++) { |
418 | if (sysrq_key_table[i]) { | 394 | if (sysrq_key_table[i]) { |
419 | for (j=0; sysrq_key_table[i] != sysrq_key_table[j]; j++); | 395 | int j; |
420 | if (j == i) | 396 | |
421 | printk ("%s ", sysrq_key_table[i]->help_msg); | 397 | for (j = 0; sysrq_key_table[i] != |
398 | sysrq_key_table[j]; j++) | ||
399 | ; | ||
400 | if (j != i) | ||
401 | continue; | ||
402 | printk("%s ", sysrq_key_table[i]->help_msg); | ||
403 | } | ||
422 | } | 404 | } |
423 | printk ("\n"); | 405 | printk("\n"); |
424 | console_loglevel = orig_log_level; | 406 | console_loglevel = orig_log_level; |
425 | } | 407 | } |
426 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); | 408 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); |
@@ -430,16 +412,17 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in | |||
430 | * This function is called by the keyboard handler when SysRq is pressed | 412 | * This function is called by the keyboard handler when SysRq is pressed |
431 | * and any other keycode arrives. | 413 | * and any other keycode arrives. |
432 | */ | 414 | */ |
433 | |||
434 | void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) | 415 | void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) |
435 | { | 416 | { |
436 | if (!sysrq_enabled) | 417 | if (!sysrq_enabled) |
437 | return; | 418 | return; |
438 | __handle_sysrq(key, pt_regs, tty, 1); | 419 | __handle_sysrq(key, pt_regs, tty, 1); |
439 | } | 420 | } |
421 | EXPORT_SYMBOL(handle_sysrq); | ||
440 | 422 | ||
441 | static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, | 423 | static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, |
442 | struct sysrq_key_op *remove_op_p) { | 424 | struct sysrq_key_op *remove_op_p) |
425 | { | ||
443 | 426 | ||
444 | int retval; | 427 | int retval; |
445 | unsigned long flags; | 428 | unsigned long flags; |
@@ -452,7 +435,6 @@ static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, | |||
452 | retval = -1; | 435 | retval = -1; |
453 | } | 436 | } |
454 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); | 437 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); |
455 | |||
456 | return retval; | 438 | return retval; |
457 | } | 439 | } |
458 | 440 | ||
@@ -460,12 +442,10 @@ int register_sysrq_key(int key, struct sysrq_key_op *op_p) | |||
460 | { | 442 | { |
461 | return __sysrq_swap_key_ops(key, op_p, NULL); | 443 | return __sysrq_swap_key_ops(key, op_p, NULL); |
462 | } | 444 | } |
445 | EXPORT_SYMBOL(register_sysrq_key); | ||
463 | 446 | ||
464 | int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) | 447 | int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) |
465 | { | 448 | { |
466 | return __sysrq_swap_key_ops(key, NULL, op_p); | 449 | return __sysrq_swap_key_ops(key, NULL, op_p); |
467 | } | 450 | } |
468 | |||
469 | EXPORT_SYMBOL(handle_sysrq); | ||
470 | EXPORT_SYMBOL(register_sysrq_key); | ||
471 | EXPORT_SYMBOL(unregister_sysrq_key); | 451 | EXPORT_SYMBOL(unregister_sysrq_key); |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index fd3a4beaa53d..dec0224b4478 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/io.h> | ||
27 | 28 | ||
28 | enum tpm_timeout { | 29 | enum tpm_timeout { |
29 | TPM_TIMEOUT = 5, /* msecs */ | 30 | TPM_TIMEOUT = 5, /* msecs */ |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 76592ee1fb38..48d795bb8c4b 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -354,7 +354,7 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
354 | 354 | ||
355 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); | 355 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); |
356 | 356 | ||
357 | int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size) | 357 | int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) |
358 | { | 358 | { |
359 | int copied = 0; | 359 | int copied = 0; |
360 | do { | 360 | do { |
@@ -378,7 +378,7 @@ int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t | |||
378 | 378 | ||
379 | EXPORT_SYMBOL_GPL(tty_insert_flip_string); | 379 | EXPORT_SYMBOL_GPL(tty_insert_flip_string); |
380 | 380 | ||
381 | int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size) | 381 | int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) |
382 | { | 382 | { |
383 | int copied = 0; | 383 | int copied = 0; |
384 | do { | 384 | do { |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index c0dfcf273f0a..16e99db2e12d 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -148,6 +148,16 @@ config MPCORE_WATCHDOG | |||
148 | To compile this driver as a module, choose M here: the | 148 | To compile this driver as a module, choose M here: the |
149 | module will be called mpcore_wdt. | 149 | module will be called mpcore_wdt. |
150 | 150 | ||
151 | config EP93XX_WATCHDOG | ||
152 | tristate "EP93xx Watchdog" | ||
153 | depends on WATCHDOG && ARCH_EP93XX | ||
154 | help | ||
155 | Say Y here if to include support for the watchdog timer | ||
156 | embedded in the Cirrus Logic EP93xx family of devices. | ||
157 | |||
158 | To compile this driver as a module, choose M here: the | ||
159 | module will be called ep93xx_wdt. | ||
160 | |||
151 | # X86 (i386 + ia64 + x86_64) Architecture | 161 | # X86 (i386 + ia64 + x86_64) Architecture |
152 | 162 | ||
153 | config ACQUIRE_WDT | 163 | config ACQUIRE_WDT |
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index 36c0b282b8ba..d6f27fde9905 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile | |||
@@ -30,6 +30,7 @@ obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o | |||
30 | obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o | 30 | obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o |
31 | obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o | 31 | obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o |
32 | obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o | 32 | obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o |
33 | obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o | ||
33 | 34 | ||
34 | # X86 (i386 + ia64 + x86_64) Architecture | 35 | # X86 (i386 + ia64 + x86_64) Architecture |
35 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | 36 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o |
diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/char/watchdog/ep93xx_wdt.c new file mode 100644 index 000000000000..9021dbb78299 --- /dev/null +++ b/drivers/char/watchdog/ep93xx_wdt.c | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * Watchdog driver for Cirrus Logic EP93xx family of devices. | ||
3 | * | ||
4 | * Copyright (c) 2004 Ray Lehtiniemi | ||
5 | * Copyright (c) 2006 Tower Technologies | ||
6 | * Based on ep93xx driver, bits from alim7101_wdt.c | ||
7 | * | ||
8 | * Authors: Ray Lehtiniemi <rayl@mail.com>, | ||
9 | * Alessandro Zummo <a.zummo@towertech.it> | ||
10 | * | ||
11 | * This file is licensed under the terms of the GNU General Public | ||
12 | * License version 2. This program is licensed "as is" without any | ||
13 | * warranty of any kind, whether express or implied. | ||
14 | * | ||
15 | * This watchdog fires after 250msec, which is a too short interval | ||
16 | * for us to rely on the user space daemon alone. So we ping the | ||
17 | * wdt each ~200msec and eventually stop doing it if the user space | ||
18 | * daemon dies. | ||
19 | * | ||
20 | * TODO: | ||
21 | * | ||
22 | * - Test last reset from watchdog status | ||
23 | * - Add a few missing ioctls | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/miscdevice.h> | ||
29 | #include <linux/watchdog.h> | ||
30 | #include <linux/timer.h> | ||
31 | |||
32 | #include <asm/hardware.h> | ||
33 | #include <asm/uaccess.h> | ||
34 | |||
35 | #define WDT_VERSION "0.3" | ||
36 | #define PFX "ep93xx_wdt: " | ||
37 | |||
38 | /* default timeout (secs) */ | ||
39 | #define WDT_TIMEOUT 30 | ||
40 | |||
41 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
42 | static int timeout = WDT_TIMEOUT; | ||
43 | |||
44 | static struct timer_list timer; | ||
45 | static unsigned long next_heartbeat; | ||
46 | static unsigned long wdt_status; | ||
47 | static unsigned long boot_status; | ||
48 | |||
49 | #define WDT_IN_USE 0 | ||
50 | #define WDT_OK_TO_CLOSE 1 | ||
51 | |||
52 | #define EP93XX_WDT_REG(x) (EP93XX_WATCHDOG_BASE + (x)) | ||
53 | #define EP93XX_WDT_WATCHDOG EP93XX_WDT_REG(0x00) | ||
54 | #define EP93XX_WDT_WDSTATUS EP93XX_WDT_REG(0x04) | ||
55 | |||
56 | /* reset the wdt every ~200ms */ | ||
57 | #define WDT_INTERVAL (HZ/5) | ||
58 | |||
59 | static void wdt_enable(void) | ||
60 | { | ||
61 | __raw_writew(0xaaaa, EP93XX_WDT_WATCHDOG); | ||
62 | } | ||
63 | |||
64 | static void wdt_disable(void) | ||
65 | { | ||
66 | __raw_writew(0xaa55, EP93XX_WDT_WATCHDOG); | ||
67 | } | ||
68 | |||
69 | static inline void wdt_ping(void) | ||
70 | { | ||
71 | __raw_writew(0x5555, EP93XX_WDT_WATCHDOG); | ||
72 | } | ||
73 | |||
74 | static void wdt_startup(void) | ||
75 | { | ||
76 | next_heartbeat = jiffies + (timeout * HZ); | ||
77 | |||
78 | wdt_enable(); | ||
79 | mod_timer(&timer, jiffies + WDT_INTERVAL); | ||
80 | } | ||
81 | |||
82 | static void wdt_shutdown(void) | ||
83 | { | ||
84 | del_timer_sync(&timer); | ||
85 | wdt_disable(); | ||
86 | } | ||
87 | |||
88 | static void wdt_keepalive(void) | ||
89 | { | ||
90 | /* user land ping */ | ||
91 | next_heartbeat = jiffies + (timeout * HZ); | ||
92 | } | ||
93 | |||
94 | static int ep93xx_wdt_open(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
97 | return -EBUSY; | ||
98 | |||
99 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
100 | |||
101 | wdt_startup(); | ||
102 | |||
103 | return nonseekable_open(inode, file); | ||
104 | } | ||
105 | |||
106 | static ssize_t | ||
107 | ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, | ||
108 | loff_t *ppos) | ||
109 | { | ||
110 | /* Can't seek (pwrite) on this device */ | ||
111 | if (*ppos != file->f_pos) | ||
112 | return -ESPIPE; | ||
113 | |||
114 | if (len) { | ||
115 | if (!nowayout) { | ||
116 | size_t i; | ||
117 | |||
118 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
119 | |||
120 | for (i = 0; i != len; i++) { | ||
121 | char c; | ||
122 | |||
123 | if (get_user(c, data + i)) | ||
124 | return -EFAULT; | ||
125 | |||
126 | if (c == 'V') | ||
127 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
128 | else | ||
129 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
130 | } | ||
131 | } | ||
132 | wdt_keepalive(); | ||
133 | } | ||
134 | |||
135 | return len; | ||
136 | } | ||
137 | |||
138 | static struct watchdog_info ident = { | ||
139 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, | ||
140 | .identity = "EP93xx Watchdog", | ||
141 | }; | ||
142 | |||
143 | static int | ||
144 | ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
145 | unsigned long arg) | ||
146 | { | ||
147 | int ret = -ENOIOCTLCMD; | ||
148 | |||
149 | switch (cmd) { | ||
150 | case WDIOC_GETSUPPORT: | ||
151 | ret = copy_to_user((struct watchdog_info __user *)arg, &ident, | ||
152 | sizeof(ident)) ? -EFAULT : 0; | ||
153 | break; | ||
154 | |||
155 | case WDIOC_GETSTATUS: | ||
156 | ret = put_user(0, (int __user *)arg); | ||
157 | break; | ||
158 | |||
159 | case WDIOC_GETBOOTSTATUS: | ||
160 | ret = put_user(boot_status, (int __user *)arg); | ||
161 | break; | ||
162 | |||
163 | case WDIOC_GETTIMEOUT: | ||
164 | /* actually, it is 0.250 seconds.... */ | ||
165 | ret = put_user(1, (int __user *)arg); | ||
166 | break; | ||
167 | |||
168 | case WDIOC_KEEPALIVE: | ||
169 | wdt_keepalive(); | ||
170 | ret = 0; | ||
171 | break; | ||
172 | } | ||
173 | return ret; | ||
174 | } | ||
175 | |||
176 | static int ep93xx_wdt_release(struct inode *inode, struct file *file) | ||
177 | { | ||
178 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
179 | wdt_shutdown(); | ||
180 | else | ||
181 | printk(KERN_CRIT PFX "Device closed unexpectedly - " | ||
182 | "timer will not stop\n"); | ||
183 | |||
184 | clear_bit(WDT_IN_USE, &wdt_status); | ||
185 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static struct file_operations ep93xx_wdt_fops = { | ||
191 | .owner = THIS_MODULE, | ||
192 | .write = ep93xx_wdt_write, | ||
193 | .ioctl = ep93xx_wdt_ioctl, | ||
194 | .open = ep93xx_wdt_open, | ||
195 | .release = ep93xx_wdt_release, | ||
196 | }; | ||
197 | |||
198 | static struct miscdevice ep93xx_wdt_miscdev = { | ||
199 | .minor = WATCHDOG_MINOR, | ||
200 | .name = "watchdog", | ||
201 | .fops = &ep93xx_wdt_fops, | ||
202 | }; | ||
203 | |||
204 | static void ep93xx_timer_ping(unsigned long data) | ||
205 | { | ||
206 | if (time_before(jiffies, next_heartbeat)) | ||
207 | wdt_ping(); | ||
208 | |||
209 | /* Re-set the timer interval */ | ||
210 | mod_timer(&timer, jiffies + WDT_INTERVAL); | ||
211 | } | ||
212 | |||
213 | static int __init ep93xx_wdt_init(void) | ||
214 | { | ||
215 | int err; | ||
216 | |||
217 | err = misc_register(&ep93xx_wdt_miscdev); | ||
218 | |||
219 | boot_status = __raw_readl(EP93XX_WDT_WATCHDOG) & 0x01 ? 1 : 0; | ||
220 | |||
221 | printk(KERN_INFO PFX "EP93XX watchdog, driver version " | ||
222 | WDT_VERSION "%s\n", | ||
223 | (__raw_readl(EP93XX_WDT_WATCHDOG) & 0x08) | ||
224 | ? " (nCS1 disable detected)" : ""); | ||
225 | |||
226 | if (timeout < 1 || timeout > 3600) { | ||
227 | timeout = WDT_TIMEOUT; | ||
228 | printk(KERN_INFO PFX | ||
229 | "timeout value must be 1<=x<=3600, using %d\n", | ||
230 | timeout); | ||
231 | } | ||
232 | |||
233 | setup_timer(&timer, ep93xx_timer_ping, 1); | ||
234 | return err; | ||
235 | } | ||
236 | |||
237 | static void __exit ep93xx_wdt_exit(void) | ||
238 | { | ||
239 | wdt_shutdown(); | ||
240 | misc_deregister(&ep93xx_wdt_miscdev); | ||
241 | } | ||
242 | |||
243 | module_init(ep93xx_wdt_init); | ||
244 | module_exit(ep93xx_wdt_exit); | ||
245 | |||
246 | module_param(nowayout, int, 0); | ||
247 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | ||
248 | |||
249 | module_param(timeout, int, 0); | ||
250 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | ||
251 | |||
252 | MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>," | ||
253 | "Alessandro Zummo <a.zummo@towertech.it>"); | ||
254 | MODULE_DESCRIPTION("EP93xx Watchdog"); | ||
255 | MODULE_LICENSE("GPL"); | ||
256 | MODULE_VERSION(WDT_VERSION); | ||
257 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c index ca8e69d2f64d..e4c48e329367 100644 --- a/drivers/dio/dio-driver.c +++ b/drivers/dio/dio-driver.c | |||
@@ -71,22 +71,17 @@ static int dio_device_probe(struct device *dev) | |||
71 | * @drv: the driver structure to register | 71 | * @drv: the driver structure to register |
72 | * | 72 | * |
73 | * Adds the driver structure to the list of registered drivers | 73 | * Adds the driver structure to the list of registered drivers |
74 | * Returns the number of DIO devices which were claimed by the driver | 74 | * Returns zero or a negative error value. |
75 | * during registration. The driver remains registered even if the | ||
76 | * return value is zero. | ||
77 | */ | 75 | */ |
78 | 76 | ||
79 | int dio_register_driver(struct dio_driver *drv) | 77 | int dio_register_driver(struct dio_driver *drv) |
80 | { | 78 | { |
81 | int count = 0; | ||
82 | |||
83 | /* initialize common driver fields */ | 79 | /* initialize common driver fields */ |
84 | drv->driver.name = drv->name; | 80 | drv->driver.name = drv->name; |
85 | drv->driver.bus = &dio_bus_type; | 81 | drv->driver.bus = &dio_bus_type; |
86 | 82 | ||
87 | /* register with core */ | 83 | /* register with core */ |
88 | count = driver_register(&drv->driver); | 84 | return driver_register(&drv->driver); |
89 | return count ? count : 1; | ||
90 | } | 85 | } |
91 | 86 | ||
92 | 87 | ||
diff --git a/drivers/eisa/.gitignore b/drivers/eisa/.gitignore new file mode 100644 index 000000000000..4b335c0aedb0 --- /dev/null +++ b/drivers/eisa/.gitignore | |||
@@ -0,0 +1 @@ | |||
devlist.h | |||
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 4196137e66de..6078e2f58817 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
@@ -135,13 +135,8 @@ struct bus_type eisa_bus_type = { | |||
135 | 135 | ||
136 | int eisa_driver_register (struct eisa_driver *edrv) | 136 | int eisa_driver_register (struct eisa_driver *edrv) |
137 | { | 137 | { |
138 | int r; | ||
139 | |||
140 | edrv->driver.bus = &eisa_bus_type; | 138 | edrv->driver.bus = &eisa_bus_type; |
141 | if ((r = driver_register (&edrv->driver)) < 0) | 139 | return driver_register (&edrv->driver); |
142 | return r; | ||
143 | |||
144 | return 0; | ||
145 | } | 140 | } |
146 | 141 | ||
147 | void eisa_driver_unregister (struct eisa_driver *edrv) | 142 | void eisa_driver_unregister (struct eisa_driver *edrv) |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index b2cc43702f65..3fdab563fec2 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -2058,7 +2058,7 @@ static void __init parse_options (char *line) | |||
2058 | } | 2058 | } |
2059 | } | 2059 | } |
2060 | 2060 | ||
2061 | int init_module (void) | 2061 | int __init init_module (void) |
2062 | { | 2062 | { |
2063 | parse_options(options); | 2063 | parse_options(options); |
2064 | return ide_init(); | 2064 | return ide_init(); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 8c12a974b411..a81f987978c8 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/spi/ads7846.h> | 25 | #include <linux/spi/ads7846.h> |
26 | #include <linux/interrupt.h> | ||
26 | 27 | ||
27 | #ifdef CONFIG_ARM | 28 | #ifdef CONFIG_ARM |
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 91dd0551fc7c..4d64e5cbcdbf 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -39,7 +39,7 @@ MODULE_AUTHOR("Carsten Paeth"); | |||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | 40 | ||
41 | static int suppress_pollack = 0; | 41 | static int suppress_pollack = 0; |
42 | MODULE_PARM(suppress_pollack, "0-1i"); | 42 | module_param(suppress_pollack, bool, 0); |
43 | 43 | ||
44 | /* ------------------------------------------------------------- */ | 44 | /* ------------------------------------------------------------- */ |
45 | 45 | ||
diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c index 38bd4dfecbd1..80fb488848b8 100644 --- a/drivers/isdn/hardware/avm/b1isa.c +++ b/drivers/isdn/hardware/avm/b1isa.c | |||
@@ -169,8 +169,8 @@ static struct pci_dev isa_dev[MAX_CARDS]; | |||
169 | static int io[MAX_CARDS]; | 169 | static int io[MAX_CARDS]; |
170 | static int irq[MAX_CARDS]; | 170 | static int irq[MAX_CARDS]; |
171 | 171 | ||
172 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 172 | module_param_array(io, int, NULL, 0); |
173 | MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 173 | module_param_array(irq, int, NULL, 0); |
174 | MODULE_PARM_DESC(io, "I/O base address(es)"); | 174 | MODULE_PARM_DESC(io, "I/O base address(es)"); |
175 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); | 175 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); |
176 | 176 | ||
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 724aac2c1cca..f7253b2136ea 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c | |||
@@ -50,7 +50,7 @@ MODULE_DEVICE_TABLE(pci, c4_pci_tbl); | |||
50 | MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards"); | 50 | MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards"); |
51 | MODULE_AUTHOR("Carsten Paeth"); | 51 | MODULE_AUTHOR("Carsten Paeth"); |
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | MODULE_PARM(suppress_pollack, "0-1i"); | 53 | module_param(suppress_pollack, bool, 0); |
54 | 54 | ||
55 | /* ------------------------------------------------------------- */ | 55 | /* ------------------------------------------------------------- */ |
56 | 56 | ||
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 3b701d97bdf1..5a2f854d55b5 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c | |||
@@ -519,9 +519,9 @@ static int io[MAX_CARDS]; | |||
519 | static int irq[MAX_CARDS]; | 519 | static int irq[MAX_CARDS]; |
520 | static int cardnr[MAX_CARDS]; | 520 | static int cardnr[MAX_CARDS]; |
521 | 521 | ||
522 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 522 | module_param_array(io, int, NULL, 0); |
523 | MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 523 | module_param_array(irq, int, NULL, 0); |
524 | MODULE_PARM(cardnr, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 524 | module_param_array(cardnr, int, NULL, 0); |
525 | MODULE_PARM_DESC(io, "I/O base address(es)"); | 525 | MODULE_PARM_DESC(io, "I/O base address(es)"); |
526 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); | 526 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); |
527 | MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); | 527 | MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); |
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c index e19a01a305a9..48d134be9908 100644 --- a/drivers/isdn/hysdn/boardergo.c +++ b/drivers/isdn/hysdn/boardergo.c | |||
@@ -38,8 +38,8 @@ ergo_interrupt(int intno, void *dev_id, struct pt_regs *regs) | |||
38 | { | 38 | { |
39 | hysdn_card *card = dev_id; /* parameter from irq */ | 39 | hysdn_card *card = dev_id; /* parameter from irq */ |
40 | tErgDpram *dpr; | 40 | tErgDpram *dpr; |
41 | ulong flags; | 41 | unsigned long flags; |
42 | uchar volatile b; | 42 | unsigned char volatile b; |
43 | 43 | ||
44 | if (!card) | 44 | if (!card) |
45 | return IRQ_NONE; /* error -> spurious interrupt */ | 45 | return IRQ_NONE; /* error -> spurious interrupt */ |
@@ -77,7 +77,7 @@ ergo_irq_bh(hysdn_card * card) | |||
77 | { | 77 | { |
78 | tErgDpram *dpr; | 78 | tErgDpram *dpr; |
79 | int again; | 79 | int again; |
80 | ulong flags; | 80 | unsigned long flags; |
81 | 81 | ||
82 | if (card->state != CARD_STATE_RUN) | 82 | if (card->state != CARD_STATE_RUN) |
83 | return; /* invalid call */ | 83 | return; /* invalid call */ |
@@ -131,8 +131,8 @@ ergo_irq_bh(hysdn_card * card) | |||
131 | static void | 131 | static void |
132 | ergo_stopcard(hysdn_card * card) | 132 | ergo_stopcard(hysdn_card * card) |
133 | { | 133 | { |
134 | ulong flags; | 134 | unsigned long flags; |
135 | uchar val; | 135 | unsigned char val; |
136 | 136 | ||
137 | hysdn_net_release(card); /* first release the net device if existing */ | 137 | hysdn_net_release(card); /* first release the net device if existing */ |
138 | #ifdef CONFIG_HYSDN_CAPI | 138 | #ifdef CONFIG_HYSDN_CAPI |
@@ -157,7 +157,7 @@ ergo_stopcard(hysdn_card * card) | |||
157 | static void | 157 | static void |
158 | ergo_set_errlog_state(hysdn_card * card, int on) | 158 | ergo_set_errlog_state(hysdn_card * card, int on) |
159 | { | 159 | { |
160 | ulong flags; | 160 | unsigned long flags; |
161 | 161 | ||
162 | if (card->state != CARD_STATE_RUN) { | 162 | if (card->state != CARD_STATE_RUN) { |
163 | card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ | 163 | card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ |
@@ -217,9 +217,10 @@ ergo_testram(hysdn_card * card) | |||
217 | /* Negative return values are interpreted as errors. */ | 217 | /* Negative return values are interpreted as errors. */ |
218 | /*****************************************************************************/ | 218 | /*****************************************************************************/ |
219 | static int | 219 | static int |
220 | ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs) | 220 | ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf, |
221 | unsigned long offs) | ||
221 | { | 222 | { |
222 | uchar *dst; | 223 | unsigned char *dst; |
223 | tErgDpram *dpram; | 224 | tErgDpram *dpram; |
224 | int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */ | 225 | int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */ |
225 | 226 | ||
@@ -264,14 +265,14 @@ ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs) | |||
264 | /* case of errors a negative error value is returned. */ | 265 | /* case of errors a negative error value is returned. */ |
265 | /********************************************************************************/ | 266 | /********************************************************************************/ |
266 | static int | 267 | static int |
267 | ergo_writebootseq(struct HYSDN_CARD *card, uchar * buf, int len) | 268 | ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len) |
268 | { | 269 | { |
269 | tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram; | 270 | tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram; |
270 | uchar *dst; | 271 | unsigned char *dst; |
271 | uchar buflen; | 272 | unsigned char buflen; |
272 | int nr_write; | 273 | int nr_write; |
273 | uchar tmp_rdptr; | 274 | unsigned char tmp_rdptr; |
274 | uchar wr_mirror; | 275 | unsigned char wr_mirror; |
275 | int i; | 276 | int i; |
276 | 277 | ||
277 | if (card->debug_flags & LOG_POF_CARD) | 278 | if (card->debug_flags & LOG_POF_CARD) |
@@ -330,7 +331,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
330 | { | 331 | { |
331 | tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */ | 332 | tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */ |
332 | int timecnt = 10000 / 50; /* timeout is 10 secs max. */ | 333 | int timecnt = 10000 / 50; /* timeout is 10 secs max. */ |
333 | ulong flags; | 334 | unsigned long flags; |
334 | int msg_size; | 335 | int msg_size; |
335 | int i; | 336 | int i; |
336 | 337 | ||
@@ -345,7 +346,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
345 | if ((dpr->ToPcChannel != CHAN_SYSTEM) || | 346 | if ((dpr->ToPcChannel != CHAN_SYSTEM) || |
346 | (dpr->ToPcSize < MIN_RDY_MSG_SIZE) || | 347 | (dpr->ToPcSize < MIN_RDY_MSG_SIZE) || |
347 | (dpr->ToPcSize > MAX_RDY_MSG_SIZE) || | 348 | (dpr->ToPcSize > MAX_RDY_MSG_SIZE) || |
348 | ((*(ulong *) dpr->ToPcBuf) != RDY_MAGIC)) | 349 | ((*(unsigned long *) dpr->ToPcBuf) != RDY_MAGIC)) |
349 | break; /* an error occurred */ | 350 | break; /* an error occurred */ |
350 | 351 | ||
351 | /* Check for additional data delivered during SysReady */ | 352 | /* Check for additional data delivered during SysReady */ |
diff --git a/drivers/isdn/hysdn/boardergo.h b/drivers/isdn/hysdn/boardergo.h index b56ff0889ead..c59422aa8c3f 100644 --- a/drivers/isdn/hysdn/boardergo.h +++ b/drivers/isdn/hysdn/boardergo.h | |||
@@ -23,36 +23,36 @@ | |||
23 | 23 | ||
24 | /* following DPRAM layout copied from OS2-driver boarderg.h */ | 24 | /* following DPRAM layout copied from OS2-driver boarderg.h */ |
25 | typedef struct ErgDpram_tag { | 25 | typedef struct ErgDpram_tag { |
26 | /*0000 */ uchar ToHyBuf[ERG_TO_HY_BUF_SIZE]; | 26 | /*0000 */ unsigned char ToHyBuf[ERG_TO_HY_BUF_SIZE]; |
27 | /*0E00 */ uchar ToPcBuf[ERG_TO_PC_BUF_SIZE]; | 27 | /*0E00 */ unsigned char ToPcBuf[ERG_TO_PC_BUF_SIZE]; |
28 | 28 | ||
29 | /*1C00 */ uchar bSoftUart[SIZE_RSV_SOFT_UART]; | 29 | /*1C00 */ unsigned char bSoftUart[SIZE_RSV_SOFT_UART]; |
30 | /* size 0x1B0 */ | 30 | /* size 0x1B0 */ |
31 | 31 | ||
32 | /*1DB0 *//* tErrLogEntry */ uchar volatile ErrLogMsg[64]; | 32 | /*1DB0 *//* tErrLogEntry */ unsigned char volatile ErrLogMsg[64]; |
33 | /* size 64 bytes */ | 33 | /* size 64 bytes */ |
34 | /*1DB0 ulong ulErrType; */ | 34 | /*1DB0 unsigned long ulErrType; */ |
35 | /*1DB4 ulong ulErrSubtype; */ | 35 | /*1DB4 unsigned long ulErrSubtype; */ |
36 | /*1DB8 ulong ucTextSize; */ | 36 | /*1DB8 unsigned long ucTextSize; */ |
37 | /*1DB9 ulong ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ | 37 | /*1DB9 unsigned long ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ |
38 | /*1DF0 */ | 38 | /*1DF0 */ |
39 | 39 | ||
40 | /*1DF0 */ word volatile ToHyChannel; | 40 | /*1DF0 */ unsigned short volatile ToHyChannel; |
41 | /*1DF2 */ word volatile ToHySize; | 41 | /*1DF2 */ unsigned short volatile ToHySize; |
42 | /*1DF4 */ uchar volatile ToHyFlag; | 42 | /*1DF4 */ unsigned char volatile ToHyFlag; |
43 | /* !=0: msg for Hy waiting */ | 43 | /* !=0: msg for Hy waiting */ |
44 | /*1DF5 */ uchar volatile ToPcFlag; | 44 | /*1DF5 */ unsigned char volatile ToPcFlag; |
45 | /* !=0: msg for PC waiting */ | 45 | /* !=0: msg for PC waiting */ |
46 | /*1DF6 */ word volatile ToPcChannel; | 46 | /*1DF6 */ unsigned short volatile ToPcChannel; |
47 | /*1DF8 */ word volatile ToPcSize; | 47 | /*1DF8 */ unsigned short volatile ToPcSize; |
48 | /*1DFA */ uchar bRes1DBA[0x1E00 - 0x1DFA]; | 48 | /*1DFA */ unsigned char bRes1DBA[0x1E00 - 0x1DFA]; |
49 | /* 6 bytes */ | 49 | /* 6 bytes */ |
50 | 50 | ||
51 | /*1E00 */ uchar bRestOfEntryTbl[0x1F00 - 0x1E00]; | 51 | /*1E00 */ unsigned char bRestOfEntryTbl[0x1F00 - 0x1E00]; |
52 | /*1F00 */ ulong TrapTable[62]; | 52 | /*1F00 */ unsigned long TrapTable[62]; |
53 | /*1FF8 */ uchar bRes1FF8[0x1FFB - 0x1FF8]; | 53 | /*1FF8 */ unsigned char bRes1FF8[0x1FFB - 0x1FF8]; |
54 | /* low part of reset vetor */ | 54 | /* low part of reset vetor */ |
55 | /*1FFB */ uchar ToPcIntMetro; | 55 | /*1FFB */ unsigned char ToPcIntMetro; |
56 | /* notes: | 56 | /* notes: |
57 | * - metro has 32-bit boot ram - accessing | 57 | * - metro has 32-bit boot ram - accessing |
58 | * ToPcInt and ToHyInt would be the same; | 58 | * ToPcInt and ToHyInt would be the same; |
@@ -65,16 +65,16 @@ typedef struct ErgDpram_tag { | |||
65 | * so E1 side should NOT change this byte | 65 | * so E1 side should NOT change this byte |
66 | * when writing! | 66 | * when writing! |
67 | */ | 67 | */ |
68 | /*1FFC */ uchar volatile ToHyNoDpramErrLog; | 68 | /*1FFC */ unsigned char volatile ToHyNoDpramErrLog; |
69 | /* note: ToHyNoDpramErrLog is used to inform | 69 | /* note: ToHyNoDpramErrLog is used to inform |
70 | * boot loader, not to use DPRAM based | 70 | * boot loader, not to use DPRAM based |
71 | * ErrLog; when DOS driver is rewritten | 71 | * ErrLog; when DOS driver is rewritten |
72 | * this becomes obsolete | 72 | * this becomes obsolete |
73 | */ | 73 | */ |
74 | /*1FFD */ uchar bRes1FFD; | 74 | /*1FFD */ unsigned char bRes1FFD; |
75 | /*1FFE */ uchar ToPcInt; | 75 | /*1FFE */ unsigned char ToPcInt; |
76 | /* E1_intclear; on CHAMP2: E1_intset */ | 76 | /* E1_intclear; on CHAMP2: E1_intset */ |
77 | /*1FFF */ uchar ToHyInt; | 77 | /*1FFF */ unsigned char ToHyInt; |
78 | /* E1_intset; on CHAMP2: E1_intclear */ | 78 | /* E1_intset; on CHAMP2: E1_intclear */ |
79 | } tErgDpram; | 79 | } tErgDpram; |
80 | 80 | ||
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index acc1d3cceebb..6bac43cc91bd 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -31,7 +31,7 @@ | |||
31 | static char hycapi_revision[]="$Revision: 1.8.6.4 $"; | 31 | static char hycapi_revision[]="$Revision: 1.8.6.4 $"; |
32 | 32 | ||
33 | unsigned int hycapi_enable = 0xffffffff; | 33 | unsigned int hycapi_enable = 0xffffffff; |
34 | MODULE_PARM(hycapi_enable, "i"); | 34 | module_param(hycapi_enable, uint, 0); |
35 | 35 | ||
36 | typedef struct _hycapi_appl { | 36 | typedef struct _hycapi_appl { |
37 | unsigned int ctrl_mask; | 37 | unsigned int ctrl_mask; |
@@ -523,7 +523,7 @@ New nccis are created if necessary. | |||
523 | *******************************************************************/ | 523 | *******************************************************************/ |
524 | 524 | ||
525 | void | 525 | void |
526 | hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) | 526 | hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
527 | { | 527 | { |
528 | struct sk_buff *skb; | 528 | struct sk_buff *skb; |
529 | hycapictrl_info *cinfo = card->hyctrlinfo; | 529 | hycapictrl_info *cinfo = card->hyctrlinfo; |
diff --git a/drivers/isdn/hysdn/hysdn_boot.c b/drivers/isdn/hysdn/hysdn_boot.c index 7bfba196f315..6d0eb0f42fca 100644 --- a/drivers/isdn/hysdn/hysdn_boot.c +++ b/drivers/isdn/hysdn/hysdn_boot.c | |||
@@ -30,17 +30,17 @@ | |||
30 | /* needed during boot and so allocated dynamically. */ | 30 | /* needed during boot and so allocated dynamically. */ |
31 | /************************************************************/ | 31 | /************************************************************/ |
32 | struct boot_data { | 32 | struct boot_data { |
33 | word Cryptor; /* for use with Decrypt function */ | 33 | unsigned short Cryptor; /* for use with Decrypt function */ |
34 | word Nrecs; /* records remaining in file */ | 34 | unsigned short Nrecs; /* records remaining in file */ |
35 | uchar pof_state; /* actual state of read handler */ | 35 | unsigned char pof_state;/* actual state of read handler */ |
36 | uchar is_crypted; /* card data is crypted */ | 36 | unsigned char is_crypted;/* card data is crypted */ |
37 | int BufSize; /* actual number of bytes bufferd */ | 37 | int BufSize; /* actual number of bytes bufferd */ |
38 | int last_error; /* last occurred error */ | 38 | int last_error; /* last occurred error */ |
39 | word pof_recid; /* actual pof recid */ | 39 | unsigned short pof_recid;/* actual pof recid */ |
40 | ulong pof_reclen; /* total length of pof record data */ | 40 | unsigned long pof_reclen;/* total length of pof record data */ |
41 | ulong pof_recoffset; /* actual offset inside pof record */ | 41 | unsigned long pof_recoffset;/* actual offset inside pof record */ |
42 | union { | 42 | union { |
43 | uchar BootBuf[BOOT_BUF_SIZE]; /* buffer as byte count */ | 43 | unsigned char BootBuf[BOOT_BUF_SIZE];/* buffer as byte count */ |
44 | tPofRecHdr PofRecHdr; /* header for actual record/chunk */ | 44 | tPofRecHdr PofRecHdr; /* header for actual record/chunk */ |
45 | tPofFileHdr PofFileHdr; /* header from POF file */ | 45 | tPofFileHdr PofFileHdr; /* header from POF file */ |
46 | tPofTimeStamp PofTime; /* time information */ | 46 | tPofTimeStamp PofTime; /* time information */ |
@@ -69,11 +69,11 @@ StartDecryption(struct boot_data *boot) | |||
69 | static void | 69 | static void |
70 | DecryptBuf(struct boot_data *boot, int cnt) | 70 | DecryptBuf(struct boot_data *boot, int cnt) |
71 | { | 71 | { |
72 | uchar *bufp = boot->buf.BootBuf; | 72 | unsigned char *bufp = boot->buf.BootBuf; |
73 | 73 | ||
74 | while (cnt--) { | 74 | while (cnt--) { |
75 | boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0); | 75 | boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0); |
76 | *bufp++ ^= (uchar) boot->Cryptor; | 76 | *bufp++ ^= (unsigned char)boot->Cryptor; |
77 | } | 77 | } |
78 | } /* DecryptBuf */ | 78 | } /* DecryptBuf */ |
79 | 79 | ||
@@ -86,7 +86,7 @@ pof_handle_data(hysdn_card * card, int datlen) | |||
86 | { | 86 | { |
87 | struct boot_data *boot = card->boot; /* pointer to boot specific data */ | 87 | struct boot_data *boot = card->boot; /* pointer to boot specific data */ |
88 | long l; | 88 | long l; |
89 | uchar *imgp; | 89 | unsigned char *imgp; |
90 | int img_len; | 90 | int img_len; |
91 | 91 | ||
92 | /* handle the different record types */ | 92 | /* handle the different record types */ |
@@ -197,7 +197,7 @@ pof_write_buffer(hysdn_card * card, int datlen) | |||
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | /* Setup the new state and vars */ | 199 | /* Setup the new state and vars */ |
200 | boot->Nrecs = (word) (boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ | 200 | boot->Nrecs = (unsigned short)(boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ |
201 | boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ | 201 | boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ |
202 | boot->last_error = sizeof(tPofRecHdr); /* new length */ | 202 | boot->last_error = sizeof(tPofRecHdr); /* new length */ |
203 | break; | 203 | break; |
@@ -268,7 +268,7 @@ pof_write_buffer(hysdn_card * card, int datlen) | |||
268 | /* occurred. Additionally the pointer to the buffer data area is set on success */ | 268 | /* occurred. Additionally the pointer to the buffer data area is set on success */ |
269 | /*******************************************************************************/ | 269 | /*******************************************************************************/ |
270 | int | 270 | int |
271 | pof_write_open(hysdn_card * card, uchar ** bufp) | 271 | pof_write_open(hysdn_card * card, unsigned char **bufp) |
272 | { | 272 | { |
273 | struct boot_data *boot; /* pointer to boot specific data */ | 273 | struct boot_data *boot; /* pointer to boot specific data */ |
274 | 274 | ||
@@ -335,7 +335,7 @@ pof_write_close(hysdn_card * card) | |||
335 | /* when POF has been booted. A return value of 0 is used if no error occurred. */ | 335 | /* when POF has been booted. A return value of 0 is used if no error occurred. */ |
336 | /*********************************************************************************/ | 336 | /*********************************************************************************/ |
337 | int | 337 | int |
338 | EvalSysrTokData(hysdn_card * card, uchar * cp, int len) | 338 | EvalSysrTokData(hysdn_card *card, unsigned char *cp, int len) |
339 | { | 339 | { |
340 | u_char *p; | 340 | u_char *p; |
341 | u_char crc; | 341 | u_char crc; |
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h index 432f6f99089e..3a9b29b38bc4 100644 --- a/drivers/isdn/hysdn/hysdn_defs.h +++ b/drivers/isdn/hysdn/hysdn_defs.h | |||
@@ -20,14 +20,6 @@ | |||
20 | #include <linux/workqueue.h> | 20 | #include <linux/workqueue.h> |
21 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
22 | 22 | ||
23 | /****************************/ | ||
24 | /* storage type definitions */ | ||
25 | /****************************/ | ||
26 | #define uchar unsigned char | ||
27 | #define uint unsigned int | ||
28 | #define ulong unsigned long | ||
29 | #define word unsigned short | ||
30 | |||
31 | #include "ince1pc.h" | 23 | #include "ince1pc.h" |
32 | 24 | ||
33 | #ifdef CONFIG_HYSDN_CAPI | 25 | #ifdef CONFIG_HYSDN_CAPI |
@@ -147,18 +139,18 @@ typedef struct HYSDN_CARD { | |||
147 | 139 | ||
148 | /* general variables for the cards */ | 140 | /* general variables for the cards */ |
149 | int myid; /* own driver card id */ | 141 | int myid; /* own driver card id */ |
150 | uchar bus; /* pci bus the card is connected to */ | 142 | unsigned char bus; /* pci bus the card is connected to */ |
151 | uchar devfn; /* slot+function bit encoded */ | 143 | unsigned char devfn; /* slot+function bit encoded */ |
152 | word subsysid; /* PCI subsystem id */ | 144 | unsigned short subsysid;/* PCI subsystem id */ |
153 | uchar brdtype; /* type of card */ | 145 | unsigned char brdtype; /* type of card */ |
154 | uint bchans; /* number of available B-channels */ | 146 | unsigned int bchans; /* number of available B-channels */ |
155 | uint faxchans; /* number of available fax-channels */ | 147 | unsigned int faxchans; /* number of available fax-channels */ |
156 | uchar mac_addr[6]; /* MAC Address read from card */ | 148 | unsigned char mac_addr[6];/* MAC Address read from card */ |
157 | uint irq; /* interrupt number */ | 149 | unsigned int irq; /* interrupt number */ |
158 | uint iobase; /* IO-port base address */ | 150 | unsigned int iobase; /* IO-port base address */ |
159 | ulong plxbase; /* PLX memory base */ | 151 | unsigned long plxbase; /* PLX memory base */ |
160 | ulong membase; /* DPRAM memory base */ | 152 | unsigned long membase; /* DPRAM memory base */ |
161 | ulong memend; /* DPRAM memory end */ | 153 | unsigned long memend; /* DPRAM memory end */ |
162 | void *dpram; /* mapped dpram */ | 154 | void *dpram; /* mapped dpram */ |
163 | int state; /* actual state of card -> CARD_STATE_** */ | 155 | int state; /* actual state of card -> CARD_STATE_** */ |
164 | struct HYSDN_CARD *next; /* pointer to next card */ | 156 | struct HYSDN_CARD *next; /* pointer to next card */ |
@@ -168,26 +160,26 @@ typedef struct HYSDN_CARD { | |||
168 | void *procconf; /* pointer to procconf filesystem specific data */ | 160 | void *procconf; /* pointer to procconf filesystem specific data */ |
169 | 161 | ||
170 | /* debugging and logging */ | 162 | /* debugging and logging */ |
171 | uchar err_log_state; /* actual error log state of the card */ | 163 | unsigned char err_log_state;/* actual error log state of the card */ |
172 | ulong debug_flags; /* tells what should be debugged and where */ | 164 | unsigned long debug_flags;/* tells what should be debugged and where */ |
173 | void (*set_errlog_state) (struct HYSDN_CARD *, int); | 165 | void (*set_errlog_state) (struct HYSDN_CARD *, int); |
174 | 166 | ||
175 | /* interrupt handler + interrupt synchronisation */ | 167 | /* interrupt handler + interrupt synchronisation */ |
176 | struct work_struct irq_queue; /* interrupt task queue */ | 168 | struct work_struct irq_queue; /* interrupt task queue */ |
177 | uchar volatile irq_enabled; /* interrupt enabled if != 0 */ | 169 | unsigned char volatile irq_enabled;/* interrupt enabled if != 0 */ |
178 | uchar volatile hw_lock; /* hardware is currently locked -> no access */ | 170 | unsigned char volatile hw_lock;/* hardware is currently locked -> no access */ |
179 | 171 | ||
180 | /* boot process */ | 172 | /* boot process */ |
181 | void *boot; /* pointer to boot private data */ | 173 | void *boot; /* pointer to boot private data */ |
182 | int (*writebootimg) (struct HYSDN_CARD *, uchar *, ulong); | 174 | int (*writebootimg) (struct HYSDN_CARD *, unsigned char *, unsigned long); |
183 | int (*writebootseq) (struct HYSDN_CARD *, uchar *, int); | 175 | int (*writebootseq) (struct HYSDN_CARD *, unsigned char *, int); |
184 | int (*waitpofready) (struct HYSDN_CARD *); | 176 | int (*waitpofready) (struct HYSDN_CARD *); |
185 | int (*testram) (struct HYSDN_CARD *); | 177 | int (*testram) (struct HYSDN_CARD *); |
186 | 178 | ||
187 | /* scheduler for data transfer (only async parts) */ | 179 | /* scheduler for data transfer (only async parts) */ |
188 | uchar async_data[256]; /* async data to be sent (normally for config) */ | 180 | unsigned char async_data[256];/* async data to be sent (normally for config) */ |
189 | word volatile async_len; /* length of data to sent */ | 181 | unsigned short volatile async_len;/* length of data to sent */ |
190 | word volatile async_channel; /* channel number for async transfer */ | 182 | unsigned short volatile async_channel;/* channel number for async transfer */ |
191 | int volatile async_busy; /* flag != 0 sending in progress */ | 183 | int volatile async_busy; /* flag != 0 sending in progress */ |
192 | int volatile net_tx_busy; /* a network packet tx is in progress */ | 184 | int volatile net_tx_busy; /* a network packet tx is in progress */ |
193 | 185 | ||
@@ -251,15 +243,18 @@ extern int ergo_inithardware(hysdn_card * card); /* get hardware -> module init | |||
251 | 243 | ||
252 | /* hysdn_boot.c */ | 244 | /* hysdn_boot.c */ |
253 | extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */ | 245 | extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */ |
254 | extern int pof_write_open(hysdn_card *, uchar **); /* open proc file for writing pof */ | 246 | extern int pof_write_open(hysdn_card *, unsigned char **); /* open proc file for writing pof */ |
255 | extern int pof_write_buffer(hysdn_card *, int); /* write boot data to card */ | 247 | extern int pof_write_buffer(hysdn_card *, int); /* write boot data to card */ |
256 | extern int EvalSysrTokData(hysdn_card *, uchar *, int); /* Check Sysready Token Data */ | 248 | extern int EvalSysrTokData(hysdn_card *, unsigned char *, int); /* Check Sysready Token Data */ |
257 | 249 | ||
258 | /* hysdn_sched.c */ | 250 | /* hysdn_sched.c */ |
259 | extern int hysdn_sched_tx(hysdn_card *, uchar *, word volatile *, word volatile *, | 251 | extern int hysdn_sched_tx(hysdn_card *, unsigned char *, |
260 | word); | 252 | unsigned short volatile *, unsigned short volatile *, |
261 | extern int hysdn_sched_rx(hysdn_card *, uchar *, word, word); | 253 | unsigned short); |
262 | extern int hysdn_tx_cfgline(hysdn_card *, uchar *, word); /* send one cfg line */ | 254 | extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short, |
255 | unsigned short); | ||
256 | extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *, | ||
257 | unsigned short); /* send one cfg line */ | ||
263 | 258 | ||
264 | /* hysdn_net.c */ | 259 | /* hysdn_net.c */ |
265 | extern unsigned int hynet_enable; | 260 | extern unsigned int hynet_enable; |
@@ -269,14 +264,16 @@ extern int hysdn_net_release(hysdn_card *); /* delete the device */ | |||
269 | extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ | 264 | extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ |
270 | extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */ | 265 | extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */ |
271 | extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */ | 266 | extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */ |
272 | extern void hysdn_rx_netpkt(hysdn_card *, uchar *, word); /* rxed packet from network */ | 267 | extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *, |
268 | unsigned short); /* rxed packet from network */ | ||
273 | 269 | ||
274 | #ifdef CONFIG_HYSDN_CAPI | 270 | #ifdef CONFIG_HYSDN_CAPI |
275 | extern unsigned int hycapi_enable; | 271 | extern unsigned int hycapi_enable; |
276 | extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ | 272 | extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ |
277 | extern int hycapi_capi_release(hysdn_card *); /* delete the device */ | 273 | extern int hycapi_capi_release(hysdn_card *); /* delete the device */ |
278 | extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ | 274 | extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ |
279 | extern void hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len); | 275 | extern void hycapi_rx_capipkt(hysdn_card * card, unsigned char * buf, |
276 | unsigned short len); | ||
280 | extern void hycapi_tx_capiack(hysdn_card * card); | 277 | extern void hycapi_tx_capiack(hysdn_card * card); |
281 | extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); | 278 | extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); |
282 | extern int hycapi_init(void); | 279 | extern int hycapi_init(void); |
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index cb791f8e793a..b75ac5af236a 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c | |||
@@ -41,8 +41,8 @@ hysdn_card *card_root = NULL; /* pointer to first card */ | |||
41 | /* the last entry contains all 0 */ | 41 | /* the last entry contains all 0 */ |
42 | /**********************************************/ | 42 | /**********************************************/ |
43 | static struct { | 43 | static struct { |
44 | word subid; /* PCI sub id */ | 44 | unsigned short subid; /* PCI sub id */ |
45 | uchar cardtyp; /* card type assigned */ | 45 | unsigned char cardtyp; /* card type assigned */ |
46 | } pci_subid_map[] = { | 46 | } pci_subid_map[] = { |
47 | 47 | ||
48 | { | 48 | { |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index aa01628d74c6..d205249a1242 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "hysdn_defs.h" | 24 | #include "hysdn_defs.h" |
25 | 25 | ||
26 | unsigned int hynet_enable = 0xffffffff; | 26 | unsigned int hynet_enable = 0xffffffff; |
27 | MODULE_PARM(hynet_enable, "i"); | 27 | module_param(hynet_enable, uint, 0); |
28 | 28 | ||
29 | /* store the actual version for log reporting */ | 29 | /* store the actual version for log reporting */ |
30 | char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; | 30 | char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; |
@@ -83,12 +83,12 @@ net_open(struct net_device *dev) | |||
83 | 83 | ||
84 | /* Fill in the MAC-level header (if not already set) */ | 84 | /* Fill in the MAC-level header (if not already set) */ |
85 | if (!card->mac_addr[0]) { | 85 | if (!card->mac_addr[0]) { |
86 | for (i = 0; i < ETH_ALEN - sizeof(ulong); i++) | 86 | for (i = 0; i < ETH_ALEN - sizeof(unsigned long); i++) |
87 | dev->dev_addr[i] = 0xfc; | 87 | dev->dev_addr[i] = 0xfc; |
88 | if ((in_dev = dev->ip_ptr) != NULL) { | 88 | if ((in_dev = dev->ip_ptr) != NULL) { |
89 | struct in_ifaddr *ifa = in_dev->ifa_list; | 89 | struct in_ifaddr *ifa = in_dev->ifa_list; |
90 | if (ifa != NULL) | 90 | if (ifa != NULL) |
91 | memcpy(dev->dev_addr + (ETH_ALEN - sizeof(ulong)), &ifa->ifa_local, sizeof(ulong)); | 91 | memcpy(dev->dev_addr + (ETH_ALEN - sizeof(unsigned long)), &ifa->ifa_local, sizeof(unsigned long)); |
92 | } | 92 | } |
93 | } else | 93 | } else |
94 | memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN); | 94 | memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN); |
@@ -197,7 +197,7 @@ hysdn_tx_netack(hysdn_card * card) | |||
197 | /* we got a packet from the network, go and queue it */ | 197 | /* we got a packet from the network, go and queue it */ |
198 | /*****************************************************/ | 198 | /*****************************************************/ |
199 | void | 199 | void |
200 | hysdn_rx_netpkt(hysdn_card * card, uchar * buf, word len) | 200 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
201 | { | 201 | { |
202 | struct net_local *lp = card->netif; | 202 | struct net_local *lp = card->netif; |
203 | struct sk_buff *skb; | 203 | struct sk_buff *skb; |
diff --git a/drivers/isdn/hysdn/hysdn_pof.h b/drivers/isdn/hysdn/hysdn_pof.h index 6cd81b9b08bc..a368d6caca0e 100644 --- a/drivers/isdn/hysdn/hysdn_pof.h +++ b/drivers/isdn/hysdn/hysdn_pof.h | |||
@@ -47,20 +47,20 @@ | |||
47 | 47 | ||
48 | /*--------------------------------------POF file record structs------------*/ | 48 | /*--------------------------------------POF file record structs------------*/ |
49 | typedef struct PofFileHdr_tag { /* Pof file header */ | 49 | typedef struct PofFileHdr_tag { /* Pof file header */ |
50 | /*00 */ ulong Magic __attribute__((packed)); | 50 | /*00 */ unsigned long Magic __attribute__((packed)); |
51 | /*04 */ ulong N_PofRecs __attribute__((packed)); | 51 | /*04 */ unsigned long N_PofRecs __attribute__((packed)); |
52 | /*08 */ | 52 | /*08 */ |
53 | } tPofFileHdr; | 53 | } tPofFileHdr; |
54 | 54 | ||
55 | typedef struct PofRecHdr_tag { /* Pof record header */ | 55 | typedef struct PofRecHdr_tag { /* Pof record header */ |
56 | /*00 */ word PofRecId __attribute__((packed)); | 56 | /*00 */ unsigned short PofRecId __attribute__((packed)); |
57 | /*02 */ ulong PofRecDataLen __attribute__((packed)); | 57 | /*02 */ unsigned long PofRecDataLen __attribute__((packed)); |
58 | /*06 */ | 58 | /*06 */ |
59 | } tPofRecHdr; | 59 | } tPofRecHdr; |
60 | 60 | ||
61 | typedef struct PofTimeStamp_tag { | 61 | typedef struct PofTimeStamp_tag { |
62 | /*00 */ ulong UnixTime __attribute__((packed)); | 62 | /*00 */ unsigned long UnixTime __attribute__((packed)); |
63 | /*04 */ uchar DateTimeText[0x28] __attribute__((packed)); | 63 | /*04 */ unsigned char DateTimeText[0x28] __attribute__((packed)); |
64 | /* =40 */ | 64 | /* =40 */ |
65 | /*2C */ | 65 | /*2C */ |
66 | } tPofTimeStamp; | 66 | } tPofTimeStamp; |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 40e56143c768..8e2b03889f3c 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -36,9 +36,9 @@ struct conf_writedata { | |||
36 | int buf_size; /* actual number of bytes in the buffer */ | 36 | int buf_size; /* actual number of bytes in the buffer */ |
37 | int needed_size; /* needed size when reading pof */ | 37 | int needed_size; /* needed size when reading pof */ |
38 | int state; /* actual interface states from above constants */ | 38 | int state; /* actual interface states from above constants */ |
39 | uchar conf_line[CONF_LINE_LEN]; /* buffered conf line */ | 39 | unsigned char conf_line[CONF_LINE_LEN]; /* buffered conf line */ |
40 | word channel; /* active channel number */ | 40 | unsigned short channel; /* active channel number */ |
41 | uchar *pof_buffer; /* buffer when writing pof */ | 41 | unsigned char *pof_buffer; /* buffer when writing pof */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /***********************************************************************/ | 44 | /***********************************************************************/ |
@@ -49,7 +49,7 @@ struct conf_writedata { | |||
49 | static int | 49 | static int |
50 | process_line(struct conf_writedata *cnf) | 50 | process_line(struct conf_writedata *cnf) |
51 | { | 51 | { |
52 | uchar *cp = cnf->conf_line; | 52 | unsigned char *cp = cnf->conf_line; |
53 | int i; | 53 | int i; |
54 | 54 | ||
55 | if (cnf->card->debug_flags & LOG_CNF_LINE) | 55 | if (cnf->card->debug_flags & LOG_CNF_LINE) |
@@ -92,7 +92,7 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t | |||
92 | { | 92 | { |
93 | struct conf_writedata *cnf; | 93 | struct conf_writedata *cnf; |
94 | int i; | 94 | int i; |
95 | uchar ch, *cp; | 95 | unsigned char ch, *cp; |
96 | 96 | ||
97 | if (!count) | 97 | if (!count) |
98 | return (0); /* nothing to handle */ | 98 | return (0); /* nothing to handle */ |
@@ -390,7 +390,7 @@ int | |||
390 | hysdn_procconf_init(void) | 390 | hysdn_procconf_init(void) |
391 | { | 391 | { |
392 | hysdn_card *card; | 392 | hysdn_card *card; |
393 | uchar conf_name[20]; | 393 | unsigned char conf_name[20]; |
394 | 394 | ||
395 | hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net); | 395 | hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net); |
396 | if (!hysdn_proc_entry) { | 396 | if (!hysdn_proc_entry) { |
@@ -423,7 +423,7 @@ void | |||
423 | hysdn_procconf_release(void) | 423 | hysdn_procconf_release(void) |
424 | { | 424 | { |
425 | hysdn_card *card; | 425 | hysdn_card *card; |
426 | uchar conf_name[20]; | 426 | unsigned char conf_name[20]; |
427 | 427 | ||
428 | card = card_root; /* start with first card */ | 428 | card = card_root; /* start with first card */ |
429 | while (card) { | 429 | while (card) { |
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 6c26f1efabd5..c4301e8338ef 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -28,7 +28,7 @@ static void put_log_buffer(hysdn_card * card, char *cp); | |||
28 | /*************************************************/ | 28 | /*************************************************/ |
29 | struct log_data { | 29 | struct log_data { |
30 | struct log_data *next; | 30 | struct log_data *next; |
31 | ulong usage_cnt; /* number of files still to work */ | 31 | unsigned long usage_cnt;/* number of files still to work */ |
32 | void *proc_ctrl; /* pointer to own control procdata structure */ | 32 | void *proc_ctrl; /* pointer to own control procdata structure */ |
33 | char log_start[2]; /* log string start (final len aligned by size) */ | 33 | char log_start[2]; /* log string start (final len aligned by size) */ |
34 | }; | 34 | }; |
@@ -42,7 +42,7 @@ struct procdata { | |||
42 | struct log_data *log_head, *log_tail; /* head and tail for queue */ | 42 | struct log_data *log_head, *log_tail; /* head and tail for queue */ |
43 | int if_used; /* open count for interface */ | 43 | int if_used; /* open count for interface */ |
44 | int volatile del_lock; /* lock for delete operations */ | 44 | int volatile del_lock; /* lock for delete operations */ |
45 | uchar logtmp[LOG_MAX_LINELEN]; | 45 | unsigned char logtmp[LOG_MAX_LINELEN]; |
46 | wait_queue_head_t rd_queue; | 46 | wait_queue_head_t rd_queue; |
47 | }; | 47 | }; |
48 | 48 | ||
@@ -153,9 +153,9 @@ put_log_buffer(hysdn_card * card, char *cp) | |||
153 | static ssize_t | 153 | static ssize_t |
154 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) | 154 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) |
155 | { | 155 | { |
156 | ulong u = 0; | 156 | unsigned long u = 0; |
157 | int found = 0; | 157 | int found = 0; |
158 | uchar *cp, valbuf[128]; | 158 | unsigned char *cp, valbuf[128]; |
159 | long base = 10; | 159 | long base = 10; |
160 | hysdn_card *card = (hysdn_card *) file->private_data; | 160 | hysdn_card *card = (hysdn_card *) file->private_data; |
161 | 161 | ||
@@ -249,7 +249,7 @@ hysdn_log_open(struct inode *ino, struct file *filep) | |||
249 | { | 249 | { |
250 | hysdn_card *card; | 250 | hysdn_card *card; |
251 | struct procdata *pd = NULL; | 251 | struct procdata *pd = NULL; |
252 | ulong flags; | 252 | unsigned long flags; |
253 | 253 | ||
254 | lock_kernel(); | 254 | lock_kernel(); |
255 | card = card_root; | 255 | card = card_root; |
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c index 4fa3b01707cd..133032920ff8 100644 --- a/drivers/isdn/hysdn/hysdn_sched.c +++ b/drivers/isdn/hysdn/hysdn_sched.c | |||
@@ -30,7 +30,8 @@ | |||
30 | /* to keep the data until later. */ | 30 | /* to keep the data until later. */ |
31 | /*****************************************************************************/ | 31 | /*****************************************************************************/ |
32 | int | 32 | int |
33 | hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan) | 33 | hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len, |
34 | unsigned short chan) | ||
34 | { | 35 | { |
35 | 36 | ||
36 | switch (chan) { | 37 | switch (chan) { |
@@ -72,7 +73,9 @@ hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan) | |||
72 | /* sending. */ | 73 | /* sending. */ |
73 | /*****************************************************************************/ | 74 | /*****************************************************************************/ |
74 | int | 75 | int |
75 | hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile *chan, word maxlen) | 76 | hysdn_sched_tx(hysdn_card *card, unsigned char *buf, |
77 | unsigned short volatile *len, unsigned short volatile *chan, | ||
78 | unsigned short maxlen) | ||
76 | { | 79 | { |
77 | struct sk_buff *skb; | 80 | struct sk_buff *skb; |
78 | 81 | ||
@@ -145,10 +148,10 @@ hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile | |||
145 | /* are to be sent and this happens very seldom. */ | 148 | /* are to be sent and this happens very seldom. */ |
146 | /*****************************************************************************/ | 149 | /*****************************************************************************/ |
147 | int | 150 | int |
148 | hysdn_tx_cfgline(hysdn_card * card, uchar * line, word chan) | 151 | hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan) |
149 | { | 152 | { |
150 | int cnt = 50; /* timeout intervalls */ | 153 | int cnt = 50; /* timeout intervalls */ |
151 | ulong flags; | 154 | unsigned long flags; |
152 | 155 | ||
153 | if (card->debug_flags & LOG_SCHED_ASYN) | 156 | if (card->debug_flags & LOG_SCHED_ASYN) |
154 | hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); | 157 | hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); |
diff --git a/drivers/isdn/hysdn/ince1pc.h b/drivers/isdn/hysdn/ince1pc.h index 4a115a87c782..7a36694df6d7 100644 --- a/drivers/isdn/hysdn/ince1pc.h +++ b/drivers/isdn/hysdn/ince1pc.h | |||
@@ -62,7 +62,7 @@ | |||
62 | * s. RotlCRC algorithm | 62 | * s. RotlCRC algorithm |
63 | * | 63 | * |
64 | * RotlCRC algorithm: | 64 | * RotlCRC algorithm: |
65 | * ucSum= 0 1 uchar | 65 | * ucSum= 0 1 unsigned char |
66 | * for all NonEndTokenChunk bytes: | 66 | * for all NonEndTokenChunk bytes: |
67 | * ROTL(ucSum,1) rotate left by 1 | 67 | * ROTL(ucSum,1) rotate left by 1 |
68 | * ucSum += Char; add current byte with swap around | 68 | * ucSum += Char; add current byte with swap around |
@@ -85,13 +85,13 @@ | |||
85 | 85 | ||
86 | typedef struct ErrLogEntry_tag { | 86 | typedef struct ErrLogEntry_tag { |
87 | 87 | ||
88 | /*00 */ ulong ulErrType; | 88 | /*00 */ unsigned long ulErrType; |
89 | 89 | ||
90 | /*04 */ ulong ulErrSubtype; | 90 | /*04 */ unsigned long ulErrSubtype; |
91 | 91 | ||
92 | /*08 */ uchar ucTextSize; | 92 | /*08 */ unsigned char ucTextSize; |
93 | 93 | ||
94 | /*09 */ uchar ucText[ERRLOG_TEXT_SIZE]; | 94 | /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE]; |
95 | /* ASCIIZ of len ucTextSize-1 */ | 95 | /* ASCIIZ of len ucTextSize-1 */ |
96 | 96 | ||
97 | /*40 */ | 97 | /*40 */ |
@@ -111,13 +111,13 @@ typedef struct ErrLogEntry_tag { | |||
111 | #define DPRAM_SPOOLER_DATA_SIZE 0x20 | 111 | #define DPRAM_SPOOLER_DATA_SIZE 0x20 |
112 | typedef struct DpramBootSpooler_tag { | 112 | typedef struct DpramBootSpooler_tag { |
113 | 113 | ||
114 | /*00 */ uchar Len; | 114 | /*00 */ unsigned char Len; |
115 | 115 | ||
116 | /*01 */ volatile uchar RdPtr; | 116 | /*01 */ volatile unsigned char RdPtr; |
117 | 117 | ||
118 | /*02 */ uchar WrPtr; | 118 | /*02 */ unsigned char WrPtr; |
119 | 119 | ||
120 | /*03 */ uchar Data[DPRAM_SPOOLER_DATA_SIZE]; | 120 | /*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE]; |
121 | 121 | ||
122 | /*23 */ | 122 | /*23 */ |
123 | } tDpramBootSpooler; | 123 | } tDpramBootSpooler; |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 1a19a0f89428..b9fed8a3bcc6 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -782,7 +782,8 @@ isdn_ppp_read(int min, struct file *file, char __user *buf, int count) | |||
782 | is->first = b; | 782 | is->first = b; |
783 | 783 | ||
784 | spin_unlock_irqrestore(&is->buflock, flags); | 784 | spin_unlock_irqrestore(&is->buflock, flags); |
785 | copy_to_user(buf, save_buf, count); | 785 | if (copy_to_user(buf, save_buf, count)) |
786 | count = -EFAULT; | ||
786 | kfree(save_buf); | 787 | kfree(save_buf); |
787 | 788 | ||
788 | return count; | 789 | return count; |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index aeaa1db74bd8..3585fb1f3344 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -2345,12 +2345,15 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2345 | u_long flags; | 2345 | u_long flags; |
2346 | struct sk_buff *skb = NULL; | 2346 | struct sk_buff *skb = NULL; |
2347 | char *sp = NULL; | 2347 | char *sp = NULL; |
2348 | int l = strlen(msg); | 2348 | int l; |
2349 | 2349 | ||
2350 | if (!msg) { | 2350 | if (!msg) { |
2351 | printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); | 2351 | printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); |
2352 | return; | 2352 | return; |
2353 | } | 2353 | } |
2354 | |||
2355 | l = strlen(msg); | ||
2356 | |||
2354 | spin_lock_irqsave(&info->readlock, flags); | 2357 | spin_lock_irqsave(&info->readlock, flags); |
2355 | tty = info->tty; | 2358 | tty = info->tty; |
2356 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) { | 2359 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) { |
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index 33d339700411..a67d31af797a 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c | |||
@@ -22,7 +22,7 @@ static char *isdnloop_id = "loop0"; | |||
22 | MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); | 22 | MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); |
23 | MODULE_AUTHOR("Fritz Elfert"); | 23 | MODULE_AUTHOR("Fritz Elfert"); |
24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
25 | MODULE_PARM(isdnloop_id, "s"); | 25 | module_param(isdnloop_id, charp, 0); |
26 | MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); | 26 | MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); |
27 | 27 | ||
28 | static int isdnloop_addcard(char *); | 28 | static int isdnloop_addcard(char *); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index eae4473eadde..670eb01a5a23 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -556,7 +556,7 @@ static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, | |||
556 | unsigned long flags; | 556 | unsigned long flags; |
557 | 557 | ||
558 | spin_lock_irqsave(&bitmap->lock, flags); | 558 | spin_lock_irqsave(&bitmap->lock, flags); |
559 | if (!bitmap || !bitmap->sb_page) { /* can't set the state */ | 559 | if (!bitmap->sb_page) { /* can't set the state */ |
560 | spin_unlock_irqrestore(&bitmap->lock, flags); | 560 | spin_unlock_irqrestore(&bitmap->lock, flags); |
561 | return; | 561 | return; |
562 | } | 562 | } |
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index 9d340aa443c3..6ac3b6740089 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c | |||
@@ -70,10 +70,10 @@ MODULE_AUTHOR("Pauline Middelink <middelin@polyware.nl>"); | |||
70 | MODULE_DESCRIPTION("Zoran ZR36120 based framegrabber"); | 70 | MODULE_DESCRIPTION("Zoran ZR36120 based framegrabber"); |
71 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
72 | 72 | ||
73 | MODULE_PARM(triton1,"i"); | 73 | module_param(triton1, uint, 0); |
74 | MODULE_PARM(cardtype,"1-" __MODULE_STRING(ZORAN_MAX) "i"); | 74 | module_param_array(cardtype, uint, NULL, 0); |
75 | MODULE_PARM(video_nr,"i"); | 75 | module_param(video_nr, int, 0); |
76 | MODULE_PARM(vbi_nr,"i"); | 76 | module_param(vbi_nr, int, 0); |
77 | 77 | ||
78 | static int zoran_cards; | 78 | static int zoran_cards; |
79 | static struct zoran zorans[ZORAN_MAX]; | 79 | static struct zoran zorans[ZORAN_MAX]; |
diff --git a/drivers/message/i2o/debug.c b/drivers/message/i2o/debug.c index 40d4ea898dbc..5a6cca8e8c45 100644 --- a/drivers/message/i2o/debug.c +++ b/drivers/message/i2o/debug.c | |||
@@ -419,58 +419,53 @@ void i2o_dump_hrt(struct i2o_controller *c) | |||
419 | d = (u8 *) (rows + 2); | 419 | d = (u8 *) (rows + 2); |
420 | state = p[1] << 8 | p[0]; | 420 | state = p[1] << 8 | p[0]; |
421 | 421 | ||
422 | printk(KERN_DEBUG "TID %04X:[", state & 0xFFF); | 422 | printk("TID %04X:[", state & 0xFFF); |
423 | state >>= 12; | 423 | state >>= 12; |
424 | if (state & (1 << 0)) | 424 | if (state & (1 << 0)) |
425 | printk(KERN_DEBUG "H"); /* Hidden */ | 425 | printk("H"); /* Hidden */ |
426 | if (state & (1 << 2)) { | 426 | if (state & (1 << 2)) { |
427 | printk(KERN_DEBUG "P"); /* Present */ | 427 | printk("P"); /* Present */ |
428 | if (state & (1 << 1)) | 428 | if (state & (1 << 1)) |
429 | printk(KERN_DEBUG "C"); /* Controlled */ | 429 | printk("C"); /* Controlled */ |
430 | } | 430 | } |
431 | if (state > 9) | 431 | if (state > 9) |
432 | printk(KERN_DEBUG "*"); /* Hard */ | 432 | printk("*"); /* Hard */ |
433 | 433 | ||
434 | printk(KERN_DEBUG "]:"); | 434 | printk("]:"); |
435 | 435 | ||
436 | switch (p[3] & 0xFFFF) { | 436 | switch (p[3] & 0xFFFF) { |
437 | case 0: | 437 | case 0: |
438 | /* Adapter private bus - easy */ | 438 | /* Adapter private bus - easy */ |
439 | printk(KERN_DEBUG | 439 | printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], |
440 | "Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], | ||
441 | d[1] << 8 | d[0], *(u32 *) (d + 4)); | 440 | d[1] << 8 | d[0], *(u32 *) (d + 4)); |
442 | break; | 441 | break; |
443 | case 1: | 442 | case 1: |
444 | /* ISA bus */ | 443 | /* ISA bus */ |
445 | printk(KERN_DEBUG | 444 | printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], |
446 | "ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], | ||
447 | d[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); | 445 | d[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
448 | break; | 446 | break; |
449 | 447 | ||
450 | case 2: /* EISA bus */ | 448 | case 2: /* EISA bus */ |
451 | printk(KERN_DEBUG | 449 | printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", |
452 | "EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", | ||
453 | p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); | 450 | p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
454 | break; | 451 | break; |
455 | 452 | ||
456 | case 3: /* MCA bus */ | 453 | case 3: /* MCA bus */ |
457 | printk(KERN_DEBUG | 454 | printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], |
458 | "MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], | ||
459 | d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); | 455 | d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
460 | break; | 456 | break; |
461 | 457 | ||
462 | case 4: /* PCI bus */ | 458 | case 4: /* PCI bus */ |
463 | printk(KERN_DEBUG | 459 | printk("PCI %d: Bus %d Device %d Function %d", p[2], |
464 | "PCI %d: Bus %d Device %d Function %d", p[2], | ||
465 | d[2], d[1], d[0]); | 460 | d[2], d[1], d[0]); |
466 | break; | 461 | break; |
467 | 462 | ||
468 | case 0x80: /* Other */ | 463 | case 0x80: /* Other */ |
469 | default: | 464 | default: |
470 | printk(KERN_DEBUG "Unsupported bus type."); | 465 | printk("Unsupported bus type."); |
471 | break; | 466 | break; |
472 | } | 467 | } |
473 | printk(KERN_DEBUG "\n"); | 468 | printk("\n"); |
474 | rows += length; | 469 | rows += length; |
475 | } | 470 | } |
476 | } | 471 | } |
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 8d84b045bc83..85e89c77bdea 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c | |||
@@ -87,7 +87,7 @@ struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; | |||
87 | static int dma = 1; | 87 | static int dma = 1; |
88 | 88 | ||
89 | #ifdef MODULE | 89 | #ifdef MODULE |
90 | MODULE_PARM(dma, "i"); | 90 | module_param(dma, bool, 0); |
91 | MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)"); | 91 | MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)"); |
92 | #endif | 92 | #endif |
93 | 93 | ||
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index f0f8916da7ad..f988c817e196 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #ifdef CONFIG_MTD_DEBUG | 29 | #ifdef CONFIG_MTD_DEBUG |
30 | static int debug = CONFIG_MTD_DEBUG_VERBOSE; | 30 | static int debug = CONFIG_MTD_DEBUG_VERBOSE; |
31 | MODULE_PARM(debug, "i"); | 31 | module_param(debug, int, 0); |
32 | MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy"); | 32 | MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy"); |
33 | #undef DEBUG | 33 | #undef DEBUG |
34 | #define DEBUG(n, format, arg...) \ | 34 | #define DEBUG(n, format, arg...) \ |
@@ -89,17 +89,17 @@ static int mem_type; | |||
89 | MODULE_LICENSE("GPL"); | 89 | MODULE_LICENSE("GPL"); |
90 | MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>"); | 90 | MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>"); |
91 | MODULE_DESCRIPTION(DRIVER_DESC); | 91 | MODULE_DESCRIPTION(DRIVER_DESC); |
92 | MODULE_PARM(bankwidth, "i"); | 92 | module_param(bankwidth, int, 0); |
93 | MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)"); | 93 | MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)"); |
94 | MODULE_PARM(mem_speed, "i"); | 94 | module_param(mem_speed, int, 0); |
95 | MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns"); | 95 | MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns"); |
96 | MODULE_PARM(force_size, "i"); | 96 | module_param(force_size, int, 0); |
97 | MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)"); | 97 | MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)"); |
98 | MODULE_PARM(setvpp, "i"); | 98 | module_param(setvpp, int, 0); |
99 | MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)"); | 99 | MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)"); |
100 | MODULE_PARM(vpp, "i"); | 100 | module_param(vpp, int, 0); |
101 | MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)"); | 101 | MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)"); |
102 | MODULE_PARM(mem_type, "i"); | 102 | module_param(mem_type, int, 0); |
103 | MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)"); | 103 | MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)"); |
104 | 104 | ||
105 | 105 | ||
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 5d11a06ecb2c..d339308539fa 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -1096,14 +1096,18 @@ static int __init vortex_eisa_init (void) | |||
1096 | int orig_cards_found = vortex_cards_found; | 1096 | int orig_cards_found = vortex_cards_found; |
1097 | 1097 | ||
1098 | #ifdef CONFIG_EISA | 1098 | #ifdef CONFIG_EISA |
1099 | if (eisa_driver_register (&vortex_eisa_driver) >= 0) { | 1099 | int err; |
1100 | /* Because of the way EISA bus is probed, we cannot assume | 1100 | |
1101 | * any device have been found when we exit from | 1101 | err = eisa_driver_register (&vortex_eisa_driver); |
1102 | * eisa_driver_register (the bus root driver may not be | 1102 | if (!err) { |
1103 | * initialized yet). So we blindly assume something was | 1103 | /* |
1104 | * found, and let the sysfs magic happend... */ | 1104 | * Because of the way EISA bus is probed, we cannot assume |
1105 | 1105 | * any device have been found when we exit from | |
1106 | eisa_found = 1; | 1106 | * eisa_driver_register (the bus root driver may not be |
1107 | * initialized yet). So we blindly assume something was | ||
1108 | * found, and let the sysfs magic happend... | ||
1109 | */ | ||
1110 | eisa_found = 1; | ||
1107 | } | 1111 | } |
1108 | #endif | 1112 | #endif |
1109 | 1113 | ||
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 8e538a6d7d97..79bb56b8dcef 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -829,7 +829,7 @@ static void __devexit a2065_remove_one(struct zorro_dev *z) | |||
829 | 829 | ||
830 | static int __init a2065_init_module(void) | 830 | static int __init a2065_init_module(void) |
831 | { | 831 | { |
832 | return zorro_module_init(&a2065_driver); | 832 | return zorro_register_driver(&a2065_driver); |
833 | } | 833 | } |
834 | 834 | ||
835 | static void __exit a2065_cleanup_module(void) | 835 | static void __exit a2065_cleanup_module(void) |
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index 9fe93acfc8ef..d1b6b1f794e2 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c | |||
@@ -864,7 +864,7 @@ static void __devexit ariadne_remove_one(struct zorro_dev *z) | |||
864 | 864 | ||
865 | static int __init ariadne_init_module(void) | 865 | static int __init ariadne_init_module(void) |
866 | { | 866 | { |
867 | return zorro_module_init(&ariadne_driver); | 867 | return zorro_register_driver(&ariadne_driver); |
868 | } | 868 | } |
869 | 869 | ||
870 | static void __exit ariadne_cleanup_module(void) | 870 | static void __exit ariadne_cleanup_module(void) |
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 0095384ff454..5e5f80b99b9e 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c | |||
@@ -123,7 +123,7 @@ static char version[] = | |||
123 | * Global variable 'bionet_debug'. Can be set at load time by 'insmod' | 123 | * Global variable 'bionet_debug'. Can be set at load time by 'insmod' |
124 | */ | 124 | */ |
125 | unsigned int bionet_debug = NET_DEBUG; | 125 | unsigned int bionet_debug = NET_DEBUG; |
126 | MODULE_PARM(bionet_debug, "i"); | 126 | module_param(bionet_debug, int, 0); |
127 | MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)"); | 127 | MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)"); |
128 | MODULE_LICENSE("GPL"); | 128 | MODULE_LICENSE("GPL"); |
129 | 129 | ||
diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c index 8b997809f9de..d6039e62d832 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c | |||
@@ -119,7 +119,7 @@ static char *version = | |||
119 | * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod' | 119 | * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod' |
120 | */ | 120 | */ |
121 | unsigned int pamsnet_debug = NET_DEBUG; | 121 | unsigned int pamsnet_debug = NET_DEBUG; |
122 | MODULE_PARM(pamsnet_debug, "i"); | 122 | module_param(pamsnet_debug, int, 0); |
123 | MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)"); | 123 | MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)"); |
124 | MODULE_LICENSE("GPL"); | 124 | MODULE_LICENSE("GPL"); |
125 | 125 | ||
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index e01b6a78ec63..442b2cbeb58a 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -78,7 +78,7 @@ static int lance_debug = LANCE_DEBUG; | |||
78 | #else | 78 | #else |
79 | static int lance_debug = 1; | 79 | static int lance_debug = 1; |
80 | #endif | 80 | #endif |
81 | MODULE_PARM(lance_debug, "i"); | 81 | module_param(lance_debug, int, 0); |
82 | MODULE_PARM_DESC(lance_debug, "atarilance debug level (0-3)"); | 82 | MODULE_PARM_DESC(lance_debug, "atarilance debug level (0-3)"); |
83 | MODULE_LICENSE("GPL"); | 83 | MODULE_LICENSE("GPL"); |
84 | 84 | ||
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 8f1573e658a5..ac48f7543500 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -192,12 +192,15 @@ | |||
192 | static char version[] __devinitdata = | 192 | static char version[] __devinitdata = |
193 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 193 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
194 | 194 | ||
195 | static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ | ||
196 | static int link_mode; | ||
197 | |||
195 | MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)"); | 198 | MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)"); |
196 | MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver"); | 199 | MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver"); |
197 | MODULE_LICENSE("GPL"); | 200 | MODULE_LICENSE("GPL"); |
198 | MODULE_PARM(cassini_debug, "i"); | 201 | module_param(cassini_debug, int, 0); |
199 | MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); | 202 | MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); |
200 | MODULE_PARM(link_mode, "i"); | 203 | module_param(link_mode, int, 0); |
201 | MODULE_PARM_DESC(link_mode, "default link mode"); | 204 | MODULE_PARM_DESC(link_mode, "default link mode"); |
202 | 205 | ||
203 | /* | 206 | /* |
@@ -209,7 +212,7 @@ MODULE_PARM_DESC(link_mode, "default link mode"); | |||
209 | * Value in seconds, for user input. | 212 | * Value in seconds, for user input. |
210 | */ | 213 | */ |
211 | static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; | 214 | static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; |
212 | MODULE_PARM(linkdown_timeout, "i"); | 215 | module_param(linkdown_timeout, int, 0); |
213 | MODULE_PARM_DESC(linkdown_timeout, | 216 | MODULE_PARM_DESC(linkdown_timeout, |
214 | "min reset interval in sec. for PCS linkdown issue; disabled if not positive"); | 217 | "min reset interval in sec. for PCS linkdown issue; disabled if not positive"); |
215 | 218 | ||
@@ -221,8 +224,6 @@ MODULE_PARM_DESC(linkdown_timeout, | |||
221 | static int link_transition_timeout; | 224 | static int link_transition_timeout; |
222 | 225 | ||
223 | 226 | ||
224 | static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ | ||
225 | static int link_mode; | ||
226 | 227 | ||
227 | static u16 link_modes[] __devinitdata = { | 228 | static u16 link_modes[] __devinitdata = { |
228 | BMCR_ANENABLE, /* 0 : autoneg */ | 229 | BMCR_ANENABLE, /* 0 : autoneg */ |
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 349ebe783ed6..7fe2638ae06d 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -124,7 +124,7 @@ MODULE_LICENSE("GPL"); | |||
124 | 124 | ||
125 | static int dflt_msg_enable = DFLT_MSG_ENABLE; | 125 | static int dflt_msg_enable = DFLT_MSG_ENABLE; |
126 | 126 | ||
127 | MODULE_PARM(dflt_msg_enable, "i"); | 127 | module_param(dflt_msg_enable, int, 0); |
128 | MODULE_PARM_DESC(dflt_msg_enable, "Chelsio T1 message enable bitmap"); | 128 | MODULE_PARM_DESC(dflt_msg_enable, "Chelsio T1 message enable bitmap"); |
129 | 129 | ||
130 | 130 | ||
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 32d13166c6e8..e175d4876682 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c | |||
@@ -1551,7 +1551,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi- | |||
1551 | static int __init dgrs_init_module (void) | 1551 | static int __init dgrs_init_module (void) |
1552 | { | 1552 | { |
1553 | int i; | 1553 | int i; |
1554 | int cardcount = 0; | 1554 | int err; |
1555 | 1555 | ||
1556 | /* | 1556 | /* |
1557 | * Command line variable overrides | 1557 | * Command line variable overrides |
@@ -1593,13 +1593,13 @@ static int __init dgrs_init_module (void) | |||
1593 | * Find and configure all the cards | 1593 | * Find and configure all the cards |
1594 | */ | 1594 | */ |
1595 | #ifdef CONFIG_EISA | 1595 | #ifdef CONFIG_EISA |
1596 | cardcount = eisa_driver_register(&dgrs_eisa_driver); | 1596 | err = eisa_driver_register(&dgrs_eisa_driver); |
1597 | if (cardcount < 0) | 1597 | if (err) |
1598 | return cardcount; | 1598 | return err; |
1599 | #endif | 1599 | #endif |
1600 | cardcount = pci_register_driver(&dgrs_pci_driver); | 1600 | err = pci_register_driver(&dgrs_pci_driver); |
1601 | if (cardcount) | 1601 | if (err) |
1602 | return cardcount; | 1602 | return err; |
1603 | return 0; | 1603 | return 0; |
1604 | } | 1604 | } |
1605 | 1605 | ||
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index b4f3a9f8a535..7e4338097139 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c | |||
@@ -55,11 +55,11 @@ MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); | |||
55 | MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver"); | 55 | MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver"); |
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | 57 | ||
58 | MODULE_PARM(fec_8xx_debug, "i"); | 58 | int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ |
59 | module_param(fec_8xx_debug, int, 0); | ||
59 | MODULE_PARM_DESC(fec_8xx_debug, | 60 | MODULE_PARM_DESC(fec_8xx_debug, |
60 | "FEC 8xx bitmapped debugging message enable value"); | 61 | "FEC 8xx bitmapped debugging message enable value"); |
61 | 62 | ||
62 | int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ | ||
63 | 63 | ||
64 | /*************************************************/ | 64 | /*************************************************/ |
65 | 65 | ||
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f5d49a110654..196298f33db8 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -58,11 +58,11 @@ MODULE_DESCRIPTION("Freescale Ethernet Driver"); | |||
58 | MODULE_LICENSE("GPL"); | 58 | MODULE_LICENSE("GPL"); |
59 | MODULE_VERSION(DRV_MODULE_VERSION); | 59 | MODULE_VERSION(DRV_MODULE_VERSION); |
60 | 60 | ||
61 | MODULE_PARM(fs_enet_debug, "i"); | 61 | int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */ |
62 | module_param(fs_enet_debug, int, 0); | ||
62 | MODULE_PARM_DESC(fs_enet_debug, | 63 | MODULE_PARM_DESC(fs_enet_debug, |
63 | "Freescale bitmapped debugging message enable value"); | 64 | "Freescale bitmapped debugging message enable value"); |
64 | 65 | ||
65 | int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */ | ||
66 | 66 | ||
67 | static void fs_set_multicast_list(struct net_device *dev) | 67 | static void fs_set_multicast_list(struct net_device *dev) |
68 | { | 68 | { |
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 5958a6314723..2d2435404614 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c | |||
@@ -114,8 +114,8 @@ static int max_interrupt_work = 32; | |||
114 | 114 | ||
115 | static char mac0[18] = "00.02.03.04.05.06"; | 115 | static char mac0[18] = "00.02.03.04.05.06"; |
116 | static char mac1[18] = "00.01.02.03.04.05"; | 116 | static char mac1[18] = "00.01.02.03.04.05"; |
117 | MODULE_PARM(mac0, "c18"); | 117 | module_param_string(mac0, mac0, 18, 0); |
118 | MODULE_PARM(mac1, "c18"); | 118 | module_param_string(mac1, mac0, 18, 0); |
119 | MODULE_PARM_DESC(mac0, "MAC address for GT96100 ethernet port 0"); | 119 | MODULE_PARM_DESC(mac0, "MAC address for GT96100 ethernet port 0"); |
120 | MODULE_PARM_DESC(mac1, "MAC address for GT96100 ethernet port 1"); | 120 | MODULE_PARM_DESC(mac1, "MAC address for GT96100 ethernet port 1"); |
121 | 121 | ||
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index c8dc40214a08..79a8fbcf5f93 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c | |||
@@ -280,7 +280,7 @@ static unsigned long rand; | |||
280 | 280 | ||
281 | MODULE_AUTHOR("Klaus Kudielka"); | 281 | MODULE_AUTHOR("Klaus Kudielka"); |
282 | MODULE_DESCRIPTION("Driver for high-speed SCC boards"); | 282 | MODULE_DESCRIPTION("Driver for high-speed SCC boards"); |
283 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NUM_DEVS) "i"); | 283 | module_param_array(io, int, NULL, 0); |
284 | MODULE_LICENSE("GPL"); | 284 | MODULE_LICENSE("GPL"); |
285 | 285 | ||
286 | static void __exit dmascc_exit(void) | 286 | static void __exit dmascc_exit(void) |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index dc5e9d59deed..d81a8e1eeb8d 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -1012,7 +1012,7 @@ static void __exit mkiss_exit_driver(void) | |||
1012 | 1012 | ||
1013 | MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); | 1013 | MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); |
1014 | MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); | 1014 | MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); |
1015 | MODULE_PARM(crc_force, "i"); | 1015 | module_param(crc_force, int, 0); |
1016 | MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); | 1016 | MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); |
1017 | MODULE_LICENSE("GPL"); | 1017 | MODULE_LICENSE("GPL"); |
1018 | MODULE_ALIAS_LDISC(N_AX25); | 1018 | MODULE_ALIAS_LDISC(N_AX25); |
diff --git a/drivers/net/hplance.c b/drivers/net/hplance.c index d8410634bcaf..685693464605 100644 --- a/drivers/net/hplance.c +++ b/drivers/net/hplance.c | |||
@@ -217,7 +217,7 @@ static int hplance_close(struct net_device *dev) | |||
217 | 217 | ||
218 | int __init hplance_init_module(void) | 218 | int __init hplance_init_module(void) |
219 | { | 219 | { |
220 | return dio_module_init(&hplance_driver); | 220 | return dio_register_driver(&hplance_driver); |
221 | } | 221 | } |
222 | 222 | ||
223 | void __exit hplance_cleanup_module(void) | 223 | void __exit hplance_cleanup_module(void) |
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c index 6e0ca7340a8f..d9fb8e74e631 100644 --- a/drivers/net/hydra.c +++ b/drivers/net/hydra.c | |||
@@ -242,7 +242,7 @@ static void __devexit hydra_remove_one(struct zorro_dev *z) | |||
242 | 242 | ||
243 | static int __init hydra_init_module(void) | 243 | static int __init hydra_init_module(void) |
244 | { | 244 | { |
245 | return zorro_module_init(&hydra_driver); | 245 | return zorro_register_driver(&hydra_driver); |
246 | } | 246 | } |
247 | 247 | ||
248 | static void __exit hydra_cleanup_module(void) | 248 | static void __exit hydra_cleanup_module(void) |
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c index 6070195b87bd..98fa5319e5cc 100644 --- a/drivers/net/irda/irport.c +++ b/drivers/net/irda/irport.c | |||
@@ -1118,9 +1118,9 @@ static void __exit irport_cleanup(void) | |||
1118 | } | 1118 | } |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | MODULE_PARM(io, "1-4i"); | 1121 | module_param_array(io, int, NULL, 0); |
1122 | MODULE_PARM_DESC(io, "Base I/O addresses"); | 1122 | MODULE_PARM_DESC(io, "Base I/O addresses"); |
1123 | MODULE_PARM(irq, "1-4i"); | 1123 | module_param_array(irq, int, NULL, 0); |
1124 | MODULE_PARM_DESC(irq, "IRQ lines"); | 1124 | MODULE_PARM_DESC(irq, "IRQ lines"); |
1125 | 1125 | ||
1126 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | 1126 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); |
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index f7b7238d8352..957888de3d7e 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c | |||
@@ -177,7 +177,7 @@ static int i596_debug = (DEB_SERIOUS|DEB_PROBE); | |||
177 | MODULE_AUTHOR("Richard Hirst"); | 177 | MODULE_AUTHOR("Richard Hirst"); |
178 | MODULE_DESCRIPTION("i82596 driver"); | 178 | MODULE_DESCRIPTION("i82596 driver"); |
179 | MODULE_LICENSE("GPL"); | 179 | MODULE_LICENSE("GPL"); |
180 | MODULE_PARM(i596_debug, "i"); | 180 | module_param(i596_debug, int, 0); |
181 | MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask"); | 181 | MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask"); |
182 | 182 | ||
183 | /* Copy frames shorter than rx_copybreak, otherwise pass on up in | 183 | /* Copy frames shorter than rx_copybreak, otherwise pass on up in |
@@ -1520,9 +1520,9 @@ static void set_multicast_list(struct net_device *dev) | |||
1520 | } | 1520 | } |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | MODULE_PARM(debug, "i"); | ||
1524 | MODULE_PARM_DESC(debug, "lasi_82596 debug mask"); | ||
1525 | static int debug = -1; | 1523 | static int debug = -1; |
1524 | module_param(debug, int, 0); | ||
1525 | MODULE_PARM_DESC(debug, "lasi_82596 debug mask"); | ||
1526 | 1526 | ||
1527 | static int num_drivers; | 1527 | static int num_drivers; |
1528 | static struct net_device *netdevs[MAX_DRIVERS]; | 1528 | static struct net_device *netdevs[MAX_DRIVERS]; |
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index f65b0db111b8..cd3c9a5a98b2 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c | |||
@@ -629,7 +629,7 @@ static int set_mac_address(struct net_device *dev, void *addr) | |||
629 | static struct net_device *dev_cs89x0; | 629 | static struct net_device *dev_cs89x0; |
630 | static int debug; | 630 | static int debug; |
631 | 631 | ||
632 | MODULE_PARM(debug, "i"); | 632 | module_param(debug, int, 0); |
633 | MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); | 633 | MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); |
634 | MODULE_LICENSE("GPL"); | 634 | MODULE_LICENSE("GPL"); |
635 | 635 | ||
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 2a5add257b8f..77792b286027 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -1042,7 +1042,7 @@ static void __exit mace_cleanup(void) | |||
1042 | 1042 | ||
1043 | MODULE_AUTHOR("Paul Mackerras"); | 1043 | MODULE_AUTHOR("Paul Mackerras"); |
1044 | MODULE_DESCRIPTION("PowerMac MACE driver."); | 1044 | MODULE_DESCRIPTION("PowerMac MACE driver."); |
1045 | MODULE_PARM(port_aaui, "i"); | 1045 | module_param(port_aaui, int, 0); |
1046 | MODULE_PARM_DESC(port_aaui, "MACE uses AAUI port (0-1)"); | 1046 | MODULE_PARM_DESC(port_aaui, "MACE uses AAUI port (0-1)"); |
1047 | MODULE_LICENSE("GPL"); | 1047 | MODULE_LICENSE("GPL"); |
1048 | 1048 | ||
diff --git a/drivers/net/meth.c b/drivers/net/meth.c index e23655f5049f..d644bf3a933c 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c | |||
@@ -62,7 +62,7 @@ MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver"); | |||
62 | 62 | ||
63 | #ifdef HAVE_TX_TIMEOUT | 63 | #ifdef HAVE_TX_TIMEOUT |
64 | static int timeout = TX_TIMEOUT; | 64 | static int timeout = TX_TIMEOUT; |
65 | MODULE_PARM(timeout, "i"); | 65 | module_param(timeout, int, 0); |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | /* | 68 | /* |
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c index aaebd28a1920..7ea3d596ac3b 100644 --- a/drivers/net/ne-h8300.c +++ b/drivers/net/ne-h8300.c | |||
@@ -601,9 +601,9 @@ static int io[MAX_NE_CARDS]; | |||
601 | static int irq[MAX_NE_CARDS]; | 601 | static int irq[MAX_NE_CARDS]; |
602 | static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */ | 602 | static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */ |
603 | 603 | ||
604 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); | 604 | module_param_array(io, int, NULL, 0); |
605 | MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); | 605 | module_param_array(irq, int, NULL, 0); |
606 | MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); | 606 | module_param_array(bad, int, NULL, 0); |
607 | MODULE_PARM_DESC(io, "I/O base address(es)"); | 607 | MODULE_PARM_DESC(io, "I/O base address(es)"); |
608 | MODULE_PARM_DESC(irq, "IRQ number(s)"); | 608 | MODULE_PARM_DESC(irq, "IRQ number(s)"); |
609 | MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver"); | 609 | MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver"); |
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index 2ab01a5d1d22..a68bf474f6ed 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c | |||
@@ -766,8 +766,8 @@ static void ni5010_show_registers(struct net_device *dev) | |||
766 | #ifdef MODULE | 766 | #ifdef MODULE |
767 | static struct net_device *dev_ni5010; | 767 | static struct net_device *dev_ni5010; |
768 | 768 | ||
769 | MODULE_PARM(io, "i"); | 769 | module_param(io, int, 0); |
770 | MODULE_PARM(irq, "i"); | 770 | module_param(irq, int, 0); |
771 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); | 771 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); |
772 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); | 772 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); |
773 | 773 | ||
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 01bdb2334058..d4c0002b43db 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -71,7 +71,7 @@ static int lance_debug = LANCE_DEBUG; | |||
71 | #else | 71 | #else |
72 | static int lance_debug = 1; | 72 | static int lance_debug = 1; |
73 | #endif | 73 | #endif |
74 | MODULE_PARM(lance_debug, "i"); | 74 | module_param(lance_debug, int, 0); |
75 | MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)"); | 75 | MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)"); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
77 | 77 | ||
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 761021603597..8037e5806d0a 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c | |||
@@ -426,7 +426,7 @@ static void __devexit zorro8390_remove_one(struct zorro_dev *z) | |||
426 | 426 | ||
427 | static int __init zorro8390_init_module(void) | 427 | static int __init zorro8390_init_module(void) |
428 | { | 428 | { |
429 | return zorro_module_init(&zorro8390_driver); | 429 | return zorro_register_driver(&zorro8390_driver); |
430 | } | 430 | } |
431 | 431 | ||
432 | static void __exit zorro8390_cleanup_module(void) | 432 | static void __exit zorro8390_cleanup_module(void) |
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 57fd60314d59..b1b4b683cbdd 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -646,8 +646,10 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
646 | size = 0; | 646 | size = 0; |
647 | skip = 0; | 647 | skip = 0; |
648 | option = pnp_register_independent_option(dev); | 648 | option = pnp_register_independent_option(dev); |
649 | if (!option) | 649 | if (!option) { |
650 | kfree(dev); | ||
650 | return 1; | 651 | return 1; |
652 | } | ||
651 | pnp_add_card_device(card,dev); | 653 | pnp_add_card_device(card,dev); |
652 | } else { | 654 | } else { |
653 | skip = 1; | 655 | skip = 1; |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index dfe542b206cc..7967916bda18 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -43,7 +43,6 @@ MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>"); | |||
43 | MODULE_DESCRIPTION("Linux on S/390 DASD device driver," | 43 | MODULE_DESCRIPTION("Linux on S/390 DASD device driver," |
44 | " Copyright 2000 IBM Corporation"); | 44 | " Copyright 2000 IBM Corporation"); |
45 | MODULE_SUPPORTED_DEVICE("dasd"); | 45 | MODULE_SUPPORTED_DEVICE("dasd"); |
46 | MODULE_PARM(dasd, "1-" __MODULE_STRING(256) "s"); | ||
47 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
48 | 47 | ||
49 | /* | 48 | /* |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index f576f243cd93..2f720108a7e0 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | ||
19 | 20 | ||
20 | #include <asm/debug.h> | 21 | #include <asm/debug.h> |
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
@@ -69,6 +70,8 @@ int dasd_autodetect = 0; /* is true, when autodetection is active */ | |||
69 | * strings when running as a module. | 70 | * strings when running as a module. |
70 | */ | 71 | */ |
71 | static char *dasd[256]; | 72 | static char *dasd[256]; |
73 | module_param_array(dasd, charp, NULL, 0); | ||
74 | |||
72 | /* | 75 | /* |
73 | * Single spinlock to protect devmap structures and lists. | 76 | * Single spinlock to protect devmap structures and lists. |
74 | */ | 77 | */ |
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index 583d2d8c8335..fad2109268bb 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c | |||
@@ -550,6 +550,6 @@ module_exit(cumanascsi2_exit); | |||
550 | 550 | ||
551 | MODULE_AUTHOR("Russell King"); | 551 | MODULE_AUTHOR("Russell King"); |
552 | MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines"); | 552 | MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines"); |
553 | MODULE_PARM(term, "1-8i"); | 553 | module_param_array(term, int, NULL, 0); |
554 | MODULE_PARM_DESC(term, "SCSI bus termination"); | 554 | MODULE_PARM_DESC(term, "SCSI bus termination"); |
555 | MODULE_LICENSE("GPL"); | 555 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index 3ffec7efc9d5..dcbb4b2b3fe0 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c | |||
@@ -674,6 +674,6 @@ module_exit(eesox_exit); | |||
674 | 674 | ||
675 | MODULE_AUTHOR("Russell King"); | 675 | MODULE_AUTHOR("Russell King"); |
676 | MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines"); | 676 | MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines"); |
677 | MODULE_PARM(term, "1-8i"); | 677 | module_param_array(term, int, NULL, 0); |
678 | MODULE_PARM_DESC(term, "SCSI bus termination"); | 678 | MODULE_PARM_DESC(term, "SCSI bus termination"); |
679 | MODULE_LICENSE("GPL"); | 679 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 3113bdcedb13..3d69f6c45a6b 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c | |||
@@ -466,6 +466,6 @@ module_exit(powertecscsi_exit); | |||
466 | 466 | ||
467 | MODULE_AUTHOR("Russell King"); | 467 | MODULE_AUTHOR("Russell King"); |
468 | MODULE_DESCRIPTION("Powertec SCSI driver"); | 468 | MODULE_DESCRIPTION("Powertec SCSI driver"); |
469 | MODULE_PARM(term, "1-8i"); | 469 | module_param_array(term, int, NULL, 0); |
470 | MODULE_PARM_DESC(term, "SCSI bus termination"); | 470 | MODULE_PARM_DESC(term, "SCSI bus termination"); |
471 | MODULE_LICENSE("GPL"); | 471 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index f4c1ca7c1572..f677c5a32a68 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -239,17 +239,17 @@ static int atari_read_overruns = 0; | |||
239 | #endif | 239 | #endif |
240 | 240 | ||
241 | static int setup_can_queue = -1; | 241 | static int setup_can_queue = -1; |
242 | MODULE_PARM(setup_can_queue, "i"); | 242 | module_param(setup_can_queue, int, 0); |
243 | static int setup_cmd_per_lun = -1; | 243 | static int setup_cmd_per_lun = -1; |
244 | MODULE_PARM(setup_cmd_per_lun, "i"); | 244 | module_param(setup_cmd_per_lun, int, 0); |
245 | static int setup_sg_tablesize = -1; | 245 | static int setup_sg_tablesize = -1; |
246 | MODULE_PARM(setup_sg_tablesize, "i"); | 246 | module_param(setup_sg_tablesize, int, 0); |
247 | #ifdef SUPPORT_TAGS | 247 | #ifdef SUPPORT_TAGS |
248 | static int setup_use_tagged_queuing = -1; | 248 | static int setup_use_tagged_queuing = -1; |
249 | MODULE_PARM(setup_use_tagged_queuing, "i"); | 249 | module_param(setup_use_tagged_queuing, int, 0); |
250 | #endif | 250 | #endif |
251 | static int setup_hostid = -1; | 251 | static int setup_hostid = -1; |
252 | MODULE_PARM(setup_hostid, "i"); | 252 | module_param(setup_hostid, int, 0); |
253 | 253 | ||
254 | 254 | ||
255 | #if defined(CONFIG_TT_DMA_EMUL) | 255 | #if defined(CONFIG_TT_DMA_EMUL) |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 024ef86c5242..c647d85d97d1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -190,7 +190,7 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, | |||
190 | if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, | 190 | if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, |
191 | SD_MAX_RETRIES, &data, NULL)) | 191 | SD_MAX_RETRIES, &data, NULL)) |
192 | return -EINVAL; | 192 | return -EINVAL; |
193 | len = min(sizeof(buffer), data.length - data.header_length - | 193 | len = min_t(size_t, sizeof(buffer), data.length - data.header_length - |
194 | data.block_descriptor_length); | 194 | data.block_descriptor_length); |
195 | buffer_data = buffer + data.header_length + | 195 | buffer_data = buffer + data.header_length + |
196 | data.block_descriptor_length; | 196 | data.block_descriptor_length; |
diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c index 4315afe9c080..53e81a44c1a3 100644 --- a/drivers/serial/8250_hp300.c +++ b/drivers/serial/8250_hp300.c | |||
@@ -55,6 +55,8 @@ static struct dio_driver hpdca_driver = { | |||
55 | 55 | ||
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | static unsigned int num_ports; | ||
59 | |||
58 | extern int hp300_uart_scode; | 60 | extern int hp300_uart_scode; |
59 | 61 | ||
60 | /* Offset to UART registers from base of DCA */ | 62 | /* Offset to UART registers from base of DCA */ |
@@ -199,6 +201,8 @@ static int __devinit hpdca_init_one(struct dio_dev *d, | |||
199 | out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); | 201 | out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); |
200 | udelay(100); | 202 | udelay(100); |
201 | 203 | ||
204 | num_ports++; | ||
205 | |||
202 | return 0; | 206 | return 0; |
203 | } | 207 | } |
204 | #endif | 208 | #endif |
@@ -206,7 +210,6 @@ static int __devinit hpdca_init_one(struct dio_dev *d, | |||
206 | static int __init hp300_8250_init(void) | 210 | static int __init hp300_8250_init(void) |
207 | { | 211 | { |
208 | static int called = 0; | 212 | static int called = 0; |
209 | int num_ports; | ||
210 | #ifdef CONFIG_HPAPCI | 213 | #ifdef CONFIG_HPAPCI |
211 | int line; | 214 | int line; |
212 | unsigned long base; | 215 | unsigned long base; |
@@ -221,11 +224,8 @@ static int __init hp300_8250_init(void) | |||
221 | if (!MACH_IS_HP300) | 224 | if (!MACH_IS_HP300) |
222 | return -ENODEV; | 225 | return -ENODEV; |
223 | 226 | ||
224 | num_ports = 0; | ||
225 | |||
226 | #ifdef CONFIG_HPDCA | 227 | #ifdef CONFIG_HPDCA |
227 | if (dio_module_init(&hpdca_driver) == 0) | 228 | dio_register_driver(&hpdca_driver); |
228 | num_ports++; | ||
229 | #endif | 229 | #endif |
230 | #ifdef CONFIG_HPAPCI | 230 | #ifdef CONFIG_HPAPCI |
231 | if (hp300_model < HP_400) { | 231 | if (hp300_model < HP_400) { |
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index a37579ce6d76..c620209d7b9a 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 2003-2005 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (C) 2003-2006 Silicon Graphics, Inc. All Rights Reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | 9 | ||
@@ -323,9 +323,12 @@ static unsigned int Num_of_ioc4_cards; | |||
323 | #define IOC4_FIFO_CHARS 255 | 323 | #define IOC4_FIFO_CHARS 255 |
324 | 324 | ||
325 | /* Device name we're using */ | 325 | /* Device name we're using */ |
326 | #define DEVICE_NAME "ttyIOC" | 326 | #define DEVICE_NAME_RS232 "ttyIOC" |
327 | #define DEVICE_MAJOR 204 | 327 | #define DEVICE_NAME_RS422 "ttyAIOC" |
328 | #define DEVICE_MINOR 50 | 328 | #define DEVICE_MAJOR 204 |
329 | #define DEVICE_MINOR_RS232 50 | ||
330 | #define DEVICE_MINOR_RS422 84 | ||
331 | |||
329 | 332 | ||
330 | /* register offsets */ | 333 | /* register offsets */ |
331 | #define IOC4_SERIAL_OFFSET 0x300 | 334 | #define IOC4_SERIAL_OFFSET 0x300 |
@@ -341,10 +344,8 @@ static unsigned int Num_of_ioc4_cards; | |||
341 | #define MAX_BAUD_SUPPORTED 115200 | 344 | #define MAX_BAUD_SUPPORTED 115200 |
342 | 345 | ||
343 | /* protocol types supported */ | 346 | /* protocol types supported */ |
344 | enum sio_proto { | 347 | #define PROTO_RS232 3 |
345 | PROTO_RS232, | 348 | #define PROTO_RS422 7 |
346 | PROTO_RS422 | ||
347 | }; | ||
348 | 349 | ||
349 | /* Notification types */ | 350 | /* Notification types */ |
350 | #define N_DATA_READY 0x01 | 351 | #define N_DATA_READY 0x01 |
@@ -395,11 +396,17 @@ enum sio_proto { | |||
395 | /* | 396 | /* |
396 | * This is the entry saved by the driver - one per card | 397 | * This is the entry saved by the driver - one per card |
397 | */ | 398 | */ |
399 | |||
400 | #define UART_PORT_MIN 0 | ||
401 | #define UART_PORT_RS232 UART_PORT_MIN | ||
402 | #define UART_PORT_RS422 1 | ||
403 | #define UART_PORT_COUNT 2 /* one for each mode */ | ||
404 | |||
398 | struct ioc4_control { | 405 | struct ioc4_control { |
399 | int ic_irq; | 406 | int ic_irq; |
400 | struct { | 407 | struct { |
401 | /* uart ports are allocated here */ | 408 | /* uart ports are allocated here - 1 for rs232, 1 for rs422 */ |
402 | struct uart_port icp_uart_port; | 409 | struct uart_port icp_uart_port[UART_PORT_COUNT]; |
403 | /* Handy reference material */ | 410 | /* Handy reference material */ |
404 | struct ioc4_port *icp_port; | 411 | struct ioc4_port *icp_port; |
405 | } ic_port[IOC4_NUM_SERIAL_PORTS]; | 412 | } ic_port[IOC4_NUM_SERIAL_PORTS]; |
@@ -443,7 +450,9 @@ struct ioc4_soft { | |||
443 | 450 | ||
444 | /* Local port info for each IOC4 serial ports */ | 451 | /* Local port info for each IOC4 serial ports */ |
445 | struct ioc4_port { | 452 | struct ioc4_port { |
446 | struct uart_port *ip_port; | 453 | struct uart_port *ip_port; /* current active port ptr */ |
454 | /* Ptrs for all ports */ | ||
455 | struct uart_port *ip_all_ports[UART_PORT_COUNT]; | ||
447 | /* Back ptrs for this port */ | 456 | /* Back ptrs for this port */ |
448 | struct ioc4_control *ip_control; | 457 | struct ioc4_control *ip_control; |
449 | struct pci_dev *ip_pdev; | 458 | struct pci_dev *ip_pdev; |
@@ -502,6 +511,9 @@ struct ioc4_port { | |||
502 | #define DCD_ON 0x02 | 511 | #define DCD_ON 0x02 |
503 | #define LOWAT_WRITTEN 0x04 | 512 | #define LOWAT_WRITTEN 0x04 |
504 | #define READ_ABORTED 0x08 | 513 | #define READ_ABORTED 0x08 |
514 | #define PORT_ACTIVE 0x10 | ||
515 | #define PORT_INACTIVE 0 /* This is the value when "off" */ | ||
516 | |||
505 | 517 | ||
506 | /* Since each port has different register offsets and bitmasks | 518 | /* Since each port has different register offsets and bitmasks |
507 | * for everything, we'll store those that we need in tables so we | 519 | * for everything, we'll store those that we need in tables so we |
@@ -623,6 +635,23 @@ struct ring_buffer { | |||
623 | static void receive_chars(struct uart_port *); | 635 | static void receive_chars(struct uart_port *); |
624 | static void handle_intr(void *arg, uint32_t sio_ir); | 636 | static void handle_intr(void *arg, uint32_t sio_ir); |
625 | 637 | ||
638 | /* | ||
639 | * port_is_active - determines if this port is currently active | ||
640 | * @port: ptr to soft struct for this port | ||
641 | * @uart_port: uart port to test for | ||
642 | */ | ||
643 | static inline int port_is_active(struct ioc4_port *port, | ||
644 | struct uart_port *uart_port) | ||
645 | { | ||
646 | if (port) { | ||
647 | if ((port->ip_flags & PORT_ACTIVE) | ||
648 | && (port->ip_port == uart_port)) | ||
649 | return 1; | ||
650 | } | ||
651 | return 0; | ||
652 | } | ||
653 | |||
654 | |||
626 | /** | 655 | /** |
627 | * write_ireg - write the interrupt regs | 656 | * write_ireg - write the interrupt regs |
628 | * @ioc4_soft: ptr to soft struct for this port | 657 | * @ioc4_soft: ptr to soft struct for this port |
@@ -708,19 +737,33 @@ static int set_baud(struct ioc4_port *port, int baud) | |||
708 | /** | 737 | /** |
709 | * get_ioc4_port - given a uart port, return the control structure | 738 | * get_ioc4_port - given a uart port, return the control structure |
710 | * @port: uart port | 739 | * @port: uart port |
740 | * @set: set this port as current | ||
711 | */ | 741 | */ |
712 | static struct ioc4_port *get_ioc4_port(struct uart_port *the_port) | 742 | static struct ioc4_port *get_ioc4_port(struct uart_port *the_port, int set) |
713 | { | 743 | { |
714 | struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev); | 744 | struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev); |
715 | struct ioc4_control *control = idd->idd_serial_data; | 745 | struct ioc4_control *control = idd->idd_serial_data; |
716 | int ii; | 746 | struct ioc4_port *port; |
747 | int port_num, port_type; | ||
717 | 748 | ||
718 | if (control) { | 749 | if (control) { |
719 | for ( ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++ ) { | 750 | for ( port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; |
720 | if (!control->ic_port[ii].icp_port) | 751 | port_num++ ) { |
752 | port = control->ic_port[port_num].icp_port; | ||
753 | if (!port) | ||
721 | continue; | 754 | continue; |
722 | if (the_port == control->ic_port[ii].icp_port->ip_port) | 755 | for (port_type = UART_PORT_MIN; |
723 | return control->ic_port[ii].icp_port; | 756 | port_type < UART_PORT_COUNT; |
757 | port_type++) { | ||
758 | if (the_port == port->ip_all_ports | ||
759 | [port_type]) { | ||
760 | /* set local copy */ | ||
761 | if (set) { | ||
762 | port->ip_port = the_port; | ||
763 | } | ||
764 | return port; | ||
765 | } | ||
766 | } | ||
724 | } | 767 | } |
725 | } | 768 | } |
726 | return NULL; | 769 | return NULL; |
@@ -946,6 +989,7 @@ intr_connect(struct ioc4_soft *soft, int type, | |||
946 | * @arg: handler arg | 989 | * @arg: handler arg |
947 | * @regs: registers | 990 | * @regs: registers |
948 | */ | 991 | */ |
992 | |||
949 | static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | 993 | static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) |
950 | { | 994 | { |
951 | struct ioc4_soft *soft; | 995 | struct ioc4_soft *soft; |
@@ -953,7 +997,7 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | |||
953 | int xx, num_intrs = 0; | 997 | int xx, num_intrs = 0; |
954 | int intr_type; | 998 | int intr_type; |
955 | int handled = 0; | 999 | int handled = 0; |
956 | struct ioc4_intr_info *ii; | 1000 | struct ioc4_intr_info *intr_info; |
957 | 1001 | ||
958 | soft = arg; | 1002 | soft = arg; |
959 | for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++) { | 1003 | for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++) { |
@@ -966,13 +1010,13 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | |||
966 | * which interrupt bits are set. | 1010 | * which interrupt bits are set. |
967 | */ | 1011 | */ |
968 | for (xx = 0; xx < num_intrs; xx++) { | 1012 | for (xx = 0; xx < num_intrs; xx++) { |
969 | ii = &soft->is_intr_type[intr_type].is_intr_info[xx]; | 1013 | intr_info = &soft->is_intr_type[intr_type].is_intr_info[xx]; |
970 | if ((this_mir = this_ir & ii->sd_bits)) { | 1014 | if ((this_mir = this_ir & intr_info->sd_bits)) { |
971 | /* Disable owned interrupts, call handler */ | 1015 | /* Disable owned interrupts, call handler */ |
972 | handled++; | 1016 | handled++; |
973 | write_ireg(soft, ii->sd_bits, IOC4_W_IEC, | 1017 | write_ireg(soft, intr_info->sd_bits, IOC4_W_IEC, |
974 | intr_type); | 1018 | intr_type); |
975 | ii->sd_intr(ii->sd_info, this_mir); | 1019 | intr_info->sd_intr(intr_info->sd_info, this_mir); |
976 | this_ir &= ~this_mir; | 1020 | this_ir &= ~this_mir; |
977 | } | 1021 | } |
978 | } | 1022 | } |
@@ -980,7 +1024,6 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | |||
980 | #ifdef DEBUG_INTERRUPTS | 1024 | #ifdef DEBUG_INTERRUPTS |
981 | { | 1025 | { |
982 | struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr; | 1026 | struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr; |
983 | spinlock_t *lp = &soft->is_ir_lock; | ||
984 | unsigned long flag; | 1027 | unsigned long flag; |
985 | 1028 | ||
986 | spin_lock_irqsave(&soft->is_ir_lock, flag); | 1029 | spin_lock_irqsave(&soft->is_ir_lock, flag); |
@@ -1177,7 +1220,7 @@ static inline int local_open(struct ioc4_port *port) | |||
1177 | { | 1220 | { |
1178 | int spiniter = 0; | 1221 | int spiniter = 0; |
1179 | 1222 | ||
1180 | port->ip_flags = 0; | 1223 | port->ip_flags = PORT_ACTIVE; |
1181 | 1224 | ||
1182 | /* Pause the DMA interface if necessary */ | 1225 | /* Pause the DMA interface if necessary */ |
1183 | if (port->ip_sscr & IOC4_SSCR_DMA_EN) { | 1226 | if (port->ip_sscr & IOC4_SSCR_DMA_EN) { |
@@ -1187,6 +1230,7 @@ static inline int local_open(struct ioc4_port *port) | |||
1187 | & IOC4_SSCR_PAUSE_STATE) == 0) { | 1230 | & IOC4_SSCR_PAUSE_STATE) == 0) { |
1188 | spiniter++; | 1231 | spiniter++; |
1189 | if (spiniter > MAXITER) { | 1232 | if (spiniter > MAXITER) { |
1233 | port->ip_flags = PORT_INACTIVE; | ||
1190 | return -1; | 1234 | return -1; |
1191 | } | 1235 | } |
1192 | } | 1236 | } |
@@ -1506,14 +1550,13 @@ static int set_notification(struct ioc4_port *port, int mask, int set_on) | |||
1506 | /** | 1550 | /** |
1507 | * set_mcr - set the master control reg | 1551 | * set_mcr - set the master control reg |
1508 | * @the_port: port to use | 1552 | * @the_port: port to use |
1509 | * @set: set ? | ||
1510 | * @mask1: mcr mask | 1553 | * @mask1: mcr mask |
1511 | * @mask2: shadow mask | 1554 | * @mask2: shadow mask |
1512 | */ | 1555 | */ |
1513 | static inline int set_mcr(struct uart_port *the_port, int set, | 1556 | static inline int set_mcr(struct uart_port *the_port, |
1514 | int mask1, int mask2) | 1557 | int mask1, int mask2) |
1515 | { | 1558 | { |
1516 | struct ioc4_port *port = get_ioc4_port(the_port); | 1559 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
1517 | uint32_t shadow; | 1560 | uint32_t shadow; |
1518 | int spiniter = 0; | 1561 | int spiniter = 0; |
1519 | char mcr; | 1562 | char mcr; |
@@ -1536,13 +1579,9 @@ static inline int set_mcr(struct uart_port *the_port, int set, | |||
1536 | mcr = (shadow & 0xff000000) >> 24; | 1579 | mcr = (shadow & 0xff000000) >> 24; |
1537 | 1580 | ||
1538 | /* Set new value */ | 1581 | /* Set new value */ |
1539 | if (set) { | 1582 | mcr |= mask1; |
1540 | mcr |= mask1; | 1583 | shadow |= mask2; |
1541 | shadow |= mask2; | 1584 | |
1542 | } else { | ||
1543 | mcr &= ~mask1; | ||
1544 | shadow &= ~mask2; | ||
1545 | } | ||
1546 | writeb(mcr, &port->ip_uart_regs->i4u_mcr); | 1585 | writeb(mcr, &port->ip_uart_regs->i4u_mcr); |
1547 | writel(shadow, &port->ip_serial_regs->shadow); | 1586 | writel(shadow, &port->ip_serial_regs->shadow); |
1548 | 1587 | ||
@@ -1558,7 +1597,7 @@ static inline int set_mcr(struct uart_port *the_port, int set, | |||
1558 | * @port: port to use | 1597 | * @port: port to use |
1559 | * @proto: protocol to use | 1598 | * @proto: protocol to use |
1560 | */ | 1599 | */ |
1561 | static int ioc4_set_proto(struct ioc4_port *port, enum sio_proto proto) | 1600 | static int ioc4_set_proto(struct ioc4_port *port, int proto) |
1562 | { | 1601 | { |
1563 | struct hooks *hooks = port->ip_hooks; | 1602 | struct hooks *hooks = port->ip_hooks; |
1564 | 1603 | ||
@@ -1589,7 +1628,7 @@ static void transmit_chars(struct uart_port *the_port) | |||
1589 | int result; | 1628 | int result; |
1590 | char *start; | 1629 | char *start; |
1591 | struct tty_struct *tty; | 1630 | struct tty_struct *tty; |
1592 | struct ioc4_port *port = get_ioc4_port(the_port); | 1631 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
1593 | struct uart_info *info; | 1632 | struct uart_info *info; |
1594 | 1633 | ||
1595 | if (!the_port) | 1634 | if (!the_port) |
@@ -1645,7 +1684,7 @@ static void | |||
1645 | ioc4_change_speed(struct uart_port *the_port, | 1684 | ioc4_change_speed(struct uart_port *the_port, |
1646 | struct termios *new_termios, struct termios *old_termios) | 1685 | struct termios *new_termios, struct termios *old_termios) |
1647 | { | 1686 | { |
1648 | struct ioc4_port *port = get_ioc4_port(the_port); | 1687 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
1649 | int baud, bits; | 1688 | int baud, bits; |
1650 | unsigned cflag; | 1689 | unsigned cflag; |
1651 | int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; | 1690 | int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; |
@@ -1752,7 +1791,7 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1752 | if (!the_port) | 1791 | if (!the_port) |
1753 | return -1; | 1792 | return -1; |
1754 | 1793 | ||
1755 | port = get_ioc4_port(the_port); | 1794 | port = get_ioc4_port(the_port, 0); |
1756 | if (!port) | 1795 | if (!port) |
1757 | return -1; | 1796 | return -1; |
1758 | 1797 | ||
@@ -1760,6 +1799,9 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1760 | 1799 | ||
1761 | local_open(port); | 1800 | local_open(port); |
1762 | 1801 | ||
1802 | /* set the protocol - mapbase has the port type */ | ||
1803 | ioc4_set_proto(port, the_port->mapbase); | ||
1804 | |||
1763 | /* set the speed of the serial port */ | 1805 | /* set the speed of the serial port */ |
1764 | ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); | 1806 | ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); |
1765 | 1807 | ||
@@ -1768,17 +1810,17 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1768 | 1810 | ||
1769 | /* | 1811 | /* |
1770 | * ioc4_cb_output_lowat - called when the output low water mark is hit | 1812 | * ioc4_cb_output_lowat - called when the output low water mark is hit |
1771 | * @port: port to output | 1813 | * @the_port: port to output |
1772 | */ | 1814 | */ |
1773 | static void ioc4_cb_output_lowat(struct ioc4_port *port) | 1815 | static void ioc4_cb_output_lowat(struct uart_port *the_port) |
1774 | { | 1816 | { |
1775 | unsigned long pflags; | 1817 | unsigned long pflags; |
1776 | 1818 | ||
1777 | /* ip_lock is set on the call here */ | 1819 | /* ip_lock is set on the call here */ |
1778 | if (port->ip_port) { | 1820 | if (the_port) { |
1779 | spin_lock_irqsave(&port->ip_port->lock, pflags); | 1821 | spin_lock_irqsave(&the_port->lock, pflags); |
1780 | transmit_chars(port->ip_port); | 1822 | transmit_chars(the_port); |
1781 | spin_unlock_irqrestore(&port->ip_port->lock, pflags); | 1823 | spin_unlock_irqrestore(&the_port->lock, pflags); |
1782 | } | 1824 | } |
1783 | } | 1825 | } |
1784 | 1826 | ||
@@ -1923,7 +1965,7 @@ static void handle_intr(void *arg, uint32_t sio_ir) | |||
1923 | &port->ip_mem->sio_ir.raw); | 1965 | &port->ip_mem->sio_ir.raw); |
1924 | 1966 | ||
1925 | if (port->ip_notify & N_OUTPUT_LOWAT) | 1967 | if (port->ip_notify & N_OUTPUT_LOWAT) |
1926 | ioc4_cb_output_lowat(port); | 1968 | ioc4_cb_output_lowat(port->ip_port); |
1927 | } | 1969 | } |
1928 | 1970 | ||
1929 | /* Handle tx_mt. Must come after tx_explicit. */ | 1971 | /* Handle tx_mt. Must come after tx_explicit. */ |
@@ -1936,7 +1978,7 @@ static void handle_intr(void *arg, uint32_t sio_ir) | |||
1936 | * So send the notification now. | 1978 | * So send the notification now. |
1937 | */ | 1979 | */ |
1938 | if (port->ip_notify & N_OUTPUT_LOWAT) { | 1980 | if (port->ip_notify & N_OUTPUT_LOWAT) { |
1939 | ioc4_cb_output_lowat(port); | 1981 | ioc4_cb_output_lowat(port->ip_port); |
1940 | 1982 | ||
1941 | /* We need to reload the sio_ir since the lowat | 1983 | /* We need to reload the sio_ir since the lowat |
1942 | * call may have caused another write to occur, | 1984 | * call may have caused another write to occur, |
@@ -2023,7 +2065,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf, | |||
2023 | int len) | 2065 | int len) |
2024 | { | 2066 | { |
2025 | int prod_ptr, cons_ptr, total; | 2067 | int prod_ptr, cons_ptr, total; |
2026 | struct ioc4_port *port = get_ioc4_port(the_port); | 2068 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2027 | struct ring *inring; | 2069 | struct ring *inring; |
2028 | struct ring_entry *entry; | 2070 | struct ring_entry *entry; |
2029 | struct hooks *hooks = port->ip_hooks; | 2071 | struct hooks *hooks = port->ip_hooks; |
@@ -2335,17 +2377,27 @@ static void receive_chars(struct uart_port *the_port) | |||
2335 | */ | 2377 | */ |
2336 | static const char *ic4_type(struct uart_port *the_port) | 2378 | static const char *ic4_type(struct uart_port *the_port) |
2337 | { | 2379 | { |
2338 | return "SGI IOC4 Serial"; | 2380 | if (the_port->mapbase == PROTO_RS232) |
2381 | return "SGI IOC4 Serial [rs232]"; | ||
2382 | else | ||
2383 | return "SGI IOC4 Serial [rs422]"; | ||
2339 | } | 2384 | } |
2340 | 2385 | ||
2341 | /** | 2386 | /** |
2342 | * ic4_tx_empty - Is the transmitter empty? We pretend we're always empty | 2387 | * ic4_tx_empty - Is the transmitter empty? |
2343 | * @port: Port to operate on (we ignore since we always return 1) | 2388 | * @port: Port to operate on |
2344 | * | 2389 | * |
2345 | */ | 2390 | */ |
2346 | static unsigned int ic4_tx_empty(struct uart_port *the_port) | 2391 | static unsigned int ic4_tx_empty(struct uart_port *the_port) |
2347 | { | 2392 | { |
2348 | return 1; | 2393 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2394 | unsigned int ret = 0; | ||
2395 | |||
2396 | if (port_is_active(port, the_port)) { | ||
2397 | if (readl(&port->ip_serial_regs->shadow) & IOC4_SHADOW_TEMT) | ||
2398 | ret = TIOCSER_TEMT; | ||
2399 | } | ||
2400 | return ret; | ||
2349 | } | 2401 | } |
2350 | 2402 | ||
2351 | /** | 2403 | /** |
@@ -2355,6 +2407,10 @@ static unsigned int ic4_tx_empty(struct uart_port *the_port) | |||
2355 | */ | 2407 | */ |
2356 | static void ic4_stop_tx(struct uart_port *the_port) | 2408 | static void ic4_stop_tx(struct uart_port *the_port) |
2357 | { | 2409 | { |
2410 | struct ioc4_port *port = get_ioc4_port(the_port, 0); | ||
2411 | |||
2412 | if (port_is_active(port, the_port)) | ||
2413 | set_notification(port, N_OUTPUT_LOWAT, 0); | ||
2358 | } | 2414 | } |
2359 | 2415 | ||
2360 | /** | 2416 | /** |
@@ -2377,11 +2433,12 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2377 | struct ioc4_port *port; | 2433 | struct ioc4_port *port; |
2378 | struct uart_info *info; | 2434 | struct uart_info *info; |
2379 | 2435 | ||
2380 | port = get_ioc4_port(the_port); | 2436 | port = get_ioc4_port(the_port, 0); |
2381 | if (!port) | 2437 | if (!port) |
2382 | return; | 2438 | return; |
2383 | 2439 | ||
2384 | info = the_port->info; | 2440 | info = the_port->info; |
2441 | port->ip_port = NULL; | ||
2385 | 2442 | ||
2386 | wake_up_interruptible(&info->delta_msr_wait); | 2443 | wake_up_interruptible(&info->delta_msr_wait); |
2387 | 2444 | ||
@@ -2390,6 +2447,7 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2390 | 2447 | ||
2391 | spin_lock_irqsave(&the_port->lock, port_flags); | 2448 | spin_lock_irqsave(&the_port->lock, port_flags); |
2392 | set_notification(port, N_ALL, 0); | 2449 | set_notification(port, N_ALL, 0); |
2450 | port->ip_flags = PORT_INACTIVE; | ||
2393 | spin_unlock_irqrestore(&the_port->lock, port_flags); | 2451 | spin_unlock_irqrestore(&the_port->lock, port_flags); |
2394 | } | 2452 | } |
2395 | 2453 | ||
@@ -2402,6 +2460,11 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2402 | static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | 2460 | static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) |
2403 | { | 2461 | { |
2404 | unsigned char mcr = 0; | 2462 | unsigned char mcr = 0; |
2463 | struct ioc4_port *port; | ||
2464 | |||
2465 | port = get_ioc4_port(the_port, 0); | ||
2466 | if (!port_is_active(port, the_port)) | ||
2467 | return; | ||
2405 | 2468 | ||
2406 | if (mctrl & TIOCM_RTS) | 2469 | if (mctrl & TIOCM_RTS) |
2407 | mcr |= UART_MCR_RTS; | 2470 | mcr |= UART_MCR_RTS; |
@@ -2414,7 +2477,7 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | |||
2414 | if (mctrl & TIOCM_LOOP) | 2477 | if (mctrl & TIOCM_LOOP) |
2415 | mcr |= UART_MCR_LOOP; | 2478 | mcr |= UART_MCR_LOOP; |
2416 | 2479 | ||
2417 | set_mcr(the_port, 1, mcr, IOC4_SHADOW_DTR); | 2480 | set_mcr(the_port, mcr, IOC4_SHADOW_DTR); |
2418 | } | 2481 | } |
2419 | 2482 | ||
2420 | /** | 2483 | /** |
@@ -2424,11 +2487,11 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | |||
2424 | */ | 2487 | */ |
2425 | static unsigned int ic4_get_mctrl(struct uart_port *the_port) | 2488 | static unsigned int ic4_get_mctrl(struct uart_port *the_port) |
2426 | { | 2489 | { |
2427 | struct ioc4_port *port = get_ioc4_port(the_port); | 2490 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2428 | uint32_t shadow; | 2491 | uint32_t shadow; |
2429 | unsigned int ret = 0; | 2492 | unsigned int ret = 0; |
2430 | 2493 | ||
2431 | if (!port) | 2494 | if (!port_is_active(port, the_port)) |
2432 | return 0; | 2495 | return 0; |
2433 | 2496 | ||
2434 | shadow = readl(&port->ip_serial_regs->shadow); | 2497 | shadow = readl(&port->ip_serial_regs->shadow); |
@@ -2448,9 +2511,9 @@ static unsigned int ic4_get_mctrl(struct uart_port *the_port) | |||
2448 | */ | 2511 | */ |
2449 | static void ic4_start_tx(struct uart_port *the_port) | 2512 | static void ic4_start_tx(struct uart_port *the_port) |
2450 | { | 2513 | { |
2451 | struct ioc4_port *port = get_ioc4_port(the_port); | 2514 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2452 | 2515 | ||
2453 | if (port) { | 2516 | if (port_is_active(port, the_port)) { |
2454 | set_notification(port, N_OUTPUT_LOWAT, 1); | 2517 | set_notification(port, N_OUTPUT_LOWAT, 1); |
2455 | enable_intrs(port, port->ip_hooks->intr_tx_mt); | 2518 | enable_intrs(port, port->ip_hooks->intr_tx_mt); |
2456 | } | 2519 | } |
@@ -2467,7 +2530,7 @@ static void ic4_break_ctl(struct uart_port *the_port, int break_state) | |||
2467 | } | 2530 | } |
2468 | 2531 | ||
2469 | /** | 2532 | /** |
2470 | * ic4_startup - Start up the serial port - always return 0 (We're always on) | 2533 | * ic4_startup - Start up the serial port |
2471 | * @port: Port to operate on | 2534 | * @port: Port to operate on |
2472 | * | 2535 | * |
2473 | */ | 2536 | */ |
@@ -2479,17 +2542,16 @@ static int ic4_startup(struct uart_port *the_port) | |||
2479 | struct uart_info *info; | 2542 | struct uart_info *info; |
2480 | unsigned long port_flags; | 2543 | unsigned long port_flags; |
2481 | 2544 | ||
2482 | if (!the_port) { | 2545 | if (!the_port) |
2483 | return -ENODEV; | 2546 | return -ENODEV; |
2484 | } | 2547 | port = get_ioc4_port(the_port, 1); |
2485 | port = get_ioc4_port(the_port); | 2548 | if (!port) |
2486 | if (!port) { | ||
2487 | return -ENODEV; | 2549 | return -ENODEV; |
2488 | } | ||
2489 | info = the_port->info; | 2550 | info = the_port->info; |
2490 | 2551 | ||
2491 | control = port->ip_control; | 2552 | control = port->ip_control; |
2492 | if (!control) { | 2553 | if (!control) { |
2554 | port->ip_port = NULL; | ||
2493 | return -ENODEV; | 2555 | return -ENODEV; |
2494 | } | 2556 | } |
2495 | 2557 | ||
@@ -2551,28 +2613,104 @@ static struct uart_ops ioc4_ops = { | |||
2551 | * Boot-time initialization code | 2613 | * Boot-time initialization code |
2552 | */ | 2614 | */ |
2553 | 2615 | ||
2554 | static struct uart_driver ioc4_uart = { | 2616 | static struct uart_driver ioc4_uart_rs232 = { |
2555 | .owner = THIS_MODULE, | 2617 | .owner = THIS_MODULE, |
2556 | .driver_name = "ioc4_serial", | 2618 | .driver_name = "ioc4_serial_rs232", |
2557 | .dev_name = DEVICE_NAME, | 2619 | .dev_name = DEVICE_NAME_RS232, |
2558 | .major = DEVICE_MAJOR, | 2620 | .major = DEVICE_MAJOR, |
2559 | .minor = DEVICE_MINOR, | 2621 | .minor = DEVICE_MINOR_RS232, |
2560 | .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, | 2622 | .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, |
2561 | }; | 2623 | }; |
2562 | 2624 | ||
2625 | static struct uart_driver ioc4_uart_rs422 = { | ||
2626 | .owner = THIS_MODULE, | ||
2627 | .driver_name = "ioc4_serial_rs422", | ||
2628 | .dev_name = DEVICE_NAME_RS422, | ||
2629 | .major = DEVICE_MAJOR, | ||
2630 | .minor = DEVICE_MINOR_RS422, | ||
2631 | .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, | ||
2632 | }; | ||
2633 | |||
2634 | |||
2563 | /** | 2635 | /** |
2564 | * ioc4_serial_core_attach - register with serial core | 2636 | * ioc4_serial_remove_one - detach function |
2637 | * | ||
2638 | * @idd: IOC4 master module data for this IOC4 | ||
2639 | */ | ||
2640 | |||
2641 | static int ioc4_serial_remove_one(struct ioc4_driver_data *idd) | ||
2642 | { | ||
2643 | int port_num, port_type; | ||
2644 | struct ioc4_control *control; | ||
2645 | struct uart_port *the_port; | ||
2646 | struct ioc4_port *port; | ||
2647 | struct ioc4_soft *soft; | ||
2648 | |||
2649 | control = idd->idd_serial_data; | ||
2650 | |||
2651 | for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) { | ||
2652 | for (port_type = UART_PORT_MIN; | ||
2653 | port_type < UART_PORT_COUNT; | ||
2654 | port_type++) { | ||
2655 | the_port = &control->ic_port[port_num].icp_uart_port | ||
2656 | [port_type]; | ||
2657 | if (the_port) { | ||
2658 | switch (port_type) { | ||
2659 | case UART_PORT_RS422: | ||
2660 | uart_remove_one_port(&ioc4_uart_rs422, | ||
2661 | the_port); | ||
2662 | break; | ||
2663 | default: | ||
2664 | case UART_PORT_RS232: | ||
2665 | uart_remove_one_port(&ioc4_uart_rs232, | ||
2666 | the_port); | ||
2667 | break; | ||
2668 | } | ||
2669 | } | ||
2670 | } | ||
2671 | port = control->ic_port[port_num].icp_port; | ||
2672 | /* we allocate in pairs */ | ||
2673 | if (!(port_num & 1) && port) { | ||
2674 | pci_free_consistent(port->ip_pdev, | ||
2675 | TOTAL_RING_BUF_SIZE, | ||
2676 | port->ip_cpu_ringbuf, | ||
2677 | port->ip_dma_ringbuf); | ||
2678 | kfree(port); | ||
2679 | } | ||
2680 | } | ||
2681 | soft = control->ic_soft; | ||
2682 | if (soft) { | ||
2683 | free_irq(control->ic_irq, soft); | ||
2684 | if (soft->is_ioc4_serial_addr) { | ||
2685 | release_region((unsigned long) | ||
2686 | soft->is_ioc4_serial_addr, | ||
2687 | sizeof(struct ioc4_serial)); | ||
2688 | } | ||
2689 | kfree(soft); | ||
2690 | } | ||
2691 | kfree(control); | ||
2692 | idd->idd_serial_data = NULL; | ||
2693 | |||
2694 | return 0; | ||
2695 | } | ||
2696 | |||
2697 | |||
2698 | /** | ||
2699 | * ioc4_serial_core_attach_rs232 - register with serial core | ||
2565 | * This is done during pci probing | 2700 | * This is done during pci probing |
2566 | * @pdev: handle for this card | 2701 | * @pdev: handle for this card |
2567 | */ | 2702 | */ |
2568 | static inline int | 2703 | static inline int |
2569 | ioc4_serial_core_attach(struct pci_dev *pdev) | 2704 | ioc4_serial_core_attach(struct pci_dev *pdev, int port_type) |
2570 | { | 2705 | { |
2571 | struct ioc4_port *port; | 2706 | struct ioc4_port *port; |
2572 | struct uart_port *the_port; | 2707 | struct uart_port *the_port; |
2573 | struct ioc4_driver_data *idd = pci_get_drvdata(pdev); | 2708 | struct ioc4_driver_data *idd = pci_get_drvdata(pdev); |
2574 | struct ioc4_control *control = idd->idd_serial_data; | 2709 | struct ioc4_control *control = idd->idd_serial_data; |
2575 | int ii; | 2710 | int port_num; |
2711 | int port_type_idx; | ||
2712 | struct uart_driver *u_driver; | ||
2713 | |||
2576 | 2714 | ||
2577 | DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n", | 2715 | DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n", |
2578 | __FUNCTION__, pdev, (void *)control)); | 2716 | __FUNCTION__, pdev, (void *)control)); |
@@ -2580,28 +2718,36 @@ ioc4_serial_core_attach(struct pci_dev *pdev) | |||
2580 | if (!control) | 2718 | if (!control) |
2581 | return -ENODEV; | 2719 | return -ENODEV; |
2582 | 2720 | ||
2721 | port_type_idx = (port_type == PROTO_RS232) ? UART_PORT_RS232 | ||
2722 | : UART_PORT_RS422; | ||
2723 | |||
2724 | u_driver = (port_type == PROTO_RS232) ? &ioc4_uart_rs232 | ||
2725 | : &ioc4_uart_rs422; | ||
2726 | |||
2583 | /* once around for each port on this card */ | 2727 | /* once around for each port on this card */ |
2584 | for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { | 2728 | for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) { |
2585 | the_port = &control->ic_port[ii].icp_uart_port; | 2729 | the_port = &control->ic_port[port_num].icp_uart_port |
2586 | port = control->ic_port[ii].icp_port; | 2730 | [port_type_idx]; |
2587 | port->ip_port = the_port; | 2731 | port = control->ic_port[port_num].icp_port; |
2732 | port->ip_all_ports[port_type_idx] = the_port; | ||
2588 | 2733 | ||
2589 | DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p\n", | 2734 | DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p : type %s\n", |
2590 | __FUNCTION__, (void *)the_port, | 2735 | __FUNCTION__, (void *)the_port, |
2591 | (void *)port)); | 2736 | (void *)port, |
2737 | port_type == PROTO_RS232 ? "rs232" : "rs422")); | ||
2592 | 2738 | ||
2593 | /* membase, iobase and mapbase just need to be non-0 */ | 2739 | /* membase, iobase and mapbase just need to be non-0 */ |
2594 | the_port->membase = (unsigned char __iomem *)1; | 2740 | the_port->membase = (unsigned char __iomem *)1; |
2595 | the_port->iobase = (pdev->bus->number << 16) | ii; | 2741 | the_port->iobase = (pdev->bus->number << 16) | port_num; |
2596 | the_port->line = (Num_of_ioc4_cards << 2) | ii; | 2742 | the_port->line = (Num_of_ioc4_cards << 2) | port_num; |
2597 | the_port->mapbase = 1; | 2743 | the_port->mapbase = port_type; |
2598 | the_port->type = PORT_16550A; | 2744 | the_port->type = PORT_16550A; |
2599 | the_port->fifosize = IOC4_FIFO_CHARS; | 2745 | the_port->fifosize = IOC4_FIFO_CHARS; |
2600 | the_port->ops = &ioc4_ops; | 2746 | the_port->ops = &ioc4_ops; |
2601 | the_port->irq = control->ic_irq; | 2747 | the_port->irq = control->ic_irq; |
2602 | the_port->dev = &pdev->dev; | 2748 | the_port->dev = &pdev->dev; |
2603 | spin_lock_init(&the_port->lock); | 2749 | spin_lock_init(&the_port->lock); |
2604 | if (uart_add_one_port(&ioc4_uart, the_port) < 0) { | 2750 | if (uart_add_one_port(u_driver, the_port) < 0) { |
2605 | printk(KERN_WARNING | 2751 | printk(KERN_WARNING |
2606 | "%s: unable to add port %d bus %d\n", | 2752 | "%s: unable to add port %d bus %d\n", |
2607 | __FUNCTION__, the_port->line, pdev->bus->number); | 2753 | __FUNCTION__, the_port->line, pdev->bus->number); |
@@ -2610,8 +2756,6 @@ ioc4_serial_core_attach(struct pci_dev *pdev) | |||
2610 | ("IOC4 serial port %d irq = %d, bus %d\n", | 2756 | ("IOC4 serial port %d irq = %d, bus %d\n", |
2611 | the_port->line, the_port->irq, pdev->bus->number)); | 2757 | the_port->line, the_port->irq, pdev->bus->number)); |
2612 | } | 2758 | } |
2613 | /* all ports are rs232 for now */ | ||
2614 | ioc4_set_proto(port, PROTO_RS232); | ||
2615 | } | 2759 | } |
2616 | return 0; | 2760 | return 0; |
2617 | } | 2761 | } |
@@ -2631,7 +2775,8 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2631 | int ret = 0; | 2775 | int ret = 0; |
2632 | 2776 | ||
2633 | 2777 | ||
2634 | DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, idd->idd_pci_id)); | 2778 | DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, |
2779 | idd->idd_pci_id)); | ||
2635 | 2780 | ||
2636 | /* request serial registers */ | 2781 | /* request serial registers */ |
2637 | tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET; | 2782 | tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET; |
@@ -2653,11 +2798,11 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2653 | goto out2; | 2798 | goto out2; |
2654 | } | 2799 | } |
2655 | DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n", | 2800 | DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n", |
2656 | __FUNCTION__, (void *)idd->idd_misc_regs, (void *)serial)); | 2801 | __FUNCTION__, (void *)idd->idd_misc_regs, |
2802 | (void *)serial)); | ||
2657 | 2803 | ||
2658 | /* Get memory for the new card */ | 2804 | /* Get memory for the new card */ |
2659 | control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS, | 2805 | control = kmalloc(sizeof(struct ioc4_control), GFP_KERNEL); |
2660 | GFP_KERNEL); | ||
2661 | 2806 | ||
2662 | if (!control) { | 2807 | if (!control) { |
2663 | printk(KERN_WARNING "ioc4_attach_one" | 2808 | printk(KERN_WARNING "ioc4_attach_one" |
@@ -2702,7 +2847,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2702 | 2847 | ||
2703 | /* Hook up interrupt handler */ | 2848 | /* Hook up interrupt handler */ |
2704 | if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, | 2849 | if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, |
2705 | "sgi-ioc4serial", (void *)soft)) { | 2850 | "sgi-ioc4serial", soft)) { |
2706 | control->ic_irq = idd->idd_pdev->irq; | 2851 | control->ic_irq = idd->idd_pdev->irq; |
2707 | } else { | 2852 | } else { |
2708 | printk(KERN_WARNING | 2853 | printk(KERN_WARNING |
@@ -2713,16 +2858,21 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2713 | if (ret) | 2858 | if (ret) |
2714 | goto out4; | 2859 | goto out4; |
2715 | 2860 | ||
2716 | /* register port with the serial core */ | 2861 | /* register port with the serial core - 1 rs232, 1 rs422 */ |
2717 | 2862 | ||
2718 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev))) | 2863 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS232))) |
2719 | goto out4; | 2864 | goto out4; |
2720 | 2865 | ||
2866 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS422))) | ||
2867 | goto out5; | ||
2868 | |||
2721 | Num_of_ioc4_cards++; | 2869 | Num_of_ioc4_cards++; |
2722 | 2870 | ||
2723 | return ret; | 2871 | return ret; |
2724 | 2872 | ||
2725 | /* error exits that give back resources */ | 2873 | /* error exits that give back resources */ |
2874 | out5: | ||
2875 | ioc4_serial_remove_one(idd); | ||
2726 | out4: | 2876 | out4: |
2727 | kfree(soft); | 2877 | kfree(soft); |
2728 | out3: | 2878 | out3: |
@@ -2735,52 +2885,6 @@ out1: | |||
2735 | } | 2885 | } |
2736 | 2886 | ||
2737 | 2887 | ||
2738 | /** | ||
2739 | * ioc4_serial_remove_one - detach function | ||
2740 | * | ||
2741 | * @idd: IOC4 master module data for this IOC4 | ||
2742 | */ | ||
2743 | |||
2744 | int ioc4_serial_remove_one(struct ioc4_driver_data *idd) | ||
2745 | { | ||
2746 | int ii; | ||
2747 | struct ioc4_control *control; | ||
2748 | struct uart_port *the_port; | ||
2749 | struct ioc4_port *port; | ||
2750 | struct ioc4_soft *soft; | ||
2751 | |||
2752 | control = idd->idd_serial_data; | ||
2753 | |||
2754 | for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { | ||
2755 | the_port = &control->ic_port[ii].icp_uart_port; | ||
2756 | if (the_port) { | ||
2757 | uart_remove_one_port(&ioc4_uart, the_port); | ||
2758 | } | ||
2759 | port = control->ic_port[ii].icp_port; | ||
2760 | if (!(ii & 1) && port) { | ||
2761 | pci_free_consistent(port->ip_pdev, | ||
2762 | TOTAL_RING_BUF_SIZE, | ||
2763 | (void *)port->ip_cpu_ringbuf, | ||
2764 | port->ip_dma_ringbuf); | ||
2765 | kfree(port); | ||
2766 | } | ||
2767 | } | ||
2768 | soft = control->ic_soft; | ||
2769 | if (soft) { | ||
2770 | free_irq(control->ic_irq, (void *)soft); | ||
2771 | if (soft->is_ioc4_serial_addr) { | ||
2772 | release_region((unsigned long) | ||
2773 | soft->is_ioc4_serial_addr, | ||
2774 | sizeof(struct ioc4_serial)); | ||
2775 | } | ||
2776 | kfree(soft); | ||
2777 | } | ||
2778 | kfree(control); | ||
2779 | idd->idd_serial_data = NULL; | ||
2780 | |||
2781 | return 0; | ||
2782 | } | ||
2783 | |||
2784 | static struct ioc4_submodule ioc4_serial_submodule = { | 2888 | static struct ioc4_submodule ioc4_serial_submodule = { |
2785 | .is_name = "IOC4_serial", | 2889 | .is_name = "IOC4_serial", |
2786 | .is_owner = THIS_MODULE, | 2890 | .is_owner = THIS_MODULE, |
@@ -2796,9 +2900,15 @@ int ioc4_serial_init(void) | |||
2796 | int ret; | 2900 | int ret; |
2797 | 2901 | ||
2798 | /* register with serial core */ | 2902 | /* register with serial core */ |
2799 | if ((ret = uart_register_driver(&ioc4_uart)) < 0) { | 2903 | if ((ret = uart_register_driver(&ioc4_uart_rs232)) < 0) { |
2904 | printk(KERN_WARNING | ||
2905 | "%s: Couldn't register rs232 IOC4 serial driver\n", | ||
2906 | __FUNCTION__); | ||
2907 | return ret; | ||
2908 | } | ||
2909 | if ((ret = uart_register_driver(&ioc4_uart_rs422)) < 0) { | ||
2800 | printk(KERN_WARNING | 2910 | printk(KERN_WARNING |
2801 | "%s: Couldn't register IOC4 serial driver\n", | 2911 | "%s: Couldn't register rs422 IOC4 serial driver\n", |
2802 | __FUNCTION__); | 2912 | __FUNCTION__); |
2803 | return ret; | 2913 | return ret; |
2804 | } | 2914 | } |
@@ -2810,7 +2920,8 @@ int ioc4_serial_init(void) | |||
2810 | static void __devexit ioc4_serial_exit(void) | 2920 | static void __devexit ioc4_serial_exit(void) |
2811 | { | 2921 | { |
2812 | ioc4_unregister_submodule(&ioc4_serial_submodule); | 2922 | ioc4_unregister_submodule(&ioc4_serial_submodule); |
2813 | uart_unregister_driver(&ioc4_uart); | 2923 | uart_unregister_driver(&ioc4_uart_rs232); |
2924 | uart_unregister_driver(&ioc4_uart_rs422); | ||
2814 | } | 2925 | } |
2815 | 2926 | ||
2816 | module_init(ioc4_serial_init); | 2927 | module_init(ioc4_serial_init); |
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 0ca83ac31d07..94681922ea0a 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/serial/mpsc.c | ||
3 | * | ||
4 | * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240, | 2 | * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240, |
5 | * GT64260, MV64340, MV64360, GT96100, ... ). | 3 | * GT64260, MV64340, MV64360, GT96100, ... ). |
6 | * | 4 | * |
@@ -52,9 +50,263 @@ | |||
52 | * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. | 50 | * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. |
53 | */ | 51 | */ |
54 | 52 | ||
53 | #include <linux/config.h> | ||
54 | |||
55 | #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
56 | #define SUPPORT_SYSRQ | ||
57 | #endif | ||
58 | |||
59 | #include <linux/module.h> | ||
60 | #include <linux/moduleparam.h> | ||
61 | #include <linux/tty.h> | ||
62 | #include <linux/tty_flip.h> | ||
63 | #include <linux/ioport.h> | ||
64 | #include <linux/init.h> | ||
65 | #include <linux/console.h> | ||
66 | #include <linux/sysrq.h> | ||
67 | #include <linux/serial.h> | ||
68 | #include <linux/serial_core.h> | ||
69 | #include <linux/delay.h> | ||
70 | #include <linux/device.h> | ||
71 | #include <linux/dma-mapping.h> | ||
72 | #include <linux/mv643xx.h> | ||
55 | #include <linux/platform_device.h> | 73 | #include <linux/platform_device.h> |
56 | 74 | ||
57 | #include "mpsc.h" | 75 | #include <asm/io.h> |
76 | #include <asm/irq.h> | ||
77 | |||
78 | #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
79 | #define SUPPORT_SYSRQ | ||
80 | #endif | ||
81 | |||
82 | #define MPSC_NUM_CTLRS 2 | ||
83 | |||
84 | /* | ||
85 | * Descriptors and buffers must be cache line aligned. | ||
86 | * Buffers lengths must be multiple of cache line size. | ||
87 | * Number of Tx & Rx descriptors must be powers of 2. | ||
88 | */ | ||
89 | #define MPSC_RXR_ENTRIES 32 | ||
90 | #define MPSC_RXRE_SIZE dma_get_cache_alignment() | ||
91 | #define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE) | ||
92 | #define MPSC_RXBE_SIZE dma_get_cache_alignment() | ||
93 | #define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE) | ||
94 | |||
95 | #define MPSC_TXR_ENTRIES 32 | ||
96 | #define MPSC_TXRE_SIZE dma_get_cache_alignment() | ||
97 | #define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE) | ||
98 | #define MPSC_TXBE_SIZE dma_get_cache_alignment() | ||
99 | #define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE) | ||
100 | |||
101 | #define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \ | ||
102 | MPSC_TXR_SIZE + MPSC_TXB_SIZE + \ | ||
103 | dma_get_cache_alignment() /* for alignment */) | ||
104 | |||
105 | /* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */ | ||
106 | struct mpsc_rx_desc { | ||
107 | u16 bufsize; | ||
108 | u16 bytecnt; | ||
109 | u32 cmdstat; | ||
110 | u32 link; | ||
111 | u32 buf_ptr; | ||
112 | } __attribute((packed)); | ||
113 | |||
114 | struct mpsc_tx_desc { | ||
115 | u16 bytecnt; | ||
116 | u16 shadow; | ||
117 | u32 cmdstat; | ||
118 | u32 link; | ||
119 | u32 buf_ptr; | ||
120 | } __attribute((packed)); | ||
121 | |||
122 | /* | ||
123 | * Some regs that have the erratum that you can't read them are are shared | ||
124 | * between the two MPSC controllers. This struct contains those shared regs. | ||
125 | */ | ||
126 | struct mpsc_shared_regs { | ||
127 | phys_addr_t mpsc_routing_base_p; | ||
128 | phys_addr_t sdma_intr_base_p; | ||
129 | |||
130 | void __iomem *mpsc_routing_base; | ||
131 | void __iomem *sdma_intr_base; | ||
132 | |||
133 | u32 MPSC_MRR_m; | ||
134 | u32 MPSC_RCRR_m; | ||
135 | u32 MPSC_TCRR_m; | ||
136 | u32 SDMA_INTR_CAUSE_m; | ||
137 | u32 SDMA_INTR_MASK_m; | ||
138 | }; | ||
139 | |||
140 | /* The main driver data structure */ | ||
141 | struct mpsc_port_info { | ||
142 | struct uart_port port; /* Overlay uart_port structure */ | ||
143 | |||
144 | /* Internal driver state for this ctlr */ | ||
145 | u8 ready; | ||
146 | u8 rcv_data; | ||
147 | tcflag_t c_iflag; /* save termios->c_iflag */ | ||
148 | tcflag_t c_cflag; /* save termios->c_cflag */ | ||
149 | |||
150 | /* Info passed in from platform */ | ||
151 | u8 mirror_regs; /* Need to mirror regs? */ | ||
152 | u8 cache_mgmt; /* Need manual cache mgmt? */ | ||
153 | u8 brg_can_tune; /* BRG has baud tuning? */ | ||
154 | u32 brg_clk_src; | ||
155 | u16 mpsc_max_idle; | ||
156 | int default_baud; | ||
157 | int default_bits; | ||
158 | int default_parity; | ||
159 | int default_flow; | ||
160 | |||
161 | /* Physical addresses of various blocks of registers (from platform) */ | ||
162 | phys_addr_t mpsc_base_p; | ||
163 | phys_addr_t sdma_base_p; | ||
164 | phys_addr_t brg_base_p; | ||
165 | |||
166 | /* Virtual addresses of various blocks of registers (from platform) */ | ||
167 | void __iomem *mpsc_base; | ||
168 | void __iomem *sdma_base; | ||
169 | void __iomem *brg_base; | ||
170 | |||
171 | /* Descriptor ring and buffer allocations */ | ||
172 | void *dma_region; | ||
173 | dma_addr_t dma_region_p; | ||
174 | |||
175 | dma_addr_t rxr; /* Rx descriptor ring */ | ||
176 | dma_addr_t rxr_p; /* Phys addr of rxr */ | ||
177 | u8 *rxb; /* Rx Ring I/O buf */ | ||
178 | u8 *rxb_p; /* Phys addr of rxb */ | ||
179 | u32 rxr_posn; /* First desc w/ Rx data */ | ||
180 | |||
181 | dma_addr_t txr; /* Tx descriptor ring */ | ||
182 | dma_addr_t txr_p; /* Phys addr of txr */ | ||
183 | u8 *txb; /* Tx Ring I/O buf */ | ||
184 | u8 *txb_p; /* Phys addr of txb */ | ||
185 | int txr_head; /* Where new data goes */ | ||
186 | int txr_tail; /* Where sent data comes off */ | ||
187 | |||
188 | /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ | ||
189 | u32 MPSC_MPCR_m; | ||
190 | u32 MPSC_CHR_1_m; | ||
191 | u32 MPSC_CHR_2_m; | ||
192 | u32 MPSC_CHR_10_m; | ||
193 | u32 BRG_BCR_m; | ||
194 | struct mpsc_shared_regs *shared_regs; | ||
195 | }; | ||
196 | |||
197 | /* Hooks to platform-specific code */ | ||
198 | int mpsc_platform_register_driver(void); | ||
199 | void mpsc_platform_unregister_driver(void); | ||
200 | |||
201 | /* Hooks back in to mpsc common to be called by platform-specific code */ | ||
202 | struct mpsc_port_info *mpsc_device_probe(int index); | ||
203 | struct mpsc_port_info *mpsc_device_remove(int index); | ||
204 | |||
205 | /* Main MPSC Configuration Register Offsets */ | ||
206 | #define MPSC_MMCRL 0x0000 | ||
207 | #define MPSC_MMCRH 0x0004 | ||
208 | #define MPSC_MPCR 0x0008 | ||
209 | #define MPSC_CHR_1 0x000c | ||
210 | #define MPSC_CHR_2 0x0010 | ||
211 | #define MPSC_CHR_3 0x0014 | ||
212 | #define MPSC_CHR_4 0x0018 | ||
213 | #define MPSC_CHR_5 0x001c | ||
214 | #define MPSC_CHR_6 0x0020 | ||
215 | #define MPSC_CHR_7 0x0024 | ||
216 | #define MPSC_CHR_8 0x0028 | ||
217 | #define MPSC_CHR_9 0x002c | ||
218 | #define MPSC_CHR_10 0x0030 | ||
219 | #define MPSC_CHR_11 0x0034 | ||
220 | |||
221 | #define MPSC_MPCR_FRZ (1 << 9) | ||
222 | #define MPSC_MPCR_CL_5 0 | ||
223 | #define MPSC_MPCR_CL_6 1 | ||
224 | #define MPSC_MPCR_CL_7 2 | ||
225 | #define MPSC_MPCR_CL_8 3 | ||
226 | #define MPSC_MPCR_SBL_1 0 | ||
227 | #define MPSC_MPCR_SBL_2 1 | ||
228 | |||
229 | #define MPSC_CHR_2_TEV (1<<1) | ||
230 | #define MPSC_CHR_2_TA (1<<7) | ||
231 | #define MPSC_CHR_2_TTCS (1<<9) | ||
232 | #define MPSC_CHR_2_REV (1<<17) | ||
233 | #define MPSC_CHR_2_RA (1<<23) | ||
234 | #define MPSC_CHR_2_CRD (1<<25) | ||
235 | #define MPSC_CHR_2_EH (1<<31) | ||
236 | #define MPSC_CHR_2_PAR_ODD 0 | ||
237 | #define MPSC_CHR_2_PAR_SPACE 1 | ||
238 | #define MPSC_CHR_2_PAR_EVEN 2 | ||
239 | #define MPSC_CHR_2_PAR_MARK 3 | ||
240 | |||
241 | /* MPSC Signal Routing */ | ||
242 | #define MPSC_MRR 0x0000 | ||
243 | #define MPSC_RCRR 0x0004 | ||
244 | #define MPSC_TCRR 0x0008 | ||
245 | |||
246 | /* Serial DMA Controller Interface Registers */ | ||
247 | #define SDMA_SDC 0x0000 | ||
248 | #define SDMA_SDCM 0x0008 | ||
249 | #define SDMA_RX_DESC 0x0800 | ||
250 | #define SDMA_RX_BUF_PTR 0x0808 | ||
251 | #define SDMA_SCRDP 0x0810 | ||
252 | #define SDMA_TX_DESC 0x0c00 | ||
253 | #define SDMA_SCTDP 0x0c10 | ||
254 | #define SDMA_SFTDP 0x0c14 | ||
255 | |||
256 | #define SDMA_DESC_CMDSTAT_PE (1<<0) | ||
257 | #define SDMA_DESC_CMDSTAT_CDL (1<<1) | ||
258 | #define SDMA_DESC_CMDSTAT_FR (1<<3) | ||
259 | #define SDMA_DESC_CMDSTAT_OR (1<<6) | ||
260 | #define SDMA_DESC_CMDSTAT_BR (1<<9) | ||
261 | #define SDMA_DESC_CMDSTAT_MI (1<<10) | ||
262 | #define SDMA_DESC_CMDSTAT_A (1<<11) | ||
263 | #define SDMA_DESC_CMDSTAT_AM (1<<12) | ||
264 | #define SDMA_DESC_CMDSTAT_CT (1<<13) | ||
265 | #define SDMA_DESC_CMDSTAT_C (1<<14) | ||
266 | #define SDMA_DESC_CMDSTAT_ES (1<<15) | ||
267 | #define SDMA_DESC_CMDSTAT_L (1<<16) | ||
268 | #define SDMA_DESC_CMDSTAT_F (1<<17) | ||
269 | #define SDMA_DESC_CMDSTAT_P (1<<18) | ||
270 | #define SDMA_DESC_CMDSTAT_EI (1<<23) | ||
271 | #define SDMA_DESC_CMDSTAT_O (1<<31) | ||
272 | |||
273 | #define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \ | ||
274 | SDMA_DESC_CMDSTAT_EI) | ||
275 | |||
276 | #define SDMA_SDC_RFT (1<<0) | ||
277 | #define SDMA_SDC_SFM (1<<1) | ||
278 | #define SDMA_SDC_BLMR (1<<6) | ||
279 | #define SDMA_SDC_BLMT (1<<7) | ||
280 | #define SDMA_SDC_POVR (1<<8) | ||
281 | #define SDMA_SDC_RIFB (1<<9) | ||
282 | |||
283 | #define SDMA_SDCM_ERD (1<<7) | ||
284 | #define SDMA_SDCM_AR (1<<15) | ||
285 | #define SDMA_SDCM_STD (1<<16) | ||
286 | #define SDMA_SDCM_TXD (1<<23) | ||
287 | #define SDMA_SDCM_AT (1<<31) | ||
288 | |||
289 | #define SDMA_0_CAUSE_RXBUF (1<<0) | ||
290 | #define SDMA_0_CAUSE_RXERR (1<<1) | ||
291 | #define SDMA_0_CAUSE_TXBUF (1<<2) | ||
292 | #define SDMA_0_CAUSE_TXEND (1<<3) | ||
293 | #define SDMA_1_CAUSE_RXBUF (1<<8) | ||
294 | #define SDMA_1_CAUSE_RXERR (1<<9) | ||
295 | #define SDMA_1_CAUSE_TXBUF (1<<10) | ||
296 | #define SDMA_1_CAUSE_TXEND (1<<11) | ||
297 | |||
298 | #define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \ | ||
299 | SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR) | ||
300 | #define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \ | ||
301 | SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND) | ||
302 | |||
303 | /* SDMA Interrupt registers */ | ||
304 | #define SDMA_INTR_CAUSE 0x0000 | ||
305 | #define SDMA_INTR_MASK 0x0080 | ||
306 | |||
307 | /* Baud Rate Generator Interface Registers */ | ||
308 | #define BRG_BCR 0x0000 | ||
309 | #define BRG_BTR 0x0004 | ||
58 | 310 | ||
59 | /* | 311 | /* |
60 | * Define how this driver is known to the outside (we've been assigned a | 312 | * Define how this driver is known to the outside (we've been assigned a |
@@ -1165,7 +1417,7 @@ mpsc_startup(struct uart_port *port) | |||
1165 | flag = SA_SHIRQ; | 1417 | flag = SA_SHIRQ; |
1166 | 1418 | ||
1167 | if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, | 1419 | if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, |
1168 | "mpsc/sdma", pi)) | 1420 | "mpsc-sdma", pi)) |
1169 | printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n", | 1421 | printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n", |
1170 | pi->port.irq); | 1422 | pi->port.irq); |
1171 | 1423 | ||
diff --git a/drivers/serial/mpsc.h b/drivers/serial/mpsc.h deleted file mode 100644 index 678dbcf06c8f..000000000000 --- a/drivers/serial/mpsc.h +++ /dev/null | |||
@@ -1,289 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/serial/mpsc.h | ||
3 | * | ||
4 | * Author: Mark A. Greer <mgreer@mvista.com> | ||
5 | * | ||
6 | * 2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __MPSC_H__ | ||
13 | #define __MPSC_H__ | ||
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/tty.h> | ||
19 | #include <linux/tty_flip.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/console.h> | ||
23 | #include <linux/sysrq.h> | ||
24 | #include <linux/serial.h> | ||
25 | #include <linux/serial_core.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/dma-mapping.h> | ||
29 | #include <linux/mv643xx.h> | ||
30 | |||
31 | #include <asm/io.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
35 | #define SUPPORT_SYSRQ | ||
36 | #endif | ||
37 | |||
38 | #define MPSC_NUM_CTLRS 2 | ||
39 | |||
40 | /* | ||
41 | * Descriptors and buffers must be cache line aligned. | ||
42 | * Buffers lengths must be multiple of cache line size. | ||
43 | * Number of Tx & Rx descriptors must be powers of 2. | ||
44 | */ | ||
45 | #define MPSC_RXR_ENTRIES 32 | ||
46 | #define MPSC_RXRE_SIZE dma_get_cache_alignment() | ||
47 | #define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE) | ||
48 | #define MPSC_RXBE_SIZE dma_get_cache_alignment() | ||
49 | #define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE) | ||
50 | |||
51 | #define MPSC_TXR_ENTRIES 32 | ||
52 | #define MPSC_TXRE_SIZE dma_get_cache_alignment() | ||
53 | #define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE) | ||
54 | #define MPSC_TXBE_SIZE dma_get_cache_alignment() | ||
55 | #define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE) | ||
56 | |||
57 | #define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \ | ||
58 | MPSC_TXR_SIZE + MPSC_TXB_SIZE + \ | ||
59 | dma_get_cache_alignment() /* for alignment */) | ||
60 | |||
61 | /* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */ | ||
62 | struct mpsc_rx_desc { | ||
63 | u16 bufsize; | ||
64 | u16 bytecnt; | ||
65 | u32 cmdstat; | ||
66 | u32 link; | ||
67 | u32 buf_ptr; | ||
68 | } __attribute((packed)); | ||
69 | |||
70 | struct mpsc_tx_desc { | ||
71 | u16 bytecnt; | ||
72 | u16 shadow; | ||
73 | u32 cmdstat; | ||
74 | u32 link; | ||
75 | u32 buf_ptr; | ||
76 | } __attribute((packed)); | ||
77 | |||
78 | /* | ||
79 | * Some regs that have the erratum that you can't read them are are shared | ||
80 | * between the two MPSC controllers. This struct contains those shared regs. | ||
81 | */ | ||
82 | struct mpsc_shared_regs { | ||
83 | phys_addr_t mpsc_routing_base_p; | ||
84 | phys_addr_t sdma_intr_base_p; | ||
85 | |||
86 | void __iomem *mpsc_routing_base; | ||
87 | void __iomem *sdma_intr_base; | ||
88 | |||
89 | u32 MPSC_MRR_m; | ||
90 | u32 MPSC_RCRR_m; | ||
91 | u32 MPSC_TCRR_m; | ||
92 | u32 SDMA_INTR_CAUSE_m; | ||
93 | u32 SDMA_INTR_MASK_m; | ||
94 | }; | ||
95 | |||
96 | /* The main driver data structure */ | ||
97 | struct mpsc_port_info { | ||
98 | struct uart_port port; /* Overlay uart_port structure */ | ||
99 | |||
100 | /* Internal driver state for this ctlr */ | ||
101 | u8 ready; | ||
102 | u8 rcv_data; | ||
103 | tcflag_t c_iflag; /* save termios->c_iflag */ | ||
104 | tcflag_t c_cflag; /* save termios->c_cflag */ | ||
105 | |||
106 | /* Info passed in from platform */ | ||
107 | u8 mirror_regs; /* Need to mirror regs? */ | ||
108 | u8 cache_mgmt; /* Need manual cache mgmt? */ | ||
109 | u8 brg_can_tune; /* BRG has baud tuning? */ | ||
110 | u32 brg_clk_src; | ||
111 | u16 mpsc_max_idle; | ||
112 | int default_baud; | ||
113 | int default_bits; | ||
114 | int default_parity; | ||
115 | int default_flow; | ||
116 | |||
117 | /* Physical addresses of various blocks of registers (from platform) */ | ||
118 | phys_addr_t mpsc_base_p; | ||
119 | phys_addr_t sdma_base_p; | ||
120 | phys_addr_t brg_base_p; | ||
121 | |||
122 | /* Virtual addresses of various blocks of registers (from platform) */ | ||
123 | void __iomem *mpsc_base; | ||
124 | void __iomem *sdma_base; | ||
125 | void __iomem *brg_base; | ||
126 | |||
127 | /* Descriptor ring and buffer allocations */ | ||
128 | void *dma_region; | ||
129 | dma_addr_t dma_region_p; | ||
130 | |||
131 | dma_addr_t rxr; /* Rx descriptor ring */ | ||
132 | dma_addr_t rxr_p; /* Phys addr of rxr */ | ||
133 | u8 *rxb; /* Rx Ring I/O buf */ | ||
134 | u8 *rxb_p; /* Phys addr of rxb */ | ||
135 | u32 rxr_posn; /* First desc w/ Rx data */ | ||
136 | |||
137 | dma_addr_t txr; /* Tx descriptor ring */ | ||
138 | dma_addr_t txr_p; /* Phys addr of txr */ | ||
139 | u8 *txb; /* Tx Ring I/O buf */ | ||
140 | u8 *txb_p; /* Phys addr of txb */ | ||
141 | int txr_head; /* Where new data goes */ | ||
142 | int txr_tail; /* Where sent data comes off */ | ||
143 | |||
144 | /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ | ||
145 | u32 MPSC_MPCR_m; | ||
146 | u32 MPSC_CHR_1_m; | ||
147 | u32 MPSC_CHR_2_m; | ||
148 | u32 MPSC_CHR_10_m; | ||
149 | u32 BRG_BCR_m; | ||
150 | struct mpsc_shared_regs *shared_regs; | ||
151 | }; | ||
152 | |||
153 | /* Hooks to platform-specific code */ | ||
154 | int mpsc_platform_register_driver(void); | ||
155 | void mpsc_platform_unregister_driver(void); | ||
156 | |||
157 | /* Hooks back in to mpsc common to be called by platform-specific code */ | ||
158 | struct mpsc_port_info *mpsc_device_probe(int index); | ||
159 | struct mpsc_port_info *mpsc_device_remove(int index); | ||
160 | |||
161 | /* | ||
162 | ***************************************************************************** | ||
163 | * | ||
164 | * Multi-Protocol Serial Controller Interface Registers | ||
165 | * | ||
166 | ***************************************************************************** | ||
167 | */ | ||
168 | |||
169 | /* Main Configuratino Register Offsets */ | ||
170 | #define MPSC_MMCRL 0x0000 | ||
171 | #define MPSC_MMCRH 0x0004 | ||
172 | #define MPSC_MPCR 0x0008 | ||
173 | #define MPSC_CHR_1 0x000c | ||
174 | #define MPSC_CHR_2 0x0010 | ||
175 | #define MPSC_CHR_3 0x0014 | ||
176 | #define MPSC_CHR_4 0x0018 | ||
177 | #define MPSC_CHR_5 0x001c | ||
178 | #define MPSC_CHR_6 0x0020 | ||
179 | #define MPSC_CHR_7 0x0024 | ||
180 | #define MPSC_CHR_8 0x0028 | ||
181 | #define MPSC_CHR_9 0x002c | ||
182 | #define MPSC_CHR_10 0x0030 | ||
183 | #define MPSC_CHR_11 0x0034 | ||
184 | |||
185 | #define MPSC_MPCR_FRZ (1 << 9) | ||
186 | #define MPSC_MPCR_CL_5 0 | ||
187 | #define MPSC_MPCR_CL_6 1 | ||
188 | #define MPSC_MPCR_CL_7 2 | ||
189 | #define MPSC_MPCR_CL_8 3 | ||
190 | #define MPSC_MPCR_SBL_1 0 | ||
191 | #define MPSC_MPCR_SBL_2 1 | ||
192 | |||
193 | #define MPSC_CHR_2_TEV (1<<1) | ||
194 | #define MPSC_CHR_2_TA (1<<7) | ||
195 | #define MPSC_CHR_2_TTCS (1<<9) | ||
196 | #define MPSC_CHR_2_REV (1<<17) | ||
197 | #define MPSC_CHR_2_RA (1<<23) | ||
198 | #define MPSC_CHR_2_CRD (1<<25) | ||
199 | #define MPSC_CHR_2_EH (1<<31) | ||
200 | #define MPSC_CHR_2_PAR_ODD 0 | ||
201 | #define MPSC_CHR_2_PAR_SPACE 1 | ||
202 | #define MPSC_CHR_2_PAR_EVEN 2 | ||
203 | #define MPSC_CHR_2_PAR_MARK 3 | ||
204 | |||
205 | /* MPSC Signal Routing */ | ||
206 | #define MPSC_MRR 0x0000 | ||
207 | #define MPSC_RCRR 0x0004 | ||
208 | #define MPSC_TCRR 0x0008 | ||
209 | |||
210 | /* | ||
211 | ***************************************************************************** | ||
212 | * | ||
213 | * Serial DMA Controller Interface Registers | ||
214 | * | ||
215 | ***************************************************************************** | ||
216 | */ | ||
217 | |||
218 | #define SDMA_SDC 0x0000 | ||
219 | #define SDMA_SDCM 0x0008 | ||
220 | #define SDMA_RX_DESC 0x0800 | ||
221 | #define SDMA_RX_BUF_PTR 0x0808 | ||
222 | #define SDMA_SCRDP 0x0810 | ||
223 | #define SDMA_TX_DESC 0x0c00 | ||
224 | #define SDMA_SCTDP 0x0c10 | ||
225 | #define SDMA_SFTDP 0x0c14 | ||
226 | |||
227 | #define SDMA_DESC_CMDSTAT_PE (1<<0) | ||
228 | #define SDMA_DESC_CMDSTAT_CDL (1<<1) | ||
229 | #define SDMA_DESC_CMDSTAT_FR (1<<3) | ||
230 | #define SDMA_DESC_CMDSTAT_OR (1<<6) | ||
231 | #define SDMA_DESC_CMDSTAT_BR (1<<9) | ||
232 | #define SDMA_DESC_CMDSTAT_MI (1<<10) | ||
233 | #define SDMA_DESC_CMDSTAT_A (1<<11) | ||
234 | #define SDMA_DESC_CMDSTAT_AM (1<<12) | ||
235 | #define SDMA_DESC_CMDSTAT_CT (1<<13) | ||
236 | #define SDMA_DESC_CMDSTAT_C (1<<14) | ||
237 | #define SDMA_DESC_CMDSTAT_ES (1<<15) | ||
238 | #define SDMA_DESC_CMDSTAT_L (1<<16) | ||
239 | #define SDMA_DESC_CMDSTAT_F (1<<17) | ||
240 | #define SDMA_DESC_CMDSTAT_P (1<<18) | ||
241 | #define SDMA_DESC_CMDSTAT_EI (1<<23) | ||
242 | #define SDMA_DESC_CMDSTAT_O (1<<31) | ||
243 | |||
244 | #define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \ | ||
245 | SDMA_DESC_CMDSTAT_EI) | ||
246 | |||
247 | #define SDMA_SDC_RFT (1<<0) | ||
248 | #define SDMA_SDC_SFM (1<<1) | ||
249 | #define SDMA_SDC_BLMR (1<<6) | ||
250 | #define SDMA_SDC_BLMT (1<<7) | ||
251 | #define SDMA_SDC_POVR (1<<8) | ||
252 | #define SDMA_SDC_RIFB (1<<9) | ||
253 | |||
254 | #define SDMA_SDCM_ERD (1<<7) | ||
255 | #define SDMA_SDCM_AR (1<<15) | ||
256 | #define SDMA_SDCM_STD (1<<16) | ||
257 | #define SDMA_SDCM_TXD (1<<23) | ||
258 | #define SDMA_SDCM_AT (1<<31) | ||
259 | |||
260 | #define SDMA_0_CAUSE_RXBUF (1<<0) | ||
261 | #define SDMA_0_CAUSE_RXERR (1<<1) | ||
262 | #define SDMA_0_CAUSE_TXBUF (1<<2) | ||
263 | #define SDMA_0_CAUSE_TXEND (1<<3) | ||
264 | #define SDMA_1_CAUSE_RXBUF (1<<8) | ||
265 | #define SDMA_1_CAUSE_RXERR (1<<9) | ||
266 | #define SDMA_1_CAUSE_TXBUF (1<<10) | ||
267 | #define SDMA_1_CAUSE_TXEND (1<<11) | ||
268 | |||
269 | #define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \ | ||
270 | SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR) | ||
271 | #define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \ | ||
272 | SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND) | ||
273 | |||
274 | /* SDMA Interrupt registers */ | ||
275 | #define SDMA_INTR_CAUSE 0x0000 | ||
276 | #define SDMA_INTR_MASK 0x0080 | ||
277 | |||
278 | /* | ||
279 | ***************************************************************************** | ||
280 | * | ||
281 | * Baud Rate Generator Interface Registers | ||
282 | * | ||
283 | ***************************************************************************** | ||
284 | */ | ||
285 | |||
286 | #define BRG_BCR 0x0000 | ||
287 | #define BRG_BTR 0x0004 | ||
288 | |||
289 | #endif /* __MPSC_H__ */ | ||
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index ada6e75eb048..60831bb23685 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -20,14 +20,10 @@ | |||
20 | 20 | ||
21 | #include <asm/hardware/locomo.h> | 21 | #include <asm/hardware/locomo.h> |
22 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
23 | #include <asm/mach/sharpsl_param.h> | ||
24 | #include <asm/mach-types.h> | ||
23 | 25 | ||
24 | #ifdef CONFIG_SA1100_COLLIE | 26 | #include "../../../arch/arm/mach-sa1100/generic.h" |
25 | #include <asm/arch/collie.h> | ||
26 | #else | ||
27 | #include <asm/arch/poodle.h> | ||
28 | #endif | ||
29 | |||
30 | extern void (*sa1100fb_lcd_power)(int on); | ||
31 | 27 | ||
32 | static struct locomo_dev *locomolcd_dev; | 28 | static struct locomo_dev *locomolcd_dev; |
33 | 29 | ||
@@ -82,7 +78,7 @@ static void locomolcd_off(int comadj) | |||
82 | 78 | ||
83 | void locomolcd_power(int on) | 79 | void locomolcd_power(int on) |
84 | { | 80 | { |
85 | int comadj = 118; | 81 | int comadj = sharpsl_param.comadj; |
86 | unsigned long flags; | 82 | unsigned long flags; |
87 | 83 | ||
88 | local_irq_save(flags); | 84 | local_irq_save(flags); |
@@ -93,11 +89,12 @@ void locomolcd_power(int on) | |||
93 | } | 89 | } |
94 | 90 | ||
95 | /* read comadj */ | 91 | /* read comadj */ |
96 | #ifdef CONFIG_MACH_POODLE | 92 | if (comadj == -1) { |
97 | comadj = 118; | 93 | if (machine_is_poodle()) |
98 | #else | 94 | comadj = 118; |
99 | comadj = 128; | 95 | if (machine_is_collie()) |
100 | #endif | 96 | comadj = 128; |
97 | } | ||
101 | 98 | ||
102 | if (on) | 99 | if (on) |
103 | locomolcd_on(comadj); | 100 | locomolcd_on(comadj); |
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index e0dbdfc0c8b4..66d6f2f0a219 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -2622,7 +2622,7 @@ static int __init cirrusfb_init(void) | |||
2622 | #endif | 2622 | #endif |
2623 | 2623 | ||
2624 | #ifdef CONFIG_ZORRO | 2624 | #ifdef CONFIG_ZORRO |
2625 | error |= zorro_module_init(&cirrusfb_zorro_driver); | 2625 | error |= zorro_register_driver(&cirrusfb_zorro_driver); |
2626 | #endif | 2626 | #endif |
2627 | #ifdef CONFIG_PCI | 2627 | #ifdef CONFIG_PCI |
2628 | error |= pci_register_driver(&cirrusfb_pci_driver); | 2628 | error |= pci_register_driver(&cirrusfb_pci_driver); |
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index bebdac59d231..abd920a663a0 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c | |||
@@ -386,7 +386,9 @@ int __init hpfb_init(void) | |||
386 | if (fb_get_options("hpfb", NULL)) | 386 | if (fb_get_options("hpfb", NULL)) |
387 | return -ENODEV; | 387 | return -ENODEV; |
388 | 388 | ||
389 | dio_module_init(&hpfb_driver); | 389 | err = dio_register_driver(&hpfb_driver); |
390 | if (err) | ||
391 | return err; | ||
390 | 392 | ||
391 | fs = get_fs(); | 393 | fs = get_fs(); |
392 | set_fs(KERNEL_DS); | 394 | set_fs(KERNEL_DS); |
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 0e78ddc81583..52c18a35fb41 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -3532,26 +3532,26 @@ int __init pm3fb_init(void) | |||
3532 | MODULE_AUTHOR("Romain Dolbeau"); | 3532 | MODULE_AUTHOR("Romain Dolbeau"); |
3533 | MODULE_DESCRIPTION("Permedia3 framebuffer device driver"); | 3533 | MODULE_DESCRIPTION("Permedia3 framebuffer device driver"); |
3534 | static char *mode[PM3_MAX_BOARD]; | 3534 | static char *mode[PM3_MAX_BOARD]; |
3535 | MODULE_PARM(mode,PM3_MAX_BOARD_MODULE_ARRAY_STRING); | 3535 | module_param_array(mode, charp, NULL, 0); |
3536 | MODULE_PARM_DESC(mode,"video mode"); | 3536 | MODULE_PARM_DESC(mode,"video mode"); |
3537 | MODULE_PARM(disable,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3537 | module_param_array(disable, short, NULL, 0); |
3538 | MODULE_PARM_DESC(disable,"disable board"); | 3538 | MODULE_PARM_DESC(disable,"disable board"); |
3539 | static short off[PM3_MAX_BOARD]; | 3539 | static short off[PM3_MAX_BOARD]; |
3540 | MODULE_PARM(off,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3540 | module_param_array(off, short, NULL, 0); |
3541 | MODULE_PARM_DESC(off,"disable board"); | 3541 | MODULE_PARM_DESC(off,"disable board"); |
3542 | static char *pciid[PM3_MAX_BOARD]; | 3542 | static char *pciid[PM3_MAX_BOARD]; |
3543 | MODULE_PARM(pciid,PM3_MAX_BOARD_MODULE_ARRAY_STRING); | 3543 | module_param_array(pciid, charp, NULL, 0); |
3544 | MODULE_PARM_DESC(pciid,"board PCI Id"); | 3544 | MODULE_PARM_DESC(pciid,"board PCI Id"); |
3545 | MODULE_PARM(noaccel,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3545 | module_param_array(noaccel, short, NULL, 0); |
3546 | MODULE_PARM_DESC(noaccel,"disable accel"); | 3546 | MODULE_PARM_DESC(noaccel,"disable accel"); |
3547 | static char *font[PM3_MAX_BOARD]; | 3547 | static char *font[PM3_MAX_BOARD]; |
3548 | MODULE_PARM(font,PM3_MAX_BOARD_MODULE_ARRAY_STRING); | 3548 | module_param_array(font, charp, NULL, 0); |
3549 | MODULE_PARM_DESC(font,"choose font"); | 3549 | MODULE_PARM_DESC(font,"choose font"); |
3550 | MODULE_PARM(depth,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3550 | module_param(depth, short, NULL, 0); |
3551 | MODULE_PARM_DESC(depth,"boot-time depth"); | 3551 | MODULE_PARM_DESC(depth,"boot-time depth"); |
3552 | MODULE_PARM(printtimings, "h"); | 3552 | module_param(printtimings, short, NULL, 0); |
3553 | MODULE_PARM_DESC(printtimings, "print the memory timings of the card(s)"); | 3553 | MODULE_PARM_DESC(printtimings, "print the memory timings of the card(s)"); |
3554 | MODULE_PARM(forcesize, PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3554 | module_param(forcesize, short, NULL, 0); |
3555 | MODULE_PARM_DESC(forcesize, "force specified memory size"); | 3555 | MODULE_PARM_DESC(forcesize, "force specified memory size"); |
3556 | /* | 3556 | /* |
3557 | MODULE_SUPPORTED_DEVICE("Permedia3 PCI boards") | 3557 | MODULE_SUPPORTED_DEVICE("Permedia3 PCI boards") |
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index fcbee748c592..067c07be928c 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c | |||
@@ -65,22 +65,17 @@ static int zorro_device_probe(struct device *dev) | |||
65 | * @drv: the driver structure to register | 65 | * @drv: the driver structure to register |
66 | * | 66 | * |
67 | * Adds the driver structure to the list of registered drivers | 67 | * Adds the driver structure to the list of registered drivers |
68 | * Returns the number of Zorro devices which were claimed by the driver | 68 | * Returns zero or a negative error value. |
69 | * during registration. The driver remains registered even if the | ||
70 | * return value is zero. | ||
71 | */ | 69 | */ |
72 | 70 | ||
73 | int zorro_register_driver(struct zorro_driver *drv) | 71 | int zorro_register_driver(struct zorro_driver *drv) |
74 | { | 72 | { |
75 | int count = 0; | ||
76 | |||
77 | /* initialize common driver fields */ | 73 | /* initialize common driver fields */ |
78 | drv->driver.name = drv->name; | 74 | drv->driver.name = drv->name; |
79 | drv->driver.bus = &zorro_bus_type; | 75 | drv->driver.bus = &zorro_bus_type; |
80 | 76 | ||
81 | /* register with core */ | 77 | /* register with core */ |
82 | count = driver_register(&drv->driver); | 78 | return driver_register(&drv->driver); |
83 | return count ? count : 1; | ||
84 | } | 79 | } |
85 | 80 | ||
86 | 81 | ||
diff --git a/fs/9p/9p.h b/fs/9p/9p.h index 95d72aec1c1a..94e2f92ab2e8 100644 --- a/fs/9p/9p.h +++ b/fs/9p/9p.h | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -235,6 +234,7 @@ struct Tcreate { | |||
235 | struct v9fs_str name; | 234 | struct v9fs_str name; |
236 | u32 perm; | 235 | u32 perm; |
237 | u8 mode; | 236 | u8 mode; |
237 | struct v9fs_str extension; | ||
238 | }; | 238 | }; |
239 | 239 | ||
240 | struct Rcreate { | 240 | struct Rcreate { |
@@ -364,7 +364,7 @@ int v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid, | |||
364 | struct v9fs_fcall **rcall); | 364 | struct v9fs_fcall **rcall); |
365 | 365 | ||
366 | int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | 366 | int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, |
367 | u32 perm, u8 mode, struct v9fs_fcall **rcall); | 367 | u32 perm, u8 mode, char *extension, struct v9fs_fcall **rcall); |
368 | 368 | ||
369 | int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, | 369 | int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, |
370 | u64 offset, u32 count, struct v9fs_fcall **rcall); | 370 | u64 offset, u32 count, struct v9fs_fcall **rcall); |
@@ -372,3 +372,4 @@ int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, | |||
372 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, | 372 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, |
373 | u32 count, const char __user * data, | 373 | u32 count, const char __user * data, |
374 | struct v9fs_fcall **rcall); | 374 | struct v9fs_fcall **rcall); |
375 | int v9fs_printfcall(char *, int, struct v9fs_fcall *, int); | ||
diff --git a/fs/9p/Makefile b/fs/9p/Makefile index 2f4ce43f7b6c..87897f84dfb6 100644 --- a/fs/9p/Makefile +++ b/fs/9p/Makefile | |||
@@ -1,10 +1,9 @@ | |||
1 | obj-$(CONFIG_9P_FS) := 9p2000.o | 1 | obj-$(CONFIG_9P_FS) := 9p.o |
2 | 2 | ||
3 | 9p2000-objs := \ | 3 | 9p-objs := \ |
4 | trans_fd.o \ | 4 | trans_fd.o \ |
5 | trans_sock.o \ | ||
6 | mux.o \ | 5 | mux.o \ |
7 | 9p.o \ | 6 | fcall.o \ |
8 | conv.o \ | 7 | conv.o \ |
9 | vfs_super.o \ | 8 | vfs_super.o \ |
10 | vfs_inode.o \ | 9 | vfs_inode.o \ |
@@ -14,5 +13,6 @@ obj-$(CONFIG_9P_FS) := 9p2000.o | |||
14 | vfs_dentry.o \ | 13 | vfs_dentry.o \ |
15 | error.o \ | 14 | error.o \ |
16 | v9fs.o \ | 15 | v9fs.o \ |
17 | fid.o | 16 | fid.o \ |
17 | fcprint.o | ||
18 | 18 | ||
diff --git a/fs/9p/conv.c b/fs/9p/conv.c index bba817142465..a767e05b60bf 100644 --- a/fs/9p/conv.c +++ b/fs/9p/conv.c | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -666,7 +665,8 @@ struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode) | |||
666 | return fc; | 665 | return fc; |
667 | } | 666 | } |
668 | 667 | ||
669 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode) | 668 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, |
669 | char *extension, int extended) | ||
670 | { | 670 | { |
671 | int size; | 671 | int size; |
672 | struct v9fs_fcall *fc; | 672 | struct v9fs_fcall *fc; |
@@ -674,6 +674,9 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode) | |||
674 | struct cbuf *bufp = &buffer; | 674 | struct cbuf *bufp = &buffer; |
675 | 675 | ||
676 | size = 4 + 2 + strlen(name) + 4 + 1; /* fid[4] name[s] perm[4] mode[1] */ | 676 | size = 4 + 2 + strlen(name) + 4 + 1; /* fid[4] name[s] perm[4] mode[1] */ |
677 | if (extended && extension!=NULL) | ||
678 | size += 2 + strlen(extension); /* extension[s] */ | ||
679 | |||
677 | fc = v9fs_create_common(bufp, size, TCREATE); | 680 | fc = v9fs_create_common(bufp, size, TCREATE); |
678 | if (IS_ERR(fc)) | 681 | if (IS_ERR(fc)) |
679 | goto error; | 682 | goto error; |
@@ -682,6 +685,8 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode) | |||
682 | v9fs_put_str(bufp, name, &fc->params.tcreate.name); | 685 | v9fs_put_str(bufp, name, &fc->params.tcreate.name); |
683 | v9fs_put_int32(bufp, perm, &fc->params.tcreate.perm); | 686 | v9fs_put_int32(bufp, perm, &fc->params.tcreate.perm); |
684 | v9fs_put_int8(bufp, mode, &fc->params.tcreate.mode); | 687 | v9fs_put_int8(bufp, mode, &fc->params.tcreate.mode); |
688 | if (extended) | ||
689 | v9fs_put_str(bufp, extension, &fc->params.tcreate.extension); | ||
685 | 690 | ||
686 | if (buf_check_overflow(bufp)) { | 691 | if (buf_check_overflow(bufp)) { |
687 | kfree(fc); | 692 | kfree(fc); |
diff --git a/fs/9p/conv.h b/fs/9p/conv.h index f5896628dae4..dd5b6b1b610f 100644 --- a/fs/9p/conv.h +++ b/fs/9p/conv.h | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -39,7 +38,8 @@ struct v9fs_fcall *v9fs_create_tflush(u16 oldtag); | |||
39 | struct v9fs_fcall *v9fs_create_twalk(u32 fid, u32 newfid, u16 nwname, | 38 | struct v9fs_fcall *v9fs_create_twalk(u32 fid, u32 newfid, u16 nwname, |
40 | char **wnames); | 39 | char **wnames); |
41 | struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode); | 40 | struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode); |
42 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode); | 41 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, |
42 | char *extension, int extended); | ||
43 | struct v9fs_fcall *v9fs_create_tread(u32 fid, u64 offset, u32 count); | 43 | struct v9fs_fcall *v9fs_create_tread(u32 fid, u64 offset, u32 count); |
44 | struct v9fs_fcall *v9fs_create_twrite(u32 fid, u64 offset, u32 count, | 44 | struct v9fs_fcall *v9fs_create_twrite(u32 fid, u64 offset, u32 count, |
45 | const char __user *data); | 45 | const char __user *data); |
diff --git a/fs/9p/debug.h b/fs/9p/debug.h index fe551032788b..4228c0bb3c32 100644 --- a/fs/9p/debug.h +++ b/fs/9p/debug.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License version 2 |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * as published by the Free Software Foundation. |
10 | * (at your option) any later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -30,6 +29,7 @@ | |||
30 | #define DEBUG_MUX (1<<5) | 29 | #define DEBUG_MUX (1<<5) |
31 | #define DEBUG_TRANS (1<<6) | 30 | #define DEBUG_TRANS (1<<6) |
32 | #define DEBUG_SLABS (1<<7) | 31 | #define DEBUG_SLABS (1<<7) |
32 | #define DEBUG_FCALL (1<<8) | ||
33 | 33 | ||
34 | #define DEBUG_DUMP_PKT 0 | 34 | #define DEBUG_DUMP_PKT 0 |
35 | 35 | ||
diff --git a/fs/9p/error.c b/fs/9p/error.c index e4b6f8f38b6f..981fe8ecd780 100644 --- a/fs/9p/error.c +++ b/fs/9p/error.c | |||
@@ -11,9 +11,8 @@ | |||
11 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 11 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
12 | * | 12 | * |
13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 14 | * it under the terms of the GNU General Public License version 2 |
15 | * the Free Software Foundation; either version 2 of the License, or | 15 | * as published by the Free Software Foundation. |
16 | * (at your option) any later version. | ||
17 | * | 16 | * |
18 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/error.h b/fs/9p/error.h index a9794e85fe51..5f3ca522b316 100644 --- a/fs/9p/error.h +++ b/fs/9p/error.h | |||
@@ -12,9 +12,8 @@ | |||
12 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 12 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 15 | * it under the terms of the GNU General Public License version 2 |
16 | * the Free Software Foundation; either version 2 of the License, or | 16 | * as published by the Free Software Foundation. |
17 | * (at your option) any later version. | ||
18 | * | 17 | * |
19 | * This program is distributed in the hope that it will be useful, | 18 | * This program is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/9p.c b/fs/9p/fcall.c index c148e6ba07e5..71742ba150c4 100644 --- a/fs/9p/9p.c +++ b/fs/9p/fcall.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/9p/9p.c | 2 | * linux/fs/9p/fcall.c |
3 | * | 3 | * |
4 | * This file contains functions to perform synchronous 9P calls | 4 | * This file contains functions to perform synchronous 9P calls |
5 | * | 5 | * |
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -152,10 +151,9 @@ v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid) | |||
152 | /** | 151 | /** |
153 | * v9fs_v9fs_t_flush - flush a pending transaction | 152 | * v9fs_v9fs_t_flush - flush a pending transaction |
154 | * @v9ses: 9P2000 session information | 153 | * @v9ses: 9P2000 session information |
155 | * @tag: tid to release | 154 | * @tag: tag to release |
156 | * | 155 | * |
157 | */ | 156 | */ |
158 | |||
159 | int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) | 157 | int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) |
160 | { | 158 | { |
161 | int ret; | 159 | int ret; |
@@ -172,7 +170,7 @@ int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) | |||
172 | 170 | ||
173 | return ret; | 171 | return ret; |
174 | } | 172 | } |
175 | #endif /* 0 */ | 173 | #endif |
176 | 174 | ||
177 | /** | 175 | /** |
178 | * v9fs_t_stat - read a file's meta-data | 176 | * v9fs_t_stat - read a file's meta-data |
@@ -334,8 +332,8 @@ v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid, | |||
334 | */ | 332 | */ |
335 | 333 | ||
336 | int | 334 | int |
337 | v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | 335 | v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, u32 perm, |
338 | u32 perm, u8 mode, struct v9fs_fcall **rcp) | 336 | u8 mode, char *extension, struct v9fs_fcall **rcp) |
339 | { | 337 | { |
340 | int ret; | 338 | int ret; |
341 | struct v9fs_fcall *tc; | 339 | struct v9fs_fcall *tc; |
@@ -343,7 +341,9 @@ v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | |||
343 | dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n", | 341 | dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n", |
344 | fid, name, perm, mode); | 342 | fid, name, perm, mode); |
345 | 343 | ||
346 | tc = v9fs_create_tcreate(fid, name, perm, mode); | 344 | tc = v9fs_create_tcreate(fid, name, perm, mode, extension, |
345 | v9ses->extended); | ||
346 | |||
347 | if (!IS_ERR(tc)) { | 347 | if (!IS_ERR(tc)) { |
348 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 348 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
349 | kfree(tc); | 349 | kfree(tc); |
diff --git a/fs/9p/fcprint.c b/fs/9p/fcprint.c new file mode 100644 index 000000000000..583e827baebd --- /dev/null +++ b/fs/9p/fcprint.c | |||
@@ -0,0 +1,346 @@ | |||
1 | /* | ||
2 | * linux/fs/9p/fcprint.c | ||
3 | * | ||
4 | * Print 9P call. | ||
5 | * | ||
6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to: | ||
19 | * Free Software Foundation | ||
20 | * 51 Franklin Street, Fifth Floor | ||
21 | * Boston, MA 02111-1301 USA | ||
22 | * | ||
23 | */ | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/idr.h> | ||
29 | |||
30 | #include "debug.h" | ||
31 | #include "v9fs.h" | ||
32 | #include "9p.h" | ||
33 | #include "mux.h" | ||
34 | |||
35 | static int | ||
36 | v9fs_printqid(char *buf, int buflen, struct v9fs_qid *q) | ||
37 | { | ||
38 | int n; | ||
39 | char b[10]; | ||
40 | |||
41 | n = 0; | ||
42 | if (q->type & V9FS_QTDIR) | ||
43 | b[n++] = 'd'; | ||
44 | if (q->type & V9FS_QTAPPEND) | ||
45 | b[n++] = 'a'; | ||
46 | if (q->type & V9FS_QTAUTH) | ||
47 | b[n++] = 'A'; | ||
48 | if (q->type & V9FS_QTEXCL) | ||
49 | b[n++] = 'l'; | ||
50 | if (q->type & V9FS_QTTMP) | ||
51 | b[n++] = 't'; | ||
52 | if (q->type & V9FS_QTSYMLINK) | ||
53 | b[n++] = 'L'; | ||
54 | b[n] = '\0'; | ||
55 | |||
56 | return scnprintf(buf, buflen, "(%.16llx %x %s)", (long long int) q->path, | ||
57 | q->version, b); | ||
58 | } | ||
59 | |||
60 | static int | ||
61 | v9fs_printperm(char *buf, int buflen, int perm) | ||
62 | { | ||
63 | int n; | ||
64 | char b[15]; | ||
65 | |||
66 | n = 0; | ||
67 | if (perm & V9FS_DMDIR) | ||
68 | b[n++] = 'd'; | ||
69 | if (perm & V9FS_DMAPPEND) | ||
70 | b[n++] = 'a'; | ||
71 | if (perm & V9FS_DMAUTH) | ||
72 | b[n++] = 'A'; | ||
73 | if (perm & V9FS_DMEXCL) | ||
74 | b[n++] = 'l'; | ||
75 | if (perm & V9FS_DMTMP) | ||
76 | b[n++] = 't'; | ||
77 | if (perm & V9FS_DMDEVICE) | ||
78 | b[n++] = 'D'; | ||
79 | if (perm & V9FS_DMSOCKET) | ||
80 | b[n++] = 'S'; | ||
81 | if (perm & V9FS_DMNAMEDPIPE) | ||
82 | b[n++] = 'P'; | ||
83 | if (perm & V9FS_DMSYMLINK) | ||
84 | b[n++] = 'L'; | ||
85 | b[n] = '\0'; | ||
86 | |||
87 | return scnprintf(buf, buflen, "%s%03o", b, perm&077); | ||
88 | } | ||
89 | |||
90 | static int | ||
91 | v9fs_printstat(char *buf, int buflen, struct v9fs_stat *st, int extended) | ||
92 | { | ||
93 | int n; | ||
94 | |||
95 | n = scnprintf(buf, buflen, "'%.*s' '%.*s'", st->name.len, | ||
96 | st->name.str, st->uid.len, st->uid.str); | ||
97 | if (extended) | ||
98 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_uid); | ||
99 | |||
100 | n += scnprintf(buf+n, buflen-n, " '%.*s'", st->gid.len, st->gid.str); | ||
101 | if (extended) | ||
102 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_gid); | ||
103 | |||
104 | n += scnprintf(buf+n, buflen-n, " '%.*s'", st->muid.len, st->muid.str); | ||
105 | if (extended) | ||
106 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_muid); | ||
107 | |||
108 | n += scnprintf(buf+n, buflen-n, " q "); | ||
109 | n += v9fs_printqid(buf+n, buflen-n, &st->qid); | ||
110 | n += scnprintf(buf+n, buflen-n, " m "); | ||
111 | n += v9fs_printperm(buf+n, buflen-n, st->mode); | ||
112 | n += scnprintf(buf+n, buflen-n, " at %d mt %d l %lld", | ||
113 | st->atime, st->mtime, (long long int) st->length); | ||
114 | |||
115 | if (extended) | ||
116 | n += scnprintf(buf+n, buflen-n, " ext '%.*s'", | ||
117 | st->extension.len, st->extension.str); | ||
118 | |||
119 | return n; | ||
120 | } | ||
121 | |||
122 | static int | ||
123 | v9fs_dumpdata(char *buf, int buflen, u8 *data, int datalen) | ||
124 | { | ||
125 | int i, n; | ||
126 | |||
127 | i = n = 0; | ||
128 | while (i < datalen) { | ||
129 | n += scnprintf(buf + n, buflen - n, "%02x", data[i]); | ||
130 | if (i%4 == 3) | ||
131 | n += scnprintf(buf + n, buflen - n, " "); | ||
132 | if (i%32 == 31) | ||
133 | n += scnprintf(buf + n, buflen - n, "\n"); | ||
134 | |||
135 | i++; | ||
136 | } | ||
137 | n += scnprintf(buf + n, buflen - n, "\n"); | ||
138 | |||
139 | return n; | ||
140 | } | ||
141 | |||
142 | static int | ||
143 | v9fs_printdata(char *buf, int buflen, u8 *data, int datalen) | ||
144 | { | ||
145 | return v9fs_dumpdata(buf, buflen, data, datalen<16?datalen:16); | ||
146 | } | ||
147 | |||
148 | int | ||
149 | v9fs_printfcall(char *buf, int buflen, struct v9fs_fcall *fc, int extended) | ||
150 | { | ||
151 | int i, ret, type, tag; | ||
152 | |||
153 | if (!fc) | ||
154 | return scnprintf(buf, buflen, "<NULL>"); | ||
155 | |||
156 | type = fc->id; | ||
157 | tag = fc->tag; | ||
158 | |||
159 | ret = 0; | ||
160 | switch (type) { | ||
161 | case TVERSION: | ||
162 | ret += scnprintf(buf+ret, buflen-ret, | ||
163 | "Tversion tag %u msize %u version '%.*s'", tag, | ||
164 | fc->params.tversion.msize, fc->params.tversion.version.len, | ||
165 | fc->params.tversion.version.str); | ||
166 | break; | ||
167 | |||
168 | case RVERSION: | ||
169 | ret += scnprintf(buf+ret, buflen-ret, | ||
170 | "Rversion tag %u msize %u version '%.*s'", tag, | ||
171 | fc->params.rversion.msize, fc->params.rversion.version.len, | ||
172 | fc->params.rversion.version.str); | ||
173 | break; | ||
174 | |||
175 | case TAUTH: | ||
176 | ret += scnprintf(buf+ret, buflen-ret, | ||
177 | "Tauth tag %u afid %d uname '%.*s' aname '%.*s'", tag, | ||
178 | fc->params.tauth.afid, fc->params.tauth.uname.len, | ||
179 | fc->params.tauth.uname.str, fc->params.tauth.aname.len, | ||
180 | fc->params.tauth.aname.str); | ||
181 | break; | ||
182 | |||
183 | case RAUTH: | ||
184 | ret += scnprintf(buf+ret, buflen-ret, "Rauth tag %u qid ", tag); | ||
185 | v9fs_printqid(buf+ret, buflen-ret, &fc->params.rauth.qid); | ||
186 | break; | ||
187 | |||
188 | case TATTACH: | ||
189 | ret += scnprintf(buf+ret, buflen-ret, | ||
190 | "Tattach tag %u fid %d afid %d uname '%.*s' aname '%.*s'", | ||
191 | tag, fc->params.tattach.fid, fc->params.tattach.afid, | ||
192 | fc->params.tattach.uname.len, fc->params.tattach.uname.str, | ||
193 | fc->params.tattach.aname.len, fc->params.tattach.aname.str); | ||
194 | break; | ||
195 | |||
196 | case RATTACH: | ||
197 | ret += scnprintf(buf+ret, buflen-ret, "Rattach tag %u qid ", tag); | ||
198 | v9fs_printqid(buf+ret, buflen-ret, &fc->params.rattach.qid); | ||
199 | break; | ||
200 | |||
201 | case RERROR: | ||
202 | ret += scnprintf(buf+ret, buflen-ret, "Rerror tag %u ename '%.*s'", | ||
203 | tag, fc->params.rerror.error.len, | ||
204 | fc->params.rerror.error.str); | ||
205 | if (extended) | ||
206 | ret += scnprintf(buf+ret, buflen-ret, " ecode %d\n", | ||
207 | fc->params.rerror.errno); | ||
208 | break; | ||
209 | |||
210 | case TFLUSH: | ||
211 | ret += scnprintf(buf+ret, buflen-ret, "Tflush tag %u oldtag %u", | ||
212 | tag, fc->params.tflush.oldtag); | ||
213 | break; | ||
214 | |||
215 | case RFLUSH: | ||
216 | ret += scnprintf(buf+ret, buflen-ret, "Rflush tag %u", tag); | ||
217 | break; | ||
218 | |||
219 | case TWALK: | ||
220 | ret += scnprintf(buf+ret, buflen-ret, | ||
221 | "Twalk tag %u fid %d newfid %d nwname %d", tag, | ||
222 | fc->params.twalk.fid, fc->params.twalk.newfid, | ||
223 | fc->params.twalk.nwname); | ||
224 | for(i = 0; i < fc->params.twalk.nwname; i++) | ||
225 | ret += scnprintf(buf+ret, buflen-ret," '%.*s'", | ||
226 | fc->params.twalk.wnames[i].len, | ||
227 | fc->params.twalk.wnames[i].str); | ||
228 | break; | ||
229 | |||
230 | case RWALK: | ||
231 | ret += scnprintf(buf+ret, buflen-ret, "Rwalk tag %u nwqid %d", | ||
232 | tag, fc->params.rwalk.nwqid); | ||
233 | for(i = 0; i < fc->params.rwalk.nwqid; i++) | ||
234 | ret += v9fs_printqid(buf+ret, buflen-ret, | ||
235 | &fc->params.rwalk.wqids[i]); | ||
236 | break; | ||
237 | |||
238 | case TOPEN: | ||
239 | ret += scnprintf(buf+ret, buflen-ret, | ||
240 | "Topen tag %u fid %d mode %d", tag, | ||
241 | fc->params.topen.fid, fc->params.topen.mode); | ||
242 | break; | ||
243 | |||
244 | case ROPEN: | ||
245 | ret += scnprintf(buf+ret, buflen-ret, "Ropen tag %u", tag); | ||
246 | ret += v9fs_printqid(buf+ret, buflen-ret, &fc->params.ropen.qid); | ||
247 | ret += scnprintf(buf+ret, buflen-ret," iounit %d", | ||
248 | fc->params.ropen.iounit); | ||
249 | break; | ||
250 | |||
251 | case TCREATE: | ||
252 | ret += scnprintf(buf+ret, buflen-ret, | ||
253 | "Tcreate tag %u fid %d name '%.*s' perm ", tag, | ||
254 | fc->params.tcreate.fid, fc->params.tcreate.name.len, | ||
255 | fc->params.tcreate.name.str); | ||
256 | |||
257 | ret += v9fs_printperm(buf+ret, buflen-ret, fc->params.tcreate.perm); | ||
258 | ret += scnprintf(buf+ret, buflen-ret, " mode %d", | ||
259 | fc->params.tcreate.mode); | ||
260 | break; | ||
261 | |||
262 | case RCREATE: | ||
263 | ret += scnprintf(buf+ret, buflen-ret, "Rcreate tag %u", tag); | ||
264 | ret += v9fs_printqid(buf+ret, buflen-ret, &fc->params.rcreate.qid); | ||
265 | ret += scnprintf(buf+ret, buflen-ret, " iounit %d", | ||
266 | fc->params.rcreate.iounit); | ||
267 | break; | ||
268 | |||
269 | case TREAD: | ||
270 | ret += scnprintf(buf+ret, buflen-ret, | ||
271 | "Tread tag %u fid %d offset %lld count %u", tag, | ||
272 | fc->params.tread.fid, | ||
273 | (long long int) fc->params.tread.offset, | ||
274 | fc->params.tread.count); | ||
275 | break; | ||
276 | |||
277 | case RREAD: | ||
278 | ret += scnprintf(buf+ret, buflen-ret, | ||
279 | "Rread tag %u count %u data ", tag, | ||
280 | fc->params.rread.count); | ||
281 | ret += v9fs_printdata(buf+ret, buflen-ret, fc->params.rread.data, | ||
282 | fc->params.rread.count); | ||
283 | break; | ||
284 | |||
285 | case TWRITE: | ||
286 | ret += scnprintf(buf+ret, buflen-ret, | ||
287 | "Twrite tag %u fid %d offset %lld count %u data ", | ||
288 | tag, fc->params.twrite.fid, | ||
289 | (long long int) fc->params.twrite.offset, | ||
290 | fc->params.twrite.count); | ||
291 | ret += v9fs_printdata(buf+ret, buflen-ret, fc->params.twrite.data, | ||
292 | fc->params.twrite.count); | ||
293 | break; | ||
294 | |||
295 | case RWRITE: | ||
296 | ret += scnprintf(buf+ret, buflen-ret, "Rwrite tag %u count %u", | ||
297 | tag, fc->params.rwrite.count); | ||
298 | break; | ||
299 | |||
300 | case TCLUNK: | ||
301 | ret += scnprintf(buf+ret, buflen-ret, "Tclunk tag %u fid %d", | ||
302 | tag, fc->params.tclunk.fid); | ||
303 | break; | ||
304 | |||
305 | case RCLUNK: | ||
306 | ret += scnprintf(buf+ret, buflen-ret, "Rclunk tag %u", tag); | ||
307 | break; | ||
308 | |||
309 | case TREMOVE: | ||
310 | ret += scnprintf(buf+ret, buflen-ret, "Tremove tag %u fid %d", | ||
311 | tag, fc->params.tremove.fid); | ||
312 | break; | ||
313 | |||
314 | case RREMOVE: | ||
315 | ret += scnprintf(buf+ret, buflen-ret, "Rremove tag %u", tag); | ||
316 | break; | ||
317 | |||
318 | case TSTAT: | ||
319 | ret += scnprintf(buf+ret, buflen-ret, "Tstat tag %u fid %d", | ||
320 | tag, fc->params.tstat.fid); | ||
321 | break; | ||
322 | |||
323 | case RSTAT: | ||
324 | ret += scnprintf(buf+ret, buflen-ret, "Rstat tag %u ", tag); | ||
325 | ret += v9fs_printstat(buf+ret, buflen-ret, &fc->params.rstat.stat, | ||
326 | extended); | ||
327 | break; | ||
328 | |||
329 | case TWSTAT: | ||
330 | ret += scnprintf(buf+ret, buflen-ret, "Twstat tag %u fid %d ", | ||
331 | tag, fc->params.twstat.fid); | ||
332 | ret += v9fs_printstat(buf+ret, buflen-ret, &fc->params.twstat.stat, | ||
333 | extended); | ||
334 | break; | ||
335 | |||
336 | case RWSTAT: | ||
337 | ret += scnprintf(buf+ret, buflen-ret, "Rwstat tag %u", tag); | ||
338 | break; | ||
339 | |||
340 | default: | ||
341 | ret += scnprintf(buf+ret, buflen-ret, "unknown type %d", type); | ||
342 | break; | ||
343 | } | ||
344 | |||
345 | return ret; | ||
346 | } | ||
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index c4d13bf904d2..b7608af07ce8 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -4,9 +4,8 @@ | |||
4 | * Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com> | 4 | * Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License version 2 |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * as published by the Free Software Foundation. |
9 | * (at your option) any later version. | ||
10 | * | 9 | * |
11 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/fid.h b/fs/9p/fid.h index 1fc2dd08d75a..aa974d6875c3 100644 --- a/fs/9p/fid.h +++ b/fs/9p/fid.h | |||
@@ -4,9 +4,8 @@ | |||
4 | * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> | 4 | * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License version 2 |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * as published by the Free Software Foundation. |
9 | * (at your option) any later version. | ||
10 | * | 9 | * |
11 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/mux.c b/fs/9p/mux.c index e2ae60adda99..3e5b124a7212 100644 --- a/fs/9p/mux.c +++ b/fs/9p/mux.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> | 7 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -70,7 +69,7 @@ struct v9fs_mux_data { | |||
70 | int msize; | 69 | int msize; |
71 | unsigned char *extended; | 70 | unsigned char *extended; |
72 | struct v9fs_transport *trans; | 71 | struct v9fs_transport *trans; |
73 | struct v9fs_idpool tidpool; | 72 | struct v9fs_idpool tagpool; |
74 | int err; | 73 | int err; |
75 | wait_queue_head_t equeue; | 74 | wait_queue_head_t equeue; |
76 | struct list_head req_list; | 75 | struct list_head req_list; |
@@ -280,8 +279,8 @@ struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize, | |||
280 | m->msize = msize; | 279 | m->msize = msize; |
281 | m->extended = extended; | 280 | m->extended = extended; |
282 | m->trans = trans; | 281 | m->trans = trans; |
283 | idr_init(&m->tidpool.pool); | 282 | idr_init(&m->tagpool.pool); |
284 | init_MUTEX(&m->tidpool.lock); | 283 | init_MUTEX(&m->tagpool.lock); |
285 | m->err = 0; | 284 | m->err = 0; |
286 | init_waitqueue_head(&m->equeue); | 285 | init_waitqueue_head(&m->equeue); |
287 | INIT_LIST_HEAD(&m->req_list); | 286 | INIT_LIST_HEAD(&m->req_list); |
@@ -635,6 +634,14 @@ static void v9fs_read_work(void *a) | |||
635 | goto error; | 634 | goto error; |
636 | } | 635 | } |
637 | 636 | ||
637 | if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { | ||
638 | char buf[150]; | ||
639 | |||
640 | v9fs_printfcall(buf, sizeof(buf), m->rcall, | ||
641 | *m->extended); | ||
642 | printk(KERN_NOTICE ">>> %p %s\n", m, buf); | ||
643 | } | ||
644 | |||
638 | rcall = m->rcall; | 645 | rcall = m->rcall; |
639 | rbuf = m->rbuf; | 646 | rbuf = m->rbuf; |
640 | if (m->rpos > n) { | 647 | if (m->rpos > n) { |
@@ -740,6 +747,13 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m, | |||
740 | 747 | ||
741 | v9fs_set_tag(tc, n); | 748 | v9fs_set_tag(tc, n); |
742 | 749 | ||
750 | if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { | ||
751 | char buf[150]; | ||
752 | |||
753 | v9fs_printfcall(buf, sizeof(buf), tc, *m->extended); | ||
754 | printk(KERN_NOTICE "<<< %p %s\n", m, buf); | ||
755 | } | ||
756 | |||
743 | req->tag = n; | 757 | req->tag = n; |
744 | req->tcall = tc; | 758 | req->tcall = tc; |
745 | req->rcall = NULL; | 759 | req->rcall = NULL; |
@@ -965,7 +979,7 @@ static u16 v9fs_mux_get_tag(struct v9fs_mux_data *m) | |||
965 | { | 979 | { |
966 | int tag; | 980 | int tag; |
967 | 981 | ||
968 | tag = v9fs_get_idpool(&m->tidpool); | 982 | tag = v9fs_get_idpool(&m->tagpool); |
969 | if (tag < 0) | 983 | if (tag < 0) |
970 | return V9FS_NOTAG; | 984 | return V9FS_NOTAG; |
971 | else | 985 | else |
@@ -974,6 +988,6 @@ static u16 v9fs_mux_get_tag(struct v9fs_mux_data *m) | |||
974 | 988 | ||
975 | static void v9fs_mux_put_tag(struct v9fs_mux_data *m, u16 tag) | 989 | static void v9fs_mux_put_tag(struct v9fs_mux_data *m, u16 tag) |
976 | { | 990 | { |
977 | if (tag != V9FS_NOTAG && v9fs_check_idpool(tag, &m->tidpool)) | 991 | if (tag != V9FS_NOTAG && v9fs_check_idpool(tag, &m->tagpool)) |
978 | v9fs_put_idpool(tag, &m->tidpool); | 992 | v9fs_put_idpool(tag, &m->tagpool); |
979 | } | 993 | } |
diff --git a/fs/9p/mux.h b/fs/9p/mux.h index 17144fdfa11b..e90bfd32ea42 100644 --- a/fs/9p/mux.h +++ b/fs/9p/mux.h | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/trans_fd.c b/fs/9p/trans_fd.c index 5b2ce21b10fa..94e0a7fd9fc2 100644 --- a/fs/9p/trans_fd.c +++ b/fs/9p/trans_fd.c | |||
@@ -1,15 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/9p/trans_fd.c | 2 | * linux/fs/9p/trans_fd.c |
3 | * | 3 | * |
4 | * File Descriptor Transport Layer | 4 | * Fd transport layer. Includes deprecated socket layer. |
5 | * | 5 | * |
6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | 6 | * Copyright (C) 2006 by Russ Cox <rsc@swtch.com> |
7 | * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> |
8 | * Copyright (C) 2004-2005 by Eric Van Hensbergen <ericvh@gmail.com> | ||
9 | * Copyright (C) 1997-2002 by Ron Minnich <rminnich@sarnoff.com> | ||
8 | * | 10 | * |
9 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 13 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 14 | * |
14 | * This program is distributed in the hope that it will be useful, | 15 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -25,6 +26,7 @@ | |||
25 | */ | 26 | */ |
26 | 27 | ||
27 | #include <linux/config.h> | 28 | #include <linux/config.h> |
29 | #include <linux/in.h> | ||
28 | #include <linux/module.h> | 30 | #include <linux/module.h> |
29 | #include <linux/net.h> | 31 | #include <linux/net.h> |
30 | #include <linux/ipv6.h> | 32 | #include <linux/ipv6.h> |
@@ -40,89 +42,119 @@ | |||
40 | #include "v9fs.h" | 42 | #include "v9fs.h" |
41 | #include "transport.h" | 43 | #include "transport.h" |
42 | 44 | ||
45 | #define V9FS_PORT 564 | ||
46 | |||
43 | struct v9fs_trans_fd { | 47 | struct v9fs_trans_fd { |
44 | struct file *in_file; | 48 | struct file *rd; |
45 | struct file *out_file; | 49 | struct file *wr; |
46 | }; | 50 | }; |
47 | 51 | ||
48 | /** | 52 | /** |
49 | * v9fs_fd_recv - receive from a socket | 53 | * v9fs_fd_read- read from a fd |
50 | * @v9ses: session information | 54 | * @v9ses: session information |
51 | * @v: buffer to receive data into | 55 | * @v: buffer to receive data into |
52 | * @len: size of receive buffer | 56 | * @len: size of receive buffer |
53 | * | 57 | * |
54 | */ | 58 | */ |
55 | 59 | static int v9fs_fd_read(struct v9fs_transport *trans, void *v, int len) | |
56 | static int v9fs_fd_recv(struct v9fs_transport *trans, void *v, int len) | ||
57 | { | 60 | { |
58 | struct v9fs_trans_fd *ts = trans ? trans->priv : NULL; | 61 | int ret; |
62 | struct v9fs_trans_fd *ts; | ||
59 | 63 | ||
60 | if (!trans || trans->status != Connected || !ts) | 64 | if (!trans || trans->status == Disconnected || !(ts = trans->priv)) |
61 | return -EIO; | 65 | return -EREMOTEIO; |
62 | 66 | ||
63 | return kernel_read(ts->in_file, ts->in_file->f_pos, v, len); | 67 | if (!(ts->rd->f_flags & O_NONBLOCK)) |
68 | dprintk(DEBUG_ERROR, "blocking read ...\n"); | ||
69 | |||
70 | ret = kernel_read(ts->rd, ts->rd->f_pos, v, len); | ||
71 | if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN) | ||
72 | trans->status = Disconnected; | ||
73 | return ret; | ||
64 | } | 74 | } |
65 | 75 | ||
66 | /** | 76 | /** |
67 | * v9fs_fd_send - send to a socket | 77 | * v9fs_fd_write - write to a socket |
68 | * @v9ses: session information | 78 | * @v9ses: session information |
69 | * @v: buffer to send data from | 79 | * @v: buffer to send data from |
70 | * @len: size of send buffer | 80 | * @len: size of send buffer |
71 | * | 81 | * |
72 | */ | 82 | */ |
73 | 83 | static int v9fs_fd_write(struct v9fs_transport *trans, void *v, int len) | |
74 | static int v9fs_fd_send(struct v9fs_transport *trans, void *v, int len) | ||
75 | { | 84 | { |
76 | struct v9fs_trans_fd *ts = trans ? trans->priv : NULL; | 85 | int ret; |
77 | mm_segment_t oldfs = get_fs(); | 86 | mm_segment_t oldfs; |
78 | int ret = 0; | 87 | struct v9fs_trans_fd *ts; |
79 | 88 | ||
80 | if (!trans || trans->status != Connected || !ts) | 89 | if (!trans || trans->status == Disconnected || !(ts = trans->priv)) |
81 | return -EIO; | 90 | return -EREMOTEIO; |
91 | |||
92 | if (!(ts->wr->f_flags & O_NONBLOCK)) | ||
93 | dprintk(DEBUG_ERROR, "blocking write ...\n"); | ||
82 | 94 | ||
83 | oldfs = get_fs(); | 95 | oldfs = get_fs(); |
84 | set_fs(get_ds()); | 96 | set_fs(get_ds()); |
85 | /* The cast to a user pointer is valid due to the set_fs() */ | 97 | /* The cast to a user pointer is valid due to the set_fs() */ |
86 | ret = vfs_write(ts->out_file, (void __user *)v, len, &ts->out_file->f_pos); | 98 | ret = vfs_write(ts->wr, (void __user *)v, len, &ts->wr->f_pos); |
87 | set_fs(oldfs); | 99 | set_fs(oldfs); |
88 | 100 | ||
101 | if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN) | ||
102 | trans->status = Disconnected; | ||
89 | return ret; | 103 | return ret; |
90 | } | 104 | } |
91 | 105 | ||
92 | /** | 106 | static unsigned int |
93 | * v9fs_fd_init - initialize file descriptor transport | 107 | v9fs_fd_poll(struct v9fs_transport *trans, struct poll_table_struct *pt) |
94 | * @v9ses: session information | ||
95 | * @addr: address of server to mount | ||
96 | * @data: mount options | ||
97 | * | ||
98 | */ | ||
99 | |||
100 | static int | ||
101 | v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, char *data) | ||
102 | { | 108 | { |
103 | struct v9fs_trans_fd *ts = NULL; | 109 | int ret, n; |
104 | struct v9fs_transport *trans = v9ses->transport; | 110 | struct v9fs_trans_fd *ts; |
111 | mm_segment_t oldfs; | ||
105 | 112 | ||
106 | if((v9ses->wfdno == ~0) || (v9ses->rfdno == ~0)) { | 113 | if (!trans || trans->status != Connected || !(ts = trans->priv)) |
107 | printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n"); | 114 | return -EREMOTEIO; |
108 | return -ENOPROTOOPT; | ||
109 | } | ||
110 | 115 | ||
111 | ts = kmalloc(sizeof(struct v9fs_trans_fd), GFP_KERNEL); | 116 | if (!ts->rd->f_op || !ts->rd->f_op->poll) |
117 | return -EIO; | ||
112 | 118 | ||
113 | if (!ts) | 119 | if (!ts->wr->f_op || !ts->wr->f_op->poll) |
114 | return -ENOMEM; | 120 | return -EIO; |
115 | 121 | ||
116 | ts->in_file = fget( v9ses->rfdno ); | 122 | oldfs = get_fs(); |
117 | ts->out_file = fget( v9ses->wfdno ); | 123 | set_fs(get_ds()); |
118 | 124 | ||
119 | if (!ts->in_file || !ts->out_file) { | 125 | ret = ts->rd->f_op->poll(ts->rd, pt); |
120 | if (ts->in_file) | 126 | if (ret < 0) |
121 | fput(ts->in_file); | 127 | goto end; |
122 | 128 | ||
123 | if (ts->out_file) | 129 | if (ts->rd != ts->wr) { |
124 | fput(ts->out_file); | 130 | n = ts->wr->f_op->poll(ts->wr, pt); |
131 | if (n < 0) { | ||
132 | ret = n; | ||
133 | goto end; | ||
134 | } | ||
135 | ret = (ret & ~POLLOUT) | (n & ~POLLIN); | ||
136 | } | ||
125 | 137 | ||
138 | end: | ||
139 | set_fs(oldfs); | ||
140 | return ret; | ||
141 | } | ||
142 | |||
143 | static int v9fs_fd_open(struct v9fs_session_info *v9ses, int rfd, int wfd) | ||
144 | { | ||
145 | struct v9fs_transport *trans = v9ses->transport; | ||
146 | struct v9fs_trans_fd *ts = kmalloc(sizeof(struct v9fs_trans_fd), | ||
147 | GFP_KERNEL); | ||
148 | if (!ts) | ||
149 | return -ENOMEM; | ||
150 | |||
151 | ts->rd = fget(rfd); | ||
152 | ts->wr = fget(wfd); | ||
153 | if (!ts->rd || !ts->wr) { | ||
154 | if (ts->rd) | ||
155 | fput(ts->rd); | ||
156 | if (ts->wr) | ||
157 | fput(ts->wr); | ||
126 | kfree(ts); | 158 | kfree(ts); |
127 | return -EIO; | 159 | return -EIO; |
128 | } | 160 | } |
@@ -133,84 +165,145 @@ v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, char *data) | |||
133 | return 0; | 165 | return 0; |
134 | } | 166 | } |
135 | 167 | ||
136 | 168 | static int v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, | |
137 | /** | 169 | char *data) |
138 | * v9fs_fd_close - shutdown file descriptor | ||
139 | * @trans: private socket structure | ||
140 | * | ||
141 | */ | ||
142 | |||
143 | static void v9fs_fd_close(struct v9fs_transport *trans) | ||
144 | { | 170 | { |
145 | struct v9fs_trans_fd *ts; | 171 | if (v9ses->rfdno == ~0 || v9ses->wfdno == ~0) { |
146 | 172 | printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n"); | |
147 | if (!trans) | 173 | return -ENOPROTOOPT; |
148 | return; | 174 | } |
149 | |||
150 | ts = xchg(&trans->priv, NULL); | ||
151 | 175 | ||
152 | if (!ts) | 176 | return v9fs_fd_open(v9ses, v9ses->rfdno, v9ses->wfdno); |
153 | return; | 177 | } |
154 | 178 | ||
155 | trans->status = Disconnected; | 179 | static int v9fs_socket_open(struct v9fs_session_info *v9ses, |
156 | if (ts->in_file) | 180 | struct socket *csocket) |
157 | fput(ts->in_file); | 181 | { |
182 | int fd, ret; | ||
183 | |||
184 | csocket->sk->sk_allocation = GFP_NOIO; | ||
185 | if ((fd = sock_map_fd(csocket)) < 0) { | ||
186 | eprintk(KERN_ERR, "v9fs_socket_open: failed to map fd\n"); | ||
187 | ret = fd; | ||
188 | release_csocket: | ||
189 | sock_release(csocket); | ||
190 | return ret; | ||
191 | } | ||
158 | 192 | ||
159 | if (ts->out_file) | 193 | if ((ret = v9fs_fd_open(v9ses, fd, fd)) < 0) { |
160 | fput(ts->out_file); | 194 | sockfd_put(csocket); |
195 | eprintk(KERN_ERR, "v9fs_socket_open: failed to open fd\n"); | ||
196 | goto release_csocket; | ||
197 | } | ||
161 | 198 | ||
162 | kfree(ts); | 199 | ((struct v9fs_trans_fd *)v9ses->transport->priv)->rd->f_flags |= |
200 | O_NONBLOCK; | ||
201 | return 0; | ||
163 | } | 202 | } |
164 | 203 | ||
165 | static unsigned int | 204 | static int v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr, |
166 | v9fs_fd_poll(struct v9fs_transport *trans, struct poll_table_struct *pt) | 205 | char *data) |
167 | { | 206 | { |
168 | int ret, n; | 207 | int ret; |
169 | struct v9fs_trans_fd *ts; | 208 | struct socket *csocket = NULL; |
170 | mm_segment_t oldfs; | 209 | struct sockaddr_in sin_server; |
210 | |||
211 | sin_server.sin_family = AF_INET; | ||
212 | sin_server.sin_addr.s_addr = in_aton(addr); | ||
213 | sin_server.sin_port = htons(v9ses->port); | ||
214 | sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); | ||
215 | |||
216 | if (!csocket) { | ||
217 | eprintk(KERN_ERR, "v9fs_trans_tcp: problem creating socket\n"); | ||
218 | return -1; | ||
219 | } | ||
171 | 220 | ||
172 | if (!trans) | 221 | ret = csocket->ops->connect(csocket, |
173 | return -EIO; | 222 | (struct sockaddr *)&sin_server, |
223 | sizeof(struct sockaddr_in), 0); | ||
224 | if (ret < 0) { | ||
225 | eprintk(KERN_ERR, | ||
226 | "v9fs_trans_tcp: problem connecting socket to %s\n", | ||
227 | addr); | ||
228 | return ret; | ||
229 | } | ||
174 | 230 | ||
175 | ts = trans->priv; | 231 | return v9fs_socket_open(v9ses, csocket); |
176 | if (trans->status != Connected || !ts) | 232 | } |
177 | return -EIO; | ||
178 | 233 | ||
179 | oldfs = get_fs(); | 234 | static int |
180 | set_fs(get_ds()); | 235 | v9fs_unix_init(struct v9fs_session_info *v9ses, const char *addr, char *data) |
236 | { | ||
237 | int ret; | ||
238 | struct socket *csocket; | ||
239 | struct sockaddr_un sun_server; | ||
240 | |||
241 | if (strlen(addr) > UNIX_PATH_MAX) { | ||
242 | eprintk(KERN_ERR, "v9fs_trans_unix: address too long: %s\n", | ||
243 | addr); | ||
244 | return -ENAMETOOLONG; | ||
245 | } | ||
181 | 246 | ||
182 | if (!ts->in_file->f_op || !ts->in_file->f_op->poll) { | 247 | sun_server.sun_family = PF_UNIX; |
183 | ret = -EIO; | 248 | strcpy(sun_server.sun_path, addr); |
184 | goto end; | 249 | sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); |
250 | ret = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server, | ||
251 | sizeof(struct sockaddr_un) - 1, 0); | ||
252 | if (ret < 0) { | ||
253 | eprintk(KERN_ERR, | ||
254 | "v9fs_trans_unix: problem connecting socket: %s: %d\n", | ||
255 | addr, ret); | ||
256 | return ret; | ||
185 | } | 257 | } |
186 | 258 | ||
187 | ret = ts->in_file->f_op->poll(ts->in_file, pt); | 259 | return v9fs_socket_open(v9ses, csocket); |
260 | } | ||
188 | 261 | ||
189 | if (ts->out_file != ts->in_file) { | 262 | /** |
190 | if (!ts->out_file->f_op || !ts->out_file->f_op->poll) { | 263 | * v9fs_sock_close - shutdown socket |
191 | ret = -EIO; | 264 | * @trans: private socket structure |
192 | goto end; | 265 | * |
193 | } | 266 | */ |
267 | static void v9fs_fd_close(struct v9fs_transport *trans) | ||
268 | { | ||
269 | struct v9fs_trans_fd *ts; | ||
194 | 270 | ||
195 | n = ts->out_file->f_op->poll(ts->out_file, pt); | 271 | if (!trans) |
272 | return; | ||
196 | 273 | ||
197 | ret &= ~POLLOUT; | 274 | ts = xchg(&trans->priv, NULL); |
198 | n &= ~POLLIN; | ||
199 | 275 | ||
200 | ret |= n; | 276 | if (!ts) |
201 | } | 277 | return; |
202 | 278 | ||
203 | end: | 279 | trans->status = Disconnected; |
204 | set_fs(oldfs); | 280 | if (ts->rd) |
205 | return ret; | 281 | fput(ts->rd); |
282 | if (ts->wr) | ||
283 | fput(ts->wr); | ||
284 | kfree(ts); | ||
206 | } | 285 | } |
207 | 286 | ||
208 | |||
209 | struct v9fs_transport v9fs_trans_fd = { | 287 | struct v9fs_transport v9fs_trans_fd = { |
210 | .init = v9fs_fd_init, | 288 | .init = v9fs_fd_init, |
211 | .write = v9fs_fd_send, | 289 | .write = v9fs_fd_write, |
212 | .read = v9fs_fd_recv, | 290 | .read = v9fs_fd_read, |
213 | .close = v9fs_fd_close, | 291 | .close = v9fs_fd_close, |
214 | .poll = v9fs_fd_poll, | 292 | .poll = v9fs_fd_poll, |
215 | }; | 293 | }; |
216 | 294 | ||
295 | struct v9fs_transport v9fs_trans_tcp = { | ||
296 | .init = v9fs_tcp_init, | ||
297 | .write = v9fs_fd_write, | ||
298 | .read = v9fs_fd_read, | ||
299 | .close = v9fs_fd_close, | ||
300 | .poll = v9fs_fd_poll, | ||
301 | }; | ||
302 | |||
303 | struct v9fs_transport v9fs_trans_unix = { | ||
304 | .init = v9fs_unix_init, | ||
305 | .write = v9fs_fd_write, | ||
306 | .read = v9fs_fd_read, | ||
307 | .close = v9fs_fd_close, | ||
308 | .poll = v9fs_fd_poll, | ||
309 | }; | ||
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c deleted file mode 100644 index 44e830697acb..000000000000 --- a/fs/9p/trans_sock.c +++ /dev/null | |||
@@ -1,334 +0,0 @@ | |||
1 | /* | ||
2 | * linux/fs/9p/trans_socket.c | ||
3 | * | ||
4 | * Socket Transport Layer | ||
5 | * | ||
6 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | ||
8 | * Copyright (C) 1997-2002 by Ron Minnich <rminnich@sarnoff.com> | ||
9 | * Copyright (C) 1995, 1996 by Olaf Kirch <okir@monad.swb.de> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to: | ||
23 | * Free Software Foundation | ||
24 | * 51 Franklin Street, Fifth Floor | ||
25 | * Boston, MA 02111-1301 USA | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/config.h> | ||
30 | #include <linux/in.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/net.h> | ||
33 | #include <linux/ipv6.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/un.h> | ||
37 | #include <asm/uaccess.h> | ||
38 | #include <linux/inet.h> | ||
39 | #include <linux/idr.h> | ||
40 | #include <linux/file.h> | ||
41 | |||
42 | #include "debug.h" | ||
43 | #include "v9fs.h" | ||
44 | #include "transport.h" | ||
45 | |||
46 | #define V9FS_PORT 564 | ||
47 | |||
48 | struct v9fs_trans_sock { | ||
49 | struct socket *s; | ||
50 | struct file *filp; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * v9fs_sock_recv - receive from a socket | ||
55 | * @v9ses: session information | ||
56 | * @v: buffer to receive data into | ||
57 | * @len: size of receive buffer | ||
58 | * | ||
59 | */ | ||
60 | |||
61 | static int v9fs_sock_recv(struct v9fs_transport *trans, void *v, int len) | ||
62 | { | ||
63 | int ret; | ||
64 | struct v9fs_trans_sock *ts; | ||
65 | |||
66 | if (!trans || trans->status == Disconnected) { | ||
67 | dprintk(DEBUG_ERROR, "disconnected ...\n"); | ||
68 | return -EREMOTEIO; | ||
69 | } | ||
70 | |||
71 | ts = trans->priv; | ||
72 | |||
73 | if (!(ts->filp->f_flags & O_NONBLOCK)) | ||
74 | dprintk(DEBUG_ERROR, "blocking read ...\n"); | ||
75 | |||
76 | ret = kernel_read(ts->filp, ts->filp->f_pos, v, len); | ||
77 | if (ret <= 0) { | ||
78 | if (ret != -ERESTARTSYS && ret != -EAGAIN) | ||
79 | trans->status = Disconnected; | ||
80 | } | ||
81 | |||
82 | return ret; | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * v9fs_sock_send - send to a socket | ||
87 | * @v9ses: session information | ||
88 | * @v: buffer to send data from | ||
89 | * @len: size of send buffer | ||
90 | * | ||
91 | */ | ||
92 | |||
93 | static int v9fs_sock_send(struct v9fs_transport *trans, void *v, int len) | ||
94 | { | ||
95 | int ret; | ||
96 | mm_segment_t oldfs; | ||
97 | struct v9fs_trans_sock *ts; | ||
98 | |||
99 | if (!trans || trans->status == Disconnected) { | ||
100 | dprintk(DEBUG_ERROR, "disconnected ...\n"); | ||
101 | return -EREMOTEIO; | ||
102 | } | ||
103 | |||
104 | ts = trans->priv; | ||
105 | if (!ts) { | ||
106 | dprintk(DEBUG_ERROR, "no transport ...\n"); | ||
107 | return -EREMOTEIO; | ||
108 | } | ||
109 | |||
110 | if (!(ts->filp->f_flags & O_NONBLOCK)) | ||
111 | dprintk(DEBUG_ERROR, "blocking write ...\n"); | ||
112 | |||
113 | oldfs = get_fs(); | ||
114 | set_fs(get_ds()); | ||
115 | ret = vfs_write(ts->filp, (void __user *)v, len, &ts->filp->f_pos); | ||
116 | set_fs(oldfs); | ||
117 | |||
118 | if (ret < 0) { | ||
119 | if (ret != -ERESTARTSYS) | ||
120 | trans->status = Disconnected; | ||
121 | } | ||
122 | |||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | static unsigned int v9fs_sock_poll(struct v9fs_transport *trans, | ||
127 | struct poll_table_struct *pt) { | ||
128 | |||
129 | int ret; | ||
130 | struct v9fs_trans_sock *ts; | ||
131 | mm_segment_t oldfs; | ||
132 | |||
133 | if (!trans) { | ||
134 | dprintk(DEBUG_ERROR, "no transport\n"); | ||
135 | return -EIO; | ||
136 | } | ||
137 | |||
138 | ts = trans->priv; | ||
139 | if (trans->status != Connected || !ts) { | ||
140 | dprintk(DEBUG_ERROR, "transport disconnected: %d\n", trans->status); | ||
141 | return -EIO; | ||
142 | } | ||
143 | |||
144 | oldfs = get_fs(); | ||
145 | set_fs(get_ds()); | ||
146 | |||
147 | if (!ts->filp->f_op || !ts->filp->f_op->poll) { | ||
148 | dprintk(DEBUG_ERROR, "no poll operation\n"); | ||
149 | ret = -EIO; | ||
150 | goto end; | ||
151 | } | ||
152 | |||
153 | ret = ts->filp->f_op->poll(ts->filp, pt); | ||
154 | |||
155 | end: | ||
156 | set_fs(oldfs); | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | |||
161 | /** | ||
162 | * v9fs_tcp_init - initialize TCP socket | ||
163 | * @v9ses: session information | ||
164 | * @addr: address of server to mount | ||
165 | * @data: mount options | ||
166 | * | ||
167 | */ | ||
168 | |||
169 | static int | ||
170 | v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr, char *data) | ||
171 | { | ||
172 | struct socket *csocket = NULL; | ||
173 | struct sockaddr_in sin_server; | ||
174 | int rc = 0; | ||
175 | struct v9fs_trans_sock *ts = NULL; | ||
176 | struct v9fs_transport *trans = v9ses->transport; | ||
177 | int fd; | ||
178 | |||
179 | trans->status = Disconnected; | ||
180 | |||
181 | ts = kmalloc(sizeof(struct v9fs_trans_sock), GFP_KERNEL); | ||
182 | |||
183 | if (!ts) | ||
184 | return -ENOMEM; | ||
185 | |||
186 | trans->priv = ts; | ||
187 | ts->s = NULL; | ||
188 | ts->filp = NULL; | ||
189 | |||
190 | if (!addr) | ||
191 | return -EINVAL; | ||
192 | |||
193 | dprintk(DEBUG_TRANS, "Connecting to %s\n", addr); | ||
194 | |||
195 | sin_server.sin_family = AF_INET; | ||
196 | sin_server.sin_addr.s_addr = in_aton(addr); | ||
197 | sin_server.sin_port = htons(v9ses->port); | ||
198 | sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); | ||
199 | rc = csocket->ops->connect(csocket, | ||
200 | (struct sockaddr *)&sin_server, | ||
201 | sizeof(struct sockaddr_in), 0); | ||
202 | if (rc < 0) { | ||
203 | eprintk(KERN_ERR, | ||
204 | "v9fs_trans_tcp: problem connecting socket to %s\n", | ||
205 | addr); | ||
206 | return rc; | ||
207 | } | ||
208 | csocket->sk->sk_allocation = GFP_NOIO; | ||
209 | |||
210 | fd = sock_map_fd(csocket); | ||
211 | if (fd < 0) { | ||
212 | sock_release(csocket); | ||
213 | kfree(ts); | ||
214 | trans->priv = NULL; | ||
215 | return fd; | ||
216 | } | ||
217 | |||
218 | ts->s = csocket; | ||
219 | ts->filp = fget(fd); | ||
220 | ts->filp->f_flags |= O_NONBLOCK; | ||
221 | trans->status = Connected; | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * v9fs_unix_init - initialize UNIX domain socket | ||
228 | * @v9ses: session information | ||
229 | * @dev_name: path to named pipe | ||
230 | * @data: mount options | ||
231 | * | ||
232 | */ | ||
233 | |||
234 | static int | ||
235 | v9fs_unix_init(struct v9fs_session_info *v9ses, const char *dev_name, | ||
236 | char *data) | ||
237 | { | ||
238 | int rc, fd; | ||
239 | struct socket *csocket; | ||
240 | struct sockaddr_un sun_server; | ||
241 | struct v9fs_transport *trans; | ||
242 | struct v9fs_trans_sock *ts; | ||
243 | |||
244 | rc = 0; | ||
245 | csocket = NULL; | ||
246 | trans = v9ses->transport; | ||
247 | |||
248 | trans->status = Disconnected; | ||
249 | |||
250 | if (strlen(dev_name) > UNIX_PATH_MAX) { | ||
251 | eprintk(KERN_ERR, "v9fs_trans_unix: address too long: %s\n", | ||
252 | dev_name); | ||
253 | return -ENOMEM; | ||
254 | } | ||
255 | |||
256 | ts = kmalloc(sizeof(struct v9fs_trans_sock), GFP_KERNEL); | ||
257 | if (!ts) | ||
258 | return -ENOMEM; | ||
259 | |||
260 | trans->priv = ts; | ||
261 | ts->s = NULL; | ||
262 | ts->filp = NULL; | ||
263 | |||
264 | sun_server.sun_family = PF_UNIX; | ||
265 | strcpy(sun_server.sun_path, dev_name); | ||
266 | sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); | ||
267 | rc = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server, | ||
268 | sizeof(struct sockaddr_un) - 1, 0); /* -1 *is* important */ | ||
269 | if (rc < 0) { | ||
270 | eprintk(KERN_ERR, | ||
271 | "v9fs_trans_unix: problem connecting socket: %s: %d\n", | ||
272 | dev_name, rc); | ||
273 | return rc; | ||
274 | } | ||
275 | csocket->sk->sk_allocation = GFP_NOIO; | ||
276 | |||
277 | fd = sock_map_fd(csocket); | ||
278 | if (fd < 0) { | ||
279 | sock_release(csocket); | ||
280 | kfree(ts); | ||
281 | trans->priv = NULL; | ||
282 | return fd; | ||
283 | } | ||
284 | |||
285 | ts->s = csocket; | ||
286 | ts->filp = fget(fd); | ||
287 | ts->filp->f_flags |= O_NONBLOCK; | ||
288 | trans->status = Connected; | ||
289 | |||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | /** | ||
294 | * v9fs_sock_close - shutdown socket | ||
295 | * @trans: private socket structure | ||
296 | * | ||
297 | */ | ||
298 | |||
299 | static void v9fs_sock_close(struct v9fs_transport *trans) | ||
300 | { | ||
301 | struct v9fs_trans_sock *ts; | ||
302 | |||
303 | if (!trans) | ||
304 | return; | ||
305 | |||
306 | ts = trans->priv; | ||
307 | |||
308 | if ((ts) && (ts->filp)) { | ||
309 | fput(ts->filp); | ||
310 | ts->filp = NULL; | ||
311 | ts->s = NULL; | ||
312 | trans->status = Disconnected; | ||
313 | } | ||
314 | |||
315 | kfree(ts); | ||
316 | |||
317 | trans->priv = NULL; | ||
318 | } | ||
319 | |||
320 | struct v9fs_transport v9fs_trans_tcp = { | ||
321 | .init = v9fs_tcp_init, | ||
322 | .write = v9fs_sock_send, | ||
323 | .read = v9fs_sock_recv, | ||
324 | .close = v9fs_sock_close, | ||
325 | .poll = v9fs_sock_poll, | ||
326 | }; | ||
327 | |||
328 | struct v9fs_transport v9fs_trans_unix = { | ||
329 | .init = v9fs_unix_init, | ||
330 | .write = v9fs_sock_send, | ||
331 | .read = v9fs_sock_recv, | ||
332 | .close = v9fs_sock_close, | ||
333 | .poll = v9fs_sock_poll, | ||
334 | }; | ||
diff --git a/fs/9p/transport.h b/fs/9p/transport.h index 91fcdb94b361..b38a4b8a41ce 100644 --- a/fs/9p/transport.h +++ b/fs/9p/transport.h | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 61352491ba36..d37416eb5791 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -51,7 +50,7 @@ enum { | |||
51 | Opt_port, Opt_msize, Opt_uid, Opt_gid, Opt_afid, Opt_debug, | 50 | Opt_port, Opt_msize, Opt_uid, Opt_gid, Opt_afid, Opt_debug, |
52 | Opt_rfdno, Opt_wfdno, | 51 | Opt_rfdno, Opt_wfdno, |
53 | /* String options */ | 52 | /* String options */ |
54 | Opt_name, Opt_remotename, | 53 | Opt_uname, Opt_remotename, |
55 | /* Options that take no arguments */ | 54 | /* Options that take no arguments */ |
56 | Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp, Opt_fd, | 55 | Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp, Opt_fd, |
57 | /* Error token */ | 56 | /* Error token */ |
@@ -67,7 +66,7 @@ static match_table_t tokens = { | |||
67 | {Opt_rfdno, "rfdno=%u"}, | 66 | {Opt_rfdno, "rfdno=%u"}, |
68 | {Opt_wfdno, "wfdno=%u"}, | 67 | {Opt_wfdno, "wfdno=%u"}, |
69 | {Opt_debug, "debug=%x"}, | 68 | {Opt_debug, "debug=%x"}, |
70 | {Opt_name, "name=%s"}, | 69 | {Opt_uname, "uname=%s"}, |
71 | {Opt_remotename, "aname=%s"}, | 70 | {Opt_remotename, "aname=%s"}, |
72 | {Opt_unix, "proto=unix"}, | 71 | {Opt_unix, "proto=unix"}, |
73 | {Opt_tcp, "proto=tcp"}, | 72 | {Opt_tcp, "proto=tcp"}, |
@@ -116,7 +115,7 @@ static void v9fs_parse_options(char *options, struct v9fs_session_info *v9ses) | |||
116 | if (!*p) | 115 | if (!*p) |
117 | continue; | 116 | continue; |
118 | token = match_token(p, tokens, args); | 117 | token = match_token(p, tokens, args); |
119 | if (token < Opt_name) { | 118 | if (token < Opt_uname) { |
120 | if ((ret = match_int(&args[0], &option)) < 0) { | 119 | if ((ret = match_int(&args[0], &option)) < 0) { |
121 | dprintk(DEBUG_ERROR, | 120 | dprintk(DEBUG_ERROR, |
122 | "integer field, but no integer?\n"); | 121 | "integer field, but no integer?\n"); |
@@ -158,7 +157,7 @@ static void v9fs_parse_options(char *options, struct v9fs_session_info *v9ses) | |||
158 | case Opt_fd: | 157 | case Opt_fd: |
159 | v9ses->proto = PROTO_FD; | 158 | v9ses->proto = PROTO_FD; |
160 | break; | 159 | break; |
161 | case Opt_name: | 160 | case Opt_uname: |
162 | match_strcpy(v9ses->name, &args[0]); | 161 | match_strcpy(v9ses->name, &args[0]); |
163 | break; | 162 | break; |
164 | case Opt_remotename: | 163 | case Opt_remotename: |
@@ -289,7 +288,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses, | |||
289 | /* set global debug level */ | 288 | /* set global debug level */ |
290 | v9fs_debug_level = v9ses->debug; | 289 | v9fs_debug_level = v9ses->debug; |
291 | 290 | ||
292 | /* id pools that are session-dependent: FIDs and TIDs */ | 291 | /* id pools that are session-dependent: fids and tags */ |
293 | idr_init(&v9ses->fidpool.pool); | 292 | idr_init(&v9ses->fidpool.pool); |
294 | init_MUTEX(&v9ses->fidpool.lock); | 293 | init_MUTEX(&v9ses->fidpool.lock); |
295 | 294 | ||
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index f337da7a0eec..c134d104cb28 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License version 2 |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * as published by the Free Software Foundation. |
10 | * (at your option) any later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -91,6 +90,3 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses); | |||
91 | #define V9FS_DEFUSER "nobody" | 90 | #define V9FS_DEFUSER "nobody" |
92 | #define V9FS_DEFANAME "" | 91 | #define V9FS_DEFANAME "" |
93 | 92 | ||
94 | /* inital pool sizes for fids and tags */ | ||
95 | #define V9FS_START_FIDS 8192 | ||
96 | #define V9FS_START_TIDS 256 | ||
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index a759278acaae..43c9f7de0314 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License version 2 |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * as published by the Free Software Foundation. |
10 | * (at your option) any later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 8100fb5171b7..efda46fb64d9 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 12c9cc926b71..062daa6000ab 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -51,7 +50,7 @@ | |||
51 | * | 50 | * |
52 | */ | 51 | */ |
53 | 52 | ||
54 | int v9fs_dentry_delete(struct dentry *dentry) | 53 | static int v9fs_dentry_delete(struct dentry *dentry) |
55 | { | 54 | { |
56 | dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); | 55 | dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); |
57 | return 1; | 56 | return 1; |
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index cd5eeb032d64..766f11f1215c 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index de3a129698da..59e744163407 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -69,29 +68,30 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
69 | 68 | ||
70 | fid = v9fs_get_idpool(&v9ses->fidpool); | 69 | fid = v9fs_get_idpool(&v9ses->fidpool); |
71 | if (fid < 0) { | 70 | if (fid < 0) { |
72 | eprintk(KERN_WARNING, "newfid fails!\n"); | 71 | eprintk(KERN_WARNING, "newfid fails!\n"); |
73 | return -ENOSPC; | 72 | return -ENOSPC; |
74 | } | 73 | } |
75 | 74 | ||
76 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); | 75 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); |
77 | if (err < 0) { | 76 | if (err < 0) { |
78 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); | 77 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); |
79 | goto put_fid; | 78 | goto put_fid; |
80 | } | 79 | } |
81 | 80 | ||
82 | vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); | 81 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ |
83 | if (vfid == NULL) { | 82 | /* translate open mode appropriately */ |
84 | dprintk(DEBUG_ERROR, "out of memory\n"); | ||
85 | goto clunk_fid; | ||
86 | } | ||
87 | |||
88 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ | ||
89 | /* translate open mode appropriately */ | ||
90 | omode = v9fs_uflags2omode(file->f_flags); | 83 | omode = v9fs_uflags2omode(file->f_flags); |
91 | err = v9fs_t_open(v9ses, fid, omode, &fcall); | 84 | err = v9fs_t_open(v9ses, fid, omode, &fcall); |
92 | if (err < 0) { | 85 | if (err < 0) { |
93 | PRINT_FCALL_ERROR("open failed", fcall); | 86 | PRINT_FCALL_ERROR("open failed", fcall); |
94 | goto destroy_vfid; | 87 | goto clunk_fid; |
88 | } | ||
89 | |||
90 | vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); | ||
91 | if (vfid == NULL) { | ||
92 | dprintk(DEBUG_ERROR, "out of memory\n"); | ||
93 | err = -ENOMEM; | ||
94 | goto clunk_fid; | ||
95 | } | 95 | } |
96 | 96 | ||
97 | file->private_data = vfid; | 97 | file->private_data = vfid; |
@@ -106,15 +106,12 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
106 | 106 | ||
107 | return 0; | 107 | return 0; |
108 | 108 | ||
109 | destroy_vfid: | ||
110 | v9fs_fid_destroy(vfid); | ||
111 | |||
112 | clunk_fid: | 109 | clunk_fid: |
113 | v9fs_t_clunk(v9ses, fid); | 110 | v9fs_t_clunk(v9ses, fid); |
114 | 111 | ||
115 | put_fid: | 112 | put_fid: |
116 | v9fs_put_idpool(fid, &v9ses->fidpool); | 113 | v9fs_put_idpool(fid, &v9ses->fidpool); |
117 | kfree(fcall); | 114 | kfree(fcall); |
118 | 115 | ||
119 | return err; | 116 | return err; |
120 | } | 117 | } |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 651a9e14d9a9..133db366d306 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -255,8 +254,8 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
255 | } | 254 | } |
256 | 255 | ||
257 | static int | 256 | static int |
258 | v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, | 257 | v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm, |
259 | u32 perm, u8 mode, u32 *fidp, struct v9fs_qid *qid, u32 *iounit) | 258 | u8 mode, char *extension, u32 *fidp, struct v9fs_qid *qid, u32 *iounit) |
260 | { | 259 | { |
261 | u32 fid; | 260 | u32 fid; |
262 | int err; | 261 | int err; |
@@ -271,14 +270,14 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, | |||
271 | err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); | 270 | err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); |
272 | if (err < 0) { | 271 | if (err < 0) { |
273 | PRINT_FCALL_ERROR("clone error", fcall); | 272 | PRINT_FCALL_ERROR("clone error", fcall); |
274 | goto error; | 273 | goto put_fid; |
275 | } | 274 | } |
276 | kfree(fcall); | 275 | kfree(fcall); |
277 | 276 | ||
278 | err = v9fs_t_create(v9ses, fid, name, perm, mode, &fcall); | 277 | err = v9fs_t_create(v9ses, fid, name, perm, mode, extension, &fcall); |
279 | if (err < 0) { | 278 | if (err < 0) { |
280 | PRINT_FCALL_ERROR("create fails", fcall); | 279 | PRINT_FCALL_ERROR("create fails", fcall); |
281 | goto error; | 280 | goto clunk_fid; |
282 | } | 281 | } |
283 | 282 | ||
284 | if (iounit) | 283 | if (iounit) |
@@ -293,7 +292,11 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, | |||
293 | kfree(fcall); | 292 | kfree(fcall); |
294 | return 0; | 293 | return 0; |
295 | 294 | ||
296 | error: | 295 | clunk_fid: |
296 | v9fs_t_clunk(v9ses, fid); | ||
297 | fid = V9FS_NOFID; | ||
298 | |||
299 | put_fid: | ||
297 | if (fid >= 0) | 300 | if (fid >= 0) |
298 | v9fs_put_idpool(fid, &v9ses->fidpool); | 301 | v9fs_put_idpool(fid, &v9ses->fidpool); |
299 | 302 | ||
@@ -348,7 +351,7 @@ error: | |||
348 | return ERR_PTR(err); | 351 | return ERR_PTR(err); |
349 | } | 352 | } |
350 | 353 | ||
351 | struct inode * | 354 | static struct inode * |
352 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid, | 355 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid, |
353 | struct super_block *sb) | 356 | struct super_block *sb) |
354 | { | 357 | { |
@@ -474,7 +477,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
474 | flags = O_RDWR; | 477 | flags = O_RDWR; |
475 | 478 | ||
476 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, | 479 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, |
477 | perm, v9fs_uflags2omode(flags), &fid, &qid, &iounit); | 480 | perm, v9fs_uflags2omode(flags), NULL, &fid, &qid, &iounit); |
478 | 481 | ||
479 | if (err) | 482 | if (err) |
480 | goto error; | 483 | goto error; |
@@ -550,7 +553,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
550 | perm = unixmode2p9mode(v9ses, mode | S_IFDIR); | 553 | perm = unixmode2p9mode(v9ses, mode | S_IFDIR); |
551 | 554 | ||
552 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, | 555 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, |
553 | perm, V9FS_OREAD, &fid, NULL, NULL); | 556 | perm, V9FS_OREAD, NULL, &fid, NULL, NULL); |
554 | 557 | ||
555 | if (err) { | 558 | if (err) { |
556 | dprintk(DEBUG_ERROR, "create error %d\n", err); | 559 | dprintk(DEBUG_ERROR, "create error %d\n", err); |
@@ -1008,11 +1011,13 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
1008 | 1011 | ||
1009 | /* copy extension buffer into buffer */ | 1012 | /* copy extension buffer into buffer */ |
1010 | if (fcall->params.rstat.stat.extension.len < buflen) | 1013 | if (fcall->params.rstat.stat.extension.len < buflen) |
1011 | buflen = fcall->params.rstat.stat.extension.len; | 1014 | buflen = fcall->params.rstat.stat.extension.len + 1; |
1012 | 1015 | ||
1013 | memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1); | 1016 | memmove(buffer, fcall->params.rstat.stat.extension.str, buflen - 1); |
1014 | buffer[buflen-1] = 0; | 1017 | buffer[buflen-1] = 0; |
1015 | 1018 | ||
1019 | dprintk(DEBUG_ERROR, "%s -> %.*s (%s)\n", dentry->d_name.name, fcall->params.rstat.stat.extension.len, | ||
1020 | fcall->params.rstat.stat.extension.str, buffer); | ||
1016 | retval = buflen; | 1021 | retval = buflen; |
1017 | 1022 | ||
1018 | FreeFcall: | 1023 | FreeFcall: |
@@ -1072,7 +1077,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
1072 | if (!link) | 1077 | if (!link) |
1073 | link = ERR_PTR(-ENOMEM); | 1078 | link = ERR_PTR(-ENOMEM); |
1074 | else { | 1079 | else { |
1075 | len = v9fs_readlink(dentry, link, strlen(link)); | 1080 | len = v9fs_readlink(dentry, link, PATH_MAX); |
1076 | 1081 | ||
1077 | if (len < 0) { | 1082 | if (len < 0) { |
1078 | __putname(link); | 1083 | __putname(link); |
@@ -1109,10 +1114,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1109 | struct v9fs_session_info *v9ses; | 1114 | struct v9fs_session_info *v9ses; |
1110 | struct v9fs_fid *dfid, *vfid; | 1115 | struct v9fs_fid *dfid, *vfid; |
1111 | struct inode *inode; | 1116 | struct inode *inode; |
1112 | struct v9fs_fcall *fcall; | ||
1113 | struct v9fs_wstat wstat; | ||
1114 | 1117 | ||
1115 | fcall = NULL; | ||
1116 | inode = NULL; | 1118 | inode = NULL; |
1117 | vfid = NULL; | 1119 | vfid = NULL; |
1118 | v9ses = v9fs_inode2v9ses(dir); | 1120 | v9ses = v9fs_inode2v9ses(dir); |
@@ -1125,7 +1127,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1125 | } | 1127 | } |
1126 | 1128 | ||
1127 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, | 1129 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, |
1128 | perm, V9FS_OREAD, &fid, NULL, NULL); | 1130 | perm, V9FS_OREAD, (char *) extension, &fid, NULL, NULL); |
1129 | 1131 | ||
1130 | if (err) | 1132 | if (err) |
1131 | goto error; | 1133 | goto error; |
@@ -1148,23 +1150,11 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1148 | goto error; | 1150 | goto error; |
1149 | } | 1151 | } |
1150 | 1152 | ||
1151 | /* issue a Twstat */ | ||
1152 | v9fs_blank_wstat(&wstat); | ||
1153 | wstat.muid = v9ses->name; | ||
1154 | wstat.extension = (char *) extension; | ||
1155 | err = v9fs_t_wstat(v9ses, vfid->fid, &wstat, &fcall); | ||
1156 | if (err < 0) { | ||
1157 | PRINT_FCALL_ERROR("wstat error", fcall); | ||
1158 | goto error; | ||
1159 | } | ||
1160 | |||
1161 | kfree(fcall); | ||
1162 | dentry->d_op = &v9fs_dentry_operations; | 1153 | dentry->d_op = &v9fs_dentry_operations; |
1163 | d_instantiate(dentry, inode); | 1154 | d_instantiate(dentry, inode); |
1164 | return 0; | 1155 | return 0; |
1165 | 1156 | ||
1166 | error: | 1157 | error: |
1167 | kfree(fcall); | ||
1168 | if (vfid) | 1158 | if (vfid) |
1169 | v9fs_fid_destroy(vfid); | 1159 | v9fs_fid_destroy(vfid); |
1170 | 1160 | ||
@@ -1224,7 +1214,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1224 | } | 1214 | } |
1225 | 1215 | ||
1226 | name = __getname(); | 1216 | name = __getname(); |
1227 | sprintf(name, "hardlink(%d)\n", oldfid->fid); | 1217 | sprintf(name, "%d\n", oldfid->fid); |
1228 | retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); | 1218 | retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); |
1229 | __putname(name); | 1219 | __putname(name); |
1230 | 1220 | ||
@@ -1253,6 +1243,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | |||
1253 | return -EINVAL; | 1243 | return -EINVAL; |
1254 | 1244 | ||
1255 | name = __getname(); | 1245 | name = __getname(); |
1246 | if (!name) | ||
1247 | return -ENOMEM; | ||
1256 | /* build extension */ | 1248 | /* build extension */ |
1257 | if (S_ISBLK(mode)) | 1249 | if (S_ISBLK(mode)) |
1258 | sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev)); | 1250 | sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev)); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index d05318fa684e..b0a0ae509c00 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -262,7 +261,7 @@ static struct super_operations v9fs_super_ops = { | |||
262 | }; | 261 | }; |
263 | 262 | ||
264 | struct file_system_type v9fs_fs_type = { | 263 | struct file_system_type v9fs_fs_type = { |
265 | .name = "9P", | 264 | .name = "9p", |
266 | .get_sb = v9fs_get_sb, | 265 | .get_sb = v9fs_get_sb, |
267 | .kill_sb = v9fs_kill_super, | 266 | .kill_sb = v9fs_kill_super, |
268 | .owner = THIS_MODULE, | 267 | .owner = THIS_MODULE, |
@@ -122,10 +122,9 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
122 | info->nr = 0; | 122 | info->nr = 0; |
123 | info->ring_pages = info->internal_pages; | 123 | info->ring_pages = info->internal_pages; |
124 | if (nr_pages > AIO_RING_PAGES) { | 124 | if (nr_pages > AIO_RING_PAGES) { |
125 | info->ring_pages = kmalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL); | 125 | info->ring_pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); |
126 | if (!info->ring_pages) | 126 | if (!info->ring_pages) |
127 | return -ENOMEM; | 127 | return -ENOMEM; |
128 | memset(info->ring_pages, 0, sizeof(struct page *) * nr_pages); | ||
129 | } | 128 | } |
130 | 129 | ||
131 | info->mmap_size = nr_pages * PAGE_SIZE; | 130 | info->mmap_size = nr_pages * PAGE_SIZE; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c2eac2a50bd2..4349113881fb 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1334,7 +1334,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1334 | 1334 | ||
1335 | i = p->state ? ffz(~p->state) + 1 : 0; | 1335 | i = p->state ? ffz(~p->state) + 1 : 0; |
1336 | psinfo->pr_state = i; | 1336 | psinfo->pr_state = i; |
1337 | psinfo->pr_sname = (i < 0 || i > 5) ? '.' : "RSDTZW"[i]; | 1337 | psinfo->pr_sname = (i > 5) ? '.' : "RSDTZW"[i]; |
1338 | psinfo->pr_zomb = psinfo->pr_sname == 'Z'; | 1338 | psinfo->pr_zomb = psinfo->pr_sname == 'Z'; |
1339 | psinfo->pr_nice = task_nice(p); | 1339 | psinfo->pr_nice = task_nice(p); |
1340 | psinfo->pr_flag = p->flags; | 1340 | psinfo->pr_flag = p->flags; |
@@ -1465,12 +1465,11 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1465 | read_lock(&tasklist_lock); | 1465 | read_lock(&tasklist_lock); |
1466 | do_each_thread(g,p) | 1466 | do_each_thread(g,p) |
1467 | if (current->mm == p->mm && current != p) { | 1467 | if (current->mm == p->mm && current != p) { |
1468 | tmp = kmalloc(sizeof(*tmp), GFP_ATOMIC); | 1468 | tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); |
1469 | if (!tmp) { | 1469 | if (!tmp) { |
1470 | read_unlock(&tasklist_lock); | 1470 | read_unlock(&tasklist_lock); |
1471 | goto cleanup; | 1471 | goto cleanup; |
1472 | } | 1472 | } |
1473 | memset(tmp, 0, sizeof(*tmp)); | ||
1474 | INIT_LIST_HEAD(&tmp->list); | 1473 | INIT_LIST_HEAD(&tmp->list); |
1475 | tmp->thread = p; | 1474 | tmp->thread = p; |
1476 | list_add(&tmp->list, &thread_list); | 1475 | list_add(&tmp->list, &thread_list); |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 108d56bbd0d0..69f44dcdb0b4 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/personality.h> | 36 | #include <linux/personality.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/flat.h> | 38 | #include <linux/flat.h> |
39 | #include <linux/syscalls.h> | ||
39 | 40 | ||
40 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
41 | #include <asm/system.h> | 42 | #include <asm/system.h> |
@@ -426,6 +427,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
426 | int i, rev, relocs = 0; | 427 | int i, rev, relocs = 0; |
427 | loff_t fpos; | 428 | loff_t fpos; |
428 | unsigned long start_code, end_code; | 429 | unsigned long start_code, end_code; |
430 | int ret; | ||
431 | int exec_fileno; | ||
429 | 432 | ||
430 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ | 433 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ |
431 | inode = bprm->file->f_dentry->d_inode; | 434 | inode = bprm->file->f_dentry->d_inode; |
@@ -450,7 +453,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
450 | */ | 453 | */ |
451 | if (strncmp(hdr->magic, "#!", 2)) | 454 | if (strncmp(hdr->magic, "#!", 2)) |
452 | printk("BINFMT_FLAT: bad header magic\n"); | 455 | printk("BINFMT_FLAT: bad header magic\n"); |
453 | return -ENOEXEC; | 456 | ret = -ENOEXEC; |
457 | goto err; | ||
454 | } | 458 | } |
455 | 459 | ||
456 | if (flags & FLAT_FLAG_KTRACE) | 460 | if (flags & FLAT_FLAG_KTRACE) |
@@ -458,14 +462,16 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
458 | 462 | ||
459 | if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { | 463 | if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { |
460 | printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION); | 464 | printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION); |
461 | return -ENOEXEC; | 465 | ret = -ENOEXEC; |
466 | goto err; | ||
462 | } | 467 | } |
463 | 468 | ||
464 | /* Don't allow old format executables to use shared libraries */ | 469 | /* Don't allow old format executables to use shared libraries */ |
465 | if (rev == OLD_FLAT_VERSION && id != 0) { | 470 | if (rev == OLD_FLAT_VERSION && id != 0) { |
466 | printk("BINFMT_FLAT: shared libraries are not available before rev 0x%x\n", | 471 | printk("BINFMT_FLAT: shared libraries are not available before rev 0x%x\n", |
467 | (int) FLAT_VERSION); | 472 | (int) FLAT_VERSION); |
468 | return -ENOEXEC; | 473 | ret = -ENOEXEC; |
474 | goto err; | ||
469 | } | 475 | } |
470 | 476 | ||
471 | /* | 477 | /* |
@@ -478,7 +484,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
478 | #ifndef CONFIG_BINFMT_ZFLAT | 484 | #ifndef CONFIG_BINFMT_ZFLAT |
479 | if (flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) { | 485 | if (flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) { |
480 | printk("Support for ZFLAT executables is not enabled.\n"); | 486 | printk("Support for ZFLAT executables is not enabled.\n"); |
481 | return -ENOEXEC; | 487 | ret = -ENOEXEC; |
488 | goto err; | ||
482 | } | 489 | } |
483 | #endif | 490 | #endif |
484 | 491 | ||
@@ -490,14 +497,27 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
490 | rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; | 497 | rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; |
491 | if (rlim >= RLIM_INFINITY) | 498 | if (rlim >= RLIM_INFINITY) |
492 | rlim = ~0; | 499 | rlim = ~0; |
493 | if (data_len + bss_len > rlim) | 500 | if (data_len + bss_len > rlim) { |
494 | return -ENOMEM; | 501 | ret = -ENOMEM; |
502 | goto err; | ||
503 | } | ||
504 | |||
505 | /* check file descriptor */ | ||
506 | exec_fileno = get_unused_fd(); | ||
507 | if (exec_fileno < 0) { | ||
508 | ret = -EMFILE; | ||
509 | goto err; | ||
510 | } | ||
511 | get_file(bprm->file); | ||
512 | fd_install(exec_fileno, bprm->file); | ||
495 | 513 | ||
496 | /* Flush all traces of the currently running executable */ | 514 | /* Flush all traces of the currently running executable */ |
497 | if (id == 0) { | 515 | if (id == 0) { |
498 | result = flush_old_exec(bprm); | 516 | result = flush_old_exec(bprm); |
499 | if (result) | 517 | if (result) { |
500 | return result; | 518 | ret = result; |
519 | goto err_close; | ||
520 | } | ||
501 | 521 | ||
502 | /* OK, This is the point of no return */ | 522 | /* OK, This is the point of no return */ |
503 | set_personality(PER_LINUX); | 523 | set_personality(PER_LINUX); |
@@ -527,7 +547,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
527 | if (!textpos) | 547 | if (!textpos) |
528 | textpos = (unsigned long) -ENOMEM; | 548 | textpos = (unsigned long) -ENOMEM; |
529 | printk("Unable to mmap process text, errno %d\n", (int)-textpos); | 549 | printk("Unable to mmap process text, errno %d\n", (int)-textpos); |
530 | return(textpos); | 550 | ret = textpos; |
551 | goto err_close; | ||
531 | } | 552 | } |
532 | 553 | ||
533 | down_write(¤t->mm->mmap_sem); | 554 | down_write(¤t->mm->mmap_sem); |
@@ -542,7 +563,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
542 | printk("Unable to allocate RAM for process data, errno %d\n", | 563 | printk("Unable to allocate RAM for process data, errno %d\n", |
543 | (int)-datapos); | 564 | (int)-datapos); |
544 | do_munmap(current->mm, textpos, text_len); | 565 | do_munmap(current->mm, textpos, text_len); |
545 | return realdatastart; | 566 | ret = realdatastart; |
567 | goto err_close; | ||
546 | } | 568 | } |
547 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); | 569 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); |
548 | 570 | ||
@@ -564,7 +586,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
564 | printk("Unable to read data+bss, errno %d\n", (int)-result); | 586 | printk("Unable to read data+bss, errno %d\n", (int)-result); |
565 | do_munmap(current->mm, textpos, text_len); | 587 | do_munmap(current->mm, textpos, text_len); |
566 | do_munmap(current->mm, realdatastart, data_len + extra); | 588 | do_munmap(current->mm, realdatastart, data_len + extra); |
567 | return result; | 589 | ret = result; |
590 | goto err_close; | ||
568 | } | 591 | } |
569 | 592 | ||
570 | reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len)); | 593 | reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len)); |
@@ -582,7 +605,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
582 | textpos = (unsigned long) -ENOMEM; | 605 | textpos = (unsigned long) -ENOMEM; |
583 | printk("Unable to allocate RAM for process text/data, errno %d\n", | 606 | printk("Unable to allocate RAM for process text/data, errno %d\n", |
584 | (int)-textpos); | 607 | (int)-textpos); |
585 | return(textpos); | 608 | ret = textpos; |
609 | goto err_close; | ||
586 | } | 610 | } |
587 | 611 | ||
588 | realdatastart = textpos + ntohl(hdr->data_start); | 612 | realdatastart = textpos + ntohl(hdr->data_start); |
@@ -627,7 +651,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
627 | printk("Unable to read code+data+bss, errno %d\n",(int)-result); | 651 | printk("Unable to read code+data+bss, errno %d\n",(int)-result); |
628 | do_munmap(current->mm, textpos, text_len + data_len + extra + | 652 | do_munmap(current->mm, textpos, text_len + data_len + extra + |
629 | MAX_SHARED_LIBS * sizeof(unsigned long)); | 653 | MAX_SHARED_LIBS * sizeof(unsigned long)); |
630 | return result; | 654 | ret = result; |
655 | goto err_close; | ||
631 | } | 656 | } |
632 | } | 657 | } |
633 | 658 | ||
@@ -690,8 +715,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
690 | unsigned long addr; | 715 | unsigned long addr; |
691 | if (*rp) { | 716 | if (*rp) { |
692 | addr = calc_reloc(*rp, libinfo, id, 0); | 717 | addr = calc_reloc(*rp, libinfo, id, 0); |
693 | if (addr == RELOC_FAILED) | 718 | if (addr == RELOC_FAILED) { |
694 | return -ENOEXEC; | 719 | ret = -ENOEXEC; |
720 | goto err_close; | ||
721 | } | ||
695 | *rp = addr; | 722 | *rp = addr; |
696 | } | 723 | } |
697 | } | 724 | } |
@@ -718,8 +745,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
718 | relval = ntohl(reloc[i]); | 745 | relval = ntohl(reloc[i]); |
719 | addr = flat_get_relocate_addr(relval); | 746 | addr = flat_get_relocate_addr(relval); |
720 | rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1); | 747 | rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1); |
721 | if (rp == (unsigned long *)RELOC_FAILED) | 748 | if (rp == (unsigned long *)RELOC_FAILED) { |
722 | return -ENOEXEC; | 749 | ret = -ENOEXEC; |
750 | goto err_close; | ||
751 | } | ||
723 | 752 | ||
724 | /* Get the pointer's value. */ | 753 | /* Get the pointer's value. */ |
725 | addr = flat_get_addr_from_rp(rp, relval, flags); | 754 | addr = flat_get_addr_from_rp(rp, relval, flags); |
@@ -731,8 +760,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
731 | if ((flags & FLAT_FLAG_GOTPIC) == 0) | 760 | if ((flags & FLAT_FLAG_GOTPIC) == 0) |
732 | addr = ntohl(addr); | 761 | addr = ntohl(addr); |
733 | addr = calc_reloc(addr, libinfo, id, 0); | 762 | addr = calc_reloc(addr, libinfo, id, 0); |
734 | if (addr == RELOC_FAILED) | 763 | if (addr == RELOC_FAILED) { |
735 | return -ENOEXEC; | 764 | ret = -ENOEXEC; |
765 | goto err_close; | ||
766 | } | ||
736 | 767 | ||
737 | /* Write back the relocated pointer. */ | 768 | /* Write back the relocated pointer. */ |
738 | flat_put_addr_at_rp(rp, addr, relval); | 769 | flat_put_addr_at_rp(rp, addr, relval); |
@@ -752,6 +783,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
752 | stack_len); | 783 | stack_len); |
753 | 784 | ||
754 | return 0; | 785 | return 0; |
786 | err_close: | ||
787 | sys_close(exec_fileno); | ||
788 | err: | ||
789 | return ret; | ||
755 | } | 790 | } |
756 | 791 | ||
757 | 792 | ||
@@ -636,12 +636,10 @@ static struct bio *__bio_map_user_iov(request_queue_t *q, | |||
636 | return ERR_PTR(-ENOMEM); | 636 | return ERR_PTR(-ENOMEM); |
637 | 637 | ||
638 | ret = -ENOMEM; | 638 | ret = -ENOMEM; |
639 | pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL); | 639 | pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); |
640 | if (!pages) | 640 | if (!pages) |
641 | goto out; | 641 | goto out; |
642 | 642 | ||
643 | memset(pages, 0, nr_pages * sizeof(struct page *)); | ||
644 | |||
645 | for (i = 0; i < iov_count; i++) { | 643 | for (i = 0; i < iov_count; i++) { |
646 | unsigned long uaddr = (unsigned long)iov[i].iov_base; | 644 | unsigned long uaddr = (unsigned long)iov[i].iov_base; |
647 | unsigned long len = iov[i].iov_len; | 645 | unsigned long len = iov[i].iov_len; |
@@ -1186,12 +1184,11 @@ void bioset_free(struct bio_set *bs) | |||
1186 | 1184 | ||
1187 | struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale) | 1185 | struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale) |
1188 | { | 1186 | { |
1189 | struct bio_set *bs = kmalloc(sizeof(*bs), GFP_KERNEL); | 1187 | struct bio_set *bs = kzalloc(sizeof(*bs), GFP_KERNEL); |
1190 | 1188 | ||
1191 | if (!bs) | 1189 | if (!bs) |
1192 | return NULL; | 1190 | return NULL; |
1193 | 1191 | ||
1194 | memset(bs, 0, sizeof(*bs)); | ||
1195 | bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab, | 1192 | bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab, |
1196 | mempool_free_slab, bio_slab); | 1193 | mempool_free_slab, bio_slab); |
1197 | 1194 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index 6d77ce9f54e5..3b3ab5281920 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -160,12 +160,7 @@ int sync_blockdev(struct block_device *bdev) | |||
160 | } | 160 | } |
161 | EXPORT_SYMBOL(sync_blockdev); | 161 | EXPORT_SYMBOL(sync_blockdev); |
162 | 162 | ||
163 | /* | 163 | static void __fsync_super(struct super_block *sb) |
164 | * Write out and wait upon all dirty data associated with this | ||
165 | * superblock. Filesystem data as well as the underlying block | ||
166 | * device. Takes the superblock lock. | ||
167 | */ | ||
168 | int fsync_super(struct super_block *sb) | ||
169 | { | 164 | { |
170 | sync_inodes_sb(sb, 0); | 165 | sync_inodes_sb(sb, 0); |
171 | DQUOT_SYNC(sb); | 166 | DQUOT_SYNC(sb); |
@@ -177,7 +172,16 @@ int fsync_super(struct super_block *sb) | |||
177 | sb->s_op->sync_fs(sb, 1); | 172 | sb->s_op->sync_fs(sb, 1); |
178 | sync_blockdev(sb->s_bdev); | 173 | sync_blockdev(sb->s_bdev); |
179 | sync_inodes_sb(sb, 1); | 174 | sync_inodes_sb(sb, 1); |
175 | } | ||
180 | 176 | ||
177 | /* | ||
178 | * Write out and wait upon all dirty data associated with this | ||
179 | * superblock. Filesystem data as well as the underlying block | ||
180 | * device. Takes the superblock lock. | ||
181 | */ | ||
182 | int fsync_super(struct super_block *sb) | ||
183 | { | ||
184 | __fsync_super(sb); | ||
181 | return sync_blockdev(sb->s_bdev); | 185 | return sync_blockdev(sb->s_bdev); |
182 | } | 186 | } |
183 | 187 | ||
@@ -216,19 +220,7 @@ struct super_block *freeze_bdev(struct block_device *bdev) | |||
216 | sb->s_frozen = SB_FREEZE_WRITE; | 220 | sb->s_frozen = SB_FREEZE_WRITE; |
217 | smp_wmb(); | 221 | smp_wmb(); |
218 | 222 | ||
219 | sync_inodes_sb(sb, 0); | 223 | __fsync_super(sb); |
220 | DQUOT_SYNC(sb); | ||
221 | |||
222 | lock_super(sb); | ||
223 | if (sb->s_dirt && sb->s_op->write_super) | ||
224 | sb->s_op->write_super(sb); | ||
225 | unlock_super(sb); | ||
226 | |||
227 | if (sb->s_op->sync_fs) | ||
228 | sb->s_op->sync_fs(sb, 1); | ||
229 | |||
230 | sync_blockdev(sb->s_bdev); | ||
231 | sync_inodes_sb(sb, 1); | ||
232 | 224 | ||
233 | sb->s_frozen = SB_FREEZE_TRANS; | 225 | sb->s_frozen = SB_FREEZE_TRANS; |
234 | smp_wmb(); | 226 | smp_wmb(); |
diff --git a/fs/char_dev.c b/fs/char_dev.c index 5c36345c9bf7..8c6eb04d31e2 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -146,12 +146,10 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, | |||
146 | int ret = 0; | 146 | int ret = 0; |
147 | int i; | 147 | int i; |
148 | 148 | ||
149 | cd = kmalloc(sizeof(struct char_device_struct), GFP_KERNEL); | 149 | cd = kzalloc(sizeof(struct char_device_struct), GFP_KERNEL); |
150 | if (cd == NULL) | 150 | if (cd == NULL) |
151 | return ERR_PTR(-ENOMEM); | 151 | return ERR_PTR(-ENOMEM); |
152 | 152 | ||
153 | memset(cd, 0, sizeof(struct char_device_struct)); | ||
154 | |||
155 | mutex_lock(&chrdevs_lock); | 153 | mutex_lock(&chrdevs_lock); |
156 | 154 | ||
157 | /* temporary */ | 155 | /* temporary */ |
@@ -466,9 +464,8 @@ static struct kobj_type ktype_cdev_dynamic = { | |||
466 | 464 | ||
467 | struct cdev *cdev_alloc(void) | 465 | struct cdev *cdev_alloc(void) |
468 | { | 466 | { |
469 | struct cdev *p = kmalloc(sizeof(struct cdev), GFP_KERNEL); | 467 | struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); |
470 | if (p) { | 468 | if (p) { |
471 | memset(p, 0, sizeof(struct cdev)); | ||
472 | p->kobj.ktype = &ktype_cdev_dynamic; | 469 | p->kobj.ktype = &ktype_cdev_dynamic; |
473 | INIT_LIST_HEAD(&p->list); | 470 | INIT_LIST_HEAD(&p->list); |
474 | kobject_init(&p->kobj); | 471 | kobject_init(&p->kobj); |
diff --git a/fs/compat.c b/fs/compat.c index 2a88477330fc..ef5a0771592d 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1476,10 +1476,9 @@ int compat_do_execve(char * filename, | |||
1476 | int i; | 1476 | int i; |
1477 | 1477 | ||
1478 | retval = -ENOMEM; | 1478 | retval = -ENOMEM; |
1479 | bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); | 1479 | bprm = kzalloc(sizeof(*bprm), GFP_KERNEL); |
1480 | if (!bprm) | 1480 | if (!bprm) |
1481 | goto out_ret; | 1481 | goto out_ret; |
1482 | memset(bprm, 0, sizeof(*bprm)); | ||
1483 | 1482 | ||
1484 | file = open_exec(filename); | 1483 | file = open_exec(filename); |
1485 | retval = PTR_ERR(file); | 1484 | retval = PTR_ERR(file); |
@@ -2170,9 +2169,12 @@ asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user * | |||
2170 | 2169 | ||
2171 | default: | 2170 | default: |
2172 | err = -EINVAL; | 2171 | err = -EINVAL; |
2173 | goto done; | 2172 | break; |
2174 | } | 2173 | } |
2175 | 2174 | ||
2175 | if (err) | ||
2176 | goto done; | ||
2177 | |||
2176 | oldfs = get_fs(); | 2178 | oldfs = get_fs(); |
2177 | set_fs(KERNEL_DS); | 2179 | set_fs(KERNEL_DS); |
2178 | /* The __user pointer casts are valid because of the set_fs() */ | 2180 | /* The __user pointer casts are valid because of the set_fs() */ |
diff --git a/fs/dcache.c b/fs/dcache.c index 653f64ce98e2..939584648504 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -325,10 +325,13 @@ static struct dentry * __d_find_alias(struct inode *inode, int want_discon) | |||
325 | 325 | ||
326 | struct dentry * d_find_alias(struct inode *inode) | 326 | struct dentry * d_find_alias(struct inode *inode) |
327 | { | 327 | { |
328 | struct dentry *de; | 328 | struct dentry *de = NULL; |
329 | spin_lock(&dcache_lock); | 329 | |
330 | de = __d_find_alias(inode, 0); | 330 | if (!list_empty(&inode->i_dentry)) { |
331 | spin_unlock(&dcache_lock); | 331 | spin_lock(&dcache_lock); |
332 | de = __d_find_alias(inode, 0); | ||
333 | spin_unlock(&dcache_lock); | ||
334 | } | ||
332 | return de; | 335 | return de; |
333 | } | 336 | } |
334 | 337 | ||
@@ -486,6 +489,7 @@ repeat: | |||
486 | continue; | 489 | continue; |
487 | } | 490 | } |
488 | prune_one_dentry(dentry); | 491 | prune_one_dentry(dentry); |
492 | cond_resched_lock(&dcache_lock); | ||
489 | goto repeat; | 493 | goto repeat; |
490 | } | 494 | } |
491 | spin_unlock(&dcache_lock); | 495 | spin_unlock(&dcache_lock); |
@@ -799,6 +803,7 @@ void d_instantiate(struct dentry *entry, struct inode * inode) | |||
799 | if (inode) | 803 | if (inode) |
800 | list_add(&entry->d_alias, &inode->i_dentry); | 804 | list_add(&entry->d_alias, &inode->i_dentry); |
801 | entry->d_inode = inode; | 805 | entry->d_inode = inode; |
806 | fsnotify_d_instantiate(entry, inode); | ||
802 | spin_unlock(&dcache_lock); | 807 | spin_unlock(&dcache_lock); |
803 | security_d_instantiate(entry, inode); | 808 | security_d_instantiate(entry, inode); |
804 | } | 809 | } |
@@ -850,6 +855,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) | |||
850 | list_add(&entry->d_alias, &inode->i_dentry); | 855 | list_add(&entry->d_alias, &inode->i_dentry); |
851 | do_negative: | 856 | do_negative: |
852 | entry->d_inode = inode; | 857 | entry->d_inode = inode; |
858 | fsnotify_d_instantiate(entry, inode); | ||
853 | spin_unlock(&dcache_lock); | 859 | spin_unlock(&dcache_lock); |
854 | security_d_instantiate(entry, inode); | 860 | security_d_instantiate(entry, inode); |
855 | return NULL; | 861 | return NULL; |
@@ -980,6 +986,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
980 | new = __d_find_alias(inode, 1); | 986 | new = __d_find_alias(inode, 1); |
981 | if (new) { | 987 | if (new) { |
982 | BUG_ON(!(new->d_flags & DCACHE_DISCONNECTED)); | 988 | BUG_ON(!(new->d_flags & DCACHE_DISCONNECTED)); |
989 | fsnotify_d_instantiate(new, inode); | ||
983 | spin_unlock(&dcache_lock); | 990 | spin_unlock(&dcache_lock); |
984 | security_d_instantiate(new, inode); | 991 | security_d_instantiate(new, inode); |
985 | d_rehash(dentry); | 992 | d_rehash(dentry); |
@@ -989,6 +996,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
989 | /* d_instantiate takes dcache_lock, so we do it by hand */ | 996 | /* d_instantiate takes dcache_lock, so we do it by hand */ |
990 | list_add(&dentry->d_alias, &inode->i_dentry); | 997 | list_add(&dentry->d_alias, &inode->i_dentry); |
991 | dentry->d_inode = inode; | 998 | dentry->d_inode = inode; |
999 | fsnotify_d_instantiate(dentry, inode); | ||
992 | spin_unlock(&dcache_lock); | 1000 | spin_unlock(&dcache_lock); |
993 | security_d_instantiate(dentry, inode); | 1001 | security_d_instantiate(dentry, inode); |
994 | d_rehash(dentry); | 1002 | d_rehash(dentry); |
@@ -1173,6 +1181,9 @@ void d_delete(struct dentry * dentry) | |||
1173 | spin_lock(&dentry->d_lock); | 1181 | spin_lock(&dentry->d_lock); |
1174 | isdir = S_ISDIR(dentry->d_inode->i_mode); | 1182 | isdir = S_ISDIR(dentry->d_inode->i_mode); |
1175 | if (atomic_read(&dentry->d_count) == 1) { | 1183 | if (atomic_read(&dentry->d_count) == 1) { |
1184 | /* remove this and other inotify debug checks after 2.6.18 */ | ||
1185 | dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED; | ||
1186 | |||
1176 | dentry_iput(dentry); | 1187 | dentry_iput(dentry); |
1177 | fsnotify_nameremove(dentry, isdir); | 1188 | fsnotify_nameremove(dentry, isdir); |
1178 | return; | 1189 | return; |
@@ -1339,6 +1350,7 @@ already_unhashed: | |||
1339 | 1350 | ||
1340 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | 1351 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); |
1341 | spin_unlock(&target->d_lock); | 1352 | spin_unlock(&target->d_lock); |
1353 | fsnotify_d_move(dentry); | ||
1342 | spin_unlock(&dentry->d_lock); | 1354 | spin_unlock(&dentry->d_lock); |
1343 | write_sequnlock(&rename_lock); | 1355 | write_sequnlock(&rename_lock); |
1344 | spin_unlock(&dcache_lock); | 1356 | spin_unlock(&dcache_lock); |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 27f3e787faca..235ed8d1f11e 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -129,6 +129,7 @@ struct dio { | |||
129 | /* AIO related stuff */ | 129 | /* AIO related stuff */ |
130 | struct kiocb *iocb; /* kiocb */ | 130 | struct kiocb *iocb; /* kiocb */ |
131 | int is_async; /* is IO async ? */ | 131 | int is_async; /* is IO async ? */ |
132 | int io_error; /* IO error in completion path */ | ||
132 | ssize_t result; /* IO result */ | 133 | ssize_t result; /* IO result */ |
133 | }; | 134 | }; |
134 | 135 | ||
@@ -250,6 +251,10 @@ static void finished_one_bio(struct dio *dio) | |||
250 | ((offset + transferred) > dio->i_size)) | 251 | ((offset + transferred) > dio->i_size)) |
251 | transferred = dio->i_size - offset; | 252 | transferred = dio->i_size - offset; |
252 | 253 | ||
254 | /* check for error in completion path */ | ||
255 | if (dio->io_error) | ||
256 | transferred = dio->io_error; | ||
257 | |||
253 | dio_complete(dio, offset, transferred); | 258 | dio_complete(dio, offset, transferred); |
254 | 259 | ||
255 | /* Complete AIO later if falling back to buffered i/o */ | 260 | /* Complete AIO later if falling back to buffered i/o */ |
@@ -406,7 +411,7 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio) | |||
406 | int page_no; | 411 | int page_no; |
407 | 412 | ||
408 | if (!uptodate) | 413 | if (!uptodate) |
409 | dio->result = -EIO; | 414 | dio->io_error = -EIO; |
410 | 415 | ||
411 | if (dio->is_async && dio->rw == READ) { | 416 | if (dio->is_async && dio->rw == READ) { |
412 | bio_check_pages_dirty(bio); /* transfers ownership */ | 417 | bio_check_pages_dirty(bio); /* transfers ownership */ |
@@ -971,6 +976,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
971 | dio->next_block_for_io = -1; | 976 | dio->next_block_for_io = -1; |
972 | 977 | ||
973 | dio->page_errors = 0; | 978 | dio->page_errors = 0; |
979 | dio->io_error = 0; | ||
974 | dio->result = 0; | 980 | dio->result = 0; |
975 | dio->iocb = iocb; | 981 | dio->iocb = iocb; |
976 | dio->i_size = i_size_read(inode); | 982 | dio->i_size = i_size_read(inode); |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 1c2b16fda13a..a0f682cdd03e 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -599,7 +599,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) | |||
599 | switch (op) { | 599 | switch (op) { |
600 | case EPOLL_CTL_ADD: | 600 | case EPOLL_CTL_ADD: |
601 | if (!epi) { | 601 | if (!epi) { |
602 | epds.events |= POLLERR | POLLHUP; | 602 | epds.events |= POLLERR | POLLHUP | POLLRDHUP; |
603 | 603 | ||
604 | error = ep_insert(ep, &epds, tfile, fd); | 604 | error = ep_insert(ep, &epds, tfile, fd); |
605 | } else | 605 | } else |
@@ -613,7 +613,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) | |||
613 | break; | 613 | break; |
614 | case EPOLL_CTL_MOD: | 614 | case EPOLL_CTL_MOD: |
615 | if (epi) { | 615 | if (epi) { |
616 | epds.events |= POLLERR | POLLHUP; | 616 | epds.events |= POLLERR | POLLHUP | POLLRDHUP; |
617 | error = ep_modify(ep, epi, &epds); | 617 | error = ep_modify(ep, epi, &epds); |
618 | } else | 618 | } else |
619 | error = -ENOENT; | 619 | error = -ENOENT; |
@@ -127,7 +127,7 @@ asmlinkage long sys_uselib(const char __user * library) | |||
127 | struct nameidata nd; | 127 | struct nameidata nd; |
128 | int error; | 128 | int error; |
129 | 129 | ||
130 | error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ); | 130 | error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC); |
131 | if (error) | 131 | if (error) |
132 | goto out; | 132 | goto out; |
133 | 133 | ||
@@ -477,7 +477,7 @@ struct file *open_exec(const char *name) | |||
477 | int err; | 477 | int err; |
478 | struct file *file; | 478 | struct file *file; |
479 | 479 | ||
480 | err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ); | 480 | err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC); |
481 | file = ERR_PTR(err); | 481 | file = ERR_PTR(err); |
482 | 482 | ||
483 | if (!err) { | 483 | if (!err) { |
@@ -1143,10 +1143,9 @@ int do_execve(char * filename, | |||
1143 | int i; | 1143 | int i; |
1144 | 1144 | ||
1145 | retval = -ENOMEM; | 1145 | retval = -ENOMEM; |
1146 | bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); | 1146 | bprm = kzalloc(sizeof(*bprm), GFP_KERNEL); |
1147 | if (!bprm) | 1147 | if (!bprm) |
1148 | goto out_ret; | 1148 | goto out_ret; |
1149 | memset(bprm, 0, sizeof(*bprm)); | ||
1150 | 1149 | ||
1151 | file = open_exec(filename); | 1150 | file = open_exec(filename); |
1152 | retval = PTR_ERR(file); | 1151 | retval = PTR_ERR(file); |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 268b73f5847c..7e30bae174ed 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -211,8 +211,6 @@ static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
211 | 211 | ||
212 | if (sbi->s_mount_opt & EXT2_MOUNT_GRPID) | 212 | if (sbi->s_mount_opt & EXT2_MOUNT_GRPID) |
213 | seq_puts(seq, ",grpid"); | 213 | seq_puts(seq, ",grpid"); |
214 | else | ||
215 | seq_puts(seq, ",nogrpid"); | ||
216 | 214 | ||
217 | #if defined(CONFIG_QUOTA) | 215 | #if defined(CONFIG_QUOTA) |
218 | if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) | 216 | if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) |
diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c index cb16b4c5d5df..ce4f82b9e528 100644 --- a/fs/ext3/bitmap.c +++ b/fs/ext3/bitmap.c | |||
@@ -7,11 +7,11 @@ | |||
7 | * Universite Pierre et Marie Curie (Paris VI) | 7 | * Universite Pierre et Marie Curie (Paris VI) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifdef EXT3FS_DEBUG | ||
11 | |||
12 | #include <linux/buffer_head.h> | 10 | #include <linux/buffer_head.h> |
11 | #include <linux/jbd.h> | ||
12 | #include <linux/ext3_fs.h> | ||
13 | 13 | ||
14 | #include "ext3_fs.h" | 14 | #ifdef EXT3FS_DEBUG |
15 | 15 | ||
16 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; | 16 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; |
17 | 17 | ||
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 785c7213a54f..f3fbe2d030f4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -381,8 +381,8 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc) | |||
381 | list_move(&inode->i_list, &sb->s_dirty); | 381 | list_move(&inode->i_list, &sb->s_dirty); |
382 | } | 382 | } |
383 | spin_unlock(&inode_lock); | 383 | spin_unlock(&inode_lock); |
384 | cond_resched(); | ||
385 | iput(inode); | 384 | iput(inode); |
385 | cond_resched(); | ||
386 | spin_lock(&inode_lock); | 386 | spin_lock(&inode_lock); |
387 | if (wbc->nr_to_write <= 0) | 387 | if (wbc->nr_to_write <= 0) |
388 | break; | 388 | break; |
diff --git a/fs/inode.c b/fs/inode.c index a51c671c54cf..85da11044adc 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -91,7 +91,7 @@ DEFINE_SPINLOCK(inode_lock); | |||
91 | * from its final dispose_list, the struct super_block they refer to | 91 | * from its final dispose_list, the struct super_block they refer to |
92 | * (for inode->i_sb->s_op) may already have been freed and reused. | 92 | * (for inode->i_sb->s_op) may already have been freed and reused. |
93 | */ | 93 | */ |
94 | DEFINE_MUTEX(iprune_mutex); | 94 | static DEFINE_MUTEX(iprune_mutex); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Statistics gathering.. | 97 | * Statistics gathering.. |
diff --git a/fs/inotify.c b/fs/inotify.c index 0ee39ef591c6..a61e93e17853 100644 --- a/fs/inotify.c +++ b/fs/inotify.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <asm/ioctls.h> | 38 | #include <asm/ioctls.h> |
39 | 39 | ||
40 | static atomic_t inotify_cookie; | 40 | static atomic_t inotify_cookie; |
41 | static atomic_t inotify_watches; | ||
42 | 41 | ||
43 | static kmem_cache_t *watch_cachep; | 42 | static kmem_cache_t *watch_cachep; |
44 | static kmem_cache_t *event_cachep; | 43 | static kmem_cache_t *event_cachep; |
@@ -381,6 +380,48 @@ static int find_inode(const char __user *dirname, struct nameidata *nd, | |||
381 | } | 380 | } |
382 | 381 | ||
383 | /* | 382 | /* |
383 | * inotify_inode_watched - returns nonzero if there are watches on this inode | ||
384 | * and zero otherwise. We call this lockless, we do not care if we race. | ||
385 | */ | ||
386 | static inline int inotify_inode_watched(struct inode *inode) | ||
387 | { | ||
388 | return !list_empty(&inode->inotify_watches); | ||
389 | } | ||
390 | |||
391 | /* | ||
392 | * Get child dentry flag into synch with parent inode. | ||
393 | * Flag should always be clear for negative dentrys. | ||
394 | */ | ||
395 | static void set_dentry_child_flags(struct inode *inode, int watched) | ||
396 | { | ||
397 | struct dentry *alias; | ||
398 | |||
399 | spin_lock(&dcache_lock); | ||
400 | list_for_each_entry(alias, &inode->i_dentry, d_alias) { | ||
401 | struct dentry *child; | ||
402 | |||
403 | list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { | ||
404 | if (!child->d_inode) { | ||
405 | WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); | ||
406 | continue; | ||
407 | } | ||
408 | spin_lock(&child->d_lock); | ||
409 | if (watched) { | ||
410 | WARN_ON(child->d_flags & | ||
411 | DCACHE_INOTIFY_PARENT_WATCHED); | ||
412 | child->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | ||
413 | } else { | ||
414 | WARN_ON(!(child->d_flags & | ||
415 | DCACHE_INOTIFY_PARENT_WATCHED)); | ||
416 | child->d_flags&=~DCACHE_INOTIFY_PARENT_WATCHED; | ||
417 | } | ||
418 | spin_unlock(&child->d_lock); | ||
419 | } | ||
420 | } | ||
421 | spin_unlock(&dcache_lock); | ||
422 | } | ||
423 | |||
424 | /* | ||
384 | * create_watch - creates a watch on the given device. | 425 | * create_watch - creates a watch on the given device. |
385 | * | 426 | * |
386 | * Callers must hold dev->mutex. Calls inotify_dev_get_wd() so may sleep. | 427 | * Callers must hold dev->mutex. Calls inotify_dev_get_wd() so may sleep. |
@@ -426,7 +467,6 @@ static struct inotify_watch *create_watch(struct inotify_device *dev, | |||
426 | get_inotify_watch(watch); | 467 | get_inotify_watch(watch); |
427 | 468 | ||
428 | atomic_inc(&dev->user->inotify_watches); | 469 | atomic_inc(&dev->user->inotify_watches); |
429 | atomic_inc(&inotify_watches); | ||
430 | 470 | ||
431 | return watch; | 471 | return watch; |
432 | } | 472 | } |
@@ -458,8 +498,10 @@ static void remove_watch_no_event(struct inotify_watch *watch, | |||
458 | list_del(&watch->i_list); | 498 | list_del(&watch->i_list); |
459 | list_del(&watch->d_list); | 499 | list_del(&watch->d_list); |
460 | 500 | ||
501 | if (!inotify_inode_watched(watch->inode)) | ||
502 | set_dentry_child_flags(watch->inode, 0); | ||
503 | |||
461 | atomic_dec(&dev->user->inotify_watches); | 504 | atomic_dec(&dev->user->inotify_watches); |
462 | atomic_dec(&inotify_watches); | ||
463 | idr_remove(&dev->idr, watch->wd); | 505 | idr_remove(&dev->idr, watch->wd); |
464 | put_inotify_watch(watch); | 506 | put_inotify_watch(watch); |
465 | } | 507 | } |
@@ -481,16 +523,39 @@ static void remove_watch(struct inotify_watch *watch,struct inotify_device *dev) | |||
481 | remove_watch_no_event(watch, dev); | 523 | remove_watch_no_event(watch, dev); |
482 | } | 524 | } |
483 | 525 | ||
526 | /* Kernel API */ | ||
527 | |||
484 | /* | 528 | /* |
485 | * inotify_inode_watched - returns nonzero if there are watches on this inode | 529 | * inotify_d_instantiate - instantiate dcache entry for inode |
486 | * and zero otherwise. We call this lockless, we do not care if we race. | ||
487 | */ | 530 | */ |
488 | static inline int inotify_inode_watched(struct inode *inode) | 531 | void inotify_d_instantiate(struct dentry *entry, struct inode *inode) |
489 | { | 532 | { |
490 | return !list_empty(&inode->inotify_watches); | 533 | struct dentry *parent; |
534 | |||
535 | if (!inode) | ||
536 | return; | ||
537 | |||
538 | WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); | ||
539 | spin_lock(&entry->d_lock); | ||
540 | parent = entry->d_parent; | ||
541 | if (inotify_inode_watched(parent->d_inode)) | ||
542 | entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | ||
543 | spin_unlock(&entry->d_lock); | ||
491 | } | 544 | } |
492 | 545 | ||
493 | /* Kernel API */ | 546 | /* |
547 | * inotify_d_move - dcache entry has been moved | ||
548 | */ | ||
549 | void inotify_d_move(struct dentry *entry) | ||
550 | { | ||
551 | struct dentry *parent; | ||
552 | |||
553 | parent = entry->d_parent; | ||
554 | if (inotify_inode_watched(parent->d_inode)) | ||
555 | entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | ||
556 | else | ||
557 | entry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED; | ||
558 | } | ||
494 | 559 | ||
495 | /** | 560 | /** |
496 | * inotify_inode_queue_event - queue an event to all watches on this inode | 561 | * inotify_inode_queue_event - queue an event to all watches on this inode |
@@ -538,7 +603,7 @@ void inotify_dentry_parent_queue_event(struct dentry *dentry, u32 mask, | |||
538 | struct dentry *parent; | 603 | struct dentry *parent; |
539 | struct inode *inode; | 604 | struct inode *inode; |
540 | 605 | ||
541 | if (!atomic_read (&inotify_watches)) | 606 | if (!(dentry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED)) |
542 | return; | 607 | return; |
543 | 608 | ||
544 | spin_lock(&dentry->d_lock); | 609 | spin_lock(&dentry->d_lock); |
@@ -993,6 +1058,9 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) | |||
993 | goto out; | 1058 | goto out; |
994 | } | 1059 | } |
995 | 1060 | ||
1061 | if (!inotify_inode_watched(inode)) | ||
1062 | set_dentry_child_flags(inode, 1); | ||
1063 | |||
996 | /* Add the watch to the device's and the inode's list */ | 1064 | /* Add the watch to the device's and the inode's list */ |
997 | list_add(&watch->d_list, &dev->watches); | 1065 | list_add(&watch->d_list, &dev->watches); |
998 | list_add(&watch->i_list, &inode->inotify_watches); | 1066 | list_add(&watch->i_list, &inode->inotify_watches); |
@@ -1065,7 +1133,6 @@ static int __init inotify_setup(void) | |||
1065 | inotify_max_user_watches = 8192; | 1133 | inotify_max_user_watches = 8192; |
1066 | 1134 | ||
1067 | atomic_set(&inotify_cookie, 0); | 1135 | atomic_set(&inotify_cookie, 0); |
1068 | atomic_set(&inotify_watches, 0); | ||
1069 | 1136 | ||
1070 | watch_cachep = kmem_cache_create("inotify_watch_cache", | 1137 | watch_cachep = kmem_cache_create("inotify_watch_cache", |
1071 | sizeof(struct inotify_watch), | 1138 | sizeof(struct inotify_watch), |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 95a628d8cac8..7f96b5cb6781 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -33,9 +33,11 @@ | |||
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/suspend.h> | 34 | #include <linux/suspend.h> |
35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
36 | #include <linux/kthread.h> | ||
37 | #include <linux/proc_fs.h> | ||
38 | |||
36 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
37 | #include <asm/page.h> | 40 | #include <asm/page.h> |
38 | #include <linux/proc_fs.h> | ||
39 | 41 | ||
40 | EXPORT_SYMBOL(journal_start); | 42 | EXPORT_SYMBOL(journal_start); |
41 | EXPORT_SYMBOL(journal_restart); | 43 | EXPORT_SYMBOL(journal_restart); |
@@ -111,18 +113,15 @@ static void commit_timeout(unsigned long __data) | |||
111 | 113 | ||
112 | static int kjournald(void *arg) | 114 | static int kjournald(void *arg) |
113 | { | 115 | { |
114 | journal_t *journal = (journal_t *) arg; | 116 | journal_t *journal = arg; |
115 | transaction_t *transaction; | 117 | transaction_t *transaction; |
116 | struct timer_list timer; | ||
117 | 118 | ||
118 | daemonize("kjournald"); | 119 | /* |
119 | 120 | * Set up an interval timer which can be used to trigger a commit wakeup | |
120 | /* Set up an interval timer which can be used to trigger a | 121 | * after the commit interval expires |
121 | commit wakeup after the commit interval expires */ | 122 | */ |
122 | init_timer(&timer); | 123 | setup_timer(&journal->j_commit_timer, commit_timeout, |
123 | timer.data = (unsigned long) current; | 124 | (unsigned long)current); |
124 | timer.function = commit_timeout; | ||
125 | journal->j_commit_timer = &timer; | ||
126 | 125 | ||
127 | /* Record that the journal thread is running */ | 126 | /* Record that the journal thread is running */ |
128 | journal->j_task = current; | 127 | journal->j_task = current; |
@@ -146,7 +145,7 @@ loop: | |||
146 | if (journal->j_commit_sequence != journal->j_commit_request) { | 145 | if (journal->j_commit_sequence != journal->j_commit_request) { |
147 | jbd_debug(1, "OK, requests differ\n"); | 146 | jbd_debug(1, "OK, requests differ\n"); |
148 | spin_unlock(&journal->j_state_lock); | 147 | spin_unlock(&journal->j_state_lock); |
149 | del_timer_sync(journal->j_commit_timer); | 148 | del_timer_sync(&journal->j_commit_timer); |
150 | journal_commit_transaction(journal); | 149 | journal_commit_transaction(journal); |
151 | spin_lock(&journal->j_state_lock); | 150 | spin_lock(&journal->j_state_lock); |
152 | goto loop; | 151 | goto loop; |
@@ -203,7 +202,7 @@ loop: | |||
203 | 202 | ||
204 | end_loop: | 203 | end_loop: |
205 | spin_unlock(&journal->j_state_lock); | 204 | spin_unlock(&journal->j_state_lock); |
206 | del_timer_sync(journal->j_commit_timer); | 205 | del_timer_sync(&journal->j_commit_timer); |
207 | journal->j_task = NULL; | 206 | journal->j_task = NULL; |
208 | wake_up(&journal->j_wait_done_commit); | 207 | wake_up(&journal->j_wait_done_commit); |
209 | jbd_debug(1, "Journal thread exiting.\n"); | 208 | jbd_debug(1, "Journal thread exiting.\n"); |
@@ -212,7 +211,7 @@ end_loop: | |||
212 | 211 | ||
213 | static void journal_start_thread(journal_t *journal) | 212 | static void journal_start_thread(journal_t *journal) |
214 | { | 213 | { |
215 | kernel_thread(kjournald, journal, CLONE_VM|CLONE_FS|CLONE_FILES); | 214 | kthread_run(kjournald, journal, "kjournald"); |
216 | wait_event(journal->j_wait_done_commit, journal->j_task != 0); | 215 | wait_event(journal->j_wait_done_commit, journal->j_task != 0); |
217 | } | 216 | } |
218 | 217 | ||
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 5fc40888f4cf..ada31fa272e3 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -53,8 +53,8 @@ get_transaction(journal_t *journal, transaction_t *transaction) | |||
53 | spin_lock_init(&transaction->t_handle_lock); | 53 | spin_lock_init(&transaction->t_handle_lock); |
54 | 54 | ||
55 | /* Set up the commit timer for the new transaction. */ | 55 | /* Set up the commit timer for the new transaction. */ |
56 | journal->j_commit_timer->expires = transaction->t_expires; | 56 | journal->j_commit_timer.expires = transaction->t_expires; |
57 | add_timer(journal->j_commit_timer); | 57 | add_timer(&journal->j_commit_timer); |
58 | 58 | ||
59 | J_ASSERT(journal->j_running_transaction == NULL); | 59 | J_ASSERT(journal->j_running_transaction == NULL); |
60 | journal->j_running_transaction = transaction; | 60 | journal->j_running_transaction = transaction; |
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index dc6a4e4abcdc..4a6abc49418e 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c | |||
@@ -56,7 +56,7 @@ void minix_free_block(struct inode * inode, int block) | |||
56 | unsigned int bit,zone; | 56 | unsigned int bit,zone; |
57 | 57 | ||
58 | if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { | 58 | if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { |
59 | printk("trying to free block not in datazone\n"); | 59 | printk("Trying to free block not in datazone\n"); |
60 | return; | 60 | return; |
61 | } | 61 | } |
62 | zone = block - sbi->s_firstdatazone + 1; | 62 | zone = block - sbi->s_firstdatazone + 1; |
@@ -124,7 +124,7 @@ minix_V1_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh) | |||
124 | ino / MINIX_INODES_PER_BLOCK; | 124 | ino / MINIX_INODES_PER_BLOCK; |
125 | *bh = sb_bread(sb, block); | 125 | *bh = sb_bread(sb, block); |
126 | if (!*bh) { | 126 | if (!*bh) { |
127 | printk("unable to read i-node block\n"); | 127 | printk("Unable to read inode block\n"); |
128 | return NULL; | 128 | return NULL; |
129 | } | 129 | } |
130 | p = (void *)(*bh)->b_data; | 130 | p = (void *)(*bh)->b_data; |
@@ -149,7 +149,7 @@ minix_V2_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh) | |||
149 | ino / MINIX2_INODES_PER_BLOCK; | 149 | ino / MINIX2_INODES_PER_BLOCK; |
150 | *bh = sb_bread(sb, block); | 150 | *bh = sb_bread(sb, block); |
151 | if (!*bh) { | 151 | if (!*bh) { |
152 | printk("unable to read i-node block\n"); | 152 | printk("Unable to read inode block\n"); |
153 | return NULL; | 153 | return NULL; |
154 | } | 154 | } |
155 | p = (void *)(*bh)->b_data; | 155 | p = (void *)(*bh)->b_data; |
@@ -204,7 +204,7 @@ void minix_free_inode(struct inode * inode) | |||
204 | bh = sbi->s_imap[ino >> 13]; | 204 | bh = sbi->s_imap[ino >> 13]; |
205 | lock_kernel(); | 205 | lock_kernel(); |
206 | if (!minix_test_and_clear_bit(ino & 8191, bh->b_data)) | 206 | if (!minix_test_and_clear_bit(ino & 8191, bh->b_data)) |
207 | printk("minix_free_inode: bit %lu already cleared.\n", ino); | 207 | printk("minix_free_inode: bit %lu already cleared\n", ino); |
208 | unlock_kernel(); | 208 | unlock_kernel(); |
209 | mark_buffer_dirty(bh); | 209 | mark_buffer_dirty(bh); |
210 | out: | 210 | out: |
@@ -238,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) | |||
238 | return NULL; | 238 | return NULL; |
239 | } | 239 | } |
240 | if (minix_test_and_set_bit(j,bh->b_data)) { /* shouldn't happen */ | 240 | if (minix_test_and_set_bit(j,bh->b_data)) { /* shouldn't happen */ |
241 | printk("new_inode: bit already set"); | 241 | printk("new_inode: bit already set\n"); |
242 | unlock_kernel(); | 242 | unlock_kernel(); |
243 | iput(inode); | 243 | iput(inode); |
244 | return NULL; | 244 | return NULL; |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index d9ffc43fee59..2dcccf1d1b7f 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -127,11 +127,11 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) | |||
127 | mark_buffer_dirty(sbi->s_sbh); | 127 | mark_buffer_dirty(sbi->s_sbh); |
128 | 128 | ||
129 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) | 129 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) |
130 | printk ("MINIX-fs warning: remounting unchecked fs, " | 130 | printk("MINIX-fs warning: remounting unchecked fs, " |
131 | "running fsck is recommended.\n"); | 131 | "running fsck is recommended\n"); |
132 | else if ((sbi->s_mount_state & MINIX_ERROR_FS)) | 132 | else if ((sbi->s_mount_state & MINIX_ERROR_FS)) |
133 | printk ("MINIX-fs warning: remounting fs with errors, " | 133 | printk("MINIX-fs warning: remounting fs with errors, " |
134 | "running fsck is recommended.\n"); | 134 | "running fsck is recommended\n"); |
135 | } | 135 | } |
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
@@ -245,11 +245,11 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
245 | mark_buffer_dirty(bh); | 245 | mark_buffer_dirty(bh); |
246 | } | 246 | } |
247 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) | 247 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) |
248 | printk ("MINIX-fs: mounting unchecked file system, " | 248 | printk("MINIX-fs: mounting unchecked file system, " |
249 | "running fsck is recommended.\n"); | 249 | "running fsck is recommended\n"); |
250 | else if (sbi->s_mount_state & MINIX_ERROR_FS) | 250 | else if (sbi->s_mount_state & MINIX_ERROR_FS) |
251 | printk ("MINIX-fs: mounting file system with errors, " | 251 | printk("MINIX-fs: mounting file system with errors, " |
252 | "running fsck is recommended.\n"); | 252 | "running fsck is recommended\n"); |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | out_iput: | 255 | out_iput: |
@@ -273,19 +273,19 @@ out_no_bitmap: | |||
273 | 273 | ||
274 | out_no_map: | 274 | out_no_map: |
275 | if (!silent) | 275 | if (!silent) |
276 | printk ("MINIX-fs: can't allocate map\n"); | 276 | printk("MINIX-fs: can't allocate map\n"); |
277 | goto out_release; | 277 | goto out_release; |
278 | 278 | ||
279 | out_no_fs: | 279 | out_no_fs: |
280 | if (!silent) | 280 | if (!silent) |
281 | printk("VFS: Can't find a Minix or Minix V2 filesystem on device " | 281 | printk("VFS: Can't find a Minix or Minix V2 filesystem " |
282 | "%s.\n", s->s_id); | 282 | "on device %s\n", s->s_id); |
283 | out_release: | 283 | out_release: |
284 | brelse(bh); | 284 | brelse(bh); |
285 | goto out; | 285 | goto out; |
286 | 286 | ||
287 | out_bad_hblock: | 287 | out_bad_hblock: |
288 | printk("MINIX-fs: blocksize too small for device.\n"); | 288 | printk("MINIX-fs: blocksize too small for device\n"); |
289 | goto out; | 289 | goto out; |
290 | 290 | ||
291 | out_bad_sb: | 291 | out_bad_sb: |
@@ -524,7 +524,7 @@ int minix_sync_inode(struct inode * inode) | |||
524 | sync_dirty_buffer(bh); | 524 | sync_dirty_buffer(bh); |
525 | if (buffer_req(bh) && !buffer_uptodate(bh)) | 525 | if (buffer_req(bh) && !buffer_uptodate(bh)) |
526 | { | 526 | { |
527 | printk ("IO error syncing minix inode [%s:%08lx]\n", | 527 | printk("IO error syncing minix inode [%s:%08lx]\n", |
528 | inode->i_sb->s_id, inode->i_ino); | 528 | inode->i_sb->s_id, inode->i_ino); |
529 | err = -1; | 529 | err = -1; |
530 | } | 530 | } |
diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c index ba06aef4aca1..656b1347a25b 100644 --- a/fs/minix/itree_v1.c +++ b/fs/minix/itree_v1.c | |||
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | |||
25 | int n = 0; | 25 | int n = 0; |
26 | 26 | ||
27 | if (block < 0) { | 27 | if (block < 0) { |
28 | printk("minix_bmap: block<0"); | 28 | printk("minix_bmap: block<0\n"); |
29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { | 29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { |
30 | printk("minix_bmap: block>big"); | 30 | printk("minix_bmap: block>big\n"); |
31 | } else if (block < 7) { | 31 | } else if (block < 7) { |
32 | offsets[n++] = block; | 32 | offsets[n++] = block; |
33 | } else if ((block -= 7) < 512) { | 33 | } else if ((block -= 7) < 512) { |
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c index 3adc7675560f..9adcdc754e0f 100644 --- a/fs/minix/itree_v2.c +++ b/fs/minix/itree_v2.c | |||
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | |||
25 | int n = 0; | 25 | int n = 0; |
26 | 26 | ||
27 | if (block < 0) { | 27 | if (block < 0) { |
28 | printk("minix_bmap: block<0"); | 28 | printk("minix_bmap: block<0\n"); |
29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { | 29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { |
30 | printk("minix_bmap: block>big"); | 30 | printk("minix_bmap: block>big\n"); |
31 | } else if (block < 7) { | 31 | } else if (block < 7) { |
32 | offsets[n++] = block; | 32 | offsets[n++] = block; |
33 | } else if ((block -= 7) < 256) { | 33 | } else if ((block -= 7) < 256) { |
diff --git a/fs/namei.c b/fs/namei.c index c72b940797fc..712dfc77793b 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1628,6 +1628,12 @@ do_last: | |||
1628 | goto exit; | 1628 | goto exit; |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | if (IS_ERR(nd->intent.open.file)) { | ||
1632 | mutex_unlock(&dir->d_inode->i_mutex); | ||
1633 | error = PTR_ERR(nd->intent.open.file); | ||
1634 | goto exit_dput; | ||
1635 | } | ||
1636 | |||
1631 | /* Negative dentry, just create the file */ | 1637 | /* Negative dentry, just create the file */ |
1632 | if (!path.dentry->d_inode) { | 1638 | if (!path.dentry->d_inode) { |
1633 | if (!IS_POSIXACL(dir->d_inode)) | 1639 | if (!IS_POSIXACL(dir->d_inode)) |
@@ -2621,16 +2627,27 @@ int __page_symlink(struct inode *inode, const char *symname, int len, | |||
2621 | int err = -ENOMEM; | 2627 | int err = -ENOMEM; |
2622 | char *kaddr; | 2628 | char *kaddr; |
2623 | 2629 | ||
2630 | retry: | ||
2624 | page = find_or_create_page(mapping, 0, gfp_mask); | 2631 | page = find_or_create_page(mapping, 0, gfp_mask); |
2625 | if (!page) | 2632 | if (!page) |
2626 | goto fail; | 2633 | goto fail; |
2627 | err = mapping->a_ops->prepare_write(NULL, page, 0, len-1); | 2634 | err = mapping->a_ops->prepare_write(NULL, page, 0, len-1); |
2635 | if (err == AOP_TRUNCATED_PAGE) { | ||
2636 | page_cache_release(page); | ||
2637 | goto retry; | ||
2638 | } | ||
2628 | if (err) | 2639 | if (err) |
2629 | goto fail_map; | 2640 | goto fail_map; |
2630 | kaddr = kmap_atomic(page, KM_USER0); | 2641 | kaddr = kmap_atomic(page, KM_USER0); |
2631 | memcpy(kaddr, symname, len-1); | 2642 | memcpy(kaddr, symname, len-1); |
2632 | kunmap_atomic(kaddr, KM_USER0); | 2643 | kunmap_atomic(kaddr, KM_USER0); |
2633 | mapping->a_ops->commit_write(NULL, page, 0, len-1); | 2644 | err = mapping->a_ops->commit_write(NULL, page, 0, len-1); |
2645 | if (err == AOP_TRUNCATED_PAGE) { | ||
2646 | page_cache_release(page); | ||
2647 | goto retry; | ||
2648 | } | ||
2649 | if (err) | ||
2650 | goto fail_map; | ||
2634 | /* | 2651 | /* |
2635 | * Notice that we are _not_ going to block here - end of page is | 2652 | * Notice that we are _not_ going to block here - end of page is |
2636 | * unmapped, so this will only try to map the rest of page, see | 2653 | * unmapped, so this will only try to map the rest of page, see |
@@ -2640,7 +2657,8 @@ int __page_symlink(struct inode *inode, const char *symname, int len, | |||
2640 | */ | 2657 | */ |
2641 | if (!PageUptodate(page)) { | 2658 | if (!PageUptodate(page)) { |
2642 | err = mapping->a_ops->readpage(NULL, page); | 2659 | err = mapping->a_ops->readpage(NULL, page); |
2643 | wait_on_page_locked(page); | 2660 | if (err != AOP_TRUNCATED_PAGE) |
2661 | wait_on_page_locked(page); | ||
2644 | } else { | 2662 | } else { |
2645 | unlock_page(page); | 2663 | unlock_page(page); |
2646 | } | 2664 | } |
@@ -890,6 +890,10 @@ EXPORT_SYMBOL(filp_open); | |||
890 | * a fully instantiated struct file to the caller. | 890 | * a fully instantiated struct file to the caller. |
891 | * This function is meant to be called from within a filesystem's | 891 | * This function is meant to be called from within a filesystem's |
892 | * lookup method. | 892 | * lookup method. |
893 | * Beware of calling it for non-regular files! Those ->open methods might block | ||
894 | * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo, | ||
895 | * leading to a deadlock, as nobody can open that fifo anymore, because | ||
896 | * another process to open fifo will block on locked parent when doing lookup). | ||
893 | * Note that in case of error, nd->intent.open.file is destroyed, but the | 897 | * Note that in case of error, nd->intent.open.file is destroyed, but the |
894 | * path information remains valid. | 898 | * path information remains valid. |
895 | * If the open callback is set to NULL, then the standard f_op->open() | 899 | * If the open callback is set to NULL, then the standard f_op->open() |
@@ -662,10 +662,9 @@ struct inode* pipe_new(struct inode* inode) | |||
662 | { | 662 | { |
663 | struct pipe_inode_info *info; | 663 | struct pipe_inode_info *info; |
664 | 664 | ||
665 | info = kmalloc(sizeof(struct pipe_inode_info), GFP_KERNEL); | 665 | info = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL); |
666 | if (!info) | 666 | if (!info) |
667 | goto fail_page; | 667 | goto fail_page; |
668 | memset(info, 0, sizeof(*info)); | ||
669 | inode->i_pipe = info; | 668 | inode->i_pipe = info; |
670 | 669 | ||
671 | init_waitqueue_head(PIPE_WAIT(*inode)); | 670 | init_waitqueue_head(PIPE_WAIT(*inode)); |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 826c131994c3..1e9ea37d457e 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -485,6 +485,40 @@ static struct file_operations proc_slabinfo_operations = { | |||
485 | .llseek = seq_lseek, | 485 | .llseek = seq_lseek, |
486 | .release = seq_release, | 486 | .release = seq_release, |
487 | }; | 487 | }; |
488 | |||
489 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
490 | extern struct seq_operations slabstats_op; | ||
491 | static int slabstats_open(struct inode *inode, struct file *file) | ||
492 | { | ||
493 | unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL); | ||
494 | int ret = -ENOMEM; | ||
495 | if (n) { | ||
496 | ret = seq_open(file, &slabstats_op); | ||
497 | if (!ret) { | ||
498 | struct seq_file *m = file->private_data; | ||
499 | *n = PAGE_SIZE / (2 * sizeof(unsigned long)); | ||
500 | m->private = n; | ||
501 | n = NULL; | ||
502 | } | ||
503 | kfree(n); | ||
504 | } | ||
505 | return ret; | ||
506 | } | ||
507 | |||
508 | static int slabstats_release(struct inode *inode, struct file *file) | ||
509 | { | ||
510 | struct seq_file *m = file->private_data; | ||
511 | kfree(m->private); | ||
512 | return seq_release(inode, file); | ||
513 | } | ||
514 | |||
515 | static struct file_operations proc_slabstats_operations = { | ||
516 | .open = slabstats_open, | ||
517 | .read = seq_read, | ||
518 | .llseek = seq_lseek, | ||
519 | .release = slabstats_release, | ||
520 | }; | ||
521 | #endif | ||
488 | #endif | 522 | #endif |
489 | 523 | ||
490 | static int show_stat(struct seq_file *p, void *v) | 524 | static int show_stat(struct seq_file *p, void *v) |
@@ -744,6 +778,9 @@ void __init proc_misc_init(void) | |||
744 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); | 778 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); |
745 | #ifdef CONFIG_SLAB | 779 | #ifdef CONFIG_SLAB |
746 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); | 780 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); |
781 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
782 | create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); | ||
783 | #endif | ||
747 | #endif | 784 | #endif |
748 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 785 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
749 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 786 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |
diff --git a/fs/read_write.c b/fs/read_write.c index 3f7a1a62165f..34b1bf259efd 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -470,7 +470,7 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
470 | * verify all the pointers | 470 | * verify all the pointers |
471 | */ | 471 | */ |
472 | ret = -EINVAL; | 472 | ret = -EINVAL; |
473 | if ((nr_segs > UIO_MAXIOV) || (nr_segs <= 0)) | 473 | if (nr_segs > UIO_MAXIOV) |
474 | goto out; | 474 | goto out; |
475 | if (!file->f_op) | 475 | if (!file->f_op) |
476 | goto out; | 476 | goto out; |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index be12879bb179..d0c1e865963e 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -1532,7 +1532,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1532 | buf += write_bytes; | 1532 | buf += write_bytes; |
1533 | *ppos = pos += write_bytes; | 1533 | *ppos = pos += write_bytes; |
1534 | count -= write_bytes; | 1534 | count -= write_bytes; |
1535 | balance_dirty_pages_ratelimited(inode->i_mapping); | 1535 | balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages); |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | /* this is only true on error */ | 1538 | /* this is only true on error */ |
@@ -1546,10 +1546,10 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1546 | } | 1546 | } |
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) | 1549 | if (likely(res >= 0) && |
1550 | res = | 1550 | (unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode)))) |
1551 | generic_osync_inode(inode, file->f_mapping, | 1551 | res = generic_osync_inode(inode, file->f_mapping, |
1552 | OSYNC_METADATA | OSYNC_DATA); | 1552 | OSYNC_METADATA | OSYNC_DATA); |
1553 | 1553 | ||
1554 | mutex_unlock(&inode->i_mutex); | 1554 | mutex_unlock(&inode->i_mutex); |
1555 | reiserfs_async_progress_wait(inode->i_sb); | 1555 | reiserfs_async_progress_wait(inode->i_sb); |
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c index aa22588019ec..5600d3d60cf7 100644 --- a/fs/reiserfs/fix_node.c +++ b/fs/reiserfs/fix_node.c | |||
@@ -191,9 +191,7 @@ static void create_virtual_node(struct tree_balance *tb, int h) | |||
191 | "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c", | 191 | "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c", |
192 | key, vn->vn_affected_item_num, | 192 | key, vn->vn_affected_item_num, |
193 | vn->vn_mode, M_DELETE); | 193 | vn->vn_mode, M_DELETE); |
194 | } else | 194 | } |
195 | /* we can delete directory item, that has only one directory entry in it */ | ||
196 | ; | ||
197 | } | 195 | } |
198 | #endif | 196 | #endif |
199 | 197 | ||
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c index e237cd668e5b..7a88adbceef6 100644 --- a/fs/reiserfs/item_ops.c +++ b/fs/reiserfs/item_ops.c | |||
@@ -275,7 +275,7 @@ static void indirect_print_item(struct item_head *ih, char *item) | |||
275 | int j; | 275 | int j; |
276 | __le32 *unp; | 276 | __le32 *unp; |
277 | __u32 prev = INT_MAX; | 277 | __u32 prev = INT_MAX; |
278 | int num; | 278 | int num = 0; |
279 | 279 | ||
280 | unp = (__le32 *) item; | 280 | unp = (__le32 *) item; |
281 | 281 | ||
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 5a9d2722fa0a..1b73529b8099 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2227,6 +2227,9 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2227 | journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb); | 2227 | journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb); |
2228 | journal->j_last_flush_trans_id = trans_id; | 2228 | journal->j_last_flush_trans_id = trans_id; |
2229 | journal->j_trans_id = trans_id + 1; | 2229 | journal->j_trans_id = trans_id + 1; |
2230 | /* check for trans_id overflow */ | ||
2231 | if (journal->j_trans_id == 0) | ||
2232 | journal->j_trans_id = 10; | ||
2230 | brelse(c_bh); | 2233 | brelse(c_bh); |
2231 | brelse(d_bh); | 2234 | brelse(d_bh); |
2232 | kfree(log_blocks); | 2235 | kfree(log_blocks); |
@@ -2450,6 +2453,9 @@ static int journal_read(struct super_block *p_s_sb) | |||
2450 | journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset); | 2453 | journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset); |
2451 | journal->j_trans_id = | 2454 | journal->j_trans_id = |
2452 | le32_to_cpu(jh->j_last_flush_trans_id) + 1; | 2455 | le32_to_cpu(jh->j_last_flush_trans_id) + 1; |
2456 | /* check for trans_id overflow */ | ||
2457 | if (journal->j_trans_id == 0) | ||
2458 | journal->j_trans_id = 10; | ||
2453 | journal->j_last_flush_trans_id = | 2459 | journal->j_last_flush_trans_id = |
2454 | le32_to_cpu(jh->j_last_flush_trans_id); | 2460 | le32_to_cpu(jh->j_last_flush_trans_id); |
2455 | journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1; | 2461 | journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1; |
@@ -3873,8 +3879,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3873 | int cur_write_start = 0; /* start index of current log write */ | 3879 | int cur_write_start = 0; /* start index of current log write */ |
3874 | int old_start; | 3880 | int old_start; |
3875 | int i; | 3881 | int i; |
3876 | int flush = flags & FLUSH_ALL; | 3882 | int flush; |
3877 | int wait_on_commit = flags & WAIT; | 3883 | int wait_on_commit; |
3878 | struct reiserfs_journal_list *jl, *temp_jl; | 3884 | struct reiserfs_journal_list *jl, *temp_jl; |
3879 | struct list_head *entry, *safe; | 3885 | struct list_head *entry, *safe; |
3880 | unsigned long jindex; | 3886 | unsigned long jindex; |
@@ -3884,6 +3890,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3884 | BUG_ON(th->t_refcount > 1); | 3890 | BUG_ON(th->t_refcount > 1); |
3885 | BUG_ON(!th->t_trans_id); | 3891 | BUG_ON(!th->t_trans_id); |
3886 | 3892 | ||
3893 | /* protect flush_older_commits from doing mistakes if the | ||
3894 | transaction ID counter gets overflowed. */ | ||
3895 | if (th->t_trans_id == ~0UL) | ||
3896 | flags |= FLUSH_ALL | COMMIT_NOW | WAIT; | ||
3897 | flush = flags & FLUSH_ALL; | ||
3898 | wait_on_commit = flags & WAIT; | ||
3899 | |||
3887 | put_fs_excl(); | 3900 | put_fs_excl(); |
3888 | current->journal_info = th->t_handle_save; | 3901 | current->journal_info = th->t_handle_save; |
3889 | reiserfs_check_lock_depth(p_s_sb, "journal end"); | 3902 | reiserfs_check_lock_depth(p_s_sb, "journal end"); |
@@ -4105,7 +4118,9 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
4105 | journal->j_first = NULL; | 4118 | journal->j_first = NULL; |
4106 | journal->j_len = 0; | 4119 | journal->j_len = 0; |
4107 | journal->j_trans_start_time = 0; | 4120 | journal->j_trans_start_time = 0; |
4108 | journal->j_trans_id++; | 4121 | /* check for trans_id overflow */ |
4122 | if (++journal->j_trans_id == 0) | ||
4123 | journal->j_trans_id = 10; | ||
4109 | journal->j_current_jl->j_trans_id = journal->j_trans_id; | 4124 | journal->j_current_jl->j_trans_id = journal->j_trans_id; |
4110 | journal->j_must_wait = 0; | 4125 | journal->j_must_wait = 0; |
4111 | journal->j_len_alloc = 0; | 4126 | journal->j_len_alloc = 0; |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index e2d08d7bcffc..d2b25e1ba6e9 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -981,6 +981,8 @@ static inline int prepare_for_direntry_item(struct path *path, | |||
981 | return M_CUT; | 981 | return M_CUT; |
982 | } | 982 | } |
983 | 983 | ||
984 | #define JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD (2 * JOURNAL_PER_BALANCE_CNT + 1) | ||
985 | |||
984 | /* If the path points to a directory or direct item, calculate mode and the size cut, for balance. | 986 | /* If the path points to a directory or direct item, calculate mode and the size cut, for balance. |
985 | If the path points to an indirect item, remove some number of its unformatted nodes. | 987 | If the path points to an indirect item, remove some number of its unformatted nodes. |
986 | In case of file truncate calculate whether this item must be deleted/truncated or last | 988 | In case of file truncate calculate whether this item must be deleted/truncated or last |
@@ -1020,148 +1022,79 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st | |||
1020 | 1022 | ||
1021 | /* Case of an indirect item. */ | 1023 | /* Case of an indirect item. */ |
1022 | { | 1024 | { |
1023 | int n_unfm_number, /* Number of the item unformatted nodes. */ | 1025 | int blk_size = p_s_sb->s_blocksize; |
1024 | n_counter, n_blk_size; | 1026 | struct item_head s_ih; |
1025 | __le32 *p_n_unfm_pointer; /* Pointer to the unformatted node number. */ | 1027 | int need_re_search; |
1026 | __u32 tmp; | 1028 | int delete = 0; |
1027 | struct item_head s_ih; /* Item header. */ | 1029 | int result = M_CUT; |
1028 | char c_mode; /* Returned mode of the balance. */ | 1030 | int pos = 0; |
1029 | int need_research; | 1031 | |
1030 | 1032 | if ( n_new_file_length == max_reiserfs_offset (inode) ) { | |
1031 | n_blk_size = p_s_sb->s_blocksize; | 1033 | /* prepare_for_delete_or_cut() is called by |
1032 | 1034 | * reiserfs_delete_item() */ | |
1033 | /* Search for the needed object indirect item until there are no unformatted nodes to be removed. */ | 1035 | n_new_file_length = 0; |
1034 | do { | 1036 | delete = 1; |
1035 | need_research = 0; | 1037 | } |
1036 | p_s_bh = PATH_PLAST_BUFFER(p_s_path); | 1038 | |
1037 | /* Copy indirect item header to a temp variable. */ | 1039 | do { |
1038 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | 1040 | need_re_search = 0; |
1039 | /* Calculate number of unformatted nodes in this item. */ | 1041 | *p_n_cut_size = 0; |
1040 | n_unfm_number = I_UNFM_NUM(&s_ih); | 1042 | p_s_bh = PATH_PLAST_BUFFER(p_s_path); |
1041 | 1043 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | |
1042 | RFALSE(!is_indirect_le_ih(&s_ih) || !n_unfm_number || | 1044 | pos = I_UNFM_NUM(&s_ih); |
1043 | pos_in_item(p_s_path) + 1 != n_unfm_number, | ||
1044 | "PAP-5240: invalid item %h " | ||
1045 | "n_unfm_number = %d *p_n_pos_in_item = %d", | ||
1046 | &s_ih, n_unfm_number, pos_in_item(p_s_path)); | ||
1047 | |||
1048 | /* Calculate balance mode and position in the item to remove unformatted nodes. */ | ||
1049 | if (n_new_file_length == max_reiserfs_offset(inode)) { /* Case of delete. */ | ||
1050 | pos_in_item(p_s_path) = 0; | ||
1051 | *p_n_cut_size = -(IH_SIZE + ih_item_len(&s_ih)); | ||
1052 | c_mode = M_DELETE; | ||
1053 | } else { /* Case of truncate. */ | ||
1054 | if (n_new_file_length < le_ih_k_offset(&s_ih)) { | ||
1055 | pos_in_item(p_s_path) = 0; | ||
1056 | *p_n_cut_size = | ||
1057 | -(IH_SIZE + ih_item_len(&s_ih)); | ||
1058 | c_mode = M_DELETE; /* Delete this item. */ | ||
1059 | } else { | ||
1060 | /* indirect item must be truncated starting from *p_n_pos_in_item-th position */ | ||
1061 | pos_in_item(p_s_path) = | ||
1062 | (n_new_file_length + n_blk_size - | ||
1063 | le_ih_k_offset(&s_ih)) >> p_s_sb-> | ||
1064 | s_blocksize_bits; | ||
1065 | |||
1066 | RFALSE(pos_in_item(p_s_path) > | ||
1067 | n_unfm_number, | ||
1068 | "PAP-5250: invalid position in the item"); | ||
1069 | |||
1070 | /* Either convert last unformatted node of indirect item to direct item or increase | ||
1071 | its free space. */ | ||
1072 | if (pos_in_item(p_s_path) == | ||
1073 | n_unfm_number) { | ||
1074 | *p_n_cut_size = 0; /* Nothing to cut. */ | ||
1075 | return M_CONVERT; /* Maybe convert last unformatted node to the direct item. */ | ||
1076 | } | ||
1077 | /* Calculate size to cut. */ | ||
1078 | *p_n_cut_size = | ||
1079 | -(ih_item_len(&s_ih) - | ||
1080 | pos_in_item(p_s_path) * | ||
1081 | UNFM_P_SIZE); | ||
1082 | |||
1083 | c_mode = M_CUT; /* Cut from this indirect item. */ | ||
1084 | } | ||
1085 | } | ||
1086 | 1045 | ||
1087 | RFALSE(n_unfm_number <= pos_in_item(p_s_path), | 1046 | while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) { |
1088 | "PAP-5260: invalid position in the indirect item"); | 1047 | __u32 *unfm, block; |
1089 | |||
1090 | /* pointers to be cut */ | ||
1091 | n_unfm_number -= pos_in_item(p_s_path); | ||
1092 | /* Set pointer to the last unformatted node pointer that is to be cut. */ | ||
1093 | p_n_unfm_pointer = | ||
1094 | (__le32 *) B_I_PITEM(p_s_bh, | ||
1095 | &s_ih) + I_UNFM_NUM(&s_ih) - | ||
1096 | 1 - *p_n_removed; | ||
1097 | |||
1098 | /* We go through the unformatted nodes pointers of the indirect | ||
1099 | item and look for the unformatted nodes in the cache. If we | ||
1100 | found some of them we free it, zero corresponding indirect item | ||
1101 | entry and log buffer containing that indirect item. For this we | ||
1102 | need to prepare last path element for logging. If some | ||
1103 | unformatted node has b_count > 1 we must not free this | ||
1104 | unformatted node since it is in use. */ | ||
1105 | reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1); | ||
1106 | // note: path could be changed, first line in for loop takes care | ||
1107 | // of it | ||
1108 | 1048 | ||
1109 | for (n_counter = *p_n_removed; | 1049 | /* Each unformatted block deletion may involve one additional |
1110 | n_counter < n_unfm_number; | 1050 | * bitmap block into the transaction, thereby the initial |
1111 | n_counter++, p_n_unfm_pointer--) { | 1051 | * journal space reservation might not be enough. */ |
1052 | if (!delete && (*p_n_cut_size) != 0 && | ||
1053 | reiserfs_transaction_free_space(th) < JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) { | ||
1054 | break; | ||
1055 | } | ||
1112 | 1056 | ||
1113 | cond_resched(); | 1057 | unfm = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1; |
1114 | if (item_moved(&s_ih, p_s_path)) { | 1058 | block = get_block_num(unfm, 0); |
1115 | need_research = 1; | ||
1116 | break; | ||
1117 | } | ||
1118 | RFALSE(p_n_unfm_pointer < | ||
1119 | (__le32 *) B_I_PITEM(p_s_bh, &s_ih) | ||
1120 | || p_n_unfm_pointer > | ||
1121 | (__le32 *) B_I_PITEM(p_s_bh, | ||
1122 | &s_ih) + | ||
1123 | I_UNFM_NUM(&s_ih) - 1, | ||
1124 | "vs-5265: pointer out of range"); | ||
1125 | |||
1126 | /* Hole, nothing to remove. */ | ||
1127 | if (!get_block_num(p_n_unfm_pointer, 0)) { | ||
1128 | (*p_n_removed)++; | ||
1129 | continue; | ||
1130 | } | ||
1131 | 1059 | ||
1132 | (*p_n_removed)++; | 1060 | if (block != 0) { |
1061 | reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1); | ||
1062 | put_block_num(unfm, 0, 0); | ||
1063 | journal_mark_dirty (th, p_s_sb, p_s_bh); | ||
1064 | reiserfs_free_block(th, inode, block, 1); | ||
1065 | } | ||
1133 | 1066 | ||
1134 | tmp = get_block_num(p_n_unfm_pointer, 0); | 1067 | cond_resched(); |
1135 | put_block_num(p_n_unfm_pointer, 0, 0); | ||
1136 | journal_mark_dirty(th, p_s_sb, p_s_bh); | ||
1137 | reiserfs_free_block(th, inode, tmp, 1); | ||
1138 | if (item_moved(&s_ih, p_s_path)) { | ||
1139 | need_research = 1; | ||
1140 | break; | ||
1141 | } | ||
1142 | } | ||
1143 | 1068 | ||
1144 | /* a trick. If the buffer has been logged, this | 1069 | if (item_moved (&s_ih, p_s_path)) { |
1145 | ** will do nothing. If we've broken the loop without | 1070 | need_re_search = 1; |
1146 | ** logging it, it will restore the buffer | 1071 | break; |
1147 | ** | 1072 | } |
1148 | */ | 1073 | |
1149 | reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh); | 1074 | pos --; |
1150 | 1075 | (*p_n_removed) ++; | |
1151 | /* This loop can be optimized. */ | 1076 | (*p_n_cut_size) -= UNFM_P_SIZE; |
1152 | } while ((*p_n_removed < n_unfm_number || need_research) && | 1077 | |
1153 | search_for_position_by_key(p_s_sb, p_s_item_key, | 1078 | if (pos == 0) { |
1154 | p_s_path) == | 1079 | (*p_n_cut_size) -= IH_SIZE; |
1155 | POSITION_FOUND); | 1080 | result = M_DELETE; |
1156 | 1081 | break; | |
1157 | RFALSE(*p_n_removed < n_unfm_number, | 1082 | } |
1158 | "PAP-5310: indirect item is not found"); | 1083 | } |
1159 | RFALSE(item_moved(&s_ih, p_s_path), | 1084 | /* a trick. If the buffer has been logged, this will do nothing. If |
1160 | "after while, comp failed, retry"); | 1085 | ** we've broken the loop without logging it, it will restore the |
1161 | 1086 | ** buffer */ | |
1162 | if (c_mode == M_CUT) | 1087 | reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh); |
1163 | pos_in_item(p_s_path) *= UNFM_P_SIZE; | 1088 | } while (need_re_search && |
1164 | return c_mode; | 1089 | search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND); |
1090 | pos_in_item(p_s_path) = pos * UNFM_P_SIZE; | ||
1091 | |||
1092 | if (*p_n_cut_size == 0) { | ||
1093 | /* Nothing were cut. maybe convert last unformatted node to the | ||
1094 | * direct item? */ | ||
1095 | result = M_CONVERT; | ||
1096 | } | ||
1097 | return result; | ||
1165 | } | 1098 | } |
1166 | } | 1099 | } |
1167 | 1100 | ||
@@ -1948,7 +1881,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1948 | ** sure the file is consistent before ending the current trans | 1881 | ** sure the file is consistent before ending the current trans |
1949 | ** and starting a new one | 1882 | ** and starting a new one |
1950 | */ | 1883 | */ |
1951 | if (journal_transaction_should_end(th, th->t_blocks_allocated)) { | 1884 | if (journal_transaction_should_end(th, 0) || |
1885 | reiserfs_transaction_free_space(th) <= JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) { | ||
1952 | int orig_len_alloc = th->t_blocks_allocated; | 1886 | int orig_len_alloc = th->t_blocks_allocated; |
1953 | decrement_counters_in_path(&s_search_path); | 1887 | decrement_counters_in_path(&s_search_path); |
1954 | 1888 | ||
@@ -1962,7 +1896,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1962 | if (err) | 1896 | if (err) |
1963 | goto out; | 1897 | goto out; |
1964 | err = journal_begin(th, p_s_inode->i_sb, | 1898 | err = journal_begin(th, p_s_inode->i_sb, |
1965 | JOURNAL_PER_BALANCE_CNT * 6); | 1899 | JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ; |
1966 | if (err) | 1900 | if (err) |
1967 | goto out; | 1901 | goto out; |
1968 | reiserfs_update_inode_transaction(p_s_inode); | 1902 | reiserfs_update_inode_transaction(p_s_inode); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 93e6ef9360e3..cae2abbc0c71 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -685,14 +685,14 @@ static const arg_desc_t logging_mode[] = { | |||
685 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_WRITEBACK)}, | 685 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_WRITEBACK)}, |
686 | {"writeback", 1 << REISERFS_DATA_WRITEBACK, | 686 | {"writeback", 1 << REISERFS_DATA_WRITEBACK, |
687 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_LOG)}, | 687 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_LOG)}, |
688 | {NULL, 0} | 688 | {.value = NULL} |
689 | }; | 689 | }; |
690 | 690 | ||
691 | /* possible values for -o barrier= */ | 691 | /* possible values for -o barrier= */ |
692 | static const arg_desc_t barrier_mode[] = { | 692 | static const arg_desc_t barrier_mode[] = { |
693 | {"none", 1 << REISERFS_BARRIER_NONE, 1 << REISERFS_BARRIER_FLUSH}, | 693 | {"none", 1 << REISERFS_BARRIER_NONE, 1 << REISERFS_BARRIER_FLUSH}, |
694 | {"flush", 1 << REISERFS_BARRIER_FLUSH, 1 << REISERFS_BARRIER_NONE}, | 694 | {"flush", 1 << REISERFS_BARRIER_FLUSH, 1 << REISERFS_BARRIER_NONE}, |
695 | {NULL, 0} | 695 | {.value = NULL} |
696 | }; | 696 | }; |
697 | 697 | ||
698 | /* possible values for "-o block-allocator=" and bits which are to be set in | 698 | /* possible values for "-o block-allocator=" and bits which are to be set in |
@@ -890,7 +890,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
890 | {"acl",.setmask = 1 << REISERFS_UNSUPPORTED_OPT}, | 890 | {"acl",.setmask = 1 << REISERFS_UNSUPPORTED_OPT}, |
891 | {"noacl",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT}, | 891 | {"noacl",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT}, |
892 | #endif | 892 | #endif |
893 | {"nolog",}, /* This is unsupported */ | 893 | {.option_name = "nolog"}, |
894 | {"replayonly",.setmask = 1 << REPLAYONLY}, | 894 | {"replayonly",.setmask = 1 << REPLAYONLY}, |
895 | {"block-allocator",.arg_required = 'a',.values = balloc}, | 895 | {"block-allocator",.arg_required = 'a',.values = balloc}, |
896 | {"data",.arg_required = 'd',.values = logging_mode}, | 896 | {"data",.arg_required = 'd',.values = logging_mode}, |
@@ -908,7 +908,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
908 | {"grpjquota",.arg_required = | 908 | {"grpjquota",.arg_required = |
909 | 'g' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL}, | 909 | 'g' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL}, |
910 | {"jqfmt",.arg_required = 'f',.values = NULL}, | 910 | {"jqfmt",.arg_required = 'f',.values = NULL}, |
911 | {NULL,} | 911 | {.option_name = NULL} |
912 | }; | 912 | }; |
913 | 913 | ||
914 | *blocks = 0; | 914 | *blocks = 0; |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index ab8894c3b9e5..58c418fbca2c 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -182,7 +182,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
182 | { | 182 | { |
183 | char *name, *value; | 183 | char *name, *value; |
184 | struct posix_acl *acl, **p_acl; | 184 | struct posix_acl *acl, **p_acl; |
185 | size_t size; | 185 | int size; |
186 | int retval; | 186 | int retval; |
187 | struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); | 187 | struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); |
188 | 188 | ||
@@ -206,7 +206,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
206 | return posix_acl_dup(*p_acl); | 206 | return posix_acl_dup(*p_acl); |
207 | 207 | ||
208 | size = reiserfs_xattr_get(inode, name, NULL, 0); | 208 | size = reiserfs_xattr_get(inode, name, NULL, 0); |
209 | if ((int)size < 0) { | 209 | if (size < 0) { |
210 | if (size == -ENODATA || size == -ENOSYS) { | 210 | if (size == -ENODATA || size == -ENOSYS) { |
211 | *p_acl = ERR_PTR(-ENODATA); | 211 | *p_acl = ERR_PTR(-ENODATA); |
212 | return NULL; | 212 | return NULL; |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 44ed1d418b46..fdeabc0a34f7 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -217,7 +217,7 @@ smb_set_inode_attr(struct inode *inode, struct smb_fattr *fattr) | |||
217 | if (inode->i_mtime.tv_sec != last_time || inode->i_size != last_sz) { | 217 | if (inode->i_mtime.tv_sec != last_time || inode->i_size != last_sz) { |
218 | VERBOSE("%ld changed, old=%ld, new=%ld, oz=%ld, nz=%ld\n", | 218 | VERBOSE("%ld changed, old=%ld, new=%ld, oz=%ld, nz=%ld\n", |
219 | inode->i_ino, | 219 | inode->i_ino, |
220 | (long) last_time, (long) inode->i_mtime, | 220 | (long) last_time, (long) inode->i_mtime.tv_sec, |
221 | (long) last_sz, (long) inode->i_size); | 221 | (long) last_sz, (long) inode->i_size); |
222 | 222 | ||
223 | if (!S_ISDIR(inode->i_mode)) | 223 | if (!S_ISDIR(inode->i_mode)) |
diff --git a/fs/super.c b/fs/super.c index 37554b876182..8743e9bbb297 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -55,11 +55,10 @@ DEFINE_SPINLOCK(sb_lock); | |||
55 | */ | 55 | */ |
56 | static struct super_block *alloc_super(void) | 56 | static struct super_block *alloc_super(void) |
57 | { | 57 | { |
58 | struct super_block *s = kmalloc(sizeof(struct super_block), GFP_USER); | 58 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); |
59 | static struct super_operations default_op; | 59 | static struct super_operations default_op; |
60 | 60 | ||
61 | if (s) { | 61 | if (s) { |
62 | memset(s, 0, sizeof(struct super_block)); | ||
63 | if (security_sb_alloc(s)) { | 62 | if (security_sb_alloc(s)) { |
64 | kfree(s); | 63 | kfree(s); |
65 | s = NULL; | 64 | s = NULL; |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index d04cff2273b6..81e0e8459af1 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1341,13 +1341,11 @@ udf_update_inode(struct inode *inode, int do_sync) | |||
1341 | 1341 | ||
1342 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) | 1342 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) |
1343 | fe->uid = cpu_to_le32(-1); | 1343 | fe->uid = cpu_to_le32(-1); |
1344 | else if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid) | 1344 | else fe->uid = cpu_to_le32(inode->i_uid); |
1345 | fe->uid = cpu_to_le32(inode->i_uid); | ||
1346 | 1345 | ||
1347 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) | 1346 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) |
1348 | fe->gid = cpu_to_le32(-1); | 1347 | fe->gid = cpu_to_le32(-1); |
1349 | else if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid) | 1348 | else fe->gid = cpu_to_le32(inode->i_gid); |
1350 | fe->gid = cpu_to_le32(inode->i_gid); | ||
1351 | 1349 | ||
1352 | udfperms = ((inode->i_mode & S_IRWXO) ) | | 1350 | udfperms = ((inode->i_mode & S_IRWXO) ) | |
1353 | ((inode->i_mode & S_IRWXG) << 2) | | 1351 | ((inode->i_mode & S_IRWXG) << 2) | |
diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h index 34f333b762a0..95707182b3ed 100644 --- a/include/asm-alpha/poll.h +++ b/include/asm-alpha/poll.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #define POLLWRBAND (1 << 9) | 13 | #define POLLWRBAND (1 << 9) |
14 | #define POLLMSG (1 << 10) | 14 | #define POLLMSG (1 << 10) |
15 | #define POLLREMOVE (1 << 11) | 15 | #define POLLREMOVE (1 << 11) |
16 | #define POLLRDHUP (1 << 12) | ||
17 | |||
16 | 18 | ||
17 | struct pollfd { | 19 | struct pollfd { |
18 | int fd; | 20 | int fd; |
diff --git a/include/asm-arm/poll.h b/include/asm-arm/poll.h index 2744ca831f5d..5030b2b232a3 100644 --- a/include/asm-arm/poll.h +++ b/include/asm-arm/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-arm26/poll.h b/include/asm-arm26/poll.h index fdfdab064a65..9ccb7f4190ca 100644 --- a/include/asm-arm26/poll.h +++ b/include/asm-arm26/poll.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define POLLWRNORM 0x0100 | 15 | #define POLLWRNORM 0x0100 |
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLRDHUP 0x2000 | ||
18 | 19 | ||
19 | struct pollfd { | 20 | struct pollfd { |
20 | int fd; | 21 | int fd; |
diff --git a/include/asm-cris/poll.h b/include/asm-cris/poll.h index 1c0efc3e4be7..1b25d4cf498c 100644 --- a/include/asm-cris/poll.h +++ b/include/asm-cris/poll.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define POLLWRBAND 512 | 15 | #define POLLWRBAND 512 |
16 | #define POLLMSG 1024 | 16 | #define POLLMSG 1024 |
17 | #define POLLREMOVE 4096 | 17 | #define POLLREMOVE 4096 |
18 | #define POLLRDHUP 8192 | ||
18 | 19 | ||
19 | struct pollfd { | 20 | struct pollfd { |
20 | int fd; | 21 | int fd; |
diff --git a/include/asm-frv/poll.h b/include/asm-frv/poll.h index 8cbcd60e334f..c8fe8801d075 100644 --- a/include/asm-frv/poll.h +++ b/include/asm-frv/poll.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define POLLRDBAND 128 | 12 | #define POLLRDBAND 128 |
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLRDHUP 0x2000 | ||
15 | 16 | ||
16 | struct pollfd { | 17 | struct pollfd { |
17 | int fd; | 18 | int fd; |
diff --git a/include/asm-h8300/poll.h b/include/asm-h8300/poll.h index bf49ab8ad6da..fc52103b276a 100644 --- a/include/asm-h8300/poll.h +++ b/include/asm-h8300/poll.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define POLLRDBAND 128 | 12 | #define POLLRDBAND 128 |
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLRDHUP 0x2000 | ||
15 | 16 | ||
16 | struct pollfd { | 17 | struct pollfd { |
17 | int fd; | 18 | int fd; |
diff --git a/include/asm-i386/poll.h b/include/asm-i386/poll.h index aecc80a15d36..2cd4929abd40 100644 --- a/include/asm-i386/poll.h +++ b/include/asm-i386/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-ia64/poll.h b/include/asm-ia64/poll.h index 160258a0528d..bcaf9f140242 100644 --- a/include/asm-ia64/poll.h +++ b/include/asm-ia64/poll.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define POLLWRBAND 0x0200 | 21 | #define POLLWRBAND 0x0200 |
22 | #define POLLMSG 0x0400 | 22 | #define POLLMSG 0x0400 |
23 | #define POLLREMOVE 0x1000 | 23 | #define POLLREMOVE 0x1000 |
24 | #define POLLRDHUP 0x2000 | ||
24 | 25 | ||
25 | struct pollfd { | 26 | struct pollfd { |
26 | int fd; | 27 | int fd; |
diff --git a/include/asm-m32r/poll.h b/include/asm-m32r/poll.h index 43b7acf732d5..9e0e700e727c 100644 --- a/include/asm-m32r/poll.h +++ b/include/asm-m32r/poll.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define POLLWRBAND 0x0200 | 21 | #define POLLWRBAND 0x0200 |
22 | #define POLLMSG 0x0400 | 22 | #define POLLMSG 0x0400 |
23 | #define POLLREMOVE 0x1000 | 23 | #define POLLREMOVE 0x1000 |
24 | #define POLLRDHUP 0x2000 | ||
24 | 25 | ||
25 | struct pollfd { | 26 | struct pollfd { |
26 | int fd; | 27 | int fd; |
diff --git a/include/asm-m68k/poll.h b/include/asm-m68k/poll.h index c4b69c4a87e1..0fb8843647f8 100644 --- a/include/asm-m68k/poll.h +++ b/include/asm-m68k/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLREMOVE 0x1000 | 15 | #define POLLREMOVE 0x1000 |
16 | #define POLLRDHUP 0x2000 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-mips/poll.h b/include/asm-mips/poll.h index a000f1f789e3..70881f8c5c50 100644 --- a/include/asm-mips/poll.h +++ b/include/asm-mips/poll.h | |||
@@ -17,6 +17,7 @@ | |||
17 | /* These seem to be more or less nonstandard ... */ | 17 | /* These seem to be more or less nonstandard ... */ |
18 | #define POLLMSG 0x0400 | 18 | #define POLLMSG 0x0400 |
19 | #define POLLREMOVE 0x1000 | 19 | #define POLLREMOVE 0x1000 |
20 | #define POLLRDHUP 0x2000 | ||
20 | 21 | ||
21 | struct pollfd { | 22 | struct pollfd { |
22 | int fd; | 23 | int fd; |
diff --git a/include/asm-parisc/poll.h b/include/asm-parisc/poll.h index 1c1da86934cf..20e4d03c74cb 100644 --- a/include/asm-parisc/poll.h +++ b/include/asm-parisc/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h index edd2054da86b..9c7d12631033 100644 --- a/include/asm-powerpc/poll.h +++ b/include/asm-powerpc/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 0x0200 | 13 | #define POLLWRBAND 0x0200 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLREMOVE 0x1000 | 15 | #define POLLREMOVE 0x1000 |
16 | #define POLLRDHUP 0x2000 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-s390/poll.h b/include/asm-s390/poll.h index e90a5ca42061..6f7f65ac7d27 100644 --- a/include/asm-s390/poll.h +++ b/include/asm-s390/poll.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define POLLWRBAND 0x0200 | 24 | #define POLLWRBAND 0x0200 |
25 | #define POLLMSG 0x0400 | 25 | #define POLLMSG 0x0400 |
26 | #define POLLREMOVE 0x1000 | 26 | #define POLLREMOVE 0x1000 |
27 | #define POLLRDHUP 0x2000 | ||
27 | 28 | ||
28 | struct pollfd { | 29 | struct pollfd { |
29 | int fd; | 30 | int fd; |
diff --git a/include/asm-sh/poll.h b/include/asm-sh/poll.h index 52f95b9188dc..dbca9b32f4a6 100644 --- a/include/asm-sh/poll.h +++ b/include/asm-sh/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-sh64/poll.h b/include/asm-sh64/poll.h index a420d14eb704..3a6cbad08d28 100644 --- a/include/asm-sh64/poll.h +++ b/include/asm-sh64/poll.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define POLLWRNORM 0x0100 | 26 | #define POLLWRNORM 0x0100 |
27 | #define POLLWRBAND 0x0200 | 27 | #define POLLWRBAND 0x0200 |
28 | #define POLLMSG 0x0400 | 28 | #define POLLMSG 0x0400 |
29 | #define POLLRDHUP 0x2000 | ||
29 | 30 | ||
30 | struct pollfd { | 31 | struct pollfd { |
31 | int fd; | 32 | int fd; |
diff --git a/include/asm-sparc/poll.h b/include/asm-sparc/poll.h index 3ddcc6481f09..26f13fb35497 100644 --- a/include/asm-sparc/poll.h +++ b/include/asm-sparc/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 512 | 14 | #define POLLMSG 512 |
15 | #define POLLREMOVE 1024 | 15 | #define POLLREMOVE 1024 |
16 | #define POLLRDHUP 2048 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-sparc64/poll.h b/include/asm-sparc64/poll.h index 31b611aa7468..ab6b0d1bb4ad 100644 --- a/include/asm-sparc64/poll.h +++ b/include/asm-sparc64/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 512 | 14 | #define POLLMSG 512 |
15 | #define POLLREMOVE 1024 | 15 | #define POLLREMOVE 1024 |
16 | #define POLLRDHUP 2048 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-v850/poll.h b/include/asm-v850/poll.h index 0369562c7e15..c10176c2c28f 100644 --- a/include/asm-v850/poll.h +++ b/include/asm-v850/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 0x0100 | 13 | #define POLLWRBAND 0x0100 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLREMOVE 0x1000 | 15 | #define POLLREMOVE 0x1000 |
16 | #define POLLRDHUP 0x2000 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-x86_64/poll.h b/include/asm-x86_64/poll.h index c43cbba31913..c0475a9d8bb8 100644 --- a/include/asm-x86_64/poll.h +++ b/include/asm-x86_64/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-xtensa/poll.h b/include/asm-xtensa/poll.h index dffe447534e0..6fd94773e866 100644 --- a/include/asm-xtensa/poll.h +++ b/include/asm-xtensa/poll.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #define POLLMSG 0x0400 | 28 | #define POLLMSG 0x0400 |
29 | #define POLLREMOVE 0x0800 | 29 | #define POLLREMOVE 0x0800 |
30 | #define POLLRDHUP 0x2000 | ||
30 | 31 | ||
31 | struct pollfd { | 32 | struct pollfd { |
32 | int fd; | 33 | int fd; |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 208650b1ad3a..f17525a963d1 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -175,4 +175,11 @@ static inline __u32 ror32(__u32 word, unsigned int shift) | |||
175 | return (word >> shift) | (word << (32 - shift)); | 175 | return (word >> shift) | (word << (32 - shift)); |
176 | } | 176 | } |
177 | 177 | ||
178 | static inline unsigned fls_long(unsigned long l) | ||
179 | { | ||
180 | if (sizeof(l) == 4) | ||
181 | return fls(l); | ||
182 | return fls64(l); | ||
183 | } | ||
184 | |||
178 | #endif | 185 | #endif |
diff --git a/include/linux/capability.h b/include/linux/capability.h index 5a23ce752629..6548b35ab9f6 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
@@ -357,7 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c) | |||
357 | 357 | ||
358 | #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) | 358 | #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) |
359 | 359 | ||
360 | extern int capable(int cap); | 360 | int capable(int cap); |
361 | int __capable(struct task_struct *t, int cap); | ||
361 | 362 | ||
362 | #endif /* __KERNEL__ */ | 363 | #endif /* __KERNEL__ */ |
363 | 364 | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index d612b89dce33..08d50c53aab4 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -74,7 +74,6 @@ extern int lock_cpu_hotplug_interruptible(void); | |||
74 | register_cpu_notifier(&fn##_nb); \ | 74 | register_cpu_notifier(&fn##_nb); \ |
75 | } | 75 | } |
76 | int cpu_down(unsigned int cpu); | 76 | int cpu_down(unsigned int cpu); |
77 | extern int __attribute__((weak)) smp_prepare_cpu(int cpu); | ||
78 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) | 77 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) |
79 | #else | 78 | #else |
80 | #define lock_cpu_hotplug() do { } while (0) | 79 | #define lock_cpu_hotplug() do { } while (0) |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 60e56c6e03dd..99e6115d8e52 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -212,17 +212,15 @@ static inline void __cpus_shift_left(cpumask_t *dstp, | |||
212 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); | 212 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); |
213 | } | 213 | } |
214 | 214 | ||
215 | #define first_cpu(src) __first_cpu(&(src), NR_CPUS) | 215 | #ifdef CONFIG_SMP |
216 | static inline int __first_cpu(const cpumask_t *srcp, int nbits) | 216 | int __first_cpu(const cpumask_t *srcp); |
217 | { | 217 | #define first_cpu(src) __first_cpu(&(src)) |
218 | return min_t(int, nbits, find_first_bit(srcp->bits, nbits)); | 218 | int __next_cpu(int n, const cpumask_t *srcp); |
219 | } | 219 | #define next_cpu(n, src) __next_cpu((n), &(src)) |
220 | 220 | #else | |
221 | #define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS) | 221 | #define first_cpu(src) 0 |
222 | static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits) | 222 | #define next_cpu(n, src) 1 |
223 | { | 223 | #endif |
224 | return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1)); | ||
225 | } | ||
226 | 224 | ||
227 | #define cpumask_of_cpu(cpu) \ | 225 | #define cpumask_of_cpu(cpu) \ |
228 | ({ \ | 226 | ({ \ |
@@ -398,27 +396,17 @@ extern cpumask_t cpu_present_map; | |||
398 | #define cpu_present(cpu) ((cpu) == 0) | 396 | #define cpu_present(cpu) ((cpu) == 0) |
399 | #endif | 397 | #endif |
400 | 398 | ||
401 | #define any_online_cpu(mask) \ | 399 | #ifdef CONFIG_SMP |
402 | ({ \ | 400 | int highest_possible_processor_id(void); |
403 | int cpu; \ | 401 | #define any_online_cpu(mask) __any_online_cpu(&(mask)) |
404 | for_each_cpu_mask(cpu, (mask)) \ | 402 | int __any_online_cpu(const cpumask_t *mask); |
405 | if (cpu_online(cpu)) \ | 403 | #else |
406 | break; \ | 404 | #define highest_possible_processor_id() 0 |
407 | cpu; \ | 405 | #define any_online_cpu(mask) 0 |
408 | }) | 406 | #endif |
409 | 407 | ||
410 | #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) | 408 | #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) |
411 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) | 409 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) |
412 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) | 410 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) |
413 | 411 | ||
414 | /* Find the highest possible smp_processor_id() */ | ||
415 | #define highest_possible_processor_id() \ | ||
416 | ({ \ | ||
417 | unsigned int cpu, highest = 0; \ | ||
418 | for_each_cpu_mask(cpu, cpu_possible_map) \ | ||
419 | highest = cpu; \ | ||
420 | highest; \ | ||
421 | }) | ||
422 | |||
423 | |||
424 | #endif /* __LINUX_CPUMASK_H */ | 412 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4361f3789975..d10bd30c337e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -162,6 +162,8 @@ d_iput: no no no yes | |||
162 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ | 162 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ |
163 | #define DCACHE_UNHASHED 0x0010 | 163 | #define DCACHE_UNHASHED 0x0010 |
164 | 164 | ||
165 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */ | ||
166 | |||
165 | extern spinlock_t dcache_lock; | 167 | extern spinlock_t dcache_lock; |
166 | 168 | ||
167 | /** | 169 | /** |
diff --git a/include/linux/dio.h b/include/linux/dio.h index fae9395fcf4f..1e65ebc2a3db 100644 --- a/include/linux/dio.h +++ b/include/linux/dio.h | |||
@@ -276,37 +276,5 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data) | |||
276 | dev_set_drvdata(&d->dev, data); | 276 | dev_set_drvdata(&d->dev, data); |
277 | } | 277 | } |
278 | 278 | ||
279 | /* | ||
280 | * A helper function which helps ensure correct dio_driver | ||
281 | * setup and cleanup for commonly-encountered hotplug/modular cases | ||
282 | * | ||
283 | * This MUST stay in a header, as it checks for -DMODULE | ||
284 | */ | ||
285 | static inline int dio_module_init(struct dio_driver *drv) | ||
286 | { | ||
287 | int rc = dio_register_driver(drv); | ||
288 | |||
289 | if (rc > 0) | ||
290 | return 0; | ||
291 | |||
292 | /* iff CONFIG_HOTPLUG and built into kernel, we should | ||
293 | * leave the driver around for future hotplug events. | ||
294 | * For the module case, a hotplug daemon of some sort | ||
295 | * should load a module in response to an insert event. */ | ||
296 | #if defined(CONFIG_HOTPLUG) && !defined(MODULE) | ||
297 | if (rc == 0) | ||
298 | return 0; | ||
299 | #else | ||
300 | if (rc == 0) | ||
301 | rc = -ENODEV; | ||
302 | #endif | ||
303 | |||
304 | /* if we get here, we need to clean up DIO driver instance | ||
305 | * and return some sort of error */ | ||
306 | dio_unregister_driver(drv); | ||
307 | |||
308 | return rc; | ||
309 | } | ||
310 | |||
311 | #endif /* __KERNEL__ */ | 279 | #endif /* __KERNEL__ */ |
312 | #endif /* ndef _LINUX_DIO_H */ | 280 | #endif /* ndef _LINUX_DIO_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 215696a0f16f..21e8cf795c38 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -65,6 +65,11 @@ extern int dir_notify_enable; | |||
65 | #define FMODE_PREAD 8 | 65 | #define FMODE_PREAD 8 |
66 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ | 66 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ |
67 | 67 | ||
68 | /* File is being opened for execution. Primary users of this flag are | ||
69 | distributed filesystems that can use it to achieve correct ETXTBUSY | ||
70 | behavior for cross-node execution/opening_for_writing of files */ | ||
71 | #define FMODE_EXEC 16 | ||
72 | |||
68 | #define RW_MASK 1 | 73 | #define RW_MASK 1 |
69 | #define RWA_MASK 2 | 74 | #define RWA_MASK 2 |
70 | #define READ 0 | 75 | #define READ 0 |
@@ -1558,7 +1563,6 @@ extern void destroy_inode(struct inode *); | |||
1558 | extern struct inode *new_inode(struct super_block *); | 1563 | extern struct inode *new_inode(struct super_block *); |
1559 | extern int remove_suid(struct dentry *); | 1564 | extern int remove_suid(struct dentry *); |
1560 | extern void remove_dquot_ref(struct super_block *, int, struct list_head *); | 1565 | extern void remove_dquot_ref(struct super_block *, int, struct list_head *); |
1561 | extern struct mutex iprune_mutex; | ||
1562 | 1566 | ||
1563 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 1567 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
1564 | extern void remove_inode_hash(struct inode *); | 1568 | extern void remove_inode_hash(struct inode *); |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 03b8e7932b83..f7e517c1f1bd 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -17,6 +17,25 @@ | |||
17 | #include <linux/inotify.h> | 17 | #include <linux/inotify.h> |
18 | 18 | ||
19 | /* | 19 | /* |
20 | * fsnotify_d_instantiate - instantiate a dentry for inode | ||
21 | * Called with dcache_lock held. | ||
22 | */ | ||
23 | static inline void fsnotify_d_instantiate(struct dentry *entry, | ||
24 | struct inode *inode) | ||
25 | { | ||
26 | inotify_d_instantiate(entry, inode); | ||
27 | } | ||
28 | |||
29 | /* | ||
30 | * fsnotify_d_move - entry has been moved | ||
31 | * Called with dcache_lock and entry->d_lock held. | ||
32 | */ | ||
33 | static inline void fsnotify_d_move(struct dentry *entry) | ||
34 | { | ||
35 | inotify_d_move(entry); | ||
36 | } | ||
37 | |||
38 | /* | ||
20 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir | 39 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir |
21 | */ | 40 | */ |
22 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | 41 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, |
diff --git a/include/linux/init.h b/include/linux/init.h index ff8d8b8632f4..ed0ac7c39fdc 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -69,6 +69,10 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[]; | |||
69 | 69 | ||
70 | /* Defined in init/main.c */ | 70 | /* Defined in init/main.c */ |
71 | extern char saved_command_line[]; | 71 | extern char saved_command_line[]; |
72 | |||
73 | /* used by init/main.c */ | ||
74 | extern void setup_arch(char **); | ||
75 | |||
72 | #endif | 76 | #endif |
73 | 77 | ||
74 | #ifndef MODULE | 78 | #ifndef MODULE |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 267c88b5f742..09e00433c78e 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -71,6 +71,8 @@ struct inotify_event { | |||
71 | 71 | ||
72 | #ifdef CONFIG_INOTIFY | 72 | #ifdef CONFIG_INOTIFY |
73 | 73 | ||
74 | extern void inotify_d_instantiate(struct dentry *, struct inode *); | ||
75 | extern void inotify_d_move(struct dentry *); | ||
74 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | 76 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, |
75 | const char *); | 77 | const char *); |
76 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | 78 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, |
@@ -81,6 +83,15 @@ extern u32 inotify_get_cookie(void); | |||
81 | 83 | ||
82 | #else | 84 | #else |
83 | 85 | ||
86 | static inline void inotify_d_instantiate(struct dentry *dentry, | ||
87 | struct inode *inode) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | static inline void inotify_d_move(struct dentry *dentry) | ||
92 | { | ||
93 | } | ||
94 | |||
84 | static inline void inotify_inode_queue_event(struct inode *inode, | 95 | static inline void inotify_inode_queue_event(struct inode *inode, |
85 | __u32 mask, __u32 cookie, | 96 | __u32 mask, __u32 cookie, |
86 | const char *filename) | 97 | const char *filename) |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 6c5d4c898ccb..ee2a82a572f7 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -114,53 +114,8 @@ static inline void set_native_irq_info(int irq, cpumask_t mask) | |||
114 | #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) | 114 | #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) |
115 | extern cpumask_t pending_irq_cpumask[NR_IRQS]; | 115 | extern cpumask_t pending_irq_cpumask[NR_IRQS]; |
116 | 116 | ||
117 | static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | 117 | void set_pending_irq(unsigned int irq, cpumask_t mask); |
118 | { | 118 | void move_native_irq(int irq); |
119 | irq_desc_t *desc = irq_desc + irq; | ||
120 | unsigned long flags; | ||
121 | |||
122 | spin_lock_irqsave(&desc->lock, flags); | ||
123 | desc->move_irq = 1; | ||
124 | pending_irq_cpumask[irq] = mask; | ||
125 | spin_unlock_irqrestore(&desc->lock, flags); | ||
126 | } | ||
127 | |||
128 | static inline void | ||
129 | move_native_irq(int irq) | ||
130 | { | ||
131 | cpumask_t tmp; | ||
132 | irq_desc_t *desc = irq_descp(irq); | ||
133 | |||
134 | if (likely (!desc->move_irq)) | ||
135 | return; | ||
136 | |||
137 | desc->move_irq = 0; | ||
138 | |||
139 | if (likely(cpus_empty(pending_irq_cpumask[irq]))) | ||
140 | return; | ||
141 | |||
142 | if (!desc->handler->set_affinity) | ||
143 | return; | ||
144 | |||
145 | /* note - we hold the desc->lock */ | ||
146 | cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map); | ||
147 | |||
148 | /* | ||
149 | * If there was a valid mask to work with, please | ||
150 | * do the disable, re-program, enable sequence. | ||
151 | * This is *not* particularly important for level triggered | ||
152 | * but in a edge trigger case, we might be setting rte | ||
153 | * when an active trigger is comming in. This could | ||
154 | * cause some ioapics to mal-function. | ||
155 | * Being paranoid i guess! | ||
156 | */ | ||
157 | if (unlikely(!cpus_empty(tmp))) { | ||
158 | desc->handler->disable(irq); | ||
159 | desc->handler->set_affinity(irq,tmp); | ||
160 | desc->handler->enable(irq); | ||
161 | } | ||
162 | cpus_clear(pending_irq_cpumask[irq]); | ||
163 | } | ||
164 | 119 | ||
165 | #ifdef CONFIG_PCI_MSI | 120 | #ifdef CONFIG_PCI_MSI |
166 | /* | 121 | /* |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 2ccbfb6340ba..4fc7dffd66ef 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/stddef.h> | 29 | #include <linux/stddef.h> |
30 | #include <linux/bit_spinlock.h> | 30 | #include <linux/bit_spinlock.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/timer.h> | ||
33 | |||
32 | #include <asm/semaphore.h> | 34 | #include <asm/semaphore.h> |
33 | #endif | 35 | #endif |
34 | 36 | ||
@@ -787,7 +789,7 @@ struct journal_s | |||
787 | unsigned long j_commit_interval; | 789 | unsigned long j_commit_interval; |
788 | 790 | ||
789 | /* The timer used to wakeup the commit thread: */ | 791 | /* The timer used to wakeup the commit thread: */ |
790 | struct timer_list *j_commit_timer; | 792 | struct timer_list j_commit_timer; |
791 | 793 | ||
792 | /* | 794 | /* |
793 | * The revoke table: maintains the list of revoked blocks in the | 795 | * The revoke table: maintains the list of revoked blocks in the |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index bb6e7ddee2fd..03d6cfaa5b8a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -154,9 +154,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x) | |||
154 | return r; | 154 | return r; |
155 | } | 155 | } |
156 | 156 | ||
157 | static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x) | 157 | static inline unsigned long |
158 | __attribute_const__ roundup_pow_of_two(unsigned long x) | ||
158 | { | 159 | { |
159 | return (1UL << fls(x - 1)); | 160 | return 1UL << fls_long(x - 1); |
160 | } | 161 | } |
161 | 162 | ||
162 | extern int printk_ratelimit(void); | 163 | extern int printk_ratelimit(void); |
diff --git a/include/linux/major.h b/include/linux/major.h index e36a46702d94..0a74c52924c9 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
@@ -113,6 +113,7 @@ | |||
113 | 113 | ||
114 | #define UBD_MAJOR 98 | 114 | #define UBD_MAJOR 98 |
115 | 115 | ||
116 | #define PP_MAJOR 99 | ||
116 | #define JSFD_MAJOR 99 | 117 | #define JSFD_MAJOR 99 |
117 | 118 | ||
118 | #define PHONE_MAJOR 100 | 119 | #define PHONE_MAJOR 100 |
diff --git a/include/linux/module.h b/include/linux/module.h index 70bd843c71cb..e144309836af 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -554,25 +554,6 @@ static inline void module_remove_driver(struct device_driver *driver) | |||
554 | 554 | ||
555 | /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ | 555 | /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ |
556 | 556 | ||
557 | struct obsolete_modparm { | ||
558 | char name[64]; | ||
559 | char type[64-sizeof(void *)]; | ||
560 | void *addr; | ||
561 | }; | ||
562 | |||
563 | static inline void MODULE_PARM_(void) { } | ||
564 | #ifdef MODULE | ||
565 | /* DEPRECATED: Do not use. */ | ||
566 | #define MODULE_PARM(var,type) \ | ||
567 | extern struct obsolete_modparm __parm_##var \ | ||
568 | __attribute__((section("__obsparm"))); \ | ||
569 | struct obsolete_modparm __parm_##var = \ | ||
570 | { __stringify(var), type, &MODULE_PARM_ }; \ | ||
571 | __MODULE_PARM_TYPE(var, type); | ||
572 | #else | ||
573 | #define MODULE_PARM(var,type) static void __attribute__((__unused__)) *__parm_##var = &MODULE_PARM_; | ||
574 | #endif | ||
575 | |||
576 | #define __MODULE_STRING(x) __stringify(x) | 557 | #define __MODULE_STRING(x) __stringify(x) |
577 | 558 | ||
578 | /* Use symbol_get and symbol_put instead. You'll thank me. */ | 559 | /* Use symbol_get and symbol_put instead. You'll thank me. */ |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index b5c98c43779e..7c0c2c198f1f 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -162,13 +162,6 @@ extern int param_array_get(char *buffer, struct kernel_param *kp); | |||
162 | extern int param_set_copystring(const char *val, struct kernel_param *kp); | 162 | extern int param_set_copystring(const char *val, struct kernel_param *kp); |
163 | extern int param_get_string(char *buffer, struct kernel_param *kp); | 163 | extern int param_get_string(char *buffer, struct kernel_param *kp); |
164 | 164 | ||
165 | int param_array(const char *name, | ||
166 | const char *val, | ||
167 | unsigned int min, unsigned int max, | ||
168 | void *elem, int elemsize, | ||
169 | int (*set)(const char *, struct kernel_param *kp), | ||
170 | int *num); | ||
171 | |||
172 | /* for exporting parameters in /sys/parameters */ | 165 | /* for exporting parameters in /sys/parameters */ |
173 | 166 | ||
174 | struct module; | 167 | struct module; |
diff --git a/include/linux/ppdev.h b/include/linux/ppdev.h index 141c96586824..f376a7598a78 100644 --- a/include/linux/ppdev.h +++ b/include/linux/ppdev.h | |||
@@ -14,8 +14,6 @@ | |||
14 | * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 | 14 | * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define PP_MAJOR 99 | ||
18 | |||
19 | #define PP_IOCTL 'p' | 17 | #define PP_IOCTL 'p' |
20 | 18 | ||
21 | /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ | 19 | /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 8dc2d04a103f..2dab71e1c3d1 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -209,7 +209,6 @@ extern struct dqstats dqstats; | |||
209 | #define DQ_FAKE_B 3 /* no limits only usage */ | 209 | #define DQ_FAKE_B 3 /* no limits only usage */ |
210 | #define DQ_READ_B 4 /* dquot was read into memory */ | 210 | #define DQ_READ_B 4 /* dquot was read into memory */ |
211 | #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ | 211 | #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ |
212 | #define DQ_WAITFREE_B 6 /* dquot being waited (by invalidate_dquots) */ | ||
213 | 212 | ||
214 | struct dquot { | 213 | struct dquot { |
215 | struct hlist_node dq_hash; /* Hash list in memory */ | 214 | struct hlist_node dq_hash; /* Hash list in memory */ |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index c57ff2fcb30a..dd83cca28001 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -45,6 +45,8 @@ do { \ | |||
45 | (root)->rnode = NULL; \ | 45 | (root)->rnode = NULL; \ |
46 | } while (0) | 46 | } while (0) |
47 | 47 | ||
48 | #define RADIX_TREE_MAX_TAGS 2 | ||
49 | |||
48 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); | 50 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); |
49 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); | 51 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); |
50 | void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); | 52 | void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); |
@@ -55,15 +57,16 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | |||
55 | int radix_tree_preload(gfp_t gfp_mask); | 57 | int radix_tree_preload(gfp_t gfp_mask); |
56 | void radix_tree_init(void); | 58 | void radix_tree_init(void); |
57 | void *radix_tree_tag_set(struct radix_tree_root *root, | 59 | void *radix_tree_tag_set(struct radix_tree_root *root, |
58 | unsigned long index, int tag); | 60 | unsigned long index, unsigned int tag); |
59 | void *radix_tree_tag_clear(struct radix_tree_root *root, | 61 | void *radix_tree_tag_clear(struct radix_tree_root *root, |
60 | unsigned long index, int tag); | 62 | unsigned long index, unsigned int tag); |
61 | int radix_tree_tag_get(struct radix_tree_root *root, | 63 | int radix_tree_tag_get(struct radix_tree_root *root, |
62 | unsigned long index, int tag); | 64 | unsigned long index, unsigned int tag); |
63 | unsigned int | 65 | unsigned int |
64 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | 66 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
65 | unsigned long first_index, unsigned int max_items, int tag); | 67 | unsigned long first_index, unsigned int max_items, |
66 | int radix_tree_tagged(struct radix_tree_root *root, int tag); | 68 | unsigned int tag); |
69 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); | ||
67 | 70 | ||
68 | static inline void radix_tree_preload_end(void) | 71 | static inline void radix_tree_preload_end(void) |
69 | { | 72 | { |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index dad78cecfd20..912f1b7cb18f 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1704,6 +1704,11 @@ static inline int reiserfs_transaction_running(struct super_block *s) | |||
1704 | return 0; | 1704 | return 0; |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th) | ||
1708 | { | ||
1709 | return th->t_blocks_allocated - th->t_blocks_logged; | ||
1710 | } | ||
1711 | |||
1707 | int reiserfs_async_progress_wait(struct super_block *s); | 1712 | int reiserfs_async_progress_wait(struct super_block *s); |
1708 | 1713 | ||
1709 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | 1714 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 87280eb6083d..5353afb11db3 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -101,13 +101,13 @@ static inline void reiserfs_mark_inode_private(struct inode *inode) | |||
101 | #else | 101 | #else |
102 | 102 | ||
103 | #define is_reiserfs_priv_object(inode) 0 | 103 | #define is_reiserfs_priv_object(inode) 0 |
104 | #define reiserfs_mark_inode_private(inode) | 104 | #define reiserfs_mark_inode_private(inode) do {;} while(0) |
105 | #define reiserfs_getxattr NULL | 105 | #define reiserfs_getxattr NULL |
106 | #define reiserfs_setxattr NULL | 106 | #define reiserfs_setxattr NULL |
107 | #define reiserfs_listxattr NULL | 107 | #define reiserfs_listxattr NULL |
108 | #define reiserfs_removexattr NULL | 108 | #define reiserfs_removexattr NULL |
109 | #define reiserfs_write_lock_xattrs(sb) | 109 | #define reiserfs_write_lock_xattrs(sb) do {;} while(0) |
110 | #define reiserfs_write_unlock_xattrs(sb) | 110 | #define reiserfs_write_unlock_xattrs(sb) do {;} while(0) |
111 | #define reiserfs_read_lock_xattrs(sb) | 111 | #define reiserfs_read_lock_xattrs(sb) |
112 | #define reiserfs_read_unlock_xattrs(sb) | 112 | #define reiserfs_read_unlock_xattrs(sb) |
113 | 113 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index b18eb8cfa639..3c19be35124b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1040,6 +1040,11 @@ struct swap_info_struct; | |||
1040 | * @effective contains the effective capability set. | 1040 | * @effective contains the effective capability set. |
1041 | * @inheritable contains the inheritable capability set. | 1041 | * @inheritable contains the inheritable capability set. |
1042 | * @permitted contains the permitted capability set. | 1042 | * @permitted contains the permitted capability set. |
1043 | * @capable: | ||
1044 | * Check whether the @tsk process has the @cap capability. | ||
1045 | * @tsk contains the task_struct for the process. | ||
1046 | * @cap contains the capability <include/linux/capability.h>. | ||
1047 | * Return 0 if the capability is granted for @tsk. | ||
1043 | * @acct: | 1048 | * @acct: |
1044 | * Check permission before enabling or disabling process accounting. If | 1049 | * Check permission before enabling or disabling process accounting. If |
1045 | * accounting is being enabled, then @file refers to the open file used to | 1050 | * accounting is being enabled, then @file refers to the open file used to |
@@ -1053,11 +1058,6 @@ struct swap_info_struct; | |||
1053 | * @table contains the ctl_table structure for the sysctl variable. | 1058 | * @table contains the ctl_table structure for the sysctl variable. |
1054 | * @op contains the operation (001 = search, 002 = write, 004 = read). | 1059 | * @op contains the operation (001 = search, 002 = write, 004 = read). |
1055 | * Return 0 if permission is granted. | 1060 | * Return 0 if permission is granted. |
1056 | * @capable: | ||
1057 | * Check whether the @tsk process has the @cap capability. | ||
1058 | * @tsk contains the task_struct for the process. | ||
1059 | * @cap contains the capability <include/linux/capability.h>. | ||
1060 | * Return 0 if the capability is granted for @tsk. | ||
1061 | * @syslog: | 1061 | * @syslog: |
1062 | * Check permission before accessing the kernel message ring or changing | 1062 | * Check permission before accessing the kernel message ring or changing |
1063 | * logging to the console. | 1063 | * logging to the console. |
@@ -1099,9 +1099,9 @@ struct security_operations { | |||
1099 | kernel_cap_t * effective, | 1099 | kernel_cap_t * effective, |
1100 | kernel_cap_t * inheritable, | 1100 | kernel_cap_t * inheritable, |
1101 | kernel_cap_t * permitted); | 1101 | kernel_cap_t * permitted); |
1102 | int (*capable) (struct task_struct * tsk, int cap); | ||
1102 | int (*acct) (struct file * file); | 1103 | int (*acct) (struct file * file); |
1103 | int (*sysctl) (struct ctl_table * table, int op); | 1104 | int (*sysctl) (struct ctl_table * table, int op); |
1104 | int (*capable) (struct task_struct * tsk, int cap); | ||
1105 | int (*quotactl) (int cmds, int type, int id, struct super_block * sb); | 1105 | int (*quotactl) (int cmds, int type, int id, struct super_block * sb); |
1106 | int (*quota_on) (struct dentry * dentry); | 1106 | int (*quota_on) (struct dentry * dentry); |
1107 | int (*syslog) (int type); | 1107 | int (*syslog) (int type); |
@@ -1347,6 +1347,11 @@ static inline void security_capset_set (struct task_struct *target, | |||
1347 | security_ops->capset_set (target, effective, inheritable, permitted); | 1347 | security_ops->capset_set (target, effective, inheritable, permitted); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | static inline int security_capable(struct task_struct *tsk, int cap) | ||
1351 | { | ||
1352 | return security_ops->capable(tsk, cap); | ||
1353 | } | ||
1354 | |||
1350 | static inline int security_acct (struct file *file) | 1355 | static inline int security_acct (struct file *file) |
1351 | { | 1356 | { |
1352 | return security_ops->acct (file); | 1357 | return security_ops->acct (file); |
@@ -2050,6 +2055,11 @@ static inline void security_capset_set (struct task_struct *target, | |||
2050 | cap_capset_set (target, effective, inheritable, permitted); | 2055 | cap_capset_set (target, effective, inheritable, permitted); |
2051 | } | 2056 | } |
2052 | 2057 | ||
2058 | static inline int security_capable(struct task_struct *tsk, int cap) | ||
2059 | { | ||
2060 | return cap_capable(tsk, cap); | ||
2061 | } | ||
2062 | |||
2053 | static inline int security_acct (struct file *file) | 2063 | static inline int security_acct (struct file *file) |
2054 | { | 2064 | { |
2055 | return 0; | 2065 | return 0; |
diff --git a/include/linux/slab.h b/include/linux/slab.h index e2ee5b268797..15e1d9736b1b 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -64,6 +64,7 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo | |||
64 | extern int kmem_cache_destroy(kmem_cache_t *); | 64 | extern int kmem_cache_destroy(kmem_cache_t *); |
65 | extern int kmem_cache_shrink(kmem_cache_t *); | 65 | extern int kmem_cache_shrink(kmem_cache_t *); |
66 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); | 66 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); |
67 | extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | ||
67 | extern void kmem_cache_free(kmem_cache_t *, void *); | 68 | extern void kmem_cache_free(kmem_cache_t *, void *); |
68 | extern unsigned int kmem_cache_size(kmem_cache_t *); | 69 | extern unsigned int kmem_cache_size(kmem_cache_t *); |
69 | extern const char *kmem_cache_name(kmem_cache_t *); | 70 | extern const char *kmem_cache_name(kmem_cache_t *); |
@@ -77,11 +78,12 @@ struct cache_sizes { | |||
77 | }; | 78 | }; |
78 | extern struct cache_sizes malloc_sizes[]; | 79 | extern struct cache_sizes malloc_sizes[]; |
79 | 80 | ||
80 | #ifndef CONFIG_DEBUG_SLAB | ||
81 | extern void *__kmalloc(size_t, gfp_t); | 81 | extern void *__kmalloc(size_t, gfp_t); |
82 | #ifndef CONFIG_DEBUG_SLAB | ||
83 | #define ____kmalloc(size, flags) __kmalloc(size, flags) | ||
82 | #else | 84 | #else |
83 | extern void *__kmalloc_track_caller(size_t, gfp_t, void*); | 85 | extern void *__kmalloc_track_caller(size_t, gfp_t, void*); |
84 | #define __kmalloc(size, flags) \ | 86 | #define ____kmalloc(size, flags) \ |
85 | __kmalloc_track_caller(size, flags, __builtin_return_address(0)) | 87 | __kmalloc_track_caller(size, flags, __builtin_return_address(0)) |
86 | #endif | 88 | #endif |
87 | 89 | ||
@@ -108,7 +110,30 @@ found: | |||
108 | return __kmalloc(size, flags); | 110 | return __kmalloc(size, flags); |
109 | } | 111 | } |
110 | 112 | ||
111 | extern void *kzalloc(size_t, gfp_t); | 113 | extern void *__kzalloc(size_t, gfp_t); |
114 | |||
115 | static inline void *kzalloc(size_t size, gfp_t flags) | ||
116 | { | ||
117 | if (__builtin_constant_p(size)) { | ||
118 | int i = 0; | ||
119 | #define CACHE(x) \ | ||
120 | if (size <= x) \ | ||
121 | goto found; \ | ||
122 | else \ | ||
123 | i++; | ||
124 | #include "kmalloc_sizes.h" | ||
125 | #undef CACHE | ||
126 | { | ||
127 | extern void __you_cannot_kzalloc_that_much(void); | ||
128 | __you_cannot_kzalloc_that_much(); | ||
129 | } | ||
130 | found: | ||
131 | return kmem_cache_zalloc((flags & GFP_DMA) ? | ||
132 | malloc_sizes[i].cs_dmacachep : | ||
133 | malloc_sizes[i].cs_cachep, flags); | ||
134 | } | ||
135 | return __kzalloc(size, flags); | ||
136 | } | ||
112 | 137 | ||
113 | /** | 138 | /** |
114 | * kcalloc - allocate memory for an array. The memory is set to zero. | 139 | * kcalloc - allocate memory for an array. The memory is set to zero. |
@@ -155,17 +180,18 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, | |||
155 | void (*)(void *, struct kmem_cache *, unsigned long)); | 180 | void (*)(void *, struct kmem_cache *, unsigned long)); |
156 | int kmem_cache_destroy(struct kmem_cache *c); | 181 | int kmem_cache_destroy(struct kmem_cache *c); |
157 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); | 182 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); |
183 | void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | ||
158 | void kmem_cache_free(struct kmem_cache *c, void *b); | 184 | void kmem_cache_free(struct kmem_cache *c, void *b); |
159 | const char *kmem_cache_name(struct kmem_cache *); | 185 | const char *kmem_cache_name(struct kmem_cache *); |
160 | void *kmalloc(size_t size, gfp_t flags); | 186 | void *kmalloc(size_t size, gfp_t flags); |
161 | void *kzalloc(size_t size, gfp_t flags); | 187 | void *__kzalloc(size_t size, gfp_t flags); |
162 | void kfree(const void *m); | 188 | void kfree(const void *m); |
163 | unsigned int ksize(const void *m); | 189 | unsigned int ksize(const void *m); |
164 | unsigned int kmem_cache_size(struct kmem_cache *c); | 190 | unsigned int kmem_cache_size(struct kmem_cache *c); |
165 | 191 | ||
166 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | 192 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) |
167 | { | 193 | { |
168 | return kzalloc(n * size, flags); | 194 | return __kzalloc(n * size, flags); |
169 | } | 195 | } |
170 | 196 | ||
171 | #define kmem_cache_shrink(d) (0) | 197 | #define kmem_cache_shrink(d) (0) |
@@ -173,6 +199,8 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | |||
173 | #define kmem_ptr_validate(a, b) (0) | 199 | #define kmem_ptr_validate(a, b) (0) |
174 | #define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) | 200 | #define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) |
175 | #define kmalloc_node(s, f, n) kmalloc(s, f) | 201 | #define kmalloc_node(s, f, n) kmalloc(s, f) |
202 | #define kzalloc(s, f) __kzalloc(s, f) | ||
203 | #define ____kmalloc kmalloc | ||
176 | 204 | ||
177 | #endif /* CONFIG_SLOB */ | 205 | #endif /* CONFIG_SLOB */ |
178 | 206 | ||
diff --git a/include/linux/time.h b/include/linux/time.h index d9cdba54b789..bf0e785e2e03 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -101,6 +101,7 @@ extern long do_utimes(int dfd, char __user *filename, struct timeval *times); | |||
101 | struct itimerval; | 101 | struct itimerval; |
102 | extern int do_setitimer(int which, struct itimerval *value, | 102 | extern int do_setitimer(int which, struct itimerval *value, |
103 | struct itimerval *ovalue); | 103 | struct itimerval *ovalue); |
104 | extern unsigned int alarm_setitimer(unsigned int seconds); | ||
104 | extern int do_getitimer(int which, struct itimerval *value); | 105 | extern int do_getitimer(int which, struct itimerval *value); |
105 | extern void getnstimeofday(struct timespec *tv); | 106 | extern void getnstimeofday(struct timespec *tv); |
106 | 107 | ||
diff --git a/include/linux/timex.h b/include/linux/timex.h index b7ca1204e42a..82dc9ae79d37 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -97,38 +97,11 @@ | |||
97 | 97 | ||
98 | #define MAXPHASE 512000L /* max phase error (us) */ | 98 | #define MAXPHASE 512000L /* max phase error (us) */ |
99 | #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ | 99 | #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ |
100 | #define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ | ||
101 | #define MINSEC 16L /* min interval between updates (s) */ | 100 | #define MINSEC 16L /* min interval between updates (s) */ |
102 | #define MAXSEC 1200L /* max interval between updates (s) */ | 101 | #define MAXSEC 1200L /* max interval between updates (s) */ |
103 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ | 102 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ |
104 | 103 | ||
105 | /* | 104 | /* |
106 | * The following defines are used only if a pulse-per-second (PPS) | ||
107 | * signal is available and connected via a modem control lead, such as | ||
108 | * produced by the optional ppsclock feature incorporated in the Sun | ||
109 | * asynch driver. They establish the design parameters of the frequency- | ||
110 | * lock loop used to discipline the CPU clock oscillator to the PPS | ||
111 | * signal. | ||
112 | * | ||
113 | * PPS_AVG is the averaging factor for the frequency loop, as well as | ||
114 | * the time and frequency dispersion. | ||
115 | * | ||
116 | * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum | ||
117 | * calibration intervals, respectively, in seconds as a power of two. | ||
118 | * | ||
119 | * PPS_VALID is the maximum interval before the PPS signal is considered | ||
120 | * invalid and protocol updates used directly instead. | ||
121 | * | ||
122 | * MAXGLITCH is the maximum interval before a time offset of more than | ||
123 | * MAXTIME is believed. | ||
124 | */ | ||
125 | #define PPS_AVG 2 /* pps averaging constant (shift) */ | ||
126 | #define PPS_SHIFT 2 /* min interval duration (s) (shift) */ | ||
127 | #define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ | ||
128 | #define PPS_VALID 120 /* pps signal watchdog max (s) */ | ||
129 | #define MAXGLITCH 30 /* pps signal glitch max (s) */ | ||
130 | |||
131 | /* | ||
132 | * syscall interface - used (mainly by NTP daemon) | 105 | * syscall interface - used (mainly by NTP daemon) |
133 | * to discipline kernel clock oscillator | 106 | * to discipline kernel clock oscillator |
134 | */ | 107 | */ |
@@ -246,20 +219,6 @@ extern long time_reftime; /* time at last adjustment (s) */ | |||
246 | extern long time_adjust; /* The amount of adjtime left */ | 219 | extern long time_adjust; /* The amount of adjtime left */ |
247 | extern long time_next_adjust; /* Value for time_adjust at next tick */ | 220 | extern long time_next_adjust; /* Value for time_adjust at next tick */ |
248 | 221 | ||
249 | /* interface variables pps->timer interrupt */ | ||
250 | extern long pps_offset; /* pps time offset (us) */ | ||
251 | extern long pps_jitter; /* time dispersion (jitter) (us) */ | ||
252 | extern long pps_freq; /* frequency offset (scaled ppm) */ | ||
253 | extern long pps_stabil; /* frequency dispersion (scaled ppm) */ | ||
254 | extern long pps_valid; /* pps signal watchdog counter */ | ||
255 | |||
256 | /* interface variables pps->adjtimex */ | ||
257 | extern int pps_shift; /* interval duration (s) (shift) */ | ||
258 | extern long pps_jitcnt; /* jitter limit exceeded */ | ||
259 | extern long pps_calcnt; /* calibration intervals */ | ||
260 | extern long pps_errcnt; /* calibration errors */ | ||
261 | extern long pps_stbcnt; /* stability limit exceeded */ | ||
262 | |||
263 | /** | 222 | /** |
264 | * ntp_clear - Clears the NTP state variables | 223 | * ntp_clear - Clears the NTP state variables |
265 | * | 224 | * |
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index 0c6169fff366..0976a163b459 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define _LINUX_TTY_FLIP_H | 2 | #define _LINUX_TTY_FLIP_H |
3 | 3 | ||
4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); | 4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); |
5 | extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size); | 5 | extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size); |
6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size); | 6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); |
7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); | 7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); |
8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); | 8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); |
9 | 9 | ||
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h index 1e7508420fcf..ffaf05679ffb 100644 --- a/include/linux/udf_fs_i.h +++ b/include/linux/udf_fs_i.h | |||
@@ -15,27 +15,6 @@ | |||
15 | 15 | ||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | 17 | ||
18 | #ifndef _ECMA_167_H | ||
19 | typedef struct | ||
20 | { | ||
21 | __u32 logicalBlockNum; | ||
22 | __u16 partitionReferenceNum; | ||
23 | } __attribute__ ((packed)) lb_addr; | ||
24 | |||
25 | typedef struct | ||
26 | { | ||
27 | __u32 extLength; | ||
28 | __u32 extPosition; | ||
29 | } __attribute__ ((packed)) short_ad; | ||
30 | |||
31 | typedef struct | ||
32 | { | ||
33 | __u32 extLength; | ||
34 | lb_addr extLocation; | ||
35 | __u8 impUse[6]; | ||
36 | } __attribute__ ((packed)) long_ad; | ||
37 | #endif | ||
38 | |||
39 | struct udf_inode_info | 18 | struct udf_inode_info |
40 | { | 19 | { |
41 | struct timespec i_crtime; | 20 | struct timespec i_crtime; |
diff --git a/include/linux/zorro.h b/include/linux/zorro.h index ba5b72768bbe..2f135cf6eef1 100644 --- a/include/linux/zorro.h +++ b/include/linux/zorro.h | |||
@@ -271,39 +271,6 @@ static inline void zorro_set_drvdata (struct zorro_dev *z, void *data) | |||
271 | } | 271 | } |
272 | 272 | ||
273 | 273 | ||
274 | /* | ||
275 | * A helper function which helps ensure correct zorro_driver | ||
276 | * setup and cleanup for commonly-encountered hotplug/modular cases | ||
277 | * | ||
278 | * This MUST stay in a header, as it checks for -DMODULE | ||
279 | */ | ||
280 | static inline int zorro_module_init(struct zorro_driver *drv) | ||
281 | { | ||
282 | int rc = zorro_register_driver(drv); | ||
283 | |||
284 | if (rc > 0) | ||
285 | return 0; | ||
286 | |||
287 | /* iff CONFIG_HOTPLUG and built into kernel, we should | ||
288 | * leave the driver around for future hotplug events. | ||
289 | * For the module case, a hotplug daemon of some sort | ||
290 | * should load a module in response to an insert event. */ | ||
291 | #if defined(CONFIG_HOTPLUG) && !defined(MODULE) | ||
292 | if (rc == 0) | ||
293 | return 0; | ||
294 | #else | ||
295 | if (rc == 0) | ||
296 | rc = -ENODEV; | ||
297 | #endif | ||
298 | |||
299 | /* if we get here, we need to clean up Zorro driver instance | ||
300 | * and return some sort of error */ | ||
301 | zorro_unregister_driver(drv); | ||
302 | |||
303 | return rc; | ||
304 | } | ||
305 | |||
306 | |||
307 | /* | 274 | /* |
308 | * Bitmask indicating portions of available Zorro II RAM that are unused | 275 | * Bitmask indicating portions of available Zorro II RAM that are unused |
309 | * by the system. Every bit represents a 64K chunk, for a maximum of 8MB | 276 | * by the system. Every bit represents a 64K chunk, for a maximum of 8MB |
diff --git a/include/video/pm3fb.h b/include/video/pm3fb.h index 6f4ea808cf74..ac021379ac40 100644 --- a/include/video/pm3fb.h +++ b/include/video/pm3fb.h | |||
@@ -1128,10 +1128,7 @@ | |||
1128 | #endif | 1128 | #endif |
1129 | 1129 | ||
1130 | /* max number of simultaneous board */ | 1130 | /* max number of simultaneous board */ |
1131 | /* warning : make sure module array def's are coherent with PM3_MAX_BOARD */ | ||
1132 | #define PM3_MAX_BOARD 4 | 1131 | #define PM3_MAX_BOARD 4 |
1133 | #define PM3_MAX_BOARD_MODULE_ARRAY_SHORT "1-4h" | ||
1134 | #define PM3_MAX_BOARD_MODULE_ARRAY_STRING "1-4s" | ||
1135 | 1132 | ||
1136 | /* max size of options */ | 1133 | /* max size of options */ |
1137 | #define PM3_OPTIONS_SIZE 256 | 1134 | #define PM3_OPTIONS_SIZE 256 |
diff --git a/init/Kconfig b/init/Kconfig index 1d19fd25204b..05951c1d654e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -470,15 +470,6 @@ config MODULE_FORCE_UNLOAD | |||
470 | rmmod). This is mainly for kernel developers and desperate users. | 470 | rmmod). This is mainly for kernel developers and desperate users. |
471 | If unsure, say N. | 471 | If unsure, say N. |
472 | 472 | ||
473 | config OBSOLETE_MODPARM | ||
474 | bool | ||
475 | default y | ||
476 | depends on MODULES | ||
477 | help | ||
478 | You need this option to use module parameters on modules which | ||
479 | have not been converted to the new module parameter system yet. | ||
480 | If unsure, say Y. | ||
481 | |||
482 | config MODVERSIONS | 473 | config MODVERSIONS |
483 | bool "Module versioning support" | 474 | bool "Module versioning support" |
484 | depends on MODULES | 475 | depends on MODULES |
diff --git a/init/initramfs.c b/init/initramfs.c index 637344b05981..77b934cccefe 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
@@ -506,6 +506,7 @@ void __init populate_rootfs(void) | |||
506 | panic(err); | 506 | panic(err); |
507 | #ifdef CONFIG_BLK_DEV_INITRD | 507 | #ifdef CONFIG_BLK_DEV_INITRD |
508 | if (initrd_start) { | 508 | if (initrd_start) { |
509 | #ifdef CONFIG_BLK_DEV_RAM | ||
509 | int fd; | 510 | int fd; |
510 | printk(KERN_INFO "checking if image is initramfs..."); | 511 | printk(KERN_INFO "checking if image is initramfs..."); |
511 | err = unpack_to_rootfs((char *)initrd_start, | 512 | err = unpack_to_rootfs((char *)initrd_start, |
@@ -525,6 +526,15 @@ void __init populate_rootfs(void) | |||
525 | sys_close(fd); | 526 | sys_close(fd); |
526 | free_initrd(); | 527 | free_initrd(); |
527 | } | 528 | } |
529 | #else | ||
530 | printk(KERN_INFO "Unpacking initramfs..."); | ||
531 | err = unpack_to_rootfs((char *)initrd_start, | ||
532 | initrd_end - initrd_start, 0); | ||
533 | if (err) | ||
534 | panic(err); | ||
535 | printk(" done\n"); | ||
536 | free_initrd(); | ||
537 | #endif | ||
528 | } | 538 | } |
529 | #endif | 539 | #endif |
530 | } | 540 | } |
diff --git a/init/main.c b/init/main.c index 2714e0e7cfec..006dcd547dc2 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -306,8 +306,6 @@ static int __init rdinit_setup(char *str) | |||
306 | } | 306 | } |
307 | __setup("rdinit=", rdinit_setup); | 307 | __setup("rdinit=", rdinit_setup); |
308 | 308 | ||
309 | extern void setup_arch(char **); | ||
310 | |||
311 | #ifndef CONFIG_SMP | 309 | #ifndef CONFIG_SMP |
312 | 310 | ||
313 | #ifdef CONFIG_X86_LOCAL_APIC | 311 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -571,17 +569,23 @@ static void __init do_initcalls(void) | |||
571 | int count = preempt_count(); | 569 | int count = preempt_count(); |
572 | 570 | ||
573 | for (call = __initcall_start; call < __initcall_end; call++) { | 571 | for (call = __initcall_start; call < __initcall_end; call++) { |
574 | char *msg; | 572 | char *msg = NULL; |
573 | char msgbuf[40]; | ||
574 | int result; | ||
575 | 575 | ||
576 | if (initcall_debug) { | 576 | if (initcall_debug) { |
577 | printk(KERN_DEBUG "Calling initcall 0x%p", *call); | 577 | printk("Calling initcall 0x%p", *call); |
578 | print_fn_descriptor_symbol(": %s()", (unsigned long) *call); | 578 | print_fn_descriptor_symbol(": %s()", |
579 | (unsigned long) *call); | ||
579 | printk("\n"); | 580 | printk("\n"); |
580 | } | 581 | } |
581 | 582 | ||
582 | (*call)(); | 583 | result = (*call)(); |
583 | 584 | ||
584 | msg = NULL; | 585 | if (result && (result != -ENODEV || initcall_debug)) { |
586 | sprintf(msgbuf, "error code %d", result); | ||
587 | msg = msgbuf; | ||
588 | } | ||
585 | if (preempt_count() != count) { | 589 | if (preempt_count() != count) { |
586 | msg = "preemption imbalance"; | 590 | msg = "preemption imbalance"; |
587 | preempt_count() = count; | 591 | preempt_count() = count; |
@@ -591,8 +595,10 @@ static void __init do_initcalls(void) | |||
591 | local_irq_enable(); | 595 | local_irq_enable(); |
592 | } | 596 | } |
593 | if (msg) { | 597 | if (msg) { |
594 | printk(KERN_WARNING "error in initcall at 0x%p: " | 598 | printk(KERN_WARNING "initcall at 0x%p", *call); |
595 | "returned with %s\n", *call, msg); | 599 | print_fn_descriptor_symbol(": %s()", |
600 | (unsigned long) *call); | ||
601 | printk(": returned with %s\n", msg); | ||
596 | } | 602 | } |
597 | } | 603 | } |
598 | 604 | ||
diff --git a/kernel/capability.c b/kernel/capability.c index bfa3c92e16f2..1a4d8a40d3f9 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -233,3 +233,19 @@ out: | |||
233 | 233 | ||
234 | return ret; | 234 | return ret; |
235 | } | 235 | } |
236 | |||
237 | int __capable(struct task_struct *t, int cap) | ||
238 | { | ||
239 | if (security_capable(t, cap) == 0) { | ||
240 | t->flags |= PF_SUPERPRIV; | ||
241 | return 1; | ||
242 | } | ||
243 | return 0; | ||
244 | } | ||
245 | EXPORT_SYMBOL(__capable); | ||
246 | |||
247 | int capable(int cap) | ||
248 | { | ||
249 | return __capable(current, cap); | ||
250 | } | ||
251 | EXPORT_SYMBOL(capable); | ||
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile index 49378738ff5e..2b33f852be3e 100644 --- a/kernel/irq/Makefile +++ b/kernel/irq/Makefile | |||
@@ -1,5 +1,4 @@ | |||
1 | 1 | ||
2 | obj-y := handle.o manage.o spurious.o | 2 | obj-y := handle.o manage.o spurious.o migration.o |
3 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o | 3 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o |
4 | obj-$(CONFIG_PROC_FS) += proc.o | 4 | obj-$(CONFIG_PROC_FS) += proc.o |
5 | |||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 97d5559997d2..6edfcef291e8 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -204,10 +204,14 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
204 | p = &desc->action; | 204 | p = &desc->action; |
205 | if ((old = *p) != NULL) { | 205 | if ((old = *p) != NULL) { |
206 | /* Can't share interrupts unless both agree to */ | 206 | /* Can't share interrupts unless both agree to */ |
207 | if (!(old->flags & new->flags & SA_SHIRQ)) { | 207 | if (!(old->flags & new->flags & SA_SHIRQ)) |
208 | spin_unlock_irqrestore(&desc->lock,flags); | 208 | goto mismatch; |
209 | return -EBUSY; | 209 | |
210 | } | 210 | #if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ) |
211 | /* All handlers must agree on per-cpuness */ | ||
212 | if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU)) | ||
213 | goto mismatch; | ||
214 | #endif | ||
211 | 215 | ||
212 | /* add new interrupt at end of irq queue */ | 216 | /* add new interrupt at end of irq queue */ |
213 | do { | 217 | do { |
@@ -218,7 +222,10 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
218 | } | 222 | } |
219 | 223 | ||
220 | *p = new; | 224 | *p = new; |
221 | 225 | #if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ) | |
226 | if (new->flags & SA_PERCPU_IRQ) | ||
227 | desc->status |= IRQ_PER_CPU; | ||
228 | #endif | ||
222 | if (!shared) { | 229 | if (!shared) { |
223 | desc->depth = 0; | 230 | desc->depth = 0; |
224 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | | 231 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | |
@@ -236,6 +243,12 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
236 | register_handler_proc(irq, new); | 243 | register_handler_proc(irq, new); |
237 | 244 | ||
238 | return 0; | 245 | return 0; |
246 | |||
247 | mismatch: | ||
248 | spin_unlock_irqrestore(&desc->lock, flags); | ||
249 | printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__); | ||
250 | dump_stack(); | ||
251 | return -EBUSY; | ||
239 | } | 252 | } |
240 | 253 | ||
241 | /** | 254 | /** |
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c new file mode 100644 index 000000000000..52a8655fa080 --- /dev/null +++ b/kernel/irq/migration.c | |||
@@ -0,0 +1,65 @@ | |||
1 | #include <linux/irq.h> | ||
2 | |||
3 | #if defined(CONFIG_GENERIC_PENDING_IRQ) | ||
4 | |||
5 | void set_pending_irq(unsigned int irq, cpumask_t mask) | ||
6 | { | ||
7 | irq_desc_t *desc = irq_desc + irq; | ||
8 | unsigned long flags; | ||
9 | |||
10 | spin_lock_irqsave(&desc->lock, flags); | ||
11 | desc->move_irq = 1; | ||
12 | pending_irq_cpumask[irq] = mask; | ||
13 | spin_unlock_irqrestore(&desc->lock, flags); | ||
14 | } | ||
15 | |||
16 | void move_native_irq(int irq) | ||
17 | { | ||
18 | cpumask_t tmp; | ||
19 | irq_desc_t *desc = irq_descp(irq); | ||
20 | |||
21 | if (likely(!desc->move_irq)) | ||
22 | return; | ||
23 | |||
24 | /* | ||
25 | * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. | ||
26 | */ | ||
27 | if (CHECK_IRQ_PER_CPU(desc->status)) { | ||
28 | WARN_ON(1); | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | desc->move_irq = 0; | ||
33 | |||
34 | if (likely(cpus_empty(pending_irq_cpumask[irq]))) | ||
35 | return; | ||
36 | |||
37 | if (!desc->handler->set_affinity) | ||
38 | return; | ||
39 | |||
40 | assert_spin_locked(&desc->lock); | ||
41 | |||
42 | cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map); | ||
43 | |||
44 | /* | ||
45 | * If there was a valid mask to work with, please | ||
46 | * do the disable, re-program, enable sequence. | ||
47 | * This is *not* particularly important for level triggered | ||
48 | * but in a edge trigger case, we might be setting rte | ||
49 | * when an active trigger is comming in. This could | ||
50 | * cause some ioapics to mal-function. | ||
51 | * Being paranoid i guess! | ||
52 | */ | ||
53 | if (unlikely(!cpus_empty(tmp))) { | ||
54 | if (likely(!(desc->status & IRQ_DISABLED))) | ||
55 | desc->handler->disable(irq); | ||
56 | |||
57 | desc->handler->set_affinity(irq,tmp); | ||
58 | |||
59 | if (likely(!(desc->status & IRQ_DISABLED))) | ||
60 | desc->handler->enable(irq); | ||
61 | } | ||
62 | cpus_clear(pending_irq_cpumask[irq]); | ||
63 | } | ||
64 | |||
65 | #endif | ||
diff --git a/kernel/itimer.c b/kernel/itimer.c index 379be2f8c84c..680e6b70c872 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c | |||
@@ -143,6 +143,60 @@ int it_real_fn(void *data) | |||
143 | return HRTIMER_NORESTART; | 143 | return HRTIMER_NORESTART; |
144 | } | 144 | } |
145 | 145 | ||
146 | /* | ||
147 | * We do not care about correctness. We just sanitize the values so | ||
148 | * the ktime_t operations which expect normalized values do not | ||
149 | * break. This converts negative values to long timeouts similar to | ||
150 | * the code in kernel versions < 2.6.16 | ||
151 | * | ||
152 | * Print a limited number of warning messages when an invalid timeval | ||
153 | * is detected. | ||
154 | */ | ||
155 | static void fixup_timeval(struct timeval *tv, int interval) | ||
156 | { | ||
157 | static int warnlimit = 10; | ||
158 | unsigned long tmp; | ||
159 | |||
160 | if (warnlimit > 0) { | ||
161 | warnlimit--; | ||
162 | printk(KERN_WARNING | ||
163 | "setitimer: %s (pid = %d) provided " | ||
164 | "invalid timeval %s: tv_sec = %ld tv_usec = %ld\n", | ||
165 | current->comm, current->pid, | ||
166 | interval ? "it_interval" : "it_value", | ||
167 | tv->tv_sec, (long) tv->tv_usec); | ||
168 | } | ||
169 | |||
170 | tmp = tv->tv_usec; | ||
171 | if (tmp >= USEC_PER_SEC) { | ||
172 | tv->tv_usec = tmp % USEC_PER_SEC; | ||
173 | tv->tv_sec += tmp / USEC_PER_SEC; | ||
174 | } | ||
175 | |||
176 | tmp = tv->tv_sec; | ||
177 | if (tmp > LONG_MAX) | ||
178 | tv->tv_sec = LONG_MAX; | ||
179 | } | ||
180 | |||
181 | /* | ||
182 | * Returns true if the timeval is in canonical form | ||
183 | */ | ||
184 | #define timeval_valid(t) \ | ||
185 | (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC)) | ||
186 | |||
187 | /* | ||
188 | * Check for invalid timevals, sanitize them and print a limited | ||
189 | * number of warnings. | ||
190 | */ | ||
191 | static void check_itimerval(struct itimerval *value) { | ||
192 | |||
193 | if (unlikely(!timeval_valid(&value->it_value))) | ||
194 | fixup_timeval(&value->it_value, 0); | ||
195 | |||
196 | if (unlikely(!timeval_valid(&value->it_interval))) | ||
197 | fixup_timeval(&value->it_interval, 1); | ||
198 | } | ||
199 | |||
146 | int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | 200 | int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) |
147 | { | 201 | { |
148 | struct task_struct *tsk = current; | 202 | struct task_struct *tsk = current; |
@@ -150,6 +204,18 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | |||
150 | ktime_t expires; | 204 | ktime_t expires; |
151 | cputime_t cval, cinterval, nval, ninterval; | 205 | cputime_t cval, cinterval, nval, ninterval; |
152 | 206 | ||
207 | /* | ||
208 | * Validate the timevals in value. | ||
209 | * | ||
210 | * Note: Although the spec requires that invalid values shall | ||
211 | * return -EINVAL, we just fixup the value and print a limited | ||
212 | * number of warnings in order not to break users of this | ||
213 | * historical misfeature. | ||
214 | * | ||
215 | * Scheduled for replacement in March 2007 | ||
216 | */ | ||
217 | check_itimerval(value); | ||
218 | |||
153 | switch (which) { | 219 | switch (which) { |
154 | case ITIMER_REAL: | 220 | case ITIMER_REAL: |
155 | again: | 221 | again: |
@@ -226,6 +292,43 @@ again: | |||
226 | return 0; | 292 | return 0; |
227 | } | 293 | } |
228 | 294 | ||
295 | /** | ||
296 | * alarm_setitimer - set alarm in seconds | ||
297 | * | ||
298 | * @seconds: number of seconds until alarm | ||
299 | * 0 disables the alarm | ||
300 | * | ||
301 | * Returns the remaining time in seconds of a pending timer or 0 when | ||
302 | * the timer is not active. | ||
303 | * | ||
304 | * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid | ||
305 | * negative timeval settings which would cause immediate expiry. | ||
306 | */ | ||
307 | unsigned int alarm_setitimer(unsigned int seconds) | ||
308 | { | ||
309 | struct itimerval it_new, it_old; | ||
310 | |||
311 | #if BITS_PER_LONG < 64 | ||
312 | if (seconds > INT_MAX) | ||
313 | seconds = INT_MAX; | ||
314 | #endif | ||
315 | it_new.it_value.tv_sec = seconds; | ||
316 | it_new.it_value.tv_usec = 0; | ||
317 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
318 | |||
319 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
320 | |||
321 | /* | ||
322 | * We can't return 0 if we have an alarm pending ... And we'd | ||
323 | * better return too much than too little anyway | ||
324 | */ | ||
325 | if ((!it_old.it_value.tv_sec && it_old.it_value.tv_usec) || | ||
326 | it_old.it_value.tv_usec >= 500000) | ||
327 | it_old.it_value.tv_sec++; | ||
328 | |||
329 | return it_old.it_value.tv_sec; | ||
330 | } | ||
331 | |||
229 | asmlinkage long sys_setitimer(int which, | 332 | asmlinkage long sys_setitimer(int which, |
230 | struct itimerval __user *value, | 333 | struct itimerval __user *value, |
231 | struct itimerval __user *ovalue) | 334 | struct itimerval __user *ovalue) |
diff --git a/kernel/kthread.c b/kernel/kthread.c index 6a5373868a98..c5f3c6613b6d 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -115,7 +115,9 @@ static void keventd_create_kthread(void *_create) | |||
115 | create->result = ERR_PTR(pid); | 115 | create->result = ERR_PTR(pid); |
116 | } else { | 116 | } else { |
117 | wait_for_completion(&create->started); | 117 | wait_for_completion(&create->started); |
118 | read_lock(&tasklist_lock); | ||
118 | create->result = find_task_by_pid(pid); | 119 | create->result = find_task_by_pid(pid); |
120 | read_unlock(&tasklist_lock); | ||
119 | } | 121 | } |
120 | complete(&create->done); | 122 | complete(&create->done); |
121 | } | 123 | } |
diff --git a/kernel/module.c b/kernel/module.c index 54623c714bba..ddfe45ac2fd1 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -233,24 +233,6 @@ static unsigned long __find_symbol(const char *name, | |||
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | 235 | ||
236 | /* Find a symbol in this elf symbol table */ | ||
237 | static unsigned long find_local_symbol(Elf_Shdr *sechdrs, | ||
238 | unsigned int symindex, | ||
239 | const char *strtab, | ||
240 | const char *name) | ||
241 | { | ||
242 | unsigned int i; | ||
243 | Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; | ||
244 | |||
245 | /* Search (defined) internal symbols first. */ | ||
246 | for (i = 1; i < sechdrs[symindex].sh_size/sizeof(*sym); i++) { | ||
247 | if (sym[i].st_shndx != SHN_UNDEF | ||
248 | && strcmp(name, strtab + sym[i].st_name) == 0) | ||
249 | return sym[i].st_value; | ||
250 | } | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | /* Search for module by name: must hold module_mutex. */ | 236 | /* Search for module by name: must hold module_mutex. */ |
255 | static struct module *find_module(const char *name) | 237 | static struct module *find_module(const char *name) |
256 | { | 238 | { |
@@ -785,139 +767,6 @@ static struct module_attribute *modinfo_attrs[] = { | |||
785 | NULL, | 767 | NULL, |
786 | }; | 768 | }; |
787 | 769 | ||
788 | #ifdef CONFIG_OBSOLETE_MODPARM | ||
789 | /* Bounds checking done below */ | ||
790 | static int obsparm_copy_string(const char *val, struct kernel_param *kp) | ||
791 | { | ||
792 | strcpy(kp->arg, val); | ||
793 | return 0; | ||
794 | } | ||
795 | |||
796 | static int set_obsolete(const char *val, struct kernel_param *kp) | ||
797 | { | ||
798 | unsigned int min, max; | ||
799 | unsigned int size, maxsize; | ||
800 | int dummy; | ||
801 | char *endp; | ||
802 | const char *p; | ||
803 | struct obsolete_modparm *obsparm = kp->arg; | ||
804 | |||
805 | if (!val) { | ||
806 | printk(KERN_ERR "Parameter %s needs an argument\n", kp->name); | ||
807 | return -EINVAL; | ||
808 | } | ||
809 | |||
810 | /* type is: [min[-max]]{b,h,i,l,s} */ | ||
811 | p = obsparm->type; | ||
812 | min = simple_strtol(p, &endp, 10); | ||
813 | if (endp == obsparm->type) | ||
814 | min = max = 1; | ||
815 | else if (*endp == '-') { | ||
816 | p = endp+1; | ||
817 | max = simple_strtol(p, &endp, 10); | ||
818 | } else | ||
819 | max = min; | ||
820 | switch (*endp) { | ||
821 | case 'b': | ||
822 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
823 | 1, param_set_byte, &dummy); | ||
824 | case 'h': | ||
825 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
826 | sizeof(short), param_set_short, &dummy); | ||
827 | case 'i': | ||
828 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
829 | sizeof(int), param_set_int, &dummy); | ||
830 | case 'l': | ||
831 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
832 | sizeof(long), param_set_long, &dummy); | ||
833 | case 's': | ||
834 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
835 | sizeof(char *), param_set_charp, &dummy); | ||
836 | |||
837 | case 'c': | ||
838 | /* Undocumented: 1-5c50 means 1-5 strings of up to 49 chars, | ||
839 | and the decl is "char xxx[5][50];" */ | ||
840 | p = endp+1; | ||
841 | maxsize = simple_strtol(p, &endp, 10); | ||
842 | /* We check lengths here (yes, this is a hack). */ | ||
843 | p = val; | ||
844 | while (p[size = strcspn(p, ",")]) { | ||
845 | if (size >= maxsize) | ||
846 | goto oversize; | ||
847 | p += size+1; | ||
848 | } | ||
849 | if (size >= maxsize) | ||
850 | goto oversize; | ||
851 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
852 | maxsize, obsparm_copy_string, &dummy); | ||
853 | } | ||
854 | printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type); | ||
855 | return -EINVAL; | ||
856 | oversize: | ||
857 | printk(KERN_ERR | ||
858 | "Parameter %s doesn't fit in %u chars.\n", kp->name, maxsize); | ||
859 | return -EINVAL; | ||
860 | } | ||
861 | |||
862 | static int obsolete_params(const char *name, | ||
863 | char *args, | ||
864 | struct obsolete_modparm obsparm[], | ||
865 | unsigned int num, | ||
866 | Elf_Shdr *sechdrs, | ||
867 | unsigned int symindex, | ||
868 | const char *strtab) | ||
869 | { | ||
870 | struct kernel_param *kp; | ||
871 | unsigned int i; | ||
872 | int ret; | ||
873 | |||
874 | kp = kmalloc(sizeof(kp[0]) * num, GFP_KERNEL); | ||
875 | if (!kp) | ||
876 | return -ENOMEM; | ||
877 | |||
878 | for (i = 0; i < num; i++) { | ||
879 | char sym_name[128 + sizeof(MODULE_SYMBOL_PREFIX)]; | ||
880 | |||
881 | snprintf(sym_name, sizeof(sym_name), "%s%s", | ||
882 | MODULE_SYMBOL_PREFIX, obsparm[i].name); | ||
883 | |||
884 | kp[i].name = obsparm[i].name; | ||
885 | kp[i].perm = 000; | ||
886 | kp[i].set = set_obsolete; | ||
887 | kp[i].get = NULL; | ||
888 | obsparm[i].addr | ||
889 | = (void *)find_local_symbol(sechdrs, symindex, strtab, | ||
890 | sym_name); | ||
891 | if (!obsparm[i].addr) { | ||
892 | printk("%s: falsely claims to have parameter %s\n", | ||
893 | name, obsparm[i].name); | ||
894 | ret = -EINVAL; | ||
895 | goto out; | ||
896 | } | ||
897 | kp[i].arg = &obsparm[i]; | ||
898 | } | ||
899 | |||
900 | ret = parse_args(name, args, kp, num, NULL); | ||
901 | out: | ||
902 | kfree(kp); | ||
903 | return ret; | ||
904 | } | ||
905 | #else | ||
906 | static int obsolete_params(const char *name, | ||
907 | char *args, | ||
908 | struct obsolete_modparm obsparm[], | ||
909 | unsigned int num, | ||
910 | Elf_Shdr *sechdrs, | ||
911 | unsigned int symindex, | ||
912 | const char *strtab) | ||
913 | { | ||
914 | if (num != 0) | ||
915 | printk(KERN_WARNING "%s: Ignoring obsolete parameters\n", | ||
916 | name); | ||
917 | return 0; | ||
918 | } | ||
919 | #endif /* CONFIG_OBSOLETE_MODPARM */ | ||
920 | |||
921 | static const char vermagic[] = VERMAGIC_STRING; | 770 | static const char vermagic[] = VERMAGIC_STRING; |
922 | 771 | ||
923 | #ifdef CONFIG_MODVERSIONS | 772 | #ifdef CONFIG_MODVERSIONS |
@@ -1874,27 +1723,17 @@ static struct module *load_module(void __user *umod, | |||
1874 | set_fs(old_fs); | 1723 | set_fs(old_fs); |
1875 | 1724 | ||
1876 | mod->args = args; | 1725 | mod->args = args; |
1877 | if (obsparmindex) { | 1726 | if (obsparmindex) |
1878 | err = obsolete_params(mod->name, mod->args, | 1727 | printk(KERN_WARNING "%s: Ignoring obsolete parameters\n", |
1879 | (struct obsolete_modparm *) | 1728 | mod->name); |
1880 | sechdrs[obsparmindex].sh_addr, | 1729 | |
1881 | sechdrs[obsparmindex].sh_size | 1730 | /* Size of section 0 is 0, so this works well if no params */ |
1882 | / sizeof(struct obsolete_modparm), | 1731 | err = parse_args(mod->name, mod->args, |
1883 | sechdrs, symindex, | 1732 | (struct kernel_param *) |
1884 | (char *)sechdrs[strindex].sh_addr); | 1733 | sechdrs[setupindex].sh_addr, |
1885 | if (setupindex) | 1734 | sechdrs[setupindex].sh_size |
1886 | printk(KERN_WARNING "%s: Ignoring new-style " | 1735 | / sizeof(struct kernel_param), |
1887 | "parameters in presence of obsolete ones\n", | 1736 | NULL); |
1888 | mod->name); | ||
1889 | } else { | ||
1890 | /* Size of section 0 is 0, so this works well if no params */ | ||
1891 | err = parse_args(mod->name, mod->args, | ||
1892 | (struct kernel_param *) | ||
1893 | sechdrs[setupindex].sh_addr, | ||
1894 | sechdrs[setupindex].sh_size | ||
1895 | / sizeof(struct kernel_param), | ||
1896 | NULL); | ||
1897 | } | ||
1898 | if (err < 0) | 1737 | if (err < 0) |
1899 | goto arch_cleanup; | 1738 | goto arch_cleanup; |
1900 | 1739 | ||
diff --git a/kernel/params.c b/kernel/params.c index a29150582310..9de637a5c8bc 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -265,12 +265,12 @@ int param_get_invbool(char *buffer, struct kernel_param *kp) | |||
265 | } | 265 | } |
266 | 266 | ||
267 | /* We cheat here and temporarily mangle the string. */ | 267 | /* We cheat here and temporarily mangle the string. */ |
268 | int param_array(const char *name, | 268 | static int param_array(const char *name, |
269 | const char *val, | 269 | const char *val, |
270 | unsigned int min, unsigned int max, | 270 | unsigned int min, unsigned int max, |
271 | void *elem, int elemsize, | 271 | void *elem, int elemsize, |
272 | int (*set)(const char *, struct kernel_param *kp), | 272 | int (*set)(const char *, struct kernel_param *kp), |
273 | int *num) | 273 | int *num) |
274 | { | 274 | { |
275 | int ret; | 275 | int ret; |
276 | struct kernel_param kp; | 276 | struct kernel_param kp; |
diff --git a/kernel/power/smp.c b/kernel/power/smp.c index 911fc62b8225..5957312b2d68 100644 --- a/kernel/power/smp.c +++ b/kernel/power/smp.c | |||
@@ -49,9 +49,7 @@ void enable_nonboot_cpus(void) | |||
49 | 49 | ||
50 | printk("Thawing cpus ...\n"); | 50 | printk("Thawing cpus ...\n"); |
51 | for_each_cpu_mask(cpu, frozen_cpus) { | 51 | for_each_cpu_mask(cpu, frozen_cpus) { |
52 | error = smp_prepare_cpu(cpu); | 52 | error = cpu_up(cpu); |
53 | if (!error) | ||
54 | error = cpu_up(cpu); | ||
55 | if (!error) { | 53 | if (!error) { |
56 | printk("CPU%d is up\n", cpu); | 54 | printk("CPU%d is up\n", cpu); |
57 | continue; | 55 | continue; |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 9a1fa8894b95..b4b362b5baf5 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -54,15 +54,15 @@ static int verbose; /* Print more debug info. */ | |||
54 | static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ | 54 | static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ |
55 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ | 55 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ |
56 | 56 | ||
57 | MODULE_PARM(nreaders, "i"); | 57 | module_param(nreaders, int, 0); |
58 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); | 58 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); |
59 | MODULE_PARM(stat_interval, "i"); | 59 | module_param(stat_interval, int, 0); |
60 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); | 60 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); |
61 | MODULE_PARM(verbose, "i"); | 61 | module_param(verbose, bool, 0); |
62 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); | 62 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); |
63 | MODULE_PARM(test_no_idle_hz, "i"); | 63 | module_param(test_no_idle_hz, bool, 0); |
64 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); | 64 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); |
65 | MODULE_PARM(shuffle_interval, "i"); | 65 | module_param(shuffle_interval, int, 0); |
66 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); | 66 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); |
67 | #define TORTURE_FLAG "rcutorture: " | 67 | #define TORTURE_FLAG "rcutorture: " |
68 | #define PRINTK_STRING(s) \ | 68 | #define PRINTK_STRING(s) \ |
diff --git a/kernel/softlockup.c b/kernel/softlockup.c index dd9524fa649a..d9b3d5847ed8 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c | |||
@@ -118,6 +118,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
118 | printk("watchdog for %i failed\n", hotcpu); | 118 | printk("watchdog for %i failed\n", hotcpu); |
119 | return NOTIFY_BAD; | 119 | return NOTIFY_BAD; |
120 | } | 120 | } |
121 | per_cpu(touch_timestamp, hotcpu) = jiffies; | ||
121 | per_cpu(watchdog_task, hotcpu) = p; | 122 | per_cpu(watchdog_task, hotcpu) = p; |
122 | kthread_bind(p, hotcpu); | 123 | kthread_bind(p, hotcpu); |
123 | break; | 124 | break; |
diff --git a/kernel/sys.c b/kernel/sys.c index 19d058be49d4..38bc73ede2ba 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -224,18 +224,6 @@ int unregister_reboot_notifier(struct notifier_block * nb) | |||
224 | 224 | ||
225 | EXPORT_SYMBOL(unregister_reboot_notifier); | 225 | EXPORT_SYMBOL(unregister_reboot_notifier); |
226 | 226 | ||
227 | #ifndef CONFIG_SECURITY | ||
228 | int capable(int cap) | ||
229 | { | ||
230 | if (cap_raised(current->cap_effective, cap)) { | ||
231 | current->flags |= PF_SUPERPRIV; | ||
232 | return 1; | ||
233 | } | ||
234 | return 0; | ||
235 | } | ||
236 | EXPORT_SYMBOL(capable); | ||
237 | #endif | ||
238 | |||
239 | static int set_one_prio(struct task_struct *p, int niceval, int error) | 227 | static int set_one_prio(struct task_struct *p, int niceval, int error) |
240 | { | 228 | { |
241 | int no_nice; | 229 | int no_nice; |
@@ -1375,7 +1363,7 @@ static void groups_sort(struct group_info *group_info) | |||
1375 | /* a simple bsearch */ | 1363 | /* a simple bsearch */ |
1376 | int groups_search(struct group_info *group_info, gid_t grp) | 1364 | int groups_search(struct group_info *group_info, gid_t grp) |
1377 | { | 1365 | { |
1378 | int left, right; | 1366 | unsigned int left, right; |
1379 | 1367 | ||
1380 | if (!group_info) | 1368 | if (!group_info) |
1381 | return 0; | 1369 | return 0; |
@@ -1383,7 +1371,7 @@ int groups_search(struct group_info *group_info, gid_t grp) | |||
1383 | left = 0; | 1371 | left = 0; |
1384 | right = group_info->ngroups; | 1372 | right = group_info->ngroups; |
1385 | while (left < right) { | 1373 | while (left < right) { |
1386 | int mid = (left+right)/2; | 1374 | unsigned int mid = (left+right)/2; |
1387 | int cmp = grp - GROUP_AT(group_info, mid); | 1375 | int cmp = grp - GROUP_AT(group_info, mid); |
1388 | if (cmp > 0) | 1376 | if (cmp > 0) |
1389 | left = mid + 1; | 1377 | left = mid + 1; |
@@ -1433,7 +1421,6 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) | |||
1433 | return -EINVAL; | 1421 | return -EINVAL; |
1434 | 1422 | ||
1435 | /* no need to grab task_lock here; it cannot change */ | 1423 | /* no need to grab task_lock here; it cannot change */ |
1436 | get_group_info(current->group_info); | ||
1437 | i = current->group_info->ngroups; | 1424 | i = current->group_info->ngroups; |
1438 | if (gidsetsize) { | 1425 | if (gidsetsize) { |
1439 | if (i > gidsetsize) { | 1426 | if (i > gidsetsize) { |
@@ -1446,7 +1433,6 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) | |||
1446 | } | 1433 | } |
1447 | } | 1434 | } |
1448 | out: | 1435 | out: |
1449 | put_group_info(current->group_info); | ||
1450 | return i; | 1436 | return i; |
1451 | } | 1437 | } |
1452 | 1438 | ||
@@ -1487,9 +1473,7 @@ int in_group_p(gid_t grp) | |||
1487 | { | 1473 | { |
1488 | int retval = 1; | 1474 | int retval = 1; |
1489 | if (grp != current->fsgid) { | 1475 | if (grp != current->fsgid) { |
1490 | get_group_info(current->group_info); | ||
1491 | retval = groups_search(current->group_info, grp); | 1476 | retval = groups_search(current->group_info, grp); |
1492 | put_group_info(current->group_info); | ||
1493 | } | 1477 | } |
1494 | return retval; | 1478 | return retval; |
1495 | } | 1479 | } |
@@ -1500,9 +1484,7 @@ int in_egroup_p(gid_t grp) | |||
1500 | { | 1484 | { |
1501 | int retval = 1; | 1485 | int retval = 1; |
1502 | if (grp != current->egid) { | 1486 | if (grp != current->egid) { |
1503 | get_group_info(current->group_info); | ||
1504 | retval = groups_search(current->group_info, grp); | 1487 | retval = groups_search(current->group_info, grp); |
1505 | put_group_info(current->group_info); | ||
1506 | } | 1488 | } |
1507 | return retval; | 1489 | return retval; |
1508 | } | 1490 | } |
diff --git a/kernel/time.c b/kernel/time.c index 804539165d8b..e00a97b77241 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -202,24 +202,6 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv, | |||
202 | return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); | 202 | return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); |
203 | } | 203 | } |
204 | 204 | ||
205 | long pps_offset; /* pps time offset (us) */ | ||
206 | long pps_jitter = MAXTIME; /* time dispersion (jitter) (us) */ | ||
207 | |||
208 | long pps_freq; /* frequency offset (scaled ppm) */ | ||
209 | long pps_stabil = MAXFREQ; /* frequency dispersion (scaled ppm) */ | ||
210 | |||
211 | long pps_valid = PPS_VALID; /* pps signal watchdog counter */ | ||
212 | |||
213 | int pps_shift = PPS_SHIFT; /* interval duration (s) (shift) */ | ||
214 | |||
215 | long pps_jitcnt; /* jitter limit exceeded */ | ||
216 | long pps_calcnt; /* calibration intervals */ | ||
217 | long pps_errcnt; /* calibration errors */ | ||
218 | long pps_stbcnt; /* stability limit exceeded */ | ||
219 | |||
220 | /* hook for a loadable hardpps kernel module */ | ||
221 | void (*hardpps_ptr)(struct timeval *); | ||
222 | |||
223 | /* we call this to notify the arch when the clock is being | 205 | /* we call this to notify the arch when the clock is being |
224 | * controlled. If no such arch routine, do nothing. | 206 | * controlled. If no such arch routine, do nothing. |
225 | */ | 207 | */ |
@@ -279,7 +261,7 @@ int do_adjtimex(struct timex *txc) | |||
279 | result = -EINVAL; | 261 | result = -EINVAL; |
280 | goto leave; | 262 | goto leave; |
281 | } | 263 | } |
282 | time_freq = txc->freq - pps_freq; | 264 | time_freq = txc->freq; |
283 | } | 265 | } |
284 | 266 | ||
285 | if (txc->modes & ADJ_MAXERROR) { | 267 | if (txc->modes & ADJ_MAXERROR) { |
@@ -312,10 +294,8 @@ int do_adjtimex(struct timex *txc) | |||
312 | if ((time_next_adjust = txc->offset) == 0) | 294 | if ((time_next_adjust = txc->offset) == 0) |
313 | time_adjust = 0; | 295 | time_adjust = 0; |
314 | } | 296 | } |
315 | else if ( time_status & (STA_PLL | STA_PPSTIME) ) { | 297 | else if (time_status & STA_PLL) { |
316 | ltemp = (time_status & (STA_PPSTIME | STA_PPSSIGNAL)) == | 298 | ltemp = txc->offset; |
317 | (STA_PPSTIME | STA_PPSSIGNAL) ? | ||
318 | pps_offset : txc->offset; | ||
319 | 299 | ||
320 | /* | 300 | /* |
321 | * Scale the phase adjustment and | 301 | * Scale the phase adjustment and |
@@ -356,23 +336,14 @@ int do_adjtimex(struct timex *txc) | |||
356 | } | 336 | } |
357 | time_freq = min(time_freq, time_tolerance); | 337 | time_freq = min(time_freq, time_tolerance); |
358 | time_freq = max(time_freq, -time_tolerance); | 338 | time_freq = max(time_freq, -time_tolerance); |
359 | } /* STA_PLL || STA_PPSTIME */ | 339 | } /* STA_PLL */ |
360 | } /* txc->modes & ADJ_OFFSET */ | 340 | } /* txc->modes & ADJ_OFFSET */ |
361 | if (txc->modes & ADJ_TICK) { | 341 | if (txc->modes & ADJ_TICK) { |
362 | tick_usec = txc->tick; | 342 | tick_usec = txc->tick; |
363 | tick_nsec = TICK_USEC_TO_NSEC(tick_usec); | 343 | tick_nsec = TICK_USEC_TO_NSEC(tick_usec); |
364 | } | 344 | } |
365 | } /* txc->modes */ | 345 | } /* txc->modes */ |
366 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | 346 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) |
367 | || ((time_status & (STA_PPSFREQ|STA_PPSTIME)) != 0 | ||
368 | && (time_status & STA_PPSSIGNAL) == 0) | ||
369 | /* p. 24, (b) */ | ||
370 | || ((time_status & (STA_PPSTIME|STA_PPSJITTER)) | ||
371 | == (STA_PPSTIME|STA_PPSJITTER)) | ||
372 | /* p. 24, (c) */ | ||
373 | || ((time_status & STA_PPSFREQ) != 0 | ||
374 | && (time_status & (STA_PPSWANDER|STA_PPSERROR)) != 0)) | ||
375 | /* p. 24, (d) */ | ||
376 | result = TIME_ERROR; | 347 | result = TIME_ERROR; |
377 | 348 | ||
378 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) | 349 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) |
@@ -380,7 +351,7 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | |||
380 | else { | 351 | else { |
381 | txc->offset = shift_right(time_offset, SHIFT_UPDATE); | 352 | txc->offset = shift_right(time_offset, SHIFT_UPDATE); |
382 | } | 353 | } |
383 | txc->freq = time_freq + pps_freq; | 354 | txc->freq = time_freq; |
384 | txc->maxerror = time_maxerror; | 355 | txc->maxerror = time_maxerror; |
385 | txc->esterror = time_esterror; | 356 | txc->esterror = time_esterror; |
386 | txc->status = time_status; | 357 | txc->status = time_status; |
@@ -388,14 +359,16 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | |||
388 | txc->precision = time_precision; | 359 | txc->precision = time_precision; |
389 | txc->tolerance = time_tolerance; | 360 | txc->tolerance = time_tolerance; |
390 | txc->tick = tick_usec; | 361 | txc->tick = tick_usec; |
391 | txc->ppsfreq = pps_freq; | 362 | |
392 | txc->jitter = pps_jitter >> PPS_AVG; | 363 | /* PPS is not implemented, so these are zero */ |
393 | txc->shift = pps_shift; | 364 | txc->ppsfreq = 0; |
394 | txc->stabil = pps_stabil; | 365 | txc->jitter = 0; |
395 | txc->jitcnt = pps_jitcnt; | 366 | txc->shift = 0; |
396 | txc->calcnt = pps_calcnt; | 367 | txc->stabil = 0; |
397 | txc->errcnt = pps_errcnt; | 368 | txc->jitcnt = 0; |
398 | txc->stbcnt = pps_stbcnt; | 369 | txc->calcnt = 0; |
370 | txc->errcnt = 0; | ||
371 | txc->stbcnt = 0; | ||
399 | write_sequnlock_irq(&xtime_lock); | 372 | write_sequnlock_irq(&xtime_lock); |
400 | do_gettimeofday(&txc->time); | 373 | do_gettimeofday(&txc->time); |
401 | notify_arch_cmos_timer(); | 374 | notify_arch_cmos_timer(); |
diff --git a/kernel/timer.c b/kernel/timer.c index 17d956cebcb9..ab189dd187cb 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -697,18 +697,9 @@ static void second_overflow(void) | |||
697 | 697 | ||
698 | /* | 698 | /* |
699 | * Compute the frequency estimate and additional phase adjustment due | 699 | * Compute the frequency estimate and additional phase adjustment due |
700 | * to frequency error for the next second. When the PPS signal is | 700 | * to frequency error for the next second. |
701 | * engaged, gnaw on the watchdog counter and update the frequency | ||
702 | * computed by the pll and the PPS signal. | ||
703 | */ | 701 | */ |
704 | pps_valid++; | 702 | ltemp = time_freq; |
705 | if (pps_valid == PPS_VALID) { /* PPS signal lost */ | ||
706 | pps_jitter = MAXTIME; | ||
707 | pps_stabil = MAXFREQ; | ||
708 | time_status &= ~(STA_PPSSIGNAL | STA_PPSJITTER | | ||
709 | STA_PPSWANDER | STA_PPSERROR); | ||
710 | } | ||
711 | ltemp = time_freq + pps_freq; | ||
712 | time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE)); | 703 | time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE)); |
713 | 704 | ||
714 | #if HZ == 100 | 705 | #if HZ == 100 |
@@ -956,19 +947,7 @@ void do_timer(struct pt_regs *regs) | |||
956 | */ | 947 | */ |
957 | asmlinkage unsigned long sys_alarm(unsigned int seconds) | 948 | asmlinkage unsigned long sys_alarm(unsigned int seconds) |
958 | { | 949 | { |
959 | struct itimerval it_new, it_old; | 950 | return alarm_setitimer(seconds); |
960 | unsigned int oldalarm; | ||
961 | |||
962 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
963 | it_new.it_value.tv_sec = seconds; | ||
964 | it_new.it_value.tv_usec = 0; | ||
965 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
966 | oldalarm = it_old.it_value.tv_sec; | ||
967 | /* ehhh.. We can't return 0 if we have an alarm pending.. */ | ||
968 | /* And we'd better return too much than too little anyway */ | ||
969 | if ((!oldalarm && it_old.it_value.tv_usec) || it_old.it_value.tv_usec >= 500000) | ||
970 | oldalarm++; | ||
971 | return oldalarm; | ||
972 | } | 951 | } |
973 | 952 | ||
974 | #endif | 953 | #endif |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f2618e1c2b93..0bda3c5259f7 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -78,13 +78,17 @@ config SCHEDSTATS | |||
78 | this adds. | 78 | this adds. |
79 | 79 | ||
80 | config DEBUG_SLAB | 80 | config DEBUG_SLAB |
81 | bool "Debug memory allocations" | 81 | bool "Debug slab memory allocations" |
82 | depends on DEBUG_KERNEL && SLAB | 82 | depends on DEBUG_KERNEL && SLAB |
83 | help | 83 | help |
84 | Say Y here to have the kernel do limited verification on memory | 84 | Say Y here to have the kernel do limited verification on memory |
85 | allocation as well as poisoning memory on free to catch use of freed | 85 | allocation as well as poisoning memory on free to catch use of freed |
86 | memory. This can make kmalloc/kfree-intensive workloads much slower. | 86 | memory. This can make kmalloc/kfree-intensive workloads much slower. |
87 | 87 | ||
88 | config DEBUG_SLAB_LEAK | ||
89 | bool "Memory leak debugging" | ||
90 | depends on DEBUG_SLAB | ||
91 | |||
88 | config DEBUG_PREEMPT | 92 | config DEBUG_PREEMPT |
89 | bool "Debug preemptible kernel" | 93 | bool "Debug preemptible kernel" |
90 | depends on DEBUG_KERNEL && PREEMPT | 94 | depends on DEBUG_KERNEL && PREEMPT |
diff --git a/lib/Makefile b/lib/Makefile index 648b2c1242fd..f827e3c24ec0 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -7,6 +7,8 @@ lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \ | |||
7 | idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ | 7 | idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ |
8 | sha1.o | 8 | sha1.o |
9 | 9 | ||
10 | lib-$(CONFIG_SMP) += cpumask.o | ||
11 | |||
10 | lib-y += kobject.o kref.o kobject_uevent.o klist.o | 12 | lib-y += kobject.o kref.o kobject_uevent.o klist.o |
11 | 13 | ||
12 | obj-y += sort.o parser.o halfmd4.o iomap_copy.o | 14 | obj-y += sort.o parser.o halfmd4.o iomap_copy.o |
diff --git a/lib/cpumask.c b/lib/cpumask.c new file mode 100644 index 000000000000..3a67dc5ada7d --- /dev/null +++ b/lib/cpumask.c | |||
@@ -0,0 +1,45 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/bitops.h> | ||
3 | #include <linux/cpumask.h> | ||
4 | #include <linux/module.h> | ||
5 | |||
6 | int __first_cpu(const cpumask_t *srcp) | ||
7 | { | ||
8 | return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS)); | ||
9 | } | ||
10 | EXPORT_SYMBOL(__first_cpu); | ||
11 | |||
12 | int __next_cpu(int n, const cpumask_t *srcp) | ||
13 | { | ||
14 | return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1)); | ||
15 | } | ||
16 | EXPORT_SYMBOL(__next_cpu); | ||
17 | |||
18 | /* | ||
19 | * Find the highest possible smp_processor_id() | ||
20 | * | ||
21 | * Note: if we're prepared to assume that cpu_possible_map never changes | ||
22 | * (reasonable) then this function should cache its return value. | ||
23 | */ | ||
24 | int highest_possible_processor_id(void) | ||
25 | { | ||
26 | unsigned int cpu; | ||
27 | unsigned highest = 0; | ||
28 | |||
29 | for_each_cpu_mask(cpu, cpu_possible_map) | ||
30 | highest = cpu; | ||
31 | return highest; | ||
32 | } | ||
33 | EXPORT_SYMBOL(highest_possible_processor_id); | ||
34 | |||
35 | int __any_online_cpu(const cpumask_t *mask) | ||
36 | { | ||
37 | int cpu; | ||
38 | |||
39 | for_each_cpu_mask(cpu, *mask) { | ||
40 | if (cpu_online(cpu)) | ||
41 | break; | ||
42 | } | ||
43 | return cpu; | ||
44 | } | ||
45 | EXPORT_SYMBOL(__any_online_cpu); | ||
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 1e5b17dc7e3d..7097bb239e40 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #else | 37 | #else |
38 | #define RADIX_TREE_MAP_SHIFT 3 /* For more stressful testing */ | 38 | #define RADIX_TREE_MAP_SHIFT 3 /* For more stressful testing */ |
39 | #endif | 39 | #endif |
40 | #define RADIX_TREE_TAGS 2 | ||
41 | 40 | ||
42 | #define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT) | 41 | #define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT) |
43 | #define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE-1) | 42 | #define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE-1) |
@@ -48,7 +47,7 @@ | |||
48 | struct radix_tree_node { | 47 | struct radix_tree_node { |
49 | unsigned int count; | 48 | unsigned int count; |
50 | void *slots[RADIX_TREE_MAP_SIZE]; | 49 | void *slots[RADIX_TREE_MAP_SIZE]; |
51 | unsigned long tags[RADIX_TREE_TAGS][RADIX_TREE_TAG_LONGS]; | 50 | unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS]; |
52 | }; | 51 | }; |
53 | 52 | ||
54 | struct radix_tree_path { | 53 | struct radix_tree_path { |
@@ -135,17 +134,20 @@ out: | |||
135 | return ret; | 134 | return ret; |
136 | } | 135 | } |
137 | 136 | ||
138 | static inline void tag_set(struct radix_tree_node *node, int tag, int offset) | 137 | static inline void tag_set(struct radix_tree_node *node, unsigned int tag, |
138 | int offset) | ||
139 | { | 139 | { |
140 | __set_bit(offset, node->tags[tag]); | 140 | __set_bit(offset, node->tags[tag]); |
141 | } | 141 | } |
142 | 142 | ||
143 | static inline void tag_clear(struct radix_tree_node *node, int tag, int offset) | 143 | static inline void tag_clear(struct radix_tree_node *node, unsigned int tag, |
144 | int offset) | ||
144 | { | 145 | { |
145 | __clear_bit(offset, node->tags[tag]); | 146 | __clear_bit(offset, node->tags[tag]); |
146 | } | 147 | } |
147 | 148 | ||
148 | static inline int tag_get(struct radix_tree_node *node, int tag, int offset) | 149 | static inline int tag_get(struct radix_tree_node *node, unsigned int tag, |
150 | int offset) | ||
149 | { | 151 | { |
150 | return test_bit(offset, node->tags[tag]); | 152 | return test_bit(offset, node->tags[tag]); |
151 | } | 153 | } |
@@ -154,7 +156,7 @@ static inline int tag_get(struct radix_tree_node *node, int tag, int offset) | |||
154 | * Returns 1 if any slot in the node has this tag set. | 156 | * Returns 1 if any slot in the node has this tag set. |
155 | * Otherwise returns 0. | 157 | * Otherwise returns 0. |
156 | */ | 158 | */ |
157 | static inline int any_tag_set(struct radix_tree_node *node, int tag) | 159 | static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag) |
158 | { | 160 | { |
159 | int idx; | 161 | int idx; |
160 | for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) { | 162 | for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) { |
@@ -180,7 +182,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
180 | { | 182 | { |
181 | struct radix_tree_node *node; | 183 | struct radix_tree_node *node; |
182 | unsigned int height; | 184 | unsigned int height; |
183 | char tags[RADIX_TREE_TAGS]; | 185 | char tags[RADIX_TREE_MAX_TAGS]; |
184 | int tag; | 186 | int tag; |
185 | 187 | ||
186 | /* Figure out what the height should be. */ | 188 | /* Figure out what the height should be. */ |
@@ -197,7 +199,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
197 | * Prepare the tag status of the top-level node for propagation | 199 | * Prepare the tag status of the top-level node for propagation |
198 | * into the newly-pushed top-level node(s) | 200 | * into the newly-pushed top-level node(s) |
199 | */ | 201 | */ |
200 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 202 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
201 | tags[tag] = 0; | 203 | tags[tag] = 0; |
202 | if (any_tag_set(root->rnode, tag)) | 204 | if (any_tag_set(root->rnode, tag)) |
203 | tags[tag] = 1; | 205 | tags[tag] = 1; |
@@ -211,7 +213,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
211 | node->slots[0] = root->rnode; | 213 | node->slots[0] = root->rnode; |
212 | 214 | ||
213 | /* Propagate the aggregated tag info into the new root */ | 215 | /* Propagate the aggregated tag info into the new root */ |
214 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 216 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
215 | if (tags[tag]) | 217 | if (tags[tag]) |
216 | tag_set(node, tag, 0); | 218 | tag_set(node, tag, 0); |
217 | } | 219 | } |
@@ -349,14 +351,15 @@ EXPORT_SYMBOL(radix_tree_lookup); | |||
349 | * @index: index key | 351 | * @index: index key |
350 | * @tag: tag index | 352 | * @tag: tag index |
351 | * | 353 | * |
352 | * Set the search tag corresponging to @index in the radix tree. From | 354 | * Set the search tag (which must be < RADIX_TREE_MAX_TAGS) |
355 | * corresponding to @index in the radix tree. From | ||
353 | * the root all the way down to the leaf node. | 356 | * the root all the way down to the leaf node. |
354 | * | 357 | * |
355 | * Returns the address of the tagged item. Setting a tag on a not-present | 358 | * Returns the address of the tagged item. Setting a tag on a not-present |
356 | * item is a bug. | 359 | * item is a bug. |
357 | */ | 360 | */ |
358 | void *radix_tree_tag_set(struct radix_tree_root *root, | 361 | void *radix_tree_tag_set(struct radix_tree_root *root, |
359 | unsigned long index, int tag) | 362 | unsigned long index, unsigned int tag) |
360 | { | 363 | { |
361 | unsigned int height, shift; | 364 | unsigned int height, shift; |
362 | struct radix_tree_node *slot; | 365 | struct radix_tree_node *slot; |
@@ -390,7 +393,8 @@ EXPORT_SYMBOL(radix_tree_tag_set); | |||
390 | * @index: index key | 393 | * @index: index key |
391 | * @tag: tag index | 394 | * @tag: tag index |
392 | * | 395 | * |
393 | * Clear the search tag corresponging to @index in the radix tree. If | 396 | * Clear the search tag (which must be < RADIX_TREE_MAX_TAGS) |
397 | * corresponding to @index in the radix tree. If | ||
394 | * this causes the leaf node to have no tags set then clear the tag in the | 398 | * this causes the leaf node to have no tags set then clear the tag in the |
395 | * next-to-leaf node, etc. | 399 | * next-to-leaf node, etc. |
396 | * | 400 | * |
@@ -398,7 +402,7 @@ EXPORT_SYMBOL(radix_tree_tag_set); | |||
398 | * has the same return value and semantics as radix_tree_lookup(). | 402 | * has the same return value and semantics as radix_tree_lookup(). |
399 | */ | 403 | */ |
400 | void *radix_tree_tag_clear(struct radix_tree_root *root, | 404 | void *radix_tree_tag_clear(struct radix_tree_root *root, |
401 | unsigned long index, int tag) | 405 | unsigned long index, unsigned int tag) |
402 | { | 406 | { |
403 | struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path; | 407 | struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path; |
404 | struct radix_tree_node *slot; | 408 | struct radix_tree_node *slot; |
@@ -450,7 +454,7 @@ EXPORT_SYMBOL(radix_tree_tag_clear); | |||
450 | * radix_tree_tag_get - get a tag on a radix tree node | 454 | * radix_tree_tag_get - get a tag on a radix tree node |
451 | * @root: radix tree root | 455 | * @root: radix tree root |
452 | * @index: index key | 456 | * @index: index key |
453 | * @tag: tag index | 457 | * @tag: tag index (< RADIX_TREE_MAX_TAGS) |
454 | * | 458 | * |
455 | * Return values: | 459 | * Return values: |
456 | * | 460 | * |
@@ -459,7 +463,7 @@ EXPORT_SYMBOL(radix_tree_tag_clear); | |||
459 | * -1: tag present, unset | 463 | * -1: tag present, unset |
460 | */ | 464 | */ |
461 | int radix_tree_tag_get(struct radix_tree_root *root, | 465 | int radix_tree_tag_get(struct radix_tree_root *root, |
462 | unsigned long index, int tag) | 466 | unsigned long index, unsigned int tag) |
463 | { | 467 | { |
464 | unsigned int height, shift; | 468 | unsigned int height, shift; |
465 | struct radix_tree_node *slot; | 469 | struct radix_tree_node *slot; |
@@ -592,7 +596,7 @@ EXPORT_SYMBOL(radix_tree_gang_lookup); | |||
592 | */ | 596 | */ |
593 | static unsigned int | 597 | static unsigned int |
594 | __lookup_tag(struct radix_tree_root *root, void **results, unsigned long index, | 598 | __lookup_tag(struct radix_tree_root *root, void **results, unsigned long index, |
595 | unsigned int max_items, unsigned long *next_index, int tag) | 599 | unsigned int max_items, unsigned long *next_index, unsigned int tag) |
596 | { | 600 | { |
597 | unsigned int nr_found = 0; | 601 | unsigned int nr_found = 0; |
598 | unsigned int shift; | 602 | unsigned int shift; |
@@ -646,7 +650,7 @@ out: | |||
646 | * @results: where the results of the lookup are placed | 650 | * @results: where the results of the lookup are placed |
647 | * @first_index: start the lookup from this key | 651 | * @first_index: start the lookup from this key |
648 | * @max_items: place up to this many items at *results | 652 | * @max_items: place up to this many items at *results |
649 | * @tag: the tag index | 653 | * @tag: the tag index (< RADIX_TREE_MAX_TAGS) |
650 | * | 654 | * |
651 | * Performs an index-ascending scan of the tree for present items which | 655 | * Performs an index-ascending scan of the tree for present items which |
652 | * have the tag indexed by @tag set. Places the items at *@results and | 656 | * have the tag indexed by @tag set. Places the items at *@results and |
@@ -654,7 +658,8 @@ out: | |||
654 | */ | 658 | */ |
655 | unsigned int | 659 | unsigned int |
656 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | 660 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
657 | unsigned long first_index, unsigned int max_items, int tag) | 661 | unsigned long first_index, unsigned int max_items, |
662 | unsigned int tag) | ||
658 | { | 663 | { |
659 | const unsigned long max_index = radix_tree_maxindex(root->height); | 664 | const unsigned long max_index = radix_tree_maxindex(root->height); |
660 | unsigned long cur_index = first_index; | 665 | unsigned long cur_index = first_index; |
@@ -716,7 +721,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
716 | struct radix_tree_node *slot; | 721 | struct radix_tree_node *slot; |
717 | unsigned int height, shift; | 722 | unsigned int height, shift; |
718 | void *ret = NULL; | 723 | void *ret = NULL; |
719 | char tags[RADIX_TREE_TAGS]; | 724 | char tags[RADIX_TREE_MAX_TAGS]; |
720 | int nr_cleared_tags; | 725 | int nr_cleared_tags; |
721 | int tag; | 726 | int tag; |
722 | int offset; | 727 | int offset; |
@@ -751,7 +756,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
751 | * Clear all tags associated with the just-deleted item | 756 | * Clear all tags associated with the just-deleted item |
752 | */ | 757 | */ |
753 | nr_cleared_tags = 0; | 758 | nr_cleared_tags = 0; |
754 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 759 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
755 | tags[tag] = 1; | 760 | tags[tag] = 1; |
756 | if (tag_get(pathp->node, tag, pathp->offset)) { | 761 | if (tag_get(pathp->node, tag, pathp->offset)) { |
757 | tag_clear(pathp->node, tag, pathp->offset); | 762 | tag_clear(pathp->node, tag, pathp->offset); |
@@ -763,7 +768,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
763 | } | 768 | } |
764 | 769 | ||
765 | for (pathp--; nr_cleared_tags && pathp->node; pathp--) { | 770 | for (pathp--; nr_cleared_tags && pathp->node; pathp--) { |
766 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 771 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
767 | if (tags[tag]) | 772 | if (tags[tag]) |
768 | continue; | 773 | continue; |
769 | 774 | ||
@@ -801,7 +806,7 @@ EXPORT_SYMBOL(radix_tree_delete); | |||
801 | * @root: radix tree root | 806 | * @root: radix tree root |
802 | * @tag: tag to test | 807 | * @tag: tag to test |
803 | */ | 808 | */ |
804 | int radix_tree_tagged(struct radix_tree_root *root, int tag) | 809 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag) |
805 | { | 810 | { |
806 | struct radix_tree_node *rnode; | 811 | struct radix_tree_node *rnode; |
807 | rnode = root->rnode; | 812 | rnode = root->rnode; |
diff --git a/mm/Kconfig b/mm/Kconfig index bd80460360db..332f5c29b53a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -138,8 +138,8 @@ config SPLIT_PTLOCK_CPUS | |||
138 | # | 138 | # |
139 | config MIGRATION | 139 | config MIGRATION |
140 | bool "Page migration" | 140 | bool "Page migration" |
141 | def_bool y if NUMA || SPARSEMEM || DISCONTIGMEM | 141 | def_bool y if NUMA |
142 | depends on SWAP | 142 | depends on SWAP && NUMA |
143 | help | 143 | help |
144 | Allows the migration of the physical location of pages of processes | 144 | Allows the migration of the physical location of pages of processes |
145 | while the virtual addresses are not changed. This is useful for | 145 | while the virtual addresses are not changed. This is useful for |
@@ -1040,12 +1040,11 @@ munmap_back: | |||
1040 | * specific mapper. the address has already been validated, but | 1040 | * specific mapper. the address has already been validated, but |
1041 | * not unmapped, but the maps are removed from the list. | 1041 | * not unmapped, but the maps are removed from the list. |
1042 | */ | 1042 | */ |
1043 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 1043 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
1044 | if (!vma) { | 1044 | if (!vma) { |
1045 | error = -ENOMEM; | 1045 | error = -ENOMEM; |
1046 | goto unacct_error; | 1046 | goto unacct_error; |
1047 | } | 1047 | } |
1048 | memset(vma, 0, sizeof(*vma)); | ||
1049 | 1048 | ||
1050 | vma->vm_mm = mm; | 1049 | vma->vm_mm = mm; |
1051 | vma->vm_start = addr; | 1050 | vma->vm_start = addr; |
@@ -1896,12 +1895,11 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
1896 | /* | 1895 | /* |
1897 | * create a vma struct for an anonymous mapping | 1896 | * create a vma struct for an anonymous mapping |
1898 | */ | 1897 | */ |
1899 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 1898 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
1900 | if (!vma) { | 1899 | if (!vma) { |
1901 | vm_unacct_memory(len >> PAGE_SHIFT); | 1900 | vm_unacct_memory(len >> PAGE_SHIFT); |
1902 | return -ENOMEM; | 1901 | return -ENOMEM; |
1903 | } | 1902 | } |
1904 | memset(vma, 0, sizeof(*vma)); | ||
1905 | 1903 | ||
1906 | vma->vm_mm = mm; | 1904 | vma->vm_mm = mm; |
1907 | vma->vm_start = addr; | 1905 | vma->vm_start = addr; |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a5c3f8bd98ae..338a02bb004d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2029,8 +2029,9 @@ static __meminit void zone_pcp_init(struct zone *zone) | |||
2029 | setup_pageset(zone_pcp(zone,cpu), batch); | 2029 | setup_pageset(zone_pcp(zone,cpu), batch); |
2030 | #endif | 2030 | #endif |
2031 | } | 2031 | } |
2032 | printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", | 2032 | if (zone->present_pages) |
2033 | zone->name, zone->present_pages, batch); | 2033 | printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", |
2034 | zone->name, zone->present_pages, batch); | ||
2034 | } | 2035 | } |
2035 | 2036 | ||
2036 | static __meminit void init_currently_empty_zone(struct zone *zone, | 2037 | static __meminit void init_currently_empty_zone(struct zone *zone, |
@@ -2701,8 +2702,7 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
2701 | else | 2702 | else |
2702 | numentries <<= (PAGE_SHIFT - scale); | 2703 | numentries <<= (PAGE_SHIFT - scale); |
2703 | } | 2704 | } |
2704 | /* rounded up to nearest power of 2 in size */ | 2705 | numentries = roundup_pow_of_two(numentries); |
2705 | numentries = 1UL << (long_log2(numentries) + 1); | ||
2706 | 2706 | ||
2707 | /* limit allocation size to 1/16 total memory by default */ | 2707 | /* limit allocation size to 1/16 total memory by default */ |
2708 | if (max == 0) { | 2708 | if (max == 0) { |
@@ -204,7 +204,8 @@ | |||
204 | typedef unsigned int kmem_bufctl_t; | 204 | typedef unsigned int kmem_bufctl_t; |
205 | #define BUFCTL_END (((kmem_bufctl_t)(~0U))-0) | 205 | #define BUFCTL_END (((kmem_bufctl_t)(~0U))-0) |
206 | #define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1) | 206 | #define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1) |
207 | #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-2) | 207 | #define BUFCTL_ACTIVE (((kmem_bufctl_t)(~0U))-2) |
208 | #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-3) | ||
208 | 209 | ||
209 | /* Max number of objs-per-slab for caches which use off-slab slabs. | 210 | /* Max number of objs-per-slab for caches which use off-slab slabs. |
210 | * Needed to avoid a possible looping condition in cache_grow(). | 211 | * Needed to avoid a possible looping condition in cache_grow(). |
@@ -897,6 +898,30 @@ static struct array_cache *alloc_arraycache(int node, int entries, | |||
897 | return nc; | 898 | return nc; |
898 | } | 899 | } |
899 | 900 | ||
901 | /* | ||
902 | * Transfer objects in one arraycache to another. | ||
903 | * Locking must be handled by the caller. | ||
904 | * | ||
905 | * Return the number of entries transferred. | ||
906 | */ | ||
907 | static int transfer_objects(struct array_cache *to, | ||
908 | struct array_cache *from, unsigned int max) | ||
909 | { | ||
910 | /* Figure out how many entries to transfer */ | ||
911 | int nr = min(min(from->avail, max), to->limit - to->avail); | ||
912 | |||
913 | if (!nr) | ||
914 | return 0; | ||
915 | |||
916 | memcpy(to->entry + to->avail, from->entry + from->avail -nr, | ||
917 | sizeof(void *) *nr); | ||
918 | |||
919 | from->avail -= nr; | ||
920 | to->avail += nr; | ||
921 | to->touched = 1; | ||
922 | return nr; | ||
923 | } | ||
924 | |||
900 | #ifdef CONFIG_NUMA | 925 | #ifdef CONFIG_NUMA |
901 | static void *__cache_alloc_node(struct kmem_cache *, gfp_t, int); | 926 | static void *__cache_alloc_node(struct kmem_cache *, gfp_t, int); |
902 | static void *alternate_node_alloc(struct kmem_cache *, gfp_t); | 927 | static void *alternate_node_alloc(struct kmem_cache *, gfp_t); |
@@ -946,6 +971,13 @@ static void __drain_alien_cache(struct kmem_cache *cachep, | |||
946 | 971 | ||
947 | if (ac->avail) { | 972 | if (ac->avail) { |
948 | spin_lock(&rl3->list_lock); | 973 | spin_lock(&rl3->list_lock); |
974 | /* | ||
975 | * Stuff objects into the remote nodes shared array first. | ||
976 | * That way we could avoid the overhead of putting the objects | ||
977 | * into the free lists and getting them back later. | ||
978 | */ | ||
979 | transfer_objects(rl3->shared, ac, ac->limit); | ||
980 | |||
949 | free_block(cachep, ac->entry, ac->avail, node); | 981 | free_block(cachep, ac->entry, ac->avail, node); |
950 | ac->avail = 0; | 982 | ac->avail = 0; |
951 | spin_unlock(&rl3->list_lock); | 983 | spin_unlock(&rl3->list_lock); |
@@ -961,8 +993,8 @@ static void reap_alien(struct kmem_cache *cachep, struct kmem_list3 *l3) | |||
961 | 993 | ||
962 | if (l3->alien) { | 994 | if (l3->alien) { |
963 | struct array_cache *ac = l3->alien[node]; | 995 | struct array_cache *ac = l3->alien[node]; |
964 | if (ac && ac->avail) { | 996 | |
965 | spin_lock_irq(&ac->lock); | 997 | if (ac && ac->avail && spin_trylock_irq(&ac->lock)) { |
966 | __drain_alien_cache(cachep, ac, node); | 998 | __drain_alien_cache(cachep, ac, node); |
967 | spin_unlock_irq(&ac->lock); | 999 | spin_unlock_irq(&ac->lock); |
968 | } | 1000 | } |
@@ -1989,10 +2021,9 @@ kmem_cache_create (const char *name, size_t size, size_t align, | |||
1989 | align = ralign; | 2021 | align = ralign; |
1990 | 2022 | ||
1991 | /* Get cache's description obj. */ | 2023 | /* Get cache's description obj. */ |
1992 | cachep = kmem_cache_alloc(&cache_cache, SLAB_KERNEL); | 2024 | cachep = kmem_cache_zalloc(&cache_cache, SLAB_KERNEL); |
1993 | if (!cachep) | 2025 | if (!cachep) |
1994 | goto oops; | 2026 | goto oops; |
1995 | memset(cachep, 0, sizeof(struct kmem_cache)); | ||
1996 | 2027 | ||
1997 | #if DEBUG | 2028 | #if DEBUG |
1998 | cachep->obj_size = size; | 2029 | cachep->obj_size = size; |
@@ -2399,7 +2430,7 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp, | |||
2399 | /* Verify that the slab belongs to the intended node */ | 2430 | /* Verify that the slab belongs to the intended node */ |
2400 | WARN_ON(slabp->nodeid != nodeid); | 2431 | WARN_ON(slabp->nodeid != nodeid); |
2401 | 2432 | ||
2402 | if (slab_bufctl(slabp)[objnr] != BUFCTL_FREE) { | 2433 | if (slab_bufctl(slabp)[objnr] + 1 <= SLAB_LIMIT + 1) { |
2403 | printk(KERN_ERR "slab: double free detected in cache " | 2434 | printk(KERN_ERR "slab: double free detected in cache " |
2404 | "'%s', objp %p\n", cachep->name, objp); | 2435 | "'%s', objp %p\n", cachep->name, objp); |
2405 | BUG(); | 2436 | BUG(); |
@@ -2605,6 +2636,9 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp, | |||
2605 | */ | 2636 | */ |
2606 | cachep->dtor(objp + obj_offset(cachep), cachep, 0); | 2637 | cachep->dtor(objp + obj_offset(cachep), cachep, 0); |
2607 | } | 2638 | } |
2639 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
2640 | slab_bufctl(slabp)[objnr] = BUFCTL_FREE; | ||
2641 | #endif | ||
2608 | if (cachep->flags & SLAB_POISON) { | 2642 | if (cachep->flags & SLAB_POISON) { |
2609 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2643 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2610 | if ((cachep->buffer_size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) { | 2644 | if ((cachep->buffer_size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) { |
@@ -2677,20 +2711,10 @@ retry: | |||
2677 | BUG_ON(ac->avail > 0 || !l3); | 2711 | BUG_ON(ac->avail > 0 || !l3); |
2678 | spin_lock(&l3->list_lock); | 2712 | spin_lock(&l3->list_lock); |
2679 | 2713 | ||
2680 | if (l3->shared) { | 2714 | /* See if we can refill from the shared array */ |
2681 | struct array_cache *shared_array = l3->shared; | 2715 | if (l3->shared && transfer_objects(ac, l3->shared, batchcount)) |
2682 | if (shared_array->avail) { | 2716 | goto alloc_done; |
2683 | if (batchcount > shared_array->avail) | 2717 | |
2684 | batchcount = shared_array->avail; | ||
2685 | shared_array->avail -= batchcount; | ||
2686 | ac->avail = batchcount; | ||
2687 | memcpy(ac->entry, | ||
2688 | &(shared_array->entry[shared_array->avail]), | ||
2689 | sizeof(void *) * batchcount); | ||
2690 | shared_array->touched = 1; | ||
2691 | goto alloc_done; | ||
2692 | } | ||
2693 | } | ||
2694 | while (batchcount > 0) { | 2718 | while (batchcount > 0) { |
2695 | struct list_head *entry; | 2719 | struct list_head *entry; |
2696 | struct slab *slabp; | 2720 | struct slab *slabp; |
@@ -2788,6 +2812,16 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
2788 | *dbg_redzone1(cachep, objp) = RED_ACTIVE; | 2812 | *dbg_redzone1(cachep, objp) = RED_ACTIVE; |
2789 | *dbg_redzone2(cachep, objp) = RED_ACTIVE; | 2813 | *dbg_redzone2(cachep, objp) = RED_ACTIVE; |
2790 | } | 2814 | } |
2815 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
2816 | { | ||
2817 | struct slab *slabp; | ||
2818 | unsigned objnr; | ||
2819 | |||
2820 | slabp = page_get_slab(virt_to_page(objp)); | ||
2821 | objnr = (unsigned)(objp - slabp->s_mem) / cachep->buffer_size; | ||
2822 | slab_bufctl(slabp)[objnr] = BUFCTL_ACTIVE; | ||
2823 | } | ||
2824 | #endif | ||
2791 | objp += obj_offset(cachep); | 2825 | objp += obj_offset(cachep); |
2792 | if (cachep->ctor && cachep->flags & SLAB_POISON) { | 2826 | if (cachep->ctor && cachep->flags & SLAB_POISON) { |
2793 | unsigned long ctor_flags = SLAB_CTOR_CONSTRUCTOR; | 2827 | unsigned long ctor_flags = SLAB_CTOR_CONSTRUCTOR; |
@@ -3094,6 +3128,23 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) | |||
3094 | EXPORT_SYMBOL(kmem_cache_alloc); | 3128 | EXPORT_SYMBOL(kmem_cache_alloc); |
3095 | 3129 | ||
3096 | /** | 3130 | /** |
3131 | * kmem_cache_alloc - Allocate an object. The memory is set to zero. | ||
3132 | * @cache: The cache to allocate from. | ||
3133 | * @flags: See kmalloc(). | ||
3134 | * | ||
3135 | * Allocate an object from this cache and set the allocated memory to zero. | ||
3136 | * The flags are only relevant if the cache has no available objects. | ||
3137 | */ | ||
3138 | void *kmem_cache_zalloc(struct kmem_cache *cache, gfp_t flags) | ||
3139 | { | ||
3140 | void *ret = __cache_alloc(cache, flags, __builtin_return_address(0)); | ||
3141 | if (ret) | ||
3142 | memset(ret, 0, obj_size(cache)); | ||
3143 | return ret; | ||
3144 | } | ||
3145 | EXPORT_SYMBOL(kmem_cache_zalloc); | ||
3146 | |||
3147 | /** | ||
3097 | * kmem_ptr_validate - check if an untrusted pointer might | 3148 | * kmem_ptr_validate - check if an untrusted pointer might |
3098 | * be a slab entry. | 3149 | * be a slab entry. |
3099 | * @cachep: the cache we're checking against | 3150 | * @cachep: the cache we're checking against |
@@ -3220,22 +3271,23 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags, | |||
3220 | return __cache_alloc(cachep, flags, caller); | 3271 | return __cache_alloc(cachep, flags, caller); |
3221 | } | 3272 | } |
3222 | 3273 | ||
3223 | #ifndef CONFIG_DEBUG_SLAB | ||
3224 | 3274 | ||
3225 | void *__kmalloc(size_t size, gfp_t flags) | 3275 | void *__kmalloc(size_t size, gfp_t flags) |
3226 | { | 3276 | { |
3277 | #ifndef CONFIG_DEBUG_SLAB | ||
3227 | return __do_kmalloc(size, flags, NULL); | 3278 | return __do_kmalloc(size, flags, NULL); |
3279 | #else | ||
3280 | return __do_kmalloc(size, flags, __builtin_return_address(0)); | ||
3281 | #endif | ||
3228 | } | 3282 | } |
3229 | EXPORT_SYMBOL(__kmalloc); | 3283 | EXPORT_SYMBOL(__kmalloc); |
3230 | 3284 | ||
3231 | #else | 3285 | #ifdef CONFIG_DEBUG_SLAB |
3232 | |||
3233 | void *__kmalloc_track_caller(size_t size, gfp_t flags, void *caller) | 3286 | void *__kmalloc_track_caller(size_t size, gfp_t flags, void *caller) |
3234 | { | 3287 | { |
3235 | return __do_kmalloc(size, flags, caller); | 3288 | return __do_kmalloc(size, flags, caller); |
3236 | } | 3289 | } |
3237 | EXPORT_SYMBOL(__kmalloc_track_caller); | 3290 | EXPORT_SYMBOL(__kmalloc_track_caller); |
3238 | |||
3239 | #endif | 3291 | #endif |
3240 | 3292 | ||
3241 | #ifdef CONFIG_SMP | 3293 | #ifdef CONFIG_SMP |
@@ -3366,63 +3418,86 @@ const char *kmem_cache_name(struct kmem_cache *cachep) | |||
3366 | EXPORT_SYMBOL_GPL(kmem_cache_name); | 3418 | EXPORT_SYMBOL_GPL(kmem_cache_name); |
3367 | 3419 | ||
3368 | /* | 3420 | /* |
3369 | * This initializes kmem_list3 for all nodes. | 3421 | * This initializes kmem_list3 or resizes varioius caches for all nodes. |
3370 | */ | 3422 | */ |
3371 | static int alloc_kmemlist(struct kmem_cache *cachep) | 3423 | static int alloc_kmemlist(struct kmem_cache *cachep) |
3372 | { | 3424 | { |
3373 | int node; | 3425 | int node; |
3374 | struct kmem_list3 *l3; | 3426 | struct kmem_list3 *l3; |
3375 | int err = 0; | 3427 | struct array_cache *new_shared; |
3428 | struct array_cache **new_alien; | ||
3376 | 3429 | ||
3377 | for_each_online_node(node) { | 3430 | for_each_online_node(node) { |
3378 | struct array_cache *nc = NULL, *new; | 3431 | |
3379 | struct array_cache **new_alien = NULL; | ||
3380 | #ifdef CONFIG_NUMA | ||
3381 | new_alien = alloc_alien_cache(node, cachep->limit); | 3432 | new_alien = alloc_alien_cache(node, cachep->limit); |
3382 | if (!new_alien) | 3433 | if (!new_alien) |
3383 | goto fail; | 3434 | goto fail; |
3384 | #endif | 3435 | |
3385 | new = alloc_arraycache(node, cachep->shared*cachep->batchcount, | 3436 | new_shared = alloc_arraycache(node, |
3437 | cachep->shared*cachep->batchcount, | ||
3386 | 0xbaadf00d); | 3438 | 0xbaadf00d); |
3387 | if (!new) | 3439 | if (!new_shared) { |
3440 | free_alien_cache(new_alien); | ||
3388 | goto fail; | 3441 | goto fail; |
3442 | } | ||
3443 | |||
3389 | l3 = cachep->nodelists[node]; | 3444 | l3 = cachep->nodelists[node]; |
3390 | if (l3) { | 3445 | if (l3) { |
3446 | struct array_cache *shared = l3->shared; | ||
3447 | |||
3391 | spin_lock_irq(&l3->list_lock); | 3448 | spin_lock_irq(&l3->list_lock); |
3392 | 3449 | ||
3393 | nc = cachep->nodelists[node]->shared; | 3450 | if (shared) |
3394 | if (nc) | 3451 | free_block(cachep, shared->entry, |
3395 | free_block(cachep, nc->entry, nc->avail, node); | 3452 | shared->avail, node); |
3396 | 3453 | ||
3397 | l3->shared = new; | 3454 | l3->shared = new_shared; |
3398 | if (!cachep->nodelists[node]->alien) { | 3455 | if (!l3->alien) { |
3399 | l3->alien = new_alien; | 3456 | l3->alien = new_alien; |
3400 | new_alien = NULL; | 3457 | new_alien = NULL; |
3401 | } | 3458 | } |
3402 | l3->free_limit = (1 + nr_cpus_node(node)) * | 3459 | l3->free_limit = (1 + nr_cpus_node(node)) * |
3403 | cachep->batchcount + cachep->num; | 3460 | cachep->batchcount + cachep->num; |
3404 | spin_unlock_irq(&l3->list_lock); | 3461 | spin_unlock_irq(&l3->list_lock); |
3405 | kfree(nc); | 3462 | kfree(shared); |
3406 | free_alien_cache(new_alien); | 3463 | free_alien_cache(new_alien); |
3407 | continue; | 3464 | continue; |
3408 | } | 3465 | } |
3409 | l3 = kmalloc_node(sizeof(struct kmem_list3), GFP_KERNEL, node); | 3466 | l3 = kmalloc_node(sizeof(struct kmem_list3), GFP_KERNEL, node); |
3410 | if (!l3) | 3467 | if (!l3) { |
3468 | free_alien_cache(new_alien); | ||
3469 | kfree(new_shared); | ||
3411 | goto fail; | 3470 | goto fail; |
3471 | } | ||
3412 | 3472 | ||
3413 | kmem_list3_init(l3); | 3473 | kmem_list3_init(l3); |
3414 | l3->next_reap = jiffies + REAPTIMEOUT_LIST3 + | 3474 | l3->next_reap = jiffies + REAPTIMEOUT_LIST3 + |
3415 | ((unsigned long)cachep) % REAPTIMEOUT_LIST3; | 3475 | ((unsigned long)cachep) % REAPTIMEOUT_LIST3; |
3416 | l3->shared = new; | 3476 | l3->shared = new_shared; |
3417 | l3->alien = new_alien; | 3477 | l3->alien = new_alien; |
3418 | l3->free_limit = (1 + nr_cpus_node(node)) * | 3478 | l3->free_limit = (1 + nr_cpus_node(node)) * |
3419 | cachep->batchcount + cachep->num; | 3479 | cachep->batchcount + cachep->num; |
3420 | cachep->nodelists[node] = l3; | 3480 | cachep->nodelists[node] = l3; |
3421 | } | 3481 | } |
3422 | return err; | 3482 | return 0; |
3483 | |||
3423 | fail: | 3484 | fail: |
3424 | err = -ENOMEM; | 3485 | if (!cachep->next.next) { |
3425 | return err; | 3486 | /* Cache is not active yet. Roll back what we did */ |
3487 | node--; | ||
3488 | while (node >= 0) { | ||
3489 | if (cachep->nodelists[node]) { | ||
3490 | l3 = cachep->nodelists[node]; | ||
3491 | |||
3492 | kfree(l3->shared); | ||
3493 | free_alien_cache(l3->alien); | ||
3494 | kfree(l3); | ||
3495 | cachep->nodelists[node] = NULL; | ||
3496 | } | ||
3497 | node--; | ||
3498 | } | ||
3499 | } | ||
3500 | return -ENOMEM; | ||
3426 | } | 3501 | } |
3427 | 3502 | ||
3428 | struct ccupdate_struct { | 3503 | struct ccupdate_struct { |
@@ -3899,6 +3974,159 @@ ssize_t slabinfo_write(struct file *file, const char __user * buffer, | |||
3899 | res = count; | 3974 | res = count; |
3900 | return res; | 3975 | return res; |
3901 | } | 3976 | } |
3977 | |||
3978 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
3979 | |||
3980 | static void *leaks_start(struct seq_file *m, loff_t *pos) | ||
3981 | { | ||
3982 | loff_t n = *pos; | ||
3983 | struct list_head *p; | ||
3984 | |||
3985 | mutex_lock(&cache_chain_mutex); | ||
3986 | p = cache_chain.next; | ||
3987 | while (n--) { | ||
3988 | p = p->next; | ||
3989 | if (p == &cache_chain) | ||
3990 | return NULL; | ||
3991 | } | ||
3992 | return list_entry(p, struct kmem_cache, next); | ||
3993 | } | ||
3994 | |||
3995 | static inline int add_caller(unsigned long *n, unsigned long v) | ||
3996 | { | ||
3997 | unsigned long *p; | ||
3998 | int l; | ||
3999 | if (!v) | ||
4000 | return 1; | ||
4001 | l = n[1]; | ||
4002 | p = n + 2; | ||
4003 | while (l) { | ||
4004 | int i = l/2; | ||
4005 | unsigned long *q = p + 2 * i; | ||
4006 | if (*q == v) { | ||
4007 | q[1]++; | ||
4008 | return 1; | ||
4009 | } | ||
4010 | if (*q > v) { | ||
4011 | l = i; | ||
4012 | } else { | ||
4013 | p = q + 2; | ||
4014 | l -= i + 1; | ||
4015 | } | ||
4016 | } | ||
4017 | if (++n[1] == n[0]) | ||
4018 | return 0; | ||
4019 | memmove(p + 2, p, n[1] * 2 * sizeof(unsigned long) - ((void *)p - (void *)n)); | ||
4020 | p[0] = v; | ||
4021 | p[1] = 1; | ||
4022 | return 1; | ||
4023 | } | ||
4024 | |||
4025 | static void handle_slab(unsigned long *n, struct kmem_cache *c, struct slab *s) | ||
4026 | { | ||
4027 | void *p; | ||
4028 | int i; | ||
4029 | if (n[0] == n[1]) | ||
4030 | return; | ||
4031 | for (i = 0, p = s->s_mem; i < c->num; i++, p += c->buffer_size) { | ||
4032 | if (slab_bufctl(s)[i] != BUFCTL_ACTIVE) | ||
4033 | continue; | ||
4034 | if (!add_caller(n, (unsigned long)*dbg_userword(c, p))) | ||
4035 | return; | ||
4036 | } | ||
4037 | } | ||
4038 | |||
4039 | static void show_symbol(struct seq_file *m, unsigned long address) | ||
4040 | { | ||
4041 | #ifdef CONFIG_KALLSYMS | ||
4042 | char *modname; | ||
4043 | const char *name; | ||
4044 | unsigned long offset, size; | ||
4045 | char namebuf[KSYM_NAME_LEN+1]; | ||
4046 | |||
4047 | name = kallsyms_lookup(address, &size, &offset, &modname, namebuf); | ||
4048 | |||
4049 | if (name) { | ||
4050 | seq_printf(m, "%s+%#lx/%#lx", name, offset, size); | ||
4051 | if (modname) | ||
4052 | seq_printf(m, " [%s]", modname); | ||
4053 | return; | ||
4054 | } | ||
4055 | #endif | ||
4056 | seq_printf(m, "%p", (void *)address); | ||
4057 | } | ||
4058 | |||
4059 | static int leaks_show(struct seq_file *m, void *p) | ||
4060 | { | ||
4061 | struct kmem_cache *cachep = p; | ||
4062 | struct list_head *q; | ||
4063 | struct slab *slabp; | ||
4064 | struct kmem_list3 *l3; | ||
4065 | const char *name; | ||
4066 | unsigned long *n = m->private; | ||
4067 | int node; | ||
4068 | int i; | ||
4069 | |||
4070 | if (!(cachep->flags & SLAB_STORE_USER)) | ||
4071 | return 0; | ||
4072 | if (!(cachep->flags & SLAB_RED_ZONE)) | ||
4073 | return 0; | ||
4074 | |||
4075 | /* OK, we can do it */ | ||
4076 | |||
4077 | n[1] = 0; | ||
4078 | |||
4079 | for_each_online_node(node) { | ||
4080 | l3 = cachep->nodelists[node]; | ||
4081 | if (!l3) | ||
4082 | continue; | ||
4083 | |||
4084 | check_irq_on(); | ||
4085 | spin_lock_irq(&l3->list_lock); | ||
4086 | |||
4087 | list_for_each(q, &l3->slabs_full) { | ||
4088 | slabp = list_entry(q, struct slab, list); | ||
4089 | handle_slab(n, cachep, slabp); | ||
4090 | } | ||
4091 | list_for_each(q, &l3->slabs_partial) { | ||
4092 | slabp = list_entry(q, struct slab, list); | ||
4093 | handle_slab(n, cachep, slabp); | ||
4094 | } | ||
4095 | spin_unlock_irq(&l3->list_lock); | ||
4096 | } | ||
4097 | name = cachep->name; | ||
4098 | if (n[0] == n[1]) { | ||
4099 | /* Increase the buffer size */ | ||
4100 | mutex_unlock(&cache_chain_mutex); | ||
4101 | m->private = kzalloc(n[0] * 4 * sizeof(unsigned long), GFP_KERNEL); | ||
4102 | if (!m->private) { | ||
4103 | /* Too bad, we are really out */ | ||
4104 | m->private = n; | ||
4105 | mutex_lock(&cache_chain_mutex); | ||
4106 | return -ENOMEM; | ||
4107 | } | ||
4108 | *(unsigned long *)m->private = n[0] * 2; | ||
4109 | kfree(n); | ||
4110 | mutex_lock(&cache_chain_mutex); | ||
4111 | /* Now make sure this entry will be retried */ | ||
4112 | m->count = m->size; | ||
4113 | return 0; | ||
4114 | } | ||
4115 | for (i = 0; i < n[1]; i++) { | ||
4116 | seq_printf(m, "%s: %lu ", name, n[2*i+3]); | ||
4117 | show_symbol(m, n[2*i+2]); | ||
4118 | seq_putc(m, '\n'); | ||
4119 | } | ||
4120 | return 0; | ||
4121 | } | ||
4122 | |||
4123 | struct seq_operations slabstats_op = { | ||
4124 | .start = leaks_start, | ||
4125 | .next = s_next, | ||
4126 | .stop = s_stop, | ||
4127 | .show = leaks_show, | ||
4128 | }; | ||
4129 | #endif | ||
3902 | #endif | 4130 | #endif |
3903 | 4131 | ||
3904 | /** | 4132 | /** |
@@ -294,6 +294,16 @@ void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags) | |||
294 | } | 294 | } |
295 | EXPORT_SYMBOL(kmem_cache_alloc); | 295 | EXPORT_SYMBOL(kmem_cache_alloc); |
296 | 296 | ||
297 | void *kmem_cache_zalloc(struct kmem_cache *c, gfp_t flags) | ||
298 | { | ||
299 | void *ret = kmem_cache_alloc(c, flags); | ||
300 | if (ret) | ||
301 | memset(ret, 0, c->size); | ||
302 | |||
303 | return ret; | ||
304 | } | ||
305 | EXPORT_SYMBOL(kmem_cache_zalloc); | ||
306 | |||
297 | void kmem_cache_free(struct kmem_cache *c, void *b) | 307 | void kmem_cache_free(struct kmem_cache *c, void *b) |
298 | { | 308 | { |
299 | if (c->dtor) | 309 | if (c->dtor) |
@@ -5,18 +5,18 @@ | |||
5 | #include <asm/uaccess.h> | 5 | #include <asm/uaccess.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * kzalloc - allocate memory. The memory is set to zero. | 8 | * __kzalloc - allocate memory. The memory is set to zero. |
9 | * @size: how many bytes of memory are required. | 9 | * @size: how many bytes of memory are required. |
10 | * @flags: the type of memory to allocate. | 10 | * @flags: the type of memory to allocate. |
11 | */ | 11 | */ |
12 | void *kzalloc(size_t size, gfp_t flags) | 12 | void *__kzalloc(size_t size, gfp_t flags) |
13 | { | 13 | { |
14 | void *ret = kmalloc(size, flags); | 14 | void *ret = ____kmalloc(size, flags); |
15 | if (ret) | 15 | if (ret) |
16 | memset(ret, 0, size); | 16 | memset(ret, 0, size); |
17 | return ret; | 17 | return ret; |
18 | } | 18 | } |
19 | EXPORT_SYMBOL(kzalloc); | 19 | EXPORT_SYMBOL(__kzalloc); |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * kstrdup - allocate space for and copy an existing string | 22 | * kstrdup - allocate space for and copy an existing string |
@@ -33,7 +33,7 @@ char *kstrdup(const char *s, gfp_t gfp) | |||
33 | return NULL; | 33 | return NULL; |
34 | 34 | ||
35 | len = strlen(s) + 1; | 35 | len = strlen(s) + 1; |
36 | buf = kmalloc(len, gfp); | 36 | buf = ____kmalloc(len, gfp); |
37 | if (buf) | 37 | if (buf) |
38 | memcpy(buf, s, len); | 38 | memcpy(buf, s, len); |
39 | return buf; | 39 | return buf; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index fd572bbdc9f5..78865c849f8f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1356,7 +1356,9 @@ static int __init kswapd_init(void) | |||
1356 | 1356 | ||
1357 | pid = kernel_thread(kswapd, pgdat, CLONE_KERNEL); | 1357 | pid = kernel_thread(kswapd, pgdat, CLONE_KERNEL); |
1358 | BUG_ON(pid < 0); | 1358 | BUG_ON(pid < 0); |
1359 | read_lock(&tasklist_lock); | ||
1359 | pgdat->kswapd = find_task_by_pid(pid); | 1360 | pgdat->kswapd = find_task_by_pid(pid); |
1361 | read_unlock(&tasklist_lock); | ||
1360 | } | 1362 | } |
1361 | total_memory = nr_free_pagecache_pages(); | 1363 | total_memory = nr_free_pagecache_pages(); |
1362 | hotcpu_notifier(cpu_callback, 0); | 1364 | hotcpu_notifier(cpu_callback, 0); |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index fb031fe9be9e..469eda0f0dfd 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -238,6 +238,9 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w | |||
238 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 238 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
239 | mask |= POLLERR; | 239 | mask |= POLLERR; |
240 | 240 | ||
241 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
242 | mask |= POLLRDHUP; | ||
243 | |||
241 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 244 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
242 | mask |= POLLHUP; | 245 | mask |= POLLHUP; |
243 | 246 | ||
diff --git a/net/core/datagram.c b/net/core/datagram.c index b8ce6bf81188..aecddcc30401 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -500,6 +500,8 @@ unsigned int datagram_poll(struct file *file, struct socket *sock, | |||
500 | /* exceptional events? */ | 500 | /* exceptional events? */ |
501 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 501 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
502 | mask |= POLLERR; | 502 | mask |= POLLERR; |
503 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
504 | mask |= POLLRDHUP; | ||
503 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 505 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
504 | mask |= POLLHUP; | 506 | mask |= POLLHUP; |
505 | 507 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c9f878454531..09464fa8d72f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -149,7 +149,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
149 | 149 | ||
150 | /* Get the DATA. Size must match skb_add_mtu(). */ | 150 | /* Get the DATA. Size must match skb_add_mtu(). */ |
151 | size = SKB_DATA_ALIGN(size); | 151 | size = SKB_DATA_ALIGN(size); |
152 | data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | 152 | data = ____kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); |
153 | if (!data) | 153 | if (!data) |
154 | goto nodata; | 154 | goto nodata; |
155 | 155 | ||
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index d4b293e16283..1ff7328b0e17 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -350,7 +350,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock, | |||
350 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED) | 350 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED) |
351 | mask |= POLLHUP; | 351 | mask |= POLLHUP; |
352 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 352 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
353 | mask |= POLLIN | POLLRDNORM; | 353 | mask |= POLLIN | POLLRDNORM | POLLRDHUP; |
354 | 354 | ||
355 | /* Connected? */ | 355 | /* Connected? */ |
356 | if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) { | 356 | if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 4b0272c92d66..19ea5c0b094b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -365,7 +365,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
365 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE) | 365 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE) |
366 | mask |= POLLHUP; | 366 | mask |= POLLHUP; |
367 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 367 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
368 | mask |= POLLIN | POLLRDNORM; | 368 | mask |= POLLIN | POLLRDNORM | POLLRDHUP; |
369 | 369 | ||
370 | /* Connected? */ | 370 | /* Connected? */ |
371 | if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) { | 371 | if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) { |
diff --git a/net/rxrpc/main.c b/net/rxrpc/main.c index 36fdcbcd80d1..48cbd065bb45 100644 --- a/net/rxrpc/main.c +++ b/net/rxrpc/main.c | |||
@@ -79,8 +79,8 @@ static int __init rxrpc_initialise(void) | |||
79 | error_sysctl: | 79 | error_sysctl: |
80 | #ifdef CONFIG_SYSCTL | 80 | #ifdef CONFIG_SYSCTL |
81 | rxrpc_sysctl_cleanup(); | 81 | rxrpc_sysctl_cleanup(); |
82 | #endif | ||
83 | error_proc: | 82 | error_proc: |
83 | #endif | ||
84 | #ifdef CONFIG_PROC_FS | 84 | #ifdef CONFIG_PROC_FS |
85 | rxrpc_proc_cleanup(); | 85 | rxrpc_proc_cleanup(); |
86 | #endif | 86 | #endif |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0ea947eb6813..b6e4b89539b3 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4894,6 +4894,8 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
4894 | /* Is there any exceptional events? */ | 4894 | /* Is there any exceptional events? */ |
4895 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 4895 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
4896 | mask |= POLLERR; | 4896 | mask |= POLLERR; |
4897 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
4898 | mask |= POLLRDHUP; | ||
4897 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 4899 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
4898 | mask |= POLLHUP; | 4900 | mask |= POLLHUP; |
4899 | 4901 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2b4cc2eea5b3..d901465ce013 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1878,6 +1878,8 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
1878 | mask |= POLLERR; | 1878 | mask |= POLLERR; |
1879 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 1879 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
1880 | mask |= POLLHUP; | 1880 | mask |= POLLHUP; |
1881 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
1882 | mask |= POLLRDHUP; | ||
1881 | 1883 | ||
1882 | /* readable? */ | 1884 | /* readable? */ |
1883 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 1885 | if (!skb_queue_empty(&sk->sk_receive_queue) || |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index d591578bd3b2..22d281c6ec24 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -124,6 +124,11 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
124 | * compressed together */ | 124 | * compressed together */ |
125 | s->len = strlen(str) + 1; | 125 | s->len = strlen(str) + 1; |
126 | s->sym = malloc(s->len + 1); | 126 | s->sym = malloc(s->len + 1); |
127 | if (!s->sym) { | ||
128 | fprintf(stderr, "kallsyms failure: " | ||
129 | "unable to allocate required amount of memory\n"); | ||
130 | exit(EXIT_FAILURE); | ||
131 | } | ||
127 | strcpy((char *)s->sym + 1, str); | 132 | strcpy((char *)s->sym + 1, str); |
128 | s->sym[0] = stype; | 133 | s->sym[0] = stype; |
129 | 134 | ||
@@ -272,7 +277,12 @@ static void write_src(void) | |||
272 | 277 | ||
273 | /* table of offset markers, that give the offset in the compressed stream | 278 | /* table of offset markers, that give the offset in the compressed stream |
274 | * every 256 symbols */ | 279 | * every 256 symbols */ |
275 | markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256)); | 280 | markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256)); |
281 | if (!markers) { | ||
282 | fprintf(stderr, "kallsyms failure: " | ||
283 | "unable to allocate required memory\n"); | ||
284 | exit(EXIT_FAILURE); | ||
285 | } | ||
276 | 286 | ||
277 | output_label("kallsyms_names"); | 287 | output_label("kallsyms_names"); |
278 | off = 0; | 288 | off = 0; |
diff --git a/security/commoncap.c b/security/commoncap.c index 8a6e097f99ea..841eb4e5c62b 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -60,8 +60,8 @@ int cap_settime(struct timespec *ts, struct timezone *tz) | |||
60 | int cap_ptrace (struct task_struct *parent, struct task_struct *child) | 60 | int cap_ptrace (struct task_struct *parent, struct task_struct *child) |
61 | { | 61 | { |
62 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ | 62 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ |
63 | if (!cap_issubset (child->cap_permitted, current->cap_permitted) && | 63 | if (!cap_issubset(child->cap_permitted, parent->cap_permitted) && |
64 | !capable(CAP_SYS_PTRACE)) | 64 | !__capable(parent, CAP_SYS_PTRACE)) |
65 | return -EPERM; | 65 | return -EPERM; |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
diff --git a/security/keys/key.c b/security/keys/key.c index 99781b798312..a057e3311aad 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* key.c: basic authentication token and access key management | 1 | /* key.c: basic authentication token and access key management |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -271,7 +271,7 @@ struct key *key_alloc(struct key_type *type, const char *desc, | |||
271 | * its description */ | 271 | * its description */ |
272 | if (!not_in_quota) { | 272 | if (!not_in_quota) { |
273 | spin_lock(&user->lock); | 273 | spin_lock(&user->lock); |
274 | if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS && | 274 | if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS || |
275 | user->qnbytes + quotalen >= KEYQUOTA_MAX_BYTES | 275 | user->qnbytes + quotalen >= KEYQUOTA_MAX_BYTES |
276 | ) | 276 | ) |
277 | goto no_quota; | 277 | goto no_quota; |
@@ -795,12 +795,16 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, | |||
795 | goto error_3; | 795 | goto error_3; |
796 | } | 796 | } |
797 | 797 | ||
798 | /* search for an existing key of the same type and description in the | 798 | /* if it's possible to update this type of key, search for an existing |
799 | * destination keyring | 799 | * key of the same type and description in the destination keyring and |
800 | * update that instead if possible | ||
800 | */ | 801 | */ |
801 | key_ref = __keyring_search_one(keyring_ref, ktype, description, 0); | 802 | if (ktype->update) { |
802 | if (!IS_ERR(key_ref)) | 803 | key_ref = __keyring_search_one(keyring_ref, ktype, description, |
803 | goto found_matching_key; | 804 | 0); |
805 | if (!IS_ERR(key_ref)) | ||
806 | goto found_matching_key; | ||
807 | } | ||
804 | 808 | ||
805 | /* decide on the permissions we want */ | 809 | /* decide on the permissions we want */ |
806 | perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR; | 810 | perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR; |
diff --git a/security/security.c b/security/security.c index f693e1f66b98..51ef509710b9 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -174,31 +174,8 @@ int mod_unreg_security(const char *name, struct security_operations *ops) | |||
174 | return security_ops->unregister_security(name, ops); | 174 | return security_ops->unregister_security(name, ops); |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | ||
178 | * capable - calls the currently loaded security module's capable() function with the specified capability | ||
179 | * @cap: the requested capability level. | ||
180 | * | ||
181 | * This function calls the currently loaded security module's capable() | ||
182 | * function with a pointer to the current task and the specified @cap value. | ||
183 | * | ||
184 | * This allows the security module to implement the capable function call | ||
185 | * however it chooses to. | ||
186 | */ | ||
187 | int capable(int cap) | ||
188 | { | ||
189 | if (security_ops->capable(current, cap)) { | ||
190 | /* capability denied */ | ||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | /* capability granted */ | ||
195 | current->flags |= PF_SUPERPRIV; | ||
196 | return 1; | ||
197 | } | ||
198 | |||
199 | EXPORT_SYMBOL_GPL(register_security); | 177 | EXPORT_SYMBOL_GPL(register_security); |
200 | EXPORT_SYMBOL_GPL(unregister_security); | 178 | EXPORT_SYMBOL_GPL(unregister_security); |
201 | EXPORT_SYMBOL_GPL(mod_reg_security); | 179 | EXPORT_SYMBOL_GPL(mod_reg_security); |
202 | EXPORT_SYMBOL_GPL(mod_unreg_security); | 180 | EXPORT_SYMBOL_GPL(mod_unreg_security); |
203 | EXPORT_SYMBOL(capable); | ||
204 | EXPORT_SYMBOL(security_ops); | 181 | EXPORT_SYMBOL(security_ops); |
diff --git a/sound/oss/au1000.c b/sound/oss/au1000.c index fe54de25aafc..eacb0aef21e1 100644 --- a/sound/oss/au1000.c +++ b/sound/oss/au1000.c | |||
@@ -100,7 +100,7 @@ | |||
100 | 100 | ||
101 | /* Boot options */ | 101 | /* Boot options */ |
102 | static int vra = 0; // 0 = no VRA, 1 = use VRA if codec supports it | 102 | static int vra = 0; // 0 = no VRA, 1 = use VRA if codec supports it |
103 | MODULE_PARM(vra, "i"); | 103 | module_param(vra, bool, 0); |
104 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); | 104 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); |
105 | 105 | ||
106 | 106 | ||
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 6a4956b8025d..c1168fae6be6 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -79,7 +79,7 @@ | |||
79 | * 0 = no VRA, 1 = use VRA if codec supports it | 79 | * 0 = no VRA, 1 = use VRA if codec supports it |
80 | */ | 80 | */ |
81 | static int vra = 1; | 81 | static int vra = 1; |
82 | MODULE_PARM(vra, "i"); | 82 | module_param(vra, bool, 0); |
83 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); | 83 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); |
84 | 84 | ||
85 | static struct au1550_state { | 85 | static struct au1550_state { |
diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c index b3ea719d33db..d1a0eb294d6f 100644 --- a/sound/oss/awe_wave.c +++ b/sound/oss/awe_wave.c | |||
@@ -2944,7 +2944,7 @@ alloc_new_info(void) | |||
2944 | { | 2944 | { |
2945 | awe_voice_list *newlist; | 2945 | awe_voice_list *newlist; |
2946 | 2946 | ||
2947 | newlist = (awe_voice_list *)kmalloc(sizeof(*newlist), GFP_KERNEL); | 2947 | newlist = kmalloc(sizeof(*newlist), GFP_KERNEL); |
2948 | if (newlist == NULL) { | 2948 | if (newlist == NULL) { |
2949 | printk(KERN_ERR "AWE32: can't alloc info table\n"); | 2949 | printk(KERN_ERR "AWE32: can't alloc info table\n"); |
2950 | return NULL; | 2950 | return NULL; |
@@ -3547,8 +3547,10 @@ awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag) | |||
3547 | smp->checksum_flag = 0; | 3547 | smp->checksum_flag = 0; |
3548 | smp->checksum = 0; | 3548 | smp->checksum = 0; |
3549 | 3549 | ||
3550 | if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) | 3550 | if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) { |
3551 | kfree(vrec); | ||
3551 | return rc; | 3552 | return rc; |
3553 | } | ||
3552 | sf->mem_ptr += rc; | 3554 | sf->mem_ptr += rc; |
3553 | add_sf_sample(sf, smprec); | 3555 | add_sf_sample(sf, smprec); |
3554 | 3556 | ||
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index c9302a1e515b..87bd3100aef3 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -195,18 +195,18 @@ | |||
195 | */ | 195 | */ |
196 | 196 | ||
197 | int dmasound_catchRadius = 0; | 197 | int dmasound_catchRadius = 0; |
198 | MODULE_PARM(dmasound_catchRadius, "i"); | 198 | module_param(dmasound_catchRadius, int, 0); |
199 | 199 | ||
200 | static unsigned int numWriteBufs = DEFAULT_N_BUFFERS; | 200 | static unsigned int numWriteBufs = DEFAULT_N_BUFFERS; |
201 | MODULE_PARM(numWriteBufs, "i"); | 201 | module_param(numWriteBufs, int, 0); |
202 | static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */ | 202 | static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */ |
203 | MODULE_PARM(writeBufSize, "i"); | 203 | module_param(writeBufSize, int, 0); |
204 | 204 | ||
205 | #ifdef HAS_RECORD | 205 | #ifdef HAS_RECORD |
206 | static unsigned int numReadBufs = DEFAULT_N_BUFFERS; | 206 | static unsigned int numReadBufs = DEFAULT_N_BUFFERS; |
207 | MODULE_PARM(numReadBufs, "i"); | 207 | module_param(numReadBufs, int, 0); |
208 | static unsigned int readBufSize = DEFAULT_BUFF_SIZE; /* in bytes */ | 208 | static unsigned int readBufSize = DEFAULT_BUFF_SIZE; /* in bytes */ |
209 | MODULE_PARM(readBufSize, "i"); | 209 | module_param(readBufSize, int, 0); |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | MODULE_LICENSE("GPL"); | 212 | MODULE_LICENSE("GPL"); |
diff --git a/sound/oss/ite8172.c b/sound/oss/ite8172.c index ffcb910f5c3e..00ac1c95a429 100644 --- a/sound/oss/ite8172.c +++ b/sound/oss/ite8172.c | |||
@@ -1968,9 +1968,9 @@ static int i2s_fmt[NR_DEVICE]; | |||
1968 | 1968 | ||
1969 | static unsigned int devindex; | 1969 | static unsigned int devindex; |
1970 | 1970 | ||
1971 | MODULE_PARM(spdif, "1-" __MODULE_STRING(NR_DEVICE) "i"); | 1971 | module_param_array(spdif, int, NULL, 0); |
1972 | MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled"); | 1972 | MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled"); |
1973 | MODULE_PARM(i2s_fmt, "1-" __MODULE_STRING(NR_DEVICE) "i"); | 1973 | module_param_array(i2s_fmt, int, NULL, 0); |
1974 | MODULE_PARM_DESC(i2s_fmt, "the format of I2S"); | 1974 | MODULE_PARM_DESC(i2s_fmt, "the format of I2S"); |
1975 | 1975 | ||
1976 | MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com"); | 1976 | MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com"); |
diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index f56898c3981e..ccb21d48d42c 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c | |||
@@ -273,14 +273,14 @@ int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right) | |||
273 | int regoffs; | 273 | int regoffs; |
274 | unsigned char val; | 274 | unsigned char val; |
275 | 275 | ||
276 | if ((dev < 0) || (dev >= devc->iomap_sz)) | ||
277 | return -EINVAL; | ||
278 | |||
276 | regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; | 279 | regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; |
277 | 280 | ||
278 | if (regoffs == 0) | 281 | if (regoffs == 0) |
279 | return -EINVAL; | 282 | return -EINVAL; |
280 | 283 | ||
281 | if ((dev < 0) || (dev >= devc->iomap_sz)) | ||
282 | return -EINVAL; | ||
283 | |||
284 | val = sb_getmixer(devc, regoffs); | 284 | val = sb_getmixer(devc, regoffs); |
285 | change_bits(devc, &val, dev, LEFT_CHN, left); | 285 | change_bits(devc, &val, dev, LEFT_CHN, left); |
286 | 286 | ||
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 698614226c9a..347cd79c2502 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c | |||
@@ -709,11 +709,11 @@ static void seq_local_event(unsigned char *event_rec) | |||
709 | 709 | ||
710 | static void seq_sysex_message(unsigned char *event_rec) | 710 | static void seq_sysex_message(unsigned char *event_rec) |
711 | { | 711 | { |
712 | int dev = event_rec[1]; | 712 | unsigned int dev = event_rec[1]; |
713 | int i, l = 0; | 713 | int i, l = 0; |
714 | unsigned char *buf = &event_rec[2]; | 714 | unsigned char *buf = &event_rec[2]; |
715 | 715 | ||
716 | if ((int) dev > max_synthdev) | 716 | if (dev > max_synthdev) |
717 | return; | 717 | return; |
718 | if (!(synth_open_mask & (1 << dev))) | 718 | if (!(synth_open_mask & (1 << dev))) |
719 | return; | 719 | return; |
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index dce9016cbcfd..eb5ea32fd1b0 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -154,8 +154,8 @@ static void start_adc(struct cs4297a_state *s); | |||
154 | #if CSDEBUG | 154 | #if CSDEBUG |
155 | static unsigned long cs_debuglevel = 4; // levels range from 1-9 | 155 | static unsigned long cs_debuglevel = 4; // levels range from 1-9 |
156 | static unsigned long cs_debugmask = CS_INIT /*| CS_IOCTL*/; | 156 | static unsigned long cs_debugmask = CS_INIT /*| CS_IOCTL*/; |
157 | MODULE_PARM(cs_debuglevel, "i"); | 157 | module_param(cs_debuglevel, int, 0); |
158 | MODULE_PARM(cs_debugmask, "i"); | 158 | module_param(cs_debugmask, int, 0); |
159 | #endif | 159 | #endif |
160 | #define CS_TRUE 1 | 160 | #define CS_TRUE 1 |
161 | #define CS_FALSE 0 | 161 | #define CS_FALSE 0 |
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index 99d04ad3ca13..afcb524a40eb 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c | |||
@@ -2028,8 +2028,8 @@ __setup("waveartist=", setup_waveartist); | |||
2028 | #endif | 2028 | #endif |
2029 | 2029 | ||
2030 | MODULE_DESCRIPTION("Rockwell WaveArtist RWA-010 sound driver"); | 2030 | MODULE_DESCRIPTION("Rockwell WaveArtist RWA-010 sound driver"); |
2031 | MODULE_PARM(io, "i"); /* IO base */ | 2031 | module_param(io, int, 0); /* IO base */ |
2032 | MODULE_PARM(irq, "i"); /* IRQ */ | 2032 | module_param(irq, int, 0); /* IRQ */ |
2033 | MODULE_PARM(dma, "i"); /* DMA */ | 2033 | module_param(dma, int, 0); /* DMA */ |
2034 | MODULE_PARM(dma2, "i"); /* DMA2 */ | 2034 | module_param(dma2, int, 0); /* DMA2 */ |
2035 | MODULE_LICENSE("GPL"); | 2035 | MODULE_LICENSE("GPL"); |