Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354411
b: refs/heads/master
c: 6cb2afd
h: refs/heads/master
i:
  354409: a39fd59
  354407: f6eb072
v: v3
  • Loading branch information
Guenter Roeck authored and Jonathan Cameron committed Feb 2, 2013
1 parent cc93b9e commit 08e4c5d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ca7d98dbd7db6aa8bc4b08e26be1249436d21af3
refs/heads/master: 6cb2afd7c0abb93bd9dc6d36b858b1e312e2407d
11 changes: 2 additions & 9 deletions trunk/drivers/iio/adc/lp8788_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ static int lp8788_iio_map_register(struct iio_dev *indio_dev,
return 0;
}

static inline void lp8788_iio_map_unregister(struct iio_dev *indio_dev,
struct lp8788_adc *adc)
{
iio_map_array_unregister(indio_dev, adc->map);
}

static int lp8788_adc_probe(struct platform_device *pdev)
{
struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
Expand Down Expand Up @@ -231,7 +225,7 @@ static int lp8788_adc_probe(struct platform_device *pdev)
return 0;

err_iio_device:
lp8788_iio_map_unregister(indio_dev, adc);
iio_map_array_unregister(indio_dev);
err_iio_map:
iio_device_free(indio_dev);
return ret;
Expand All @@ -240,10 +234,9 @@ static int lp8788_adc_probe(struct platform_device *pdev)
static int lp8788_adc_remove(struct platform_device *pdev)
{
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct lp8788_adc *adc = iio_priv(indio_dev);

iio_device_unregister(indio_dev);
lp8788_iio_map_unregister(indio_dev, adc);
iio_map_array_unregister(indio_dev);
iio_device_free(indio_dev);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/iio/adc/max1363.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ static int max1363_probe(struct i2c_client *client,
error_put_reg:
regulator_put(st->reg);
error_unregister_map:
iio_map_array_unregister(indio_dev, client->dev.platform_data);
iio_map_array_unregister(indio_dev);
error_free_device:
iio_device_free(indio_dev);
error_out:
Expand All @@ -1630,7 +1630,7 @@ static int max1363_remove(struct i2c_client *client)
kfree(indio_dev->available_scan_masks);
regulator_disable(st->reg);
regulator_put(st->reg);
iio_map_array_unregister(indio_dev, client->dev.platform_data);
iio_map_array_unregister(indio_dev);
iio_device_free(indio_dev);

return 0;
Expand Down
36 changes: 11 additions & 25 deletions trunk/drivers/iio/inkern.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,39 +54,25 @@ int iio_map_array_register(struct iio_dev *indio_dev, struct iio_map *maps)
EXPORT_SYMBOL_GPL(iio_map_array_register);


/* Assumes the exact same array (e.g. memory locations)
* used at unregistration as used at registration rather than
* more complex checking of contents.
/*
* Remove all map entries associated with the given iio device
*/
int iio_map_array_unregister(struct iio_dev *indio_dev,
struct iio_map *maps)
int iio_map_array_unregister(struct iio_dev *indio_dev)
{
int i = 0, ret = 0;
bool found_it;
int ret = -ENODEV;
struct iio_map_internal *mapi;

if (maps == NULL)
return 0;
struct list_head *pos, *tmp;

mutex_lock(&iio_map_list_lock);
while (maps[i].consumer_dev_name != NULL) {
found_it = false;
list_for_each_entry(mapi, &iio_map_list, l)
if (&maps[i] == mapi->map) {
list_del(&mapi->l);
kfree(mapi);
found_it = true;
break;
}
if (!found_it) {
ret = -ENODEV;
goto error_ret;
list_for_each_safe(pos, tmp, &iio_map_list) {
mapi = list_entry(pos, struct iio_map_internal, l);
if (indio_dev == mapi->indio_dev) {
list_del(&mapi->l);
kfree(mapi);
ret = 0;
}
i++;
}
error_ret:
mutex_unlock(&iio_map_list_lock);

return ret;
}
EXPORT_SYMBOL_GPL(iio_map_array_unregister);
Expand Down
9 changes: 3 additions & 6 deletions trunk/include/linux/iio/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ int iio_map_array_register(struct iio_dev *indio_dev,
struct iio_map *map);

/**
* iio_map_array_unregister() - tell the core to remove consumer mappings
* iio_map_array_unregister() - tell the core to remove consumer mappings for
* the given provider device
* @indio_dev: provider device
* @map: array of mappings to remove. Note these must have same memory
* addresses as those originally added not just equal parameter
* values.
*/
int iio_map_array_unregister(struct iio_dev *indio_dev,
struct iio_map *map);
int iio_map_array_unregister(struct iio_dev *indio_dev);

#endif

0 comments on commit 08e4c5d

Please sign in to comment.