Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45831
b: refs/heads/master
c: 1e9a51d
h: refs/heads/master
i:
  45829: 562a87a
  45827: 3f3198e
  45823: 3ff96a6
v: v3
  • Loading branch information
Atsushi Nemoto authored and Linus Torvalds committed Jan 26, 2007
1 parent 6f2e4b9 commit 8ef682d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 863c47028eb469c9e6c4e4287b01bea2bbf78766
refs/heads/master: 1e9a51dca19dc1d8807c63cb3bd4413d3f95aaf5
23 changes: 14 additions & 9 deletions trunk/drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ spi_alloc_master(struct device *dev, unsigned size)

class_device_initialize(&master->cdev);
master->cdev.class = &spi_master_class;
kobj_set_kset_s(&master->cdev, spi_master_class.subsys);
master->cdev.dev = get_device(dev);
spi_master_set_devdata(master, &master[1]);

Expand Down Expand Up @@ -466,14 +465,20 @@ EXPORT_SYMBOL_GPL(spi_unregister_master);
*/
struct spi_master *spi_busnum_to_master(u16 bus_num)
{
char name[9];
struct kobject *bus;

snprintf(name, sizeof name, "spi%u", bus_num);
bus = kset_find_obj(&spi_master_class.subsys.kset, name);
if (bus)
return container_of(bus, struct spi_master, cdev.kobj);
return NULL;
struct class_device *cdev;
struct spi_master *master = NULL;
struct spi_master *m;

down(&spi_master_class.sem);
list_for_each_entry(cdev, &spi_master_class.children, node) {
m = container_of(cdev, struct spi_master, cdev);
if (m->bus_num == bus_num) {
master = spi_master_get(m);
break;
}
}
up(&spi_master_class.sem);
return master;
}
EXPORT_SYMBOL_GPL(spi_busnum_to_master);

Expand Down

0 comments on commit 8ef682d

Please sign in to comment.