aboutsummaryrefslogtreecommitdiffstats
path: root/lib (follow)
AgeCommit message (Collapse)AuthorFilesLines
2008-02-06debug_smp_processor_id() fixletsAndrew Morton1-1/+3
- Account for debug_smp_processor_id()'s own preempt_disable() when displaying the preempt_count(). - 80 cols, not 800. Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-06lib/extable.c: remove an expensive integer divide in search_extable()Eric Dumazet1-3/+3
Actual code let compiler generates idiv instruction on x86. Using a right shift is OK here and readable as well. Before patch 10: 57 push %edi 11: 56 push %esi 12: 89 d6 mov %edx,%esi 14: 53 push %ebx 15: 89 c3 mov %eax,%ebx 17: eb 22 jmp 3b <search_extable+0x2b> 19: 89 f0 mov %esi,%eax 1b: ba 02 00 00 00 mov $0x2,%edx 20: 29 d8 sub %ebx,%eax 22: 89 d7 mov %edx,%edi 24: c1 f8 03 sar $0x3,%eax 27: 99 cltd 28: f7 ff idiv %edi 2a: 8d 04 c3 lea (%ebx,%eax,8),%eax 2d: 39 08 cmp %ecx,(%eax) ... After patch 00000010 <search_extable>: 10: 53 push %ebx 11: 89 c3 mov %eax,%ebx 13: eb 18 jmp 2d <search_extable+0x1d> 15: 89 d0 mov %edx,%eax 17: 29 d8 sub %ebx,%eax 19: c1 f8 04 sar $0x4,%eax 1c: 8d 04 c3 lea (%ebx,%eax,8),%eax 1f: 39 08 cmp %ecx,(%eax) ... Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05radix-tree: avoid atomic allocations for preloaded insertionsNick Piggin1-4/+11
Most pagecache (and some other) radix tree insertions have the great opportunity to preallocate a few nodes with relaxed gfp flags. But the preallocation is squandered when it comes time to allocate a node, we default to first attempting a GFP_ATOMIC allocation -- that doesn't normally fail, but it can eat into atomic memory reserves that we don't need to be using. Another upshot of this is that it removes the sometimes highly contended zone->lock from underneath tree_lock. Pagecache insertions are always performed with a radix tree preload, and after this change, such a situation will never fall back to kmem_cache_alloc within radix_tree_node_alloc. David Miller reports seeing this allocation fail on a highly threaded sparc64 system: [527319.459981] dd: page allocation failure. order:0, mode:0x20 [527319.460403] Call Trace: [527319.460568] [00000000004b71e0] __slab_alloc+0x1b0/0x6a8 [527319.460636] [00000000004b7bbc] kmem_cache_alloc+0x4c/0xa8 [527319.460698] [000000000055309c] radix_tree_node_alloc+0x20/0x90 [527319.460763] [0000000000553238] radix_tree_insert+0x12c/0x260 [527319.460830] [0000000000495cd0] add_to_page_cache+0x38/0xb0 [527319.460893] [00000000004e4794] mpage_readpages+0x6c/0x134 [527319.460955] [000000000049c7fc] __do_page_cache_readahead+0x170/0x280 [527319.461028] [000000000049cc88] ondemand_readahead+0x208/0x214 [527319.461094] [0000000000496018] do_generic_mapping_read+0xe8/0x428 [527319.461152] [0000000000497948] generic_file_aio_read+0x108/0x170 [527319.461217] [00000000004badac] do_sync_read+0x88/0xd0 [527319.461292] [00000000004bb5cc] vfs_read+0x78/0x10c [527319.461361] [00000000004bb920] sys_read+0x34/0x60 [527319.461424] [0000000000406294] linux_sparc_syscall32+0x3c/0x40 The calltrace is significant: __do_page_cache_readahead allocates a number of pages with GFP_KERNEL, and hence it should have reclaimed sufficient memory to satisfy GFP_ATOMIC allocations. However after the list of pages goes to mpage_readpages, there can be significant intervals (including disk IO) before all the pages are inserted into the radix-tree. So the reserves can easily be depleted at that point. The patch is confirmed to fix the problem. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05iommu sg merging: swiotlb: respect the segment boundary limitsFUJITA Tomonori1-6/+35
This patch makes swiotlb not allocate a memory area spanning LLD's segment boundary. is_span_boundary() judges whether a memory area spans LLD's segment boundary. If map_single finds such a area, map_single tries to find the next available memory area. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Greg KH <greg@kroah.com> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05iommu sg: add IOMMU helper functions for the free area managementFUJITA Tomonori2-0/+81
This adds IOMMU helper functions for the free area management. These functions take care of LLD's segment boundary limit for IOMMUs. They would be useful for IOMMUs that use bitmap for the free area management. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Jeff Garzik <jeff@garzik.org> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-04Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivialLinus Torvalds2-2/+2
* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial: (79 commits) Jesper Juhl is the new trivial patches maintainer Documentation: mention email-clients.txt in SubmittingPatches fs/binfmt_elf.c: spello fix do_invalidatepage() comment typo fix Documentation/filesystems/porting fixes typo fixes in net/core/net_namespace.c typo fix in net/rfkill/rfkill.c typo fixes in net/sctp/sm_statefuns.c lib/: Spelling fixes kernel/: Spelling fixes include/scsi/: Spelling fixes include/linux/: Spelling fixes include/asm-m68knommu/: Spelling fixes include/asm-frv/: Spelling fixes fs/: Spelling fixes drivers/watchdog/: Spelling fixes drivers/video/: Spelling fixes drivers/ssb/: Spelling fixes drivers/serial/: Spelling fixes drivers/scsi/: Spelling fixes ...
2008-02-04Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuildLinus Torvalds1-7/+7
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: scsi: fix dependency bug in aic7 Makefile kbuild: add svn revision information to setlocalversion kbuild: do not warn about __*init/__*exit symbols being exported Move Kconfig.instrumentation to arch/Kconfig and init/Kconfig Add HAVE_KPROBES Add HAVE_OPROFILE Create arch/Kconfig Fix ARM to play nicely with generic Instrumentation menu kconfig: ignore select of unknown symbol kconfig: mark config as changed when loading an alternate config kbuild: Spelling/grammar fixes for config DEBUG_SECTION_MISMATCH Remove __INIT_REFOK and __INITDATA_REFOK kbuild: print only total number of section mismatces found
2008-02-03lib/: Spelling fixesJoe Perches2-2/+2
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-02-03kbuild: Spelling/grammar fixes for config DEBUG_SECTION_MISMATCHGeert Uytterhoeven1-6/+6
Including additional fixes from Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-03kbuild: print only total number of section mismatces foundSam Ravnborg1-1/+1
We have too many section mismatches detected at the moment. So silence modpost and prevent the option from being set in a typical allyesconfig build. Tell the user how to see all the deteils in the summary message from modpost. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-02kobject: kerneldoc comment fixDave Young1-1/+1
Fix kerneldoc comment of kobject_create. Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01latencytop: Change Kconfig dependency.Heiko Carstens1-1/+1
Change latencytop Kconfig entry so it doesn't list the archictectures that support it. Instead introduce HAVE_LATENCY_SUPPORT which any architecture can set. Should reduce patch conflicts. Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Holger Wolf <wolf@linux.vnet.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-01-30x86: early boot debugging via FireWire (ohci1394_dma=early)Bernhard Kaindl1-0/+28
This patch adds a new configuration option, which adds support for a new early_param which gets checked in arch/x86/kernel/setup_{32,64}.c:setup_arch() to decide wether OHCI-1394 FireWire controllers should be initialized and enabled for physical DMA access to allow remote debugging of early problems like issues ACPI or other subsystems which are executed very early. If the config option is not enabled, no code is changed, and if the boot paramenter is not given, no new code is executed, and independent of that, all new code is freed after boot, so the config option can be even enabled in standard, non-debug kernels. With specialized tools, it is then possible to get debugging information from machines which have no serial ports (notebooks) such as the printk buffer contents, or any data which can be referenced from global pointers, if it is stored below the 4GB limit and even memory dumps of of the physical RAM region below the 4GB limit can be taken without any cooperation from the CPU of the host, so the machine can be crashed early, it does not matter. In the extreme, even kernel debuggers can be accessed in this way. I wrote a small kgdb module and an accompanying gdb stub for FireWire which allows to gdb to talk to kgdb using remote remory reads and writes over FireWire. An version of the gdb stub fore FireWire is able to read all global data from a system which is running a a normal kernel without any kernel debugger, without any interruption or support of the system's CPU. That way, e.g. the task struct and so on can be read and even manipulated when the physical DMA access is granted. A HOWTO is included in this patch, in Documentation/debugging-via-ohci1394.txt and I've put a copy online at ftp://ftp.suse.de/private/bk/firewire/docs/debugging-via-ohci1394.txt It also has links to all the tools which are available to make use of it another copy of it is online at: ftp://ftp.suse.de/private/bk/firewire/kernel/ohci1394_dma_early-v2.diff Signed-Off-By: Bernhard Kaindl <bk@suse.de> Tested-By: Thomas Renninger <trenn@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-01-30x86: add a simple backtrace test moduleArjan van de Ven1-0/+12
During the work on the x86 32 and 64 bit backtrace code I found it useful to have a simple test module to test a process and irq context backtrace. Since the existing backtrace code was buggy, I figure it might be useful to have such a test module in the kernel so that maybe we can even detect such bugs earlier.. [ mingo@elte.hu: build fix ] Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-01-30x86: fix UML and -regparm=3Ingo Molnar1-4/+4
introduce the "asmregparm" calling convention: for functions implemented in assembly with a fixed regparm input parameters calling convention. mark the semaphore and rwsem slowpath functions with that. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-01-30x86: kprobes: add kprobes smoke tests that run on bootAnanth N Mavinakayanahalli1-0/+12
Here is a quick and naive smoke test for kprobes. This is intended to just verify if some unrelated change broke the *probes subsystem. It is self contained, architecture agnostic and isn't of any great use by itself. This needs to be built in the kernel and runs a basic set of tests to verify if kprobes, jprobes and kretprobes run fine on the kernel. In case of an error, it'll print out a message with a "BUG" prefix. This is a start; we intend to add more tests to this bucket over time. Thanks to Jim Keniston and Masami Hiramatsu for comments and suggestions. Tested on x86 (32/64) and powerpc. Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-01-29Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25Linus Torvalds2-0/+59
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25: (1470 commits) [IPV6] ADDRLABEL: Fix double free on label deletion. [PPP]: Sparse warning fixes. [IPV4] fib_trie: remove unneeded NULL check [IPV4] fib_trie: More whitespace cleanup. [NET_SCHED]: Use nla_policy for attribute validation in ematches [NET_SCHED]: Use nla_policy for attribute validation in actions [NET_SCHED]: Use nla_policy for attribute validation in classifiers [NET_SCHED]: Use nla_policy for attribute validation in packet schedulers [NET_SCHED]: sch_api: introduce constant for rate table size [NET_SCHED]: Use typeful attribute parsing helpers [NET_SCHED]: Use typeful attribute construction helpers [NET_SCHED]: Use NLA_PUT_STRING for string dumping [NET_SCHED]: Use nla_nest_start/nla_nest_end [NET_SCHED]: Propagate nla_parse return value [NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get [NET_SCHED]: act_api: use nlmsg_parse [NET_SCHED]: act_api: fix netlink API conversion bug [NET_SCHED]: sch_netem: use nla_parse_nested_compat [NET_SCHED]: sch_atm: fix format string warning [NETNS]: Add namespace for ICMP replying code. ...
2008-01-29Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuildLinus Torvalds1-0/+32
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (79 commits) Remove references to "make dep" kconfig: document use of HAVE_* Introduce new section reference annotations tags: __ref, __refdata, __refconst kbuild: warn about ld added unique sections kbuild: add verbose option to Section mismatch reporting in modpost kconfig: tristate choices with mixed tristate and boolean values asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies remove __attribute_used__ kbuild: support ARCH=x86 in buildtar kconfig: remove "enable" kbuild: simplified warning report in modpost kbuild: introduce a few helpers in modpost kbuild: use simpler section mismatch warnings in modpost kbuild: link vmlinux.o before kallsyms passes kbuild: introduce new option to enhance section mismatch analysis Use separate sections for __dev/__cpu/__mem code/data compiler.h: introduce __section() all archs: consolidate init and exit sections in vmlinux.lds.h kbuild: check section names consistently in modpost kbuild: introduce blacklisting in modpost ...
2008-01-28ext4: Add ext4_find_next_bit()Aneesh Kumar K.V1-0/+43
This function is used by the ext4 multi block allocator patches. Also add generic_find_next_le_bit Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2008-01-28[LIB] pcounter : unline too big functionsEric Dumazet1-5/+37
Before pushing pcounter to Linus tree, I would like to make some adjustments. Goal is to reduce kernel text size, by unlining too big functions. When a pcounter is bound to a statically defined per_cpu variable, we define two small helpers functions. (No more folding function using the fat for_each_possible_cpu(cpu) ... ) static DEFINE_PER_CPU(int, NAME##_pcounter_values); static void NAME##_pcounter_add(struct pcounter *self, int val) { __get_cpu_var(NAME##_pcounter_values) += val; } static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) { return per_cpu(NAME##_pcounter_values, cpu); } Fast path is therefore unchanged, while folding/alloc/free is now unlined. This saves 228 bytes on i386 Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28[LIB]: Introduce struct pcounterArnaldo Carvalho de Melo2-0/+27
This just generalises what was introduced by Eric Dumazet for the struct proto inuse field in 286ab3d46058840d68e5d7d52e316c1f7e98c59f: [NET]: Define infrastructure to keep 'inuse' changes in an efficent SMP/NUMA way. Please look at the comment in there to see the rationale. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
2008-01-28kbuild: add verbose option to Section mismatch reporting in modpostSam Ravnborg1-0/+2
If the config option CONFIG_SECTION_MISMATCH is not set and we see a Section mismatch present the following to the user: modpost: Found 1 section mismatch(es). To see additional details select "Enable full Section mismatch analysis" in the Kernel Hacking menu (CONFIG_SECTION_MISMATCH). If the option CONFIG_SECTION_MISMATCH is selected then be verbose in the Section mismatch reporting from mdopost. Sample outputs: WARNING: o-x86_64/vmlinux.o(.text+0x7396): Section mismatch in reference from the function discover_ebda() to the variable .init.data:ebda_addr The function discover_ebda() references the variable __initdata ebda_addr. This is often because discover_ebda lacks a __initdata annotation or the annotation of ebda_addr is wrong. WARNING: o-x86_64/vmlinux.o(.data+0x74d58): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit() The variable pci_serial_quirks references the function __devexit pci_plx9050_exit() If the reference is valid then annotate the variable with __exit* (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console, WARNING: o-x86_64/vmlinux.o(__ksymtab+0x630): Section mismatch in reference from the variable __ksymtab_arch_register_cpu to the function .cpuinit.text:arch_register_cpu() The symbol arch_register_cpu is exported and annotated __cpuinit Fix this by removing the __cpuinit annotation of arch_register_cpu or drop the export. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28kbuild: introduce new option to enhance section mismatch analysisSam Ravnborg1-0/+30
Setting the option DEBUG_SECTION_MISMATCH will report additional section mismatch'es but this should in the end makes it possible to get rid of all of them. See help text in lib/Kconfig.debug for details. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28SG: work with the SCSI fixed maximum allocations.James Bottomley1-14/+27
SCSI sg table allocation has a maximum size (of SCSI_MAX_SG_SEGMENTS, currently 128) and this will cause a BUG_ON() in SCSI if something tries an allocation over it. This patch adds a size limit to the chaining allocator to allow the specification of the maximum allocation size for chaining, so we always chain in units of the maximum SCSI allocation size. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-01-28SG: Move functions to lib/scatterlist.c and add sg chaining allocator helpersJens Axboe2-1/+282
Manually doing chained sg lists is not trivial, so add some helpers to make sure that drivers get it right. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-01-25sched: latencytop supportArjan van de Ven1-0/+14
LatencyTOP kernel infrastructure; it measures latencies in the scheduler and tracks it system wide and per process. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-01-25sched: remove the !PREEMPT_BKL codeIngo Molnar1-123/+0
remove the !PREEMPT_BKL code. this removes 160 lines of legacy code. Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-01-24Kobject: fix coding style issues in kobject c filesGreg Kroah-Hartman2-79/+67
Clean up the kobject.c and kobject_uevent.c files to follow the proper coding style rules. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Driver core: change sysdev classes to use dynamic kobject namesKay Sievers1-9/+5
All kobjects require a dynamically allocated name now. We no longer need to keep track if the name is statically assigned, we can just unconditionally free() all kobject names on cleanup. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: remove kobject_unregister() as no one uses it anymoreGreg Kroah-Hartman1-17/+0
There are no in-kernel users of kobject_unregister() so it should be removed. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: convert remaining kobject_unregister() to kobject_put()Greg Kroah-Hartman1-2/+2
There is no need for kobject_unregister() anymore, thanks to Kay's kobject cleanup changes, so replace all instances of it with kobject_put(). Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: auto-cleanup on final unrefKay Sievers2-74/+107
We save the current state in the object itself, so we can do proper cleanup when the last reference is dropped. If the initial reference is dropped, the object will be removed from sysfs if needed, if an "add" event was sent, "remove" will be send, and the allocated resources are released. This allows us to clean up some driver core usage as well as allowing us to do other such changes to the rest of the kernel. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kset: remove kset_add functionGreg Kroah-Hartman1-12/+1
No one is calling this anymore, so just remove it and hard-code the one internal-use of it. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: remove kobject_register()Greg Kroah-Hartman1-18/+0
The function is no longer used by anyone in the kernel, and it prevents the proper sending of the kobject uevent after the needed files are set up by the caller. kobject_init_and_add() can be used in its place. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: rename kobject_init_ng() to kobject_init()Greg Kroah-Hartman1-7/+7
Now that the old kobject_init() function is gone, rename kobject_init_ng() to kobject_init() to clean up the namespace. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: remove kobject_init() as no one uses it anymoreGreg Kroah-Hartman1-8/+3
The old kobject_init() function is on longer in use, so let us remove it from the public scope (kset mess in the kobject.c file still uses it, but that can be cleaned up later very simply.) Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: rename kobject_add_ng() to kobject_add()Greg Kroah-Hartman1-7/+7
Now that the old kobject_add() function is gone, rename kobject_add_ng() to kobject_add() to clean up the namespace. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: remove kobject_add() as no one uses it anymoreGreg Kroah-Hartman1-14/+8
The old kobject_add() function is on longer in use, so let us remove it from the public scope (kset mess in the kobject.c file still uses it, but that can be cleaned up later very simply.) Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Kobject: drop child->parent ref at unregistrationAlan Stern1-3/+4
This patch (as1015) reverts changes that were made to the driver core about four years ago. The intent back then was to avoid certain kinds of invalid memory accesses by leaving kernel objects allocated as long as any of their children were still allocated. The original and correct approach was to wait only as long as any children were still _registered_; that's what this patch reinstates. This fixes a problem in the SCSI core made visible by the class_device to regular device conversion: A reference loop (scsi_device holds reference to request_queue, which is the child of a gendisk, which is the child of the scsi_device) prevents the data structures from being released, even though they are deregistered okay. It's possible that this change will cause a few bugs to surface, things that have been hidden for several years. They can be fixed easily enough by having the child device take an explicit reference to the parent whenever needed. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: clean up debugging messagesGreg Kroah-Hartman2-14/+29
The kobject debugging messages are a mess. This provides a unified message that makes them actually useful. The format for new kobject debug messages should be: kobject: 'KOBJECT_NAME' (ADDRESS): FUNCTION_NAME: message.\n Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: grab the kset reference in kobject_add, not kobject_initGreg Kroah-Hartman1-3/+3
kobject_init should not be grabing any references, but only initializing the object. This patch fixes this, and makes the lock hold-time shorter for when a kset is present in the kobject. The current kernel tree has been audited to verify that this change should be safe. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: remove subsystem_(un)register functionsGreg Kroah-Hartman1-13/+0
These functions are no longer used and are the last remants of the old subsystem crap. So delete them for good. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Driver Core: kill subsys_attribute and default sysfs opsKay Sievers1-21/+0
Remove the no longer needed subsys_attributes, they are all converted to the more sensical kobj_attributes. There is no longer a magic fallback in sysfs attribute operations, all kobjects which create simple attributes need explicitely a ktype assigned, which tells the core what was intended here. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Driver Core: switch all dynamic ksets to kobj_sysfs_opsKay Sievers1-4/+6
Switch all dynamically created ksets, that export simple attributes, to kobj_attribute from subsys_attribute. Struct subsys_attribute will be removed. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Mike Halcrow <mhalcrow@us.ibm.com> Cc: Phillip Hellewell <phillip@hellewell.homeip.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24Driver Core: add kobj_attribute handlingKay Sievers1-0/+29
Add kobj_sysfs_ops to replace subsys_sysfs_ops. There is no need for special kset operations, we want to be able to use simple attribute operations at any kobject, not only ksets. The whole concept of any default sysfs attribute operations will go away with the upcoming removal of subsys_sysfs_ops. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: get rid of kobject_kset_add_dirGreg Kroah-Hartman1-32/+5
kobject_kset_add_dir is only called in one place so remove it and use kobject_create() instead. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: get rid of kobject_add_dirGreg Kroah-Hartman1-12/+0
kobject_create_and_add is the same as kobject_add_dir, so drop kobject_add_dir. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: add kobject_create_and_add functionGreg Kroah-Hartman1-18/+63
This lets users create dynamic kobjects much easier. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kset: add kset_create_and_add functionGreg Kroah-Hartman1-1/+91
Now ksets can be dynamically created on the fly, no static definitions are required. Thanks to Miklos for hints on how to make this work better for the callers. And thanks to Kay for finding some stupid bugs in my original version and pointing out that we need to handle the fact that kobject's can have a kset as a parent and to handle that properly in kobject_add(). Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24kobject: add kobject_init_and_add functionGreg Kroah-Hartman1-0/+27
Also add a kobject_init_and_add function which bundles up what a lot of the current callers want to do all at once, and it properly handles the memory usages, unlike kobject_register(); Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>