diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-09-09 12:54:16 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 14:51:07 -0700 |
commit | 1359555eb77d240b7c1d7ee75bb07e89e89770e4 (patch) | |
tree | 62ee852622700d23dffa7593c84420762e07147f /drivers/base | |
parent | 44b760a825fae65629fb04b1deeab68c6bef5c50 (diff) | |
download | linux-3.10-1359555eb77d240b7c1d7ee75bb07e89e89770e4.tar.gz linux-3.10-1359555eb77d240b7c1d7ee75bb07e89e89770e4.tar.bz2 linux-3.10-1359555eb77d240b7c1d7ee75bb07e89e89770e4.zip |
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')
-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 a2e3910196e..fb560924148 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -161,7 +161,7 @@ static void platform_device_release(struct device *dev) * Create a platform device object which can have other objects attached * to it, and which will have attached objects freed when it is released. */ -struct platform_device *platform_device_alloc(const char *name, unsigned int id) +struct platform_device *platform_device_alloc(const char *name, int id) { struct platform_object *pa; @@ -245,7 +245,8 @@ int platform_device_add(struct platform_device *pdev) pdev->dev.bus = &platform_bus_type; if (pdev->id != -1) - snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%u", pdev->name, pdev->id); + snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%d", pdev->name, + pdev->id); else strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE); @@ -359,7 +360,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister); * the Linux driver model. In particular, when such drivers are built * as modules, they can't be "hotplugged". */ -struct platform_device *platform_device_register_simple(char *name, unsigned int id, +struct platform_device *platform_device_register_simple(char *name, int id, struct resource *res, unsigned int num) { struct platform_device *pdev; |