diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-09-09 06:54:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:07 -0400 |
commit | 1359555eb77d240b7c1d7ee75bb07e89e89770e4 (patch) | |
tree | 62ee852622700d23dffa7593c84420762e07147f /drivers/base/platform.c | |
parent | 44b760a825fae65629fb04b1deeab68c6bef5c50 (diff) |
Driver core: Make platform_device.id an int
While platform_device.id is a u32, platform_device_add() handles "-1"
as a special id value. This has potential for confusion and bugs.
Making it an int instead should prevent problems from happening in
the future.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index a2e3910196e0..fb5609241482 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -161,7 +161,7 @@ static void platform_device_release(struct device *dev) | |||
161 | * Create a platform device object which can have other objects attached | 161 | * Create a platform device object which can have other objects attached |
162 | * to it, and which will have attached objects freed when it is released. | 162 | * to it, and which will have attached objects freed when it is released. |
163 | */ | 163 | */ |
164 | struct platform_device *platform_device_alloc(const char *name, unsigned int id) | 164 | struct platform_device *platform_device_alloc(const char *name, int id) |
165 | { | 165 | { |
166 | struct platform_object *pa; | 166 | struct platform_object *pa; |
167 | 167 | ||
@@ -245,7 +245,8 @@ int platform_device_add(struct platform_device *pdev) | |||
245 | pdev->dev.bus = &platform_bus_type; | 245 | pdev->dev.bus = &platform_bus_type; |
246 | 246 | ||
247 | if (pdev->id != -1) | 247 | if (pdev->id != -1) |
248 | snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%u", pdev->name, pdev->id); | 248 | snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%d", pdev->name, |
249 | pdev->id); | ||
249 | else | 250 | else |
250 | strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE); | 251 | strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE); |
251 | 252 | ||
@@ -359,7 +360,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister); | |||
359 | * the Linux driver model. In particular, when such drivers are built | 360 | * the Linux driver model. In particular, when such drivers are built |
360 | * as modules, they can't be "hotplugged". | 361 | * as modules, they can't be "hotplugged". |
361 | */ | 362 | */ |
362 | struct platform_device *platform_device_register_simple(char *name, unsigned int id, | 363 | struct platform_device *platform_device_register_simple(char *name, int id, |
363 | struct resource *res, unsigned int num) | 364 | struct resource *res, unsigned int num) |
364 | { | 365 | { |
365 | struct platform_device *pdev; | 366 | struct platform_device *pdev; |