Staging: ipack/devices/ipoctal: Clean up device removal.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jens Taprogge 2012-09-12 14:55:39 +02:00 committed by Greg Kroah-Hartman
parent faa75c406e
commit 1adda49706
1 changed files with 3 additions and 7 deletions

View File

@ -725,6 +725,7 @@ static int ipoctal_probe(struct ipack_device *dev)
if (res) if (res)
goto out_uninst; goto out_uninst;
dev_set_drvdata(&dev->dev, ipoctal);
list_add_tail(&ipoctal->list, &ipoctal_list); list_add_tail(&ipoctal->list, &ipoctal_list);
return 0; return 0;
@ -751,14 +752,9 @@ static void __ipoctal_remove(struct ipoctal *ipoctal)
kfree(ipoctal); kfree(ipoctal);
} }
static void ipoctal_remove(struct ipack_device *device) static void ipoctal_remove(struct ipack_device *idev)
{ {
struct ipoctal *ipoctal, *next; __ipoctal_remove(dev_get_drvdata(&idev->dev));
list_for_each_entry_safe(ipoctal, next, &ipoctal_list, list) {
if (ipoctal->dev == device)
__ipoctal_remove(ipoctal);
}
} }
static DEFINE_IPACK_DEVICE_TABLE(ipoctal_ids) = { static DEFINE_IPACK_DEVICE_TABLE(ipoctal_ids) = {