summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPavan Savoy <pavan_savoy@ti.com>2010-09-10 15:58:55 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-09-16 12:54:45 -0700
commitdfb7ef7d84fa45270b0138dbe6ab4316b03cc724 (patch)
tree82bff2fedc12739dcb87c8e10fa4b2b675ac8a7f /drivers
parent48c51a8cf484c8d569f97050bbac493c5bc79c2f (diff)
downloadblackbird-obmc-linux-dfb7ef7d84fa45270b0138dbe6ab4316b03cc724.tar.gz
blackbird-obmc-linux-dfb7ef7d84fa45270b0138dbe6ab4316b03cc724.zip
staging: ti-st: fix kim platform device id
Platform devices tend to have id as -1 when only 1 device exist and a value >=0 when multiple devices exist, since we plan to store all these platform devices if multiple exist, there was a requirement to have id to be >=0. The patch fixes this problem. Signed-off-by: Pavan Savoy <pavan_savoy@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/ti-st/st_kim.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/ti-st/st_kim.c b/drivers/staging/ti-st/st_kim.c
index 9e99463f76e8..be18c7a17446 100644
--- a/drivers/staging/ti-st/st_kim.c
+++ b/drivers/staging/ti-st/st_kim.c
@@ -638,7 +638,14 @@ static int kim_probe(struct platform_device *pdev)
long *gpios = pdev->dev.platform_data;
struct kim_data_s *kim_gdata;
- st_kim_devices[pdev->id] = pdev;
+ if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
+ /* multiple devices could exist */
+ st_kim_devices[pdev->id] = pdev;
+ } else {
+ /* platform's sure about existance of 1 device */
+ st_kim_devices[0] = pdev;
+ }
+
kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
if (!kim_gdata) {
pr_err("no mem to allocate");
OpenPOWER on IntegriCloud