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/spi.c | |
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/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 20 |
1 files changed, 9 insertions, 11 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 */ |