>From dfb7ef7d84fa45270b0138dbe6ab4316b03cc724 Mon Sep 17 00:00:00 2001
From: Pavan Savoy <[email protected]>
Date: Fri, 10 Sep 2010 15:58:55 -0400
Subject: [PATCH 18/24] 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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/ti-st/st_kim.c |    9 ++++++++-
 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 9e99463..be18c7a 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");
-- 
1.6.2.5

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Attachment: 0018-staging-ti-st-fix-kim-platform-device-id.patch
Description: 0018-staging-ti-st-fix-kim-platform-device-id.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to