On 07/30/2013 12:28 AM, Peter Meerwald wrote: [...] > +static int tmp006_read_raw(struct iio_dev *indio_dev, > + struct iio_chan_spec const *channel, int *val, > + int *val2, long mask) > +{ > + struct tmp006_data *data = iio_priv(indio_dev); > + s32 ret; > + > + switch (mask) { > + case IIO_CHAN_INFO_RAW: > + if (channel->type == IIO_VOLTAGE) { > + ret = tmp006_read_measurement(data, TMP006_VOBJECT); > + if (ret < 0) > + return ret; > + *val = (s16) ret; > + } else if (channel->type == IIO_TEMP) { > + ret = tmp006_read_measurement(data, TMP006_TAMBIENT); > + if (ret < 0) > + return ret; > + *val = (s16) ret >> 2; > + } else > + break; Needs braces around the last else branch. > + return IIO_VAL_INT; > + case IIO_CHAN_INFO_SCALE: > + if (channel->type == IIO_VOLTAGE) { > + *val = 0; > + *val2 = 156250; > + } else if (channel->type == IIO_TEMP) { > + *val = 31; > + *val2 = 250000; > + } else > + break; Same here. > + return IIO_VAL_INT_PLUS_MICRO; > + default: > + break; > + } > + > + return -EINVAL; > +} > + [...] > + > +static int tmp006_probe(struct i2c_client *client, > + const struct i2c_device_id *id) > +{ > + struct iio_dev *indio_dev; > + struct tmp006_data *data; > + int ret; > + > + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) > + return -ENODEV; > + > + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); > + if (!indio_dev) > + return -ENOMEM; > + > + data = iio_priv(indio_dev); > + i2c_set_clientdata(client, indio_dev); > + data->client = client; > + > + indio_dev->dev.parent = &client->dev; > + indio_dev->name = dev_name(&client->dev); > + indio_dev->modes = INDIO_DIRECT_MODE; > + indio_dev->info = &tmp006_info; > + > + indio_dev->channels = tmp006_channels; > + indio_dev->num_channels = ARRAY_SIZE(tmp006_channels); > + > + if (!tmp006_check_identification(data)) { > + dev_err(&client->dev, "no TMP006 sensor\n"); > + return -ENODEV; > + } > + > + dev_info(&client->dev, "TMP006 IR thermophile sensor\n"); That's just noise. > + > + ret = i2c_smbus_read_word_swapped(data->client, TMP006_CONFIG); > + if (ret < 0) > + return ret; > + data->config = ret; > + > + ret = iio_device_register(indio_dev); > + if (ret < 0) > + return ret; > + > + return 0; > +} > + return 0; > +} [...] -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html