lkml.org 
[lkml]   [2012]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 17/24] Staging: ipack/devices/ipoctal: Clean up device removal.
Date
From: Jens Taprogge <jens.taprogge@taprogge.org>

Make use of dev_set_drvdata() and dev_get_drvdata() to store and obtain
a pointer to the ipoctal struct corresponding to a struct dev.
Previously we relied on a private list of devices.

Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
---
drivers/staging/ipack/devices/ipoctal.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 8e61ebd..b84ab5e 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -725,6 +725,7 @@ static int ipoctal_probe(struct ipack_device *dev)
if (res)
goto out_uninst;

+ dev_set_drvdata(&dev->dev, ipoctal);
list_add_tail(&ipoctal->list, &ipoctal_list);
return 0;

@@ -751,14 +752,9 @@ static void __ipoctal_remove(struct ipoctal *ipoctal)
kfree(ipoctal);
}

-static void ipoctal_remove(struct ipack_device *device)
+static void ipoctal_remove(struct ipack_device *idev)
{
- struct ipoctal *ipoctal, *next;
-
- list_for_each_entry_safe(ipoctal, next, &ipoctal_list, list) {
- if (ipoctal->dev == device)
- __ipoctal_remove(ipoctal);
- }
+ __ipoctal_remove(dev_get_drvdata(&idev->dev));
}

static DEFINE_IPACK_DEVICE_TABLE(ipoctal_ids) = {
--
1.7.10.4


\
 
 \ /
  Last update: 2012-09-12 15:41    [W:0.164 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site