]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/log
linux-2.6-omap-h63xx.git
16 years ago[GFS2] Run through full bitmaps quicker in gfs2_bitfit
Bob Peterson [Wed, 12 Dec 2007 01:00:16 +0000 (19:00 -0600)]
[GFS2] Run through full bitmaps quicker in gfs2_bitfit

I eliminated the passing of an unused parameter into gfs2_bitfit called rgd.

This also changes the gfs2_bitfit code that searches for free (or used) blocks.
Before, the code was trying to check for bytes that indicated 4 blocks in
the undesired state.  The problem is, it was spending more time trying to
do this than it actually was saving.  This version only optimizes the case
where we're looking for free blocks, and it checks a machine word at a time.
So on 32-bit machines, it will check 32-bits (16 blocks) and on 64-bit
machines, it will check 64-bits (32 blocks) at a time.  The compiler
optimizes that quite well and we save some time, especially when running
through full bitmaps (like the bitmaps allocated for the journals).

There's probably a more elegant or optimized way to do this, but I haven't
thought of it yet.  I'm open to suggestions.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Get rid of useless "found" variable in quota.c
Bob Peterson [Wed, 12 Dec 2007 00:51:25 +0000 (18:51 -0600)]
[GFS2] Get rid of useless "found" variable in quota.c

This just eliminates an unused variable from the quota code.
Not likely to be a time saver.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Journal extent mapping
Bob Peterson [Wed, 12 Dec 2007 00:49:21 +0000 (18:49 -0600)]
[GFS2] Journal extent mapping

This patch saves a little time when gfs2 writes to the journals by
keeping a mapping between logical and physical blocks on disk.
That's better than constantly looking up indirect pointers in
buffers, when the journals are several levels of indirection
(which they typically are).

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove function gfs2_get_block
Bob Peterson [Mon, 10 Dec 2007 20:13:27 +0000 (14:13 -0600)]
[GFS2] Remove function gfs2_get_block

This patch is just a cleanup.  Function gfs2_get_block() just calls
function gfs2_block_map reversing the last two parameters.  By
reversing the parameters, gfs2_block_map() may be called directly
and function gfs2_get_block may be eliminated altogether.
Since this function is done for every block operation,
this streamlines the code and makes it a little bit more efficient.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] use pid for plock owner for nfs clients
David Teigland [Thu, 6 Dec 2007 15:35:25 +0000 (09:35 -0600)]
[GFS2] use pid for plock owner for nfs clients

The fl_owner is that of lockd when posix locks arrive from nfs
clients, so it can't be used to distinguish between lock holders.
Use fl_pid as owner instead; it's the pid of the process on the
nfs client.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove unused variable
Steven Whitehouse [Fri, 30 Nov 2007 08:17:15 +0000 (08:17 +0000)]
[GFS2] Remove unused variable

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] patch to check for recursive lock requests in gfs2_rename code path
Abhijith Das [Thu, 29 Nov 2007 20:13:54 +0000 (14:13 -0600)]
[GFS2] patch to check for recursive lock requests in gfs2_rename code path

A certain scenario in the rename code path triggers a kernel BUG()
because it accidentally does recursive locking The first lock is
requested to unlink an already existing inode (replacing a file) and the
second lock is requested when the destination directory needs to alloc
some space. It is rare that these two
events happen during the same rename call, and even more rare that these
two instances try to lock the same rgrp. It is, however, possible.
https://bugzilla.redhat.com/show_bug.cgi?id=404711

Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove lock methods for lock_nolock protocol
Wendy Cheng [Thu, 29 Nov 2007 22:56:51 +0000 (17:56 -0500)]
[GFS2] Remove lock methods for lock_nolock protocol

GFS2 supports two modes of locking - lock_nolock for single node filesystem
and lock_dlm for cluster mode locking. The gfs2 lock methods are removed from
file operation table for lock_nolock protocol. This would allow VFS to handle
posix lock and flock logics just like other in-tree filesystems without
duplication.

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove unrequired code
Fabio M. Di Nitto [Wed, 28 Nov 2007 15:22:09 +0000 (16:22 +0100)]
[GFS2] Remove unrequired code

Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Fix build warnings
Fabio Massimo Di Nitto [Tue, 27 Nov 2007 05:16:42 +0000 (06:16 +0100)]
[GFS2] Fix build warnings

Hi Steven,

Steven Whitehouse wrote:
> Hi,
>
> Now in the -nmw git tree. Thanks,
>
> Steve.
>
> On Wed, 2007-11-21 at 11:54 -0600, Ryan O'Hara wrote:

this patch introduces a bunch of build warnings by leaving around

struct inode *inode = &ip->i_inode;

The patch in attachment cleans them up. Please apply.

Signed-off-by: Fabio Massimo Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] remove unnecessary permission checks
Ryan O'Hara [Wed, 21 Nov 2007 17:54:54 +0000 (11:54 -0600)]
[GFS2] remove unnecessary permission checks

Remove read/write permission() checks from xattr operations.
VFS layer is already handling permission for xattrs via the
xattr_permission() call, so there is no need for gfs2 to
check permissions. Futhermore, using permission() for SELinux
xattrs ops is incorrect.

Signed-off-by: Ryan O'Hara <rohara@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Fix runtime issue with UP kernels
Fabio Massimo Di Nitto [Fri, 16 Nov 2007 09:50:40 +0000 (09:50 +0000)]
[GFS2] Fix runtime issue with UP kernels

The issue is indeed UP vs SMP and it is totally random.

spin_is_locked() is a bad assertion because there is no correct answer on UP.
on UP spin_is_locked() has to return either one value or another, always.

This means that in my setup I am lucky enough to trigger the issue and your you
are lucky enough not to.

the patch in attachment removes the bogus calls to BUG_ON and according to David
(in CC and thanks for the long explanation on the problem) we can rely upon
things like lockdep to find problem that might be trying to catch.

Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] tidy up error message
David Teigland [Thu, 15 Nov 2007 15:01:13 +0000 (09:01 -0600)]
[GFS2] tidy up error message

Print error with log_error() to be consistent with others.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Check for installation of mount helpers for DLM mounts
Fabio Massimo Di Nitto [Thu, 15 Nov 2007 13:48:52 +0000 (13:48 +0000)]
[GFS2] Check for installation of mount helpers for DLM mounts

The patch is a fix to abort mount if the mount.gfs* and possible
umount.* are missing from /sbin.

While we do what we can to guarantee that they are installed properly in
userland (CVS HEAD), we want to make sure that mount still aborts properly.

The only sign of missing helpers is that lock_dlm will receive no mount options
at all. According to David the problem does not exist for lock_nolock as the
helpers are not required.

The patch has been tested for both gfs and gfs2 and it works as expected. The
lack of mount.gfs* will generate an error that is propagated to mount:

oot@node1:~# mount -t  gfs2 /dev/nbd2 /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/nbd2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

[ 3513.303346] GFS2: fsid=: Trying to join cluster "lock_dlm", "gutsy:gfs2"
[ 3513.304546] DLM/GFS2/GFS ERROR: (u)mount helpers are not installed properly!
[ 3513.306290] GFS2: fsid=: can't mount proto=lock_dlm, table=gutsy:gfs2, hostdata=

You might want to notice that it will also avoid mount to hang or fail silently
or with strange errors that will require the cluster to reboot/restart before
you can actually mount the filesystem again.

Signed-off-by: Fabio M. Di Nitto <fabbione@ubuntu.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Don't periodically update the jindex
Steven Whitehouse [Fri, 9 Nov 2007 10:07:21 +0000 (10:07 +0000)]
[GFS2] Don't periodically update the jindex

We only care about the content of the jindex in two cases,
one is when we mount the fs and the other is when we need
to recover another journal. In both cases we have to update
the jindex anyway, so there is no point in updating it
periodically between times, so this removes it to simplify
gfs2_logd.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Move gfs2_logd into log.c
Steven Whitehouse [Fri, 9 Nov 2007 10:01:41 +0000 (10:01 +0000)]
[GFS2] Move gfs2_logd into log.c

This means that we can mark gfs2_ail1_empty static and prepares
the way for further changes.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Use atomic_t for journal free blocks counter
Steven Whitehouse [Thu, 8 Nov 2007 14:55:03 +0000 (14:55 +0000)]
[GFS2] Use atomic_t for journal free blocks counter

This patch changes the counter which keeps track of the free
blocks in the journal to an atomic_t in preparation for the
following patch which will update the log reservation code.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Don't add glocks to the journal
Steven Whitehouse [Thu, 8 Nov 2007 14:25:12 +0000 (14:25 +0000)]
[GFS2] Don't add glocks to the journal

The only reason for adding glocks to the journal was to keep track
of which locks required a log flush prior to release. We add a
flag to the glock to allow this check to be made in a simpler way.

This reduces the size of a glock (by 12 bytes on i386, 24 on x86_64)
and means that we can avoid extra work during the journal flush.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] check kthread_should_stop when waiting
David Teigland [Wed, 7 Nov 2007 15:03:56 +0000 (09:03 -0600)]
[GFS2] check kthread_should_stop when waiting

Use wait_event_interruptible() in the lock_dlm thread instead
of an open coded equivalent, and include a kthread_should_stop()
check in the wait test so we don't miss a kthread_stop().

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Given device ID rather than s_id in "id" sysfs file
Bob Peterson [Fri, 2 Nov 2007 14:37:15 +0000 (09:37 -0500)]
[GFS2] Given device ID rather than s_id in "id" sysfs file

This patch changes the /sys/fs/gfs2/<s_id>/id file to give the device
id "major:minor" rather than the s_id.  That enables gfs2_tool to
match devices properly (by id, not name) when locating the tuning files.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove flags no longer required
Steven Whitehouse [Fri, 2 Nov 2007 09:14:31 +0000 (09:14 +0000)]
[GFS2] Remove flags no longer required

The HIF_MUTEX and HIF_PROMOTE flags were set on the glock holders
depending upon which of the two waiters lists they were going to
be queued upon. They were then tested when the holders were taken
off the lists to ensure that the right type of holder was being
dequeued.

Since we are already using separate lists, there doesn't seem a
lot of point having these flags as well, and since setting them
and testing them is in the fast path for locking and unlocking
glock, this patch removes them.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Reorder writeback for glock sync
Steven Whitehouse [Fri, 2 Nov 2007 08:39:34 +0000 (08:39 +0000)]
[GFS2] Reorder writeback for glock sync

Previously we were doing (write data, wait for data, write metadata, wait
for metadata). After this patch we so (write metadata, write data, wait for
data, wait for metadata) which should be more efficient.

Also I noticed that the drop_bh and xmote_bh functions were almost
identical. In fact the only difference was a single test, and that
test is such that in the drop_bh case, it would always evaluate to
the correct result. As such we can use the xmote_bh functions in
all the places where we were using the drop_bh function and remove
the drop_bh functions.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Add sync_page to metadata address space operations
Steven Whitehouse [Thu, 1 Nov 2007 09:34:14 +0000 (09:34 +0000)]
[GFS2] Add sync_page to metadata address space operations

This set of address space operations was missing a sync_page
operation.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove "reclaim limit"
Steven Whitehouse [Thu, 1 Nov 2007 09:26:54 +0000 (09:26 +0000)]
[GFS2] Remove "reclaim limit"

This call to reclaim glocks is not needed, and in particular we don't want it
in the fast path for locking glocks. The limit was entirely arbitrary anyway
and we can't expect users to adjust things like this, the remaining code will
do the right thing on its own.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove unused variables
Steven Whitehouse [Wed, 31 Oct 2007 14:24:33 +0000 (14:24 +0000)]
[GFS2] Remove unused variables

These haven't been used for some time, remove them.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Use correct include file in ops_address.c
Steven Whitehouse [Thu, 18 Oct 2007 10:15:50 +0000 (11:15 +0100)]
[GFS2] Use correct include file in ops_address.c

Something changed in the upstream kernel, and it needs this
one-liner to allow ops_address.c to build.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Don't hold page lock when starting transaction
Steven Whitehouse [Wed, 17 Oct 2007 13:05:41 +0000 (14:05 +0100)]
[GFS2] Don't hold page lock when starting transaction

This is an addendum to the new AOPs work which moves the point
at which we take the page lock so that we don't get it until
the last possible moment. This resolves a conflict between
starting transactions and the page lock.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Add writepages for GFS2 jdata
Steven Whitehouse [Wed, 17 Oct 2007 08:04:24 +0000 (09:04 +0100)]
[GFS2] Add writepages for GFS2 jdata

This patch resolves a lock ordering issue where we had been getting
a transaction lock in the wrong order with respect to the page lock.
By using writepages rather than just writepage, it is then possible
to start a transaction before locking the page, and thus matching the
locking order elsewhere in the code.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Split gfs2_writepage into three cases
Steven Whitehouse [Fri, 28 Sep 2007 12:49:05 +0000 (13:49 +0100)]
[GFS2] Split gfs2_writepage into three cases

This patch splits gfs2_writepage into separate functions for each of
the three cases: writeback, ordered and journalled. As a result
it becomes a lot easier to see what each one is doing. The common
code is moved into gfs2_writepage_common.

This fixes a performance bug where we were doing more work than
strictly required in the ordered write case.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Introduce gfs2_set_aops()
Steven Whitehouse [Wed, 17 Oct 2007 07:47:38 +0000 (08:47 +0100)]
[GFS2] Introduce gfs2_set_aops()

Just like ext3 we now have three sets of address space operations
to cover the cases of writeback, ordered and journalled data
writes. This means that the individual operations can now become
less complicated as we are able to remove some of the tests for
file data mode from the code.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Add gfs2_is_writeback()
Steven Whitehouse [Wed, 17 Oct 2007 07:35:19 +0000 (08:35 +0100)]
[GFS2] Add gfs2_is_writeback()

This adds a function "gfs2_is_writeback()" along the lines of the
existing "gfs2_is_jdata()" in order to clean up the code and make
the various tests for the inode mode more obvious. It also fixes
the PageChecked() logic where we were resetting the flag too early
in the case of an error path.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove unused field in struct gfs2_inode
Steven Whitehouse [Tue, 16 Oct 2007 10:47:04 +0000 (11:47 +0100)]
[GFS2] Remove unused field in struct gfs2_inode

Removes a field that is not used.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Remove useless i_cache from inodes
Steven Whitehouse [Mon, 15 Oct 2007 15:29:05 +0000 (16:29 +0100)]
[GFS2] Remove useless i_cache from inodes

The i_cache was designed to keep references to the indirect blocks
used during block mapping so that they didn't have to be looked
up continually. The idea failed because there are too many places
where the i_cache needs to be freed, and this has in the past been
the cause of many bugs.

In addition there was no performance benefit being gained since the
disk blocks in question were cached anyway. So this patch removes
it in order to simplify the code to prepare for other changes which
would otherwise have had to add further support for this feature.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Use ->page_mkwrite() for mmap()
Steven Whitehouse [Mon, 15 Oct 2007 14:40:33 +0000 (15:40 +0100)]
[GFS2] Use ->page_mkwrite() for mmap()

This cleans up the mmap() code path for GFS2 by implementing the
page_mkwrite function for GFS2. We are thus able to use the
generic filemap_fault function for our ->fault() implementation.

This now means that shared writable mappings will be much more
efficiently shared across the cluster if there is a reasonable
proportion of read activity (the greater proportion, the better).

As a side effect, it also reduces the size of the code, removes
special cases from readpage and readpages, and makes the code
path easier to follow.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[GFS2] Clean up internal read function
Steven Whitehouse [Mon, 15 Oct 2007 13:42:35 +0000 (14:42 +0100)]
[GFS2] Clean up internal read function

As requested by Christoph, this patch cleans up GFS2's internal
read function so that it no longer uses the do_generic_mapping_read
function. This function is obsolete and GFS2 is the last user of it.

As a side effect the internal read code gets smaller and easier
to read and gfs2_readpage is split into two. One function has the locking
and the other function has the rest of the logic.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
16 years ago[GFS2] Handle multiple glock demote requests
Wendy Cheng [Fri, 5 Oct 2007 04:27:58 +0000 (00:27 -0400)]
[GFS2] Handle multiple glock demote requests

Fix a race condition where multiple glock demote requests are sent to
a node back-to-back. This patch does a check inside handle_callback()
to see whether a demote request is in progress. If true, it sets a flag
to make sure run_queue() will loop again to handle the new request,
instead of erronously setting gl_demote_state to a different state.

Signed-off-by: S. Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
16 years ago[AVR32] extint: Set initial irq type to low level
Haavard Skinnemoen [Thu, 24 Jan 2008 15:56:53 +0000 (16:56 +0100)]
[AVR32] extint: Set initial irq type to low level

David Brownell pointed out a mismatch in the avr32 extint code:

> I noticed a small glitch that's not fixed by this patch:  the
> initial type is falling edge, but IRQ_TYPE_NONE is mapped to
> IRQ_TYPE_LEVEL_LOW.  Potentially surprising.

Fix it by setting the initial type (and handler) to low level,
matching the meaning of IRQ_TYPE_NONE.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] extint: change set_irq_type() handling
David Brownell [Wed, 19 Dec 2007 04:50:28 +0000 (20:50 -0800)]
[AVR32] extint: change set_irq_type() handling

Update the AVR32 EIC code to use the new __set_irq_handler_unlocked()
call, getting rid of one more instance of this widespread problem.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] NMI debugging
Haavard Skinnemoen [Wed, 10 Oct 2007 12:58:29 +0000 (14:58 +0200)]
[AVR32] NMI debugging

Change the NMI handler to use the die notifier chain to signal anyone
who cares. Add a simple "nmi debugger" which hooks into this chain and
that may dump registers, task state, etc. when it happens.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] constify function pointer tables
Jan Engelhardt [Tue, 22 Jan 2008 19:41:37 +0000 (20:41 +0100)]
[AVR32] constify function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] ATNGW100: Update defconfig
Haavard Skinnemoen [Wed, 9 Jan 2008 22:21:15 +0000 (23:21 +0100)]
[AVR32] ATNGW100: Update defconfig

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] ATSTK1002: Update defconfig
Haavard Skinnemoen [Wed, 9 Jan 2008 21:45:05 +0000 (22:45 +0100)]
[AVR32] ATSTK1002: Update defconfig

Turn off a few useless options, enable a few useful ones and enable
quite a few new drivers.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Kconfig: Choose daughterboard instead of CPU
Haavard Skinnemoen [Thu, 29 Nov 2007 10:15:15 +0000 (11:15 +0100)]
[AVR32] Kconfig: Choose daughterboard instead of CPU

Remove the CPU selection menu and instead let it be selected by the
board or daughterboard option. Add daughterboard selection for
ATSTK1000 (this was previously determined based on CPU type.)

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Add support for ATSTK1003 and ATSTK1004
Haavard Skinnemoen [Mon, 29 Oct 2007 16:03:26 +0000 (17:03 +0100)]
[AVR32] Add support for ATSTK1003 and ATSTK1004

ATSTK1003 and ATSTK1004 are CPU daughterboards for ATSTK1000 featuring
the AT32AP7001 and AT32AP7002 CPUs, respectively.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Clean up external DAC setup code
Haavard Skinnemoen [Mon, 29 Oct 2007 15:24:09 +0000 (16:24 +0100)]
[AVR32] Clean up external DAC setup code

Reduce the ridiculous amount of #ifdef clutter in atstk1002.c a bit by
moving all the extdac stuff into its own function and providing an
empty stub for the case when it isn't wanted.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] ATSTK1000: Move gpio-leds setup to setup.c
Haavard Skinnemoen [Mon, 29 Oct 2007 15:02:51 +0000 (16:02 +0100)]
[AVR32] ATSTK1000: Move gpio-leds setup to setup.c

There may be other boards than STK1002 that want to use the leds on
STK1000. Move it to stk1000 common code to make it easier to reuse.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Add support for AT32AP7001 and AT32AP7002
Haavard Skinnemoen [Mon, 29 Oct 2007 14:28:07 +0000 (15:28 +0100)]
[AVR32] Add support for AT32AP7001 and AT32AP7002

These are derivatives of the AT32AP7000 chip, which means that most of
the code stays the same. Rename a few files, functions, definitions
and config symbols to reflect that they apply to all AP700x chips, and
exclude some platform devices from chips where they aren't present.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Provide more CPU information in /proc/cpuinfo and dmesg
Haavard Skinnemoen [Fri, 7 Dec 2007 09:21:02 +0000 (10:21 +0100)]
[AVR32] Provide more CPU information in /proc/cpuinfo and dmesg

Add the following fields to /proc/cpuinfo:
  * chip type and revision (from the JTAG chip id)
  * cpu MHz (from clk_get_rate())
  * features (from the CONFIG0 register)

Also rename "cpu family" to "cpu arch" and "cpu type" to "cpu core" to
remove some ambiguity.

Show chip type and revision at bootup, and clarify that the other
kinds of IDs that we're already printing are for the cpu core and
architecture. Rename "AP7000" to "AP7" since that's the name of the
core.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Oprofile support
Haavard Skinnemoen [Wed, 4 Jan 2006 16:26:23 +0000 (17:26 +0100)]
[AVR32] Oprofile support

This adds the necessary architecture code to run oprofile on AVR32
using the performance counters documented by the AVR32 Architecture
Manual.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Acked-by: Philippe Elie <phil.el@wanadoo.fr>
16 years ago[AVR32] Include instrumentation menu
Haavard Skinnemoen [Wed, 31 Oct 2007 14:22:34 +0000 (15:22 +0100)]
[AVR32] Include instrumentation menu

Remove KPROBES option from Kconfig.debug and include
kernel/Kconfig.instrumentation.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years agoDisable VGA text console for AVR32 architecture
Hans-Christian Egtvedt [Mon, 3 Dec 2007 09:43:28 +0000 (10:43 +0100)]
Disable VGA text console for AVR32 architecture

This patch disables the VGA text console for AVR32 architecture since
it does not provide the vga.h include file.

AVR32 users should use framebuffer console instead if they need a
console on an attached display.

Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Enable debugging only when needed
Haavard Skinnemoen [Tue, 27 Nov 2007 12:50:45 +0000 (13:50 +0100)]
[AVR32] Enable debugging only when needed

Keep track of processes being debugged (including the kernel itself)
and turn the OCD system on and off as appropriate. Since enabling
debugging turns off some optimizations in the CPU core, this fixes the
issue that enabling KProbes support or simply running a program under
gdbserver will reduce system performance significantly until the next
reboot.

The CPU performance will still be reduced for all processes while a
process is being debugged, but this is a lot better than reducing the
performance forever.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years agoptrace: Call arch_ptrace_attach() when request=PTRACE_TRACEME
Haavard Skinnemoen [Tue, 27 Nov 2007 12:02:40 +0000 (13:02 +0100)]
ptrace: Call arch_ptrace_attach() when request=PTRACE_TRACEME

arch_ptrace_attach() is a hook that allows the architecture to do
book-keeping after a ptrace attach. This patch adds a call to this
hook when handling a PTRACE_TRACEME request as well.

Currently only one architecture, m32r, implements this hook. When
called, it initializes a number of debug trap slots in the ptraced
task's thread struct, and it looks to me like this is the right thing
to do after a PTRACE_TRACEME request as well, not only after
PTRACE_ATTACH. Please correct me if I'm wrong.

I want to use this hook on AVR32 to turn the debugging hardware on
when a process is actually being debugged and keep it off otherwise.
To be able to do this, I need to intercept PTRACE_TRACEME and
PTRACE_ATTACH, as well as PTRACE_DETACH and thread exit. The latter
two can be handled by existing hooks.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Remove redundant try_to_freeze() call from do_signal()
Haavard Skinnemoen [Wed, 28 Nov 2007 13:51:44 +0000 (14:51 +0100)]
[AVR32] Remove redundant try_to_freeze() call from do_signal()

get_signal_to_deliver() will call try_to_freeze(), so there's no point
in do_signal() doing it as well.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years ago[AVR32] Drop GFP_COMP for DMA memory allocations
Haavard Skinnemoen [Thu, 5 Jul 2007 15:08:09 +0000 (17:08 +0200)]
[AVR32] Drop GFP_COMP for DMA memory allocations

dma_alloc_coherent wants to split pages after allocation in order to
reduce the memory footprint. This does not work well with GFP_COMP
pages, so drop this flag before allocation.

This patch was forward-ported from BSP 2.0

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
16 years agoDriver core: coding style fixes
Greg Kroah-Hartman [Fri, 25 Jan 2008 06:50:12 +0000 (22:50 -0800)]
Driver core: coding style fixes

Fix up a number of coding style issues in the drivers/base/ directory
that have annoyed me over the years.  checkpatch.pl is now very happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: fix coding style issues in kobject c files
Greg Kroah-Hartman [Fri, 25 Jan 2008 05:59:04 +0000 (21:59 -0800)]
Kobject: fix coding style issues in kobject c files

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>
16 years agoKobject: fix coding style issues in kobject.h
Greg Kroah-Hartman [Fri, 25 Jan 2008 05:27:06 +0000 (21:27 -0800)]
Kobject: fix coding style issues in kobject.h

Finally clean up the odd spaces and other mess in kobject.h

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: fix coding style issues in device.h
Greg Kroah-Hartman [Fri, 25 Jan 2008 05:04:46 +0000 (21:04 -0800)]
Driver core: fix coding style issues in device.h

Finally clean up the odd spaces and other mess in device.h

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agospi: use class iteration api
Dave Young [Tue, 22 Jan 2008 07:14:18 +0000 (15:14 +0800)]
spi: use class iteration api

Convert to use the class iteration api.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoscsi: use class iteration api
Dave Young [Tue, 22 Jan 2008 06:01:34 +0000 (14:01 +0800)]
scsi: use class iteration api

Convert to use the class iteration api.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agortc: use class iteration api
Dave Young [Tue, 22 Jan 2008 06:00:34 +0000 (14:00 +0800)]
rtc: use class iteration api

Convert to use the class iteration api.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agopower supply : use class iteration api
Dave Young [Tue, 22 Jan 2008 05:58:22 +0000 (13:58 +0800)]
power supply : use class iteration api

Convert to use the class iteration api.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoieee1394: use class iteration api
Dave Young [Tue, 22 Jan 2008 05:56:32 +0000 (13:56 +0800)]
ieee1394: use class iteration api

Convert to use the class iteration api.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver Core: add class iteration api
Dave Young [Tue, 22 Jan 2008 07:27:08 +0000 (15:27 +0800)]
Driver Core: add class iteration api

Add the following class iteration functions for driver use:
class_for_each_device
class_find_device
class_for_each_child
class_find_child

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: Cleanup get_device_parent() in device_add() and device_move()
Cornelia Huck [Mon, 21 Jan 2008 15:09:44 +0000 (16:09 +0100)]
Driver core: Cleanup get_device_parent() in device_add() and device_move()

Make setup_parent() void as get_device_parent() will always return
either a valid kobject or NULL.
Introduce cleanup_glue_dir() to drop reference grabbed on "glue"
directory by get_device_parent(). Use it for cleanup in device_move()
and device_add() on errors.

This should fix the refcounting problem reported in
http://marc.info/?l=linux-kernel&m=120052487909200&w=2

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Dave Young <hidave.darkstar@gmail.com>
Cc: Gabor Gombas <gombasg@sztaki.hu>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: David Miller <davem@davemloft.net>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUIO: constify function pointer tables
Jan Engelhardt [Tue, 22 Jan 2008 19:50:54 +0000 (20:50 +0100)]
UIO: constify function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver Core: constify the name passed to platform_device_register_simple
Stephen Rothwell [Fri, 11 Jan 2008 06:24:53 +0000 (17:24 +1100)]
Driver Core: constify the name passed to platform_device_register_simple

This name is just passed to platform_device_alloc which has its parameter
declared const.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agodriver core: fix build with SYSFS=n
Randy Dunlap [Mon, 31 Dec 2007 18:05:43 +0000 (10:05 -0800)]
driver core: fix build with SYSFS=n

When SYSFS=n and MODULES=y, build ends with:

linux-2.6.24-rc6-mm1/drivers/base/module.c: In function 'module_add_driver':
linux-2.6.24-rc6-mm1/drivers/base/module.c:49: error: 'module_kset' undeclared (first use in this function)
make[3]: *** [drivers/base/module.o] Error 1

Below is one possible fix.
Build-tested with all 4 config combinations of SYSFS & MODULES.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agosysfs: make SYSFS_DEPRECATED depend on SYSFS
Randy Dunlap [Mon, 31 Dec 2007 18:05:34 +0000 (10:05 -0800)]
sysfs: make SYSFS_DEPRECATED depend on SYSFS

Make SYSFS_DEPRECATED depend on SYSFS since files that check
CONFIG_SYSFS_DEPRECATED don't check for CONFIG_SYSFS first.
Also don't prompt user about SYSFS_DEPRECATED if SYSFS=n.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init
Denis Cheng [Wed, 5 Dec 2007 18:24:40 +0000 (02:24 +0800)]
Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init

LIST_HEAD has been widely used, so switch to this simpler method.

Signed-off-by: Denis Cheng <crquan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agokobject: add sample code for how to use ksets/ktypes/kobjects
Greg Kroah-Hartman [Tue, 27 Nov 2007 19:28:26 +0000 (11:28 -0800)]
kobject: add sample code for how to use ksets/ktypes/kobjects

This is a more complex example showing how to create a kset and a ktype
and some default attributes for a group of kobjects.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agokobject: add sample code for how to use kobjects in a simple manner.
Greg Kroah-Hartman [Tue, 27 Nov 2007 19:28:26 +0000 (11:28 -0800)]
kobject: add sample code for how to use kobjects in a simple manner.

This is a simple kobject module, showing how to use kobj_attributes in
basic and more complex ways.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agokobject: update the kobject/kset documentation
Greg Kroah-Hartman [Tue, 27 Nov 2007 19:28:26 +0000 (11:28 -0800)]
kobject: update the kobject/kset documentation

This provides a much-needed kobject and kset documentation update.

Thanks to Kay Sievers, Alan Stern, Jonathan Corbet, Randy Dunlap, Jan
Engelhardt, and others for reviewing and providing help with this
document.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agokobject: remove old, outdated documentation.
Greg Kroah-Hartman [Tue, 27 Nov 2007 19:28:26 +0000 (11:28 -0800)]
kobject: remove old, outdated documentation.

As we are replacing the documentation, it's easier to do this in a two
stage pass, delete the old file and add the new one.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: change sysdev classes to use dynamic kobject names
Kay Sievers [Thu, 20 Dec 2007 01:09:39 +0000 (02:09 +0100)]
Driver core: change sysdev classes to use dynamic kobject names

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>
16 years agoKobject: remove kobject_unregister() as no one uses it anymore
Greg Kroah-Hartman [Thu, 20 Dec 2007 16:13:05 +0000 (08:13 -0800)]
Kobject: remove kobject_unregister() as no one uses it anymore

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>
16 years agoKobject: convert remaining kobject_unregister() to kobject_put()
Greg Kroah-Hartman [Thu, 20 Dec 2007 16:13:05 +0000 (08:13 -0800)]
Kobject: convert remaining kobject_unregister() to kobject_put()

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>
16 years agoKobject: convert fs/* from kobject_unregister() to kobject_put()
Greg Kroah-Hartman [Thu, 20 Dec 2007 16:13:05 +0000 (08:13 -0800)]
Kobject: convert fs/* from kobject_unregister() to kobject_put()

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>
16 years agoKobject: convert drivers/* from kobject_unregister() to kobject_put()
Greg Kroah-Hartman [Thu, 20 Dec 2007 16:13:05 +0000 (08:13 -0800)]
Kobject: convert drivers/* from kobject_unregister() to kobject_put()

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>
16 years agoKobject: convert arch/* from kobject_unregister() to kobject_put()
Greg Kroah-Hartman [Thu, 20 Dec 2007 16:13:05 +0000 (08:13 -0800)]
Kobject: convert arch/* from kobject_unregister() to kobject_put()

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>
16 years agoModules: remove unneeded release function
Greg Kroah-Hartman [Sun, 23 Dec 2007 05:18:25 +0000 (21:18 -0800)]
Modules: remove unneeded release function

Now that kobjects properly clean up their name structures, no matter if
they have a release function or not, we can drop this empty module
kobject release function too (it was needed prior to this because of the
way we handled static kobject names, we based the fact that if a release
function was present, then we could safely free the name string, now we
are more smart about things and only free names we have previously set.)

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: auto-cleanup on final unref
Kay Sievers [Wed, 19 Dec 2007 00:40:42 +0000 (01:40 +0100)]
Kobject: auto-cleanup on final unref

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>
16 years agoKset: remove kset_add function
Greg Kroah-Hartman [Tue, 9 Apr 2002 19:14:34 +0000 (12:14 -0700)]
Kset: remove kset_add function

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>
16 years agoKobject: remove kobject_register()
Greg Kroah-Hartman [Wed, 19 Dec 2007 19:26:50 +0000 (11:26 -0800)]
Kobject: remove kobject_register()

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>
16 years agoKobject: rename kobject_init_ng() to kobject_init()
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: rename kobject_init_ng() to kobject_init()

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>
16 years agoKobject: remove kobject_init() as no one uses it anymore
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: remove kobject_init() as no one uses it anymore

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>
16 years agoKobject: rename kobject_add_ng() to kobject_add()
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: rename kobject_add_ng() to kobject_add()

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>
16 years agoKobject: remove kobject_add() as no one uses it anymore
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: remove kobject_add() as no one uses it anymore

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>
16 years agoKobject: convert kernel/module.c to use kobject_init/add_ng()
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: convert kernel/module.c to use kobject_init/add_ng()

This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: convert drivers/md/md.c to use kobject_init/add_ng()
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: convert drivers/md/md.c to use kobject_init/add_ng()

This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Neil Brown <neilb@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: convert block/ll_rw_blk.c to use kobject_init/add_ng()
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: convert block/ll_rw_blk.c to use kobject_init/add_ng()

This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: convert block/elevator.c to use kobject_init/add_ng()
Greg Kroah-Hartman [Tue, 18 Dec 2007 06:05:35 +0000 (23:05 -0700)]
Kobject: convert block/elevator.c to use kobject_init/add_ng()

This converts the code to use the new kobject functions, cleaning up the
logic in doing so.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: convert block from raw kobjects to core devices
Kay Sievers [Mon, 21 May 2007 20:08:01 +0000 (22:08 +0200)]
Driver core: convert block from raw kobjects to core devices

This moves the block devices to /sys/class/block. It will create a
flat list of all block devices, with the disks and partitions in one
directory. For compatibility /sys/block is created and contains symlinks
to the disks.

  /sys/class/block
  |-- sda -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
  |-- sda1 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
  |-- sda10 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10
  |-- sda5 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5
  |-- sda6 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6
  |-- sda7 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7
  |-- sda8 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8
  |-- sda9 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9
  `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0

  /sys/block/
  |-- sda -> ../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
  `-- sr0 -> ../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: drop child->parent ref at unregistration
Alan Stern [Mon, 19 Nov 2007 15:53:40 +0000 (10:53 -0500)]
Kobject: drop child->parent ref at unregistration

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>
16 years agosysfs: fix /sys/module/*/holders after sysfs logic change
Kay Sievers [Thu, 29 Nov 2007 22:46:11 +0000 (23:46 +0100)]
sysfs: fix /sys/module/*/holders after sysfs logic change

Sysfs symlinks now require fully registered kobjects as a target,
otherwise the call to create a symlink will fail. Here we register
the kobject before we request the symlink in the holders directory.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Tejun Heo <teheo@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: fix class glue dir cleanup logic
Kay Sievers [Wed, 21 Nov 2007 16:29:15 +0000 (17:29 +0100)]
Driver core: fix class glue dir cleanup logic

We should remove the glue directory between the class and the bus
device _after_ we sent out the 'remove' event for the device, otherwise
the parent relationship is no longer valid, and composing the path
with deleted sysfs entries will not work.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: fix race in __device_release_driver
Alan Stern [Fri, 16 Nov 2007 16:57:28 +0000 (11:57 -0500)]
Driver core: fix race in __device_release_driver

This patch (as1013) was suggested by David Woodhouse; it fixes a race
in the driver core.  If a device is unregistered at the same time as
its driver is unloaded, the driver's code pages may be unmapped while
the remove method is still running.  The calls to get_driver() and
put_driver() were intended to prevent this, but they don't work if the
driver's module count has already dropped to 0.

Instead, the patch keeps the device on the driver's list until after
the remove method has returned.  This forces the necessary
synchronization to occur.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoKobject: change drivers/base/bus to use kobject_init_and_add
Greg Kroah-Hartman [Mon, 17 Dec 2007 19:54:39 +0000 (15:54 -0400)]
Kobject: change drivers/base/bus to use kobject_init_and_add

Stop using kobject_register, as this way we can control the sending of
the uevent properly, after everything is properly initialized.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoDriver core: clean up debugging messages
Greg Kroah-Hartman [Thu, 29 Nov 2007 07:49:41 +0000 (23:49 -0800)]
Driver core: clean up debugging messages

The driver core debugging messages are a mess.  This provides a unified
message that makes them actually useful.

The format for new kobject debug messages should be:
driver/bus/class: 'OBJECT_NAME': FUNCTION_NAME: message.\n

Note, the class code is not changed in this patch due to pending patches
in my queue that this would conflict with.  A later patch will clean
them up.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>