diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2009-01-06 13:44:37 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-06 13:44:37 -0500 |
commit | 35f74fcab1228be03eab5f4d21ddc89fca1bc5b8 (patch) | |
tree | 90accbaacafe47adc265c8fd414d4a1a058ca593 /drivers/spi | |
parent | 94b324864ef2a8e461f3933ab99638255299e9f0 (diff) |
spi: struct device - replace bus_id with dev_name(), dev_set_name()
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 20 | ||||
-rw-r--r-- | drivers/spi/spi_bitbang.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_butterfly.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_lm70llp.c | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3734dc9708e1..643908b74bc0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -47,7 +47,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf) | |||
47 | { | 47 | { |
48 | const struct spi_device *spi = to_spi_device(dev); | 48 | const struct spi_device *spi = to_spi_device(dev); |
49 | 49 | ||
50 | return snprintf(buf, BUS_ID_SIZE + 1, "%s\n", spi->modalias); | 50 | return sprintf(buf, "%s\n", spi->modalias); |
51 | } | 51 | } |
52 | 52 | ||
53 | static struct device_attribute spi_dev_attrs[] = { | 53 | static struct device_attribute spi_dev_attrs[] = { |
@@ -63,7 +63,7 @@ static int spi_match_device(struct device *dev, struct device_driver *drv) | |||
63 | { | 63 | { |
64 | const struct spi_device *spi = to_spi_device(dev); | 64 | const struct spi_device *spi = to_spi_device(dev); |
65 | 65 | ||
66 | return strncmp(spi->modalias, drv->name, BUS_ID_SIZE) == 0; | 66 | return strcmp(spi->modalias, drv->name) == 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) | 69 | static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) |
@@ -243,8 +243,7 @@ int spi_add_device(struct spi_device *spi) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | /* Set the bus ID string */ | 245 | /* Set the bus ID string */ |
246 | snprintf(spi->dev.bus_id, sizeof spi->dev.bus_id, | 246 | dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), |
247 | "%s.%u", spi->master->dev.bus_id, | ||
248 | spi->chip_select); | 247 | spi->chip_select); |
249 | 248 | ||
250 | 249 | ||
@@ -254,7 +253,7 @@ int spi_add_device(struct spi_device *spi) | |||
254 | */ | 253 | */ |
255 | mutex_lock(&spi_add_lock); | 254 | mutex_lock(&spi_add_lock); |
256 | 255 | ||
257 | if (bus_find_device_by_name(&spi_bus_type, NULL, spi->dev.bus_id) | 256 | if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) |
258 | != NULL) { | 257 | != NULL) { |
259 | dev_err(dev, "chipselect %d already in use\n", | 258 | dev_err(dev, "chipselect %d already in use\n", |
260 | spi->chip_select); | 259 | spi->chip_select); |
@@ -269,7 +268,7 @@ int spi_add_device(struct spi_device *spi) | |||
269 | status = spi->master->setup(spi); | 268 | status = spi->master->setup(spi); |
270 | if (status < 0) { | 269 | if (status < 0) { |
271 | dev_err(dev, "can't %s %s, status %d\n", | 270 | dev_err(dev, "can't %s %s, status %d\n", |
272 | "setup", spi->dev.bus_id, status); | 271 | "setup", dev_name(&spi->dev), status); |
273 | goto done; | 272 | goto done; |
274 | } | 273 | } |
275 | 274 | ||
@@ -277,9 +276,9 @@ int spi_add_device(struct spi_device *spi) | |||
277 | status = device_add(&spi->dev); | 276 | status = device_add(&spi->dev); |
278 | if (status < 0) | 277 | if (status < 0) |
279 | dev_err(dev, "can't %s %s, status %d\n", | 278 | dev_err(dev, "can't %s %s, status %d\n", |
280 | "add", spi->dev.bus_id, status); | 279 | "add", dev_name(&spi->dev), status); |
281 | else | 280 | else |
282 | dev_dbg(dev, "registered child %s\n", spi->dev.bus_id); | 281 | dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev)); |
283 | 282 | ||
284 | done: | 283 | done: |
285 | mutex_unlock(&spi_add_lock); | 284 | mutex_unlock(&spi_add_lock); |
@@ -504,12 +503,11 @@ int spi_register_master(struct spi_master *master) | |||
504 | /* register the device, then userspace will see it. | 503 | /* register the device, then userspace will see it. |
505 | * registration fails if the bus ID is in use. | 504 | * registration fails if the bus ID is in use. |
506 | */ | 505 | */ |
507 | snprintf(master->dev.bus_id, sizeof master->dev.bus_id, | 506 | dev_set_name(&master->dev, "spi%u", master->bus_num); |
508 | "spi%u", master->bus_num); | ||
509 | status = device_add(&master->dev); | 507 | status = device_add(&master->dev); |
510 | if (status < 0) | 508 | if (status < 0) |
511 | goto done; | 509 | goto done; |
512 | dev_dbg(dev, "registered master %s%s\n", master->dev.bus_id, | 510 | dev_dbg(dev, "registered master %s%s\n", dev_name(&master->dev), |
513 | dynamic ? " (dynamic)" : ""); | 511 | dynamic ? " (dynamic)" : ""); |
514 | 512 | ||
515 | /* populate children from any spi device tables */ | 513 | /* populate children from any spi device tables */ |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 96cc39ecb6e2..85e61f451218 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -475,7 +475,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) | |||
475 | /* this task is the only thing to touch the SPI bits */ | 475 | /* this task is the only thing to touch the SPI bits */ |
476 | bitbang->busy = 0; | 476 | bitbang->busy = 0; |
477 | bitbang->workqueue = create_singlethread_workqueue( | 477 | bitbang->workqueue = create_singlethread_workqueue( |
478 | bitbang->master->dev.parent->bus_id); | 478 | dev_name(bitbang->master->dev.parent)); |
479 | if (bitbang->workqueue == NULL) { | 479 | if (bitbang->workqueue == NULL) { |
480 | status = -EBUSY; | 480 | status = -EBUSY; |
481 | goto err1; | 481 | goto err1; |
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index 0ee2b2090252..c2184866fa9c 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c | |||
@@ -287,7 +287,7 @@ static void butterfly_attach(struct parport *p) | |||
287 | pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]); | 287 | pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]); |
288 | if (pp->dataflash) | 288 | if (pp->dataflash) |
289 | pr_debug("%s: dataflash at %s\n", p->name, | 289 | pr_debug("%s: dataflash at %s\n", p->name, |
290 | pp->dataflash->dev.bus_id); | 290 | dev_name(&pp->dataflash->dev)); |
291 | 291 | ||
292 | // dev_info(_what?_, ...) | 292 | // dev_info(_what?_, ...) |
293 | pr_info("%s: AVR Butterfly\n", p->name); | 293 | pr_info("%s: AVR Butterfly\n", p->name); |
diff --git a/drivers/spi/spi_lm70llp.c b/drivers/spi/spi_lm70llp.c index 39d8d8ad65c0..af6526767e2a 100644 --- a/drivers/spi/spi_lm70llp.c +++ b/drivers/spi/spi_lm70llp.c | |||
@@ -287,7 +287,7 @@ static void spi_lm70llp_attach(struct parport *p) | |||
287 | pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info); | 287 | pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info); |
288 | if (pp->spidev_lm70) | 288 | if (pp->spidev_lm70) |
289 | dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n", | 289 | dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n", |
290 | pp->spidev_lm70->dev.bus_id); | 290 | dev_name(&pp->spidev_lm70->dev)); |
291 | else { | 291 | else { |
292 | printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME); | 292 | printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME); |
293 | status = -ENODEV; | 293 | status = -ENODEV; |