struct iio_channel *channel = data->chan;
int val, ret;
+ if (!channel)
+ return INVALID_ADVALUE;
ret = iio_read_channel_raw(channel, &val);
if (ret < 0) {
pr_err("read channel() error: %d\n", ret);
u32 code, adc_value, flags;;
chan = iio_channel_get(&pdev->dev, NULL);
- if (IS_ERR(chan))
- goto error_ret;
+ if (IS_ERR(chan)) {
+ dev_info(&pdev->dev, "Missing io-channels\n");
+ chan = NULL;
+ }
pdata->chan = chan;
for_each_child_of_node(node, child_node) {
}
//adc polling work
- INIT_DELAYED_WORK(&ddata->adc_poll_work, adc_key_poll);
- schedule_delayed_work(&ddata->adc_poll_work,
- msecs_to_jiffies(ADC_SAMPLE_TIME));
+ if (ddata->chan) {
+ INIT_DELAYED_WORK(&ddata->adc_poll_work, adc_key_poll);
+ schedule_delayed_work(&ddata->adc_poll_work,
+ msecs_to_jiffies(ADC_SAMPLE_TIME));
+ }
spdata = ddata;
sinput_dev = input;
for (i = 0; i < ddata->nbuttons; i++) {
del_timer_sync(&ddata->button[i].timer);
}
- cancel_delayed_work_sync(&ddata->adc_poll_work);
+ if (ddata->chan)
+ cancel_delayed_work_sync(&ddata->adc_poll_work);
input_unregister_device(input);
sinput_dev = NULL;