09 Oct, 2008
1 commit
-
Iterating over entries using callback usually isn't too fun especially
when the entry being iterated over can't be manipulated freely. This
patch converts class->p->class_devices to klist and implements class
device iterator so that the users can freely build their own control
structure. The users are also free to call back into class code
without worrying about locking.class_for_each_device() and class_find_device() are converted to use
the new iterators, so their users don't have to worry about locking
anymore either.Note: This depends on klist-dont-iterate-over-deleted-entries patch
because class_intf->add/remove_dev() depends on proper synchronization
with device removal.Signed-off-by: Tejun Heo
Cc: Greg Kroah-Hartman
Cc: Jens Axboe
Signed-off-by: Jens Axboe
22 Aug, 2008
1 commit
-
Anti-oops medicine for the class iterators ... the oops was
observed when a class was implicitly referenced before it
was initialized.[Modified by Greg to spit a warning back so someone knows to fix their code]
Signed-off-by: David Brownell
Signed-off-by: Greg Kroah-Hartman
29 Jul, 2008
1 commit
-
Fix @key parameter to mutex_init() and one of its callers.
Warning(linux-2.6.26-git11//drivers/base/class.c:210): No description found for parameter 'key'
Signed-off-by: Randy Dunlap
Acked-by: Greg Kroah-Hartman
Signed-off-by: Ingo Molnar
22 Jul, 2008
10 commits
-
Now that the lockdep infrastructure in the class core is in place, we
should be able to properly change the internal class semaphore to be a
mutex.David wrote the original patch, and Greg fixed it up to apply properly
due to all of the recent changes in this area.From: Dave Young
Cc: Matthew Wilcox
Cc: Kay Sievers
Cc: Andrew Morton
Cc: James Bottomley
Signed-off-by: Greg Kroah-Hartman -
This adds the infrastructure to properly handle lockdep issues when the
internal class semaphore is changed to a mutex.Matthew wrote the original patch, and Greg fixed it up to work properly
with the class_create() function.From: Matthew Wilcox
Cc: Kay Sievers
Cc: Dave Young
Cc: Andrew Morton
Cc: James Bottomley
Cc: Peter Zijlstra
Cc: Ingo Molnar
Signed-off-by: Greg Kroah-Hartman -
This renames the struct class "sem" field to be "class_sem" to make
things easier when struct bus_type and struct class merge in the future.
It also makes grepping for fields easier as well.Based on an idea from Kay.
Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This renames the struct class "subsys" field to be "class_subsys" to
make things easier when struct bus_type and struct class merge in the
future. It also makes grepping for fields easier as well.Based on an idea from Kay.
Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This renames the struct class "interfaces" field to be
"class_interfaces" to make things easier when struct bus_type and struct
class merge in the future. It also makes grepping for fields easier as
well.Based on an idea from Kay.
Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This renames the struct class "devices" field to be "class_devices" to
make things easier when struct bus_type and struct class merge in the
future. It also makes grepping for fields easier as well.Based on an idea from Kay.
Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This moves the portions of struct class that are dynamic (kobject and
lock and lists) out of the main structure and into a dynamic, private,
structure.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This mirrors the functionality that driver_find_device has as well.
We add a start variable, and all callers of the function are fixed up at
the same time.The block layer will be using this new functionality in a follow-on
patch.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This mirrors the functionality that driver_for_each_device has as well.
We add a start variable, and all callers of the function are fixed up at
the same time.The block layer will be using this new functionality in a follow-on
patch.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
Why?:
There are occasions where userspace would like to access sysfs
attributes for a device but it may not know how sysfs has named the
device or the path. For example what is the sysfs path for
/dev/disk/by-id/ata-ST3160827AS_5MT004CK? With this change a call to
stat(2) returns the major:minor then userspace can see that
/sys/dev/block/8:32 links to /sys/block/sdc.What are the alternatives?:
1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce
the need to proliferate ioctl interfaces into the kernel, so this
seems counter productive.2/ Use udev to create these symlinks: Also doable, but it adds a
udev dependency to utilities that might be running in a limited
environment like an initramfs.3/ Do a full-tree search of sysfs.
[kay.sievers@vrfy.org: fix duplicate registrations]
[kay.sievers@vrfy.org: cleanup suggestions]Cc: Neil Brown
Cc: Tejun Heo
Acked-by: Kay Sievers
Reviewed-by: SL Baur
Acked-by: Kay Sievers
Acked-by: Mark Lord
Acked-by: H. Peter Anvin
Signed-off-by: Dan Williams
Signed-off-by: Greg Kroah-Hartman
15 May, 2008
1 commit
-
because of the class_device was removed, now do the children list removing
Signed-off-by: Dave Young
Signed-off-by: Greg Kroah-Hartman
01 May, 2008
1 commit
-
Signed-off-by: Kay Sievers
Signed-off-by: Greg Kroah-Hartman
20 Apr, 2008
1 commit
-
__FUNCTION__ is gcc-specific, use __func__
Signed-off-by: Harvey Harrison
Signed-off-by: Greg Kroah-Hartman
31 Jan, 2008
2 commits
-
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6:
PPC: Fix powerpc vio_find_name to not use devices_subsys
Driver core: add bus_find_device_by_name function
Module: check to see if we have a built in module with the same name
x86: fix runtime error in arch/x86/kernel/cpu/mcheck/mce_amd_64.c
Driver core: Fix up build when CONFIG_BLOCK=N -
Fix kernel-doc empty line warning:
Warning(linux-2.6.24-git8//drivers/base/class.c:866): bad line:Signed-off-by: Randy Dunlap
Signed-off-by: Linus Torvalds
28 Jan, 2008
1 commit
-
This fixes up the driver core build errors when CONFIG_BLOCK=N
Thanks to Alexander van Heukelum for the basis
of this patch, and to Jeremy Fitzhardinge for
reporting the problem.Cc: Alexander van Heukelum
Cc: Jeremy Fitzhardinge
Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman
25 Jan, 2008
11 commits
-
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
-
Add the following class iteration functions for driver use:
class_for_each_device
class_find_device
class_for_each_child
class_find_childSigned-off-by: Dave Young
Acked-by: Cornelia Huck
Signed-off-by: Greg Kroah-Hartman -
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
Signed-off-by: Greg Kroah-Hartman -
Now that the old kobject_init() function is gone, rename
kobject_init_ng() to kobject_init() to clean up the namespace.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
Now that the old kobject_add() function is gone, rename kobject_add_ng()
to kobject_add() to clean up the namespace.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
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/sr0Signed-off-by: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This converts the code to use the new kobject functions, cleaning up the
logic in doing so.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
These functions are no longer used and are the last remants of the old
subsystem crap. So delete them for good.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
This macro is no longer used. ksets should be created dynamically with
a call to kset_create_and_add() not declared statically.Yes, there are 5 remaining static struct kset usages in the kernel tree,
but they will be fixed up soon.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
Dynamically create the kset instead of declaring it statically.
The class_obj subsystem is not yet converted as it is more complex and
should be going away soon with the removal of class_device from the
kernel tree.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
We don't need a "default" ktype for a kset. We should set this
explicitly every time for each kset. This change is needed so that we
can make ksets dynamic, and cleans up one of the odd, undocumented
assumption that the kset/kobject/ktype model has.This patch is based on a lot of help from Kay Sievers.
Nasty bug in the block code was found by Dave Young
Cc: Kay Sievers
Cc: Dave Young
Signed-off-by: Greg Kroah-Hartman
01 Nov, 2007
1 commit
-
This reverts commit fcd239d3d5575e5cc63aab5c33cf6dc66904f6d6.
I messed up, ia64 still uses these files in the current tree, and now
can not build the pci code, which all ia64 boxes seem to require :)This fixes that mistake.
Signed-off-by: Greg Kroah-Hartman
31 Oct, 2007
1 commit
-
These functions are not used by anyone, so remove them from the tree.
The class_device code will be removed soon anyway, so no future users
will ever be possible.Signed-off-by: Greg Kroah-Hartman
13 Oct, 2007
6 commits
-
This makes it a bit more sane when trying to figure out how to clean up
the ktype mess.Based on a larger patch from Kay Sievers
Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
There is only one user of it, and it is only a wrapper for kset_init().
Signed-off-by: Greg Kroah-Hartman
-
There are no more subsystems, it's a kset now so remove the function and
the only two users, which are in the driver core.Signed-off-by: Greg Kroah-Hartman
-
There are no more subsystems, it's a kset now so remove the function and
the only two users, which are in the driver core.Signed-off-by: Greg Kroah-Hartman
-
This macro is only used by the driver core and is held over from when we
had subsystems. It is not needed anymore.Signed-off-by: Greg Kroah-Hartman
-
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.Signed-off-by: Kay Sievers
Cc: Mathieu Desnoyers
Cc: Cornelia Huck
Signed-off-by: Greg Kroah-Hartman
12 Jul, 2007
2 commits
-
devt_attr and uevent_attr are either allocated dynamically with or
embedded in device and class_device as they needed their owner field
set to the module implementing the driver. Now that sysfs implements
immediate disconnect and owner field removed from struct attribute,
there is no reason to do this. Remove these attributes from
[class_]device and use static attribute structures instead.Signed-off-by: Tejun Heo
Signed-off-by: Greg Kroah-Hartman -
sysfs is now completely out of driver/module lifetime game. After
deletion, a sysfs node doesn't access anything outside sysfs proper,
so there's no reason to hold onto the attribute owners. Note that
often the wrong modules were accounted for as owners leading to
accessing removed modules.This patch kills now unnecessary attribute->owner. Note that with
this change, userland holding a sysfs node does not prevent the
backing module from being unloaded.For more info regarding lifetime rule cleanup, please read the
following message.http://article.gmane.org/gmane.linux.kernel/510293
(tweaked by Greg to not delete the field just yet, to make it easier to
merge things properly.)Signed-off-by: Tejun Heo
Cc: Cornelia Huck
Cc: Andrew Morton
Signed-off-by: Greg Kroah-Hartman