Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354479
b: refs/heads/master
c: 5aa57f0
h: refs/heads/master
i:
  354477: 39098de
  354475: 7f7c28f
  354471: 34342f2
  354463: 03179e4
v: v3
  • Loading branch information
Guenter Roeck authored and Jonathan Cameron committed Feb 6, 2013
1 parent e1a99bf commit 6a95ab1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 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: 860c9c54272deaab43b40dbe416becb34abd344f
refs/heads/master: 5aa57f0a655276f62683c0cc714cd6328d98e08a
3 changes: 1 addition & 2 deletions trunk/drivers/extcon/extcon-adc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ static int adc_jack_probe(struct platform_device *pdev)
;
data->num_conditions = i;

data->chan = iio_channel_get(dev_name(&pdev->dev),
pdata->consumer_channel);
data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel);
if (IS_ERR(data->chan)) {
err = PTR_ERR(data->chan);
goto out;
Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/iio/inkern.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ static const struct iio_chan_spec
}


struct iio_channel *iio_channel_get(const char *name, const char *channel_name)
static struct iio_channel *iio_channel_get_sys(const char *name,
const char *channel_name)
{
struct iio_map_internal *c_i = NULL, *c = NULL;
struct iio_channel *channel;
Expand Down Expand Up @@ -144,6 +145,14 @@ struct iio_channel *iio_channel_get(const char *name, const char *channel_name)
iio_device_put(c->indio_dev);
return ERR_PTR(err);
}

struct iio_channel *iio_channel_get(struct device *dev,
const char *channel_name)
{
const char *name = dev ? dev_name(dev) : NULL;

return iio_channel_get_sys(name, channel_name);
}
EXPORT_SYMBOL_GPL(iio_channel_get);

void iio_channel_release(struct iio_channel *channel)
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/power/generic-adc-battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ static int gab_probe(struct platform_device *pdev)
* based on the channel supported by consumer device.
*/
for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++) {
adc_bat->channel[chan] = iio_channel_get(dev_name(&pdev->dev),
gab_chan_name[chan]);
adc_bat->channel[chan] = iio_channel_get(&pdev->dev,
gab_chan_name[chan]);
if (IS_ERR(adc_bat->channel[chan])) {
ret = PTR_ERR(adc_bat->channel[chan]);
} else {
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/power/lp8788-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static void lp8788_irq_unregister(struct platform_device *pdev,
}
}

static void lp8788_setup_adc_channel(const char *consumer_name,
static void lp8788_setup_adc_channel(struct device *dev,
struct lp8788_charger *pchg)
{
struct lp8788_charger_platform_data *pdata = pchg->pdata;
Expand All @@ -590,11 +590,11 @@ static void lp8788_setup_adc_channel(const char *consumer_name,
return;

/* ADC channel for battery voltage */
chan = iio_channel_get(consumer_name, pdata->adc_vbatt);
chan = iio_channel_get(dev, pdata->adc_vbatt);
pchg->chan[LP8788_VBATT] = IS_ERR(chan) ? NULL : chan;

/* ADC channel for battery temperature */
chan = iio_channel_get(consumer_name, pdata->adc_batt_temp);
chan = iio_channel_get(dev, pdata->adc_batt_temp);
pchg->chan[LP8788_BATT_TEMP] = IS_ERR(chan) ? NULL : chan;
}

Expand Down Expand Up @@ -704,7 +704,7 @@ static int lp8788_charger_probe(struct platform_device *pdev)
if (ret)
return ret;

lp8788_setup_adc_channel(pdev->name, pchg);
lp8788_setup_adc_channel(&pdev->dev, pchg);

ret = lp8788_psy_register(pdev, pchg);
if (ret)
Expand Down
5 changes: 3 additions & 2 deletions trunk/include/linux/iio/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ struct iio_channel {

/**
* iio_channel_get() - get description of all that is needed to access channel.
* @name: Unique name of the device as provided in the iio_map
* @dev: Pointer to consumer device. Device name must match
* the name of the device as provided in the iio_map
* with which the desired provider to consumer mapping
* was registered.
* @consumer_channel: Unique name to identify the channel on the consumer
* side. This typically describes the channels use within
* the consumer. E.g. 'battery_voltage'
*/
struct iio_channel *iio_channel_get(const char *name,
struct iio_channel *iio_channel_get(struct device *dev,
const char *consumer_channel);

/**
Expand Down

0 comments on commit 6a95ab1

Please sign in to comment.