Skip to content

Commit

Permalink
Staging: ipack/devices/ipoctal: Clean up device removal.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Taprogge authored and Greg Kroah-Hartman committed Sep 12, 2012
1 parent faa75c4 commit 1adda49
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/staging/ipack/devices/ipoctal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) = {
Expand Down

0 comments on commit 1adda49

Please sign in to comment.