diff options
author | Jens Taprogge <jens.taprogge@taprogge.org> | 2012-09-12 14:55:39 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-12 09:56:01 -0700 |
commit | 1adda49706ff832e9fc4f4bcb62d38285145307c (patch) | |
tree | cf7d530b1673a008a1b9dbf8913df6dc5f800ce3 /drivers/staging/ipack | |
parent | faa75c406e7396a952c3ebedfc2b1d6f1b8d2648 (diff) |
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>
Diffstat (limited to 'drivers/staging/ipack')
-rw-r--r-- | drivers/staging/ipack/devices/ipoctal.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index 8e61ebd648ee..b84ab5eb4b11 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) = { |