aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/spi/spi.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 93e9de46977a..682a6a48fec3 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -485,6 +485,15 @@ void spi_unregister_master(struct spi_master *master)
485} 485}
486EXPORT_SYMBOL_GPL(spi_unregister_master); 486EXPORT_SYMBOL_GPL(spi_unregister_master);
487 487
488static int __spi_master_match(struct device *dev, void *data)
489{
490 struct spi_master *m;
491 u16 *bus_num = data;
492
493 m = container_of(dev, struct spi_master, dev);
494 return m->bus_num == *bus_num;
495}
496
488/** 497/**
489 * spi_busnum_to_master - look up master associated with bus_num 498 * spi_busnum_to_master - look up master associated with bus_num
490 * @bus_num: the master's bus number 499 * @bus_num: the master's bus number
@@ -499,17 +508,12 @@ struct spi_master *spi_busnum_to_master(u16 bus_num)
499{ 508{
500 struct device *dev; 509 struct device *dev;
501 struct spi_master *master = NULL; 510 struct spi_master *master = NULL;
502 struct spi_master *m; 511
503 512 dev = class_find_device(&spi_master_class, &bus_num,
504 down(&spi_master_class.sem); 513 __spi_master_match);
505 list_for_each_entry(dev, &spi_master_class.children, node) { 514 if (dev)
506 m = container_of(dev, struct spi_master, dev); 515 master = container_of(dev, struct spi_master, dev);
507 if (m->bus_num == bus_num) { 516 /* reference got in class_find_device */
508 master = spi_master_get(m);
509 break;
510 }
511 }
512 up(&spi_master_class.sem);
513 return master; 517 return master;
514} 518}
515EXPORT_SYMBOL_GPL(spi_busnum_to_master); 519EXPORT_SYMBOL_GPL(spi_busnum_to_master);