static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16201_write_reset, 0);
-static IIO_CONST_ATTR(name, "adis16201");
-
static struct attribute *adis16201_attributes[] = {
&iio_dev_attr_in0_supply_raw.dev_attr.attr,
&iio_const_attr_in0_supply_scale.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_const_attr_temp_scale.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_const_attr_in1_scale.dev_attr.attr,
&iio_dev_attr_accel_x_raw.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16201_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16203_write_reset, 0);
-static IIO_CONST_ATTR(name, "adis16203");
-
static struct attribute *adis16203_attributes[] = {
&iio_dev_attr_in0_supply_raw.dev_attr.attr,
&iio_const_attr_in0_supply_scale.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_const_attr_temp_scale.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_const_attr_in1_scale.dev_attr.attr,
&iio_dev_attr_incli_x_raw.dev_attr.attr,
ret = -ENOMEM;
goto error_free_tx;
}
-
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16203_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16204_write_reset, 0);
-static IIO_CONST_ATTR(name, "adis16204");
-
static struct attribute *adis16204_attributes[] = {
&iio_dev_attr_in0_supply_raw.dev_attr.attr,
&iio_const_attr_in0_supply_scale.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_const_attr_temp_scale.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_const_attr_in1_scale.dev_attr.attr,
&iio_dev_attr_accel_x_raw.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16204_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16209_write_reset, 0);
-static IIO_CONST_ATTR_NAME("adis16209");
-
static struct attribute *adis16209_attributes[] = {
&iio_dev_attr_in0_supply_raw.dev_attr.attr,
&iio_const_attr_in0_supply_scale.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_const_attr_temp_scale.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_const_attr_in1_scale.dev_attr.attr,
&iio_dev_attr_accel_x_raw.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16209_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("100200");
-static IIO_CONST_ATTR_NAME("adis16220");
-
static struct attribute *adis16220_attributes[] = {
&iio_dev_attr_in0_supply_raw.dev_attr.attr,
&iio_const_attr_in0_supply_scale.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
&iio_dev_attr_capture.dev_attr.attr,
&iio_dev_attr_capture_count.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
NULL
};
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16220_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("4096");
-static IIO_CONST_ATTR_NAME("adis16240");
-
static struct attribute *adis16240_attributes[] = {
&iio_dev_attr_in0_supply_raw.dev_attr.attr,
&iio_const_attr_in0_supply_scale.dev_attr.attr,
&iio_const_attr_temp_scale.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
NULL
};
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16240_attribute_group;
st->indio_dev->dev_data = (void *)(st);
return ret;
}
-static IIO_CONST_ATTR_NAME("lis3l02dq");
-
static struct attribute *lis3l02dq_attributes[] = {
&iio_dev_attr_sampling_frequency.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
NULL
};
goto error_free_tx;
}
+ st->help.indio_dev->name = spi->dev.driver->name;
st->help.indio_dev->dev.parent = &spi->dev;
st->help.indio_dev->num_interrupt_lines = 1;
st->help.indio_dev->channels = lis3l02dq_channels;
/**
* struct sca3000_chip_info - model dependent parameters
- * @name: model identification
* @scale: scale * 10^-6
* @temp_output: some devices have temperature sensors.
* @measurement_mode_freq: normal mode sampling frequency
* sca3000 variant.
**/
struct sca3000_chip_info {
- const char *name;
unsigned int scale;
bool temp_output;
int measurement_mode_freq;
* do not actually appear to be available.
*/
static const struct sca3000_chip_info sca3000_spi_chip_info_tbl[] = {
- {
- .name = "sca3000-d01",
+ [d01] = {
.scale = 7357,
.temp_output = true,
.measurement_mode_freq = 250,
.option_mode_1_freq = 250,
.mot_det_mult_xz = {50, 100, 200, 350, 650, 1300},
.mot_det_mult_y = {50, 100, 150, 250, 450, 850, 1750},
- }, {
- .name = "sca3000-e02",
+ },
+ [e02] = {
.scale = 9810,
.measurement_mode_freq = 125,
.option_mode_1 = SCA3000_OP_MODE_NARROW,
.option_mode_1_freq = 63,
.mot_det_mult_xz = {100, 150, 300, 550, 1050, 2050},
.mot_det_mult_y = {50, 100, 200, 350, 700, 1350, 2700},
- }, {
- .name = "sca3000-e04",
+ },
+ [e04] = {
.scale = 19620,
.measurement_mode_freq = 100,
.option_mode_1 = SCA3000_OP_MODE_NARROW,
.option_mode_2_freq = 400,
.mot_det_mult_xz = {200, 300, 600, 1100, 2100, 4100},
.mot_det_mult_y = {100, 200, 400, 7000, 1400, 2700, 54000},
- }, {
- .name = "sca3000-e05",
+ },
+ [e05] = {
.scale = 61313,
.measurement_mode_freq = 200,
.option_mode_1 = SCA3000_OP_MODE_NARROW,
}
#endif /* SCA3000_DEBUG */
-static ssize_t sca3000_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct sca3000_state *st = dev_info->dev_data;
- return sprintf(buf, "%s\n", st->info->name);
-}
+
/**
* sca3000_show_reg() - sysfs interface to read the chip revision number
**/
/* More standard attributes */
-static IIO_DEV_ATTR_NAME(sca3000_show_name);
static IIO_DEV_ATTR_REV(sca3000_show_rev);
#define SCA3000_INFO_MASK \
}
static struct attribute *sca3000_attributes[] = {
- &iio_dev_attr_name.dev_attr.attr,
&iio_dev_attr_revision.dev_attr.attr,
&iio_dev_attr_measurement_mode_available.dev_attr.attr,
&iio_dev_attr_measurement_mode.dev_attr.attr,
};
static struct attribute *sca3000_attributes_with_temp[] = {
- &iio_dev_attr_name.dev_attr.attr,
&iio_dev_attr_revision.dev_attr.attr,
&iio_dev_attr_measurement_mode_available.dev_attr.attr,
&iio_dev_attr_measurement_mode.dev_attr.attr,
goto error_clear_st;
}
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->num_interrupt_lines = 1;
st->indio_dev->event_attrs = &sca3000_event_attribute_group;
if (st->info->temp_output)
*/
struct ad7150_chip_info {
- const char *name;
struct i2c_client *client;
struct iio_dev *indio_dev;
bool inter;
ad7150_show_ch2_setup,
ad7150_store_ch2_setup);
-static ssize_t ad7150_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7150_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7150_show_name, NULL, 0);
-
static ssize_t ad7150_show_powerdown_timer(struct device *dev,
struct device_attribute *attr,
char *buf)
&iio_dev_attr_powerdown_timer.dev_attr.attr,
&iio_dev_attr_ch1_value.dev_attr.attr,
&iio_dev_attr_ch2_value.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
i2c_set_clientdata(client, chip);
chip->client = client;
- chip->name = id->name;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
}
/* Echipabilish that the iio_dev is a child of the i2c device */
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->attrs = &ad7150_attribute_group;
chip->indio_dev->event_attrs = &ad7150_event_attribute_group;
*/
struct ad7152_chip_info {
- const char *name;
struct i2c_client *client;
struct iio_dev *indio_dev;
u16 ch1_offset; /* Channel 1 offset calibration coefficient */
ad7152_show_filter_rate_setup,
ad7152_store_filter_rate_setup);
-static ssize_t ad7152_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7152_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7152_show_name, NULL, 0);
-
static struct attribute *ad7152_attributes[] = {
&iio_dev_attr_available_conversion_modes.dev_attr.attr,
&iio_dev_attr_conversion_mode.dev_attr.attr,
&iio_dev_attr_ch1_setup.dev_attr.attr,
&iio_dev_attr_ch2_setup.dev_attr.attr,
&iio_dev_attr_filter_rate_setup.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
i2c_set_clientdata(client, chip);
chip->client = client;
- chip->name = id->name;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
}
/* Echipabilish that the iio_dev is a child of the i2c device */
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->attrs = &ad7152_attribute_group;
chip->indio_dev->dev_data = (void *)(chip);
*/
struct ad7291_chip_info {
- const char *name;
struct i2c_client *client;
struct iio_dev *indio_dev;
u16 command;
ad7291_store_channel_mask,
0);
-static ssize_t ad7291_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7291_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7291_show_name, NULL, 0);
-
static struct attribute *ad7291_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_t_average.dev_attr.attr,
&iio_dev_attr_voltage.dev_attr.attr,
&iio_dev_attr_channel_mask.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
i2c_set_clientdata(client, chip);
chip->client = client;
- chip->name = id->name;
chip->command = AD7291_NOISE_DELAY | AD7291_T_SENSE_MASK;
chip->indio_dev = iio_allocate_device(0);
goto error_free_chip;
}
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->attrs = &ad7291_attribute_group;
chip->indio_dev->event_attrs = &ad7291_event_attribute_group;
NULL,
&ad7291_event_handler,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- chip->name,
+ id->name,
chip->indio_dev);
if (ret)
goto error_unreg_dev;
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7298_show_scale, NULL, 0);
-static ssize_t ad7298_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7298_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7298_show_name, NULL, 0);
-
static struct attribute *ad7298_attributes[] = {
&iio_dev_attr_in0_raw.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_dev_attr_in7_raw.dev_attr.attr,
&iio_dev_attr_in_scale.dev_attr.attr,
&iio_dev_attr_temp0_input.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
goto error_disable_reg;
}
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &ad7298_attribute_group;
st->indio_dev->dev_data = (void *)(st);
*/
struct ad7314_chip_info {
- const char *name;
struct spi_device *spi_dev;
struct iio_dev *indio_dev;
s64 last_timestamp;
if (chip->mode)
ad7314_spi_write(chip, chip->mode);
- if (strcmp(chip->name, "ad7314")) {
+ if (strcmp(dev_info->name, "ad7314")) {
data = (data & AD7314_TEMP_MASK) >>
AD7314_TEMP_OFFSET;
if (data & AD7314_TEMP_SIGN) {
static IIO_DEVICE_ATTR(temperature, S_IRUGO, ad7314_show_temperature, NULL, 0);
-static ssize_t ad7314_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7314_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7314_show_name, NULL, 0);
-
static struct attribute *ad7314_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_temperature.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
dev_set_drvdata(&spi_dev->dev, chip);
chip->spi_dev = spi_dev;
- chip->name = spi_dev->modalias;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
goto error_free_chip;
}
+ chip->indio_dev->name = spi_get_device_id(spi_dev)->name;
chip->indio_dev->dev.parent = &spi_dev->dev;
chip->indio_dev->attrs = &ad7314_attribute_group;
chip->indio_dev->dev_data = (void *)chip;
goto error_free_dev;
dev_info(&spi_dev->dev, "%s temperature sensor registered.\n",
- chip->name);
+ chip->indio_dev->name);
return 0;
error_free_dev:
return -EINVAL;
}
-static ssize_t ad7476_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7476_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7476_show_name, NULL, 0);
-
-static struct attribute *ad7476_attributes[] = {
- &iio_dev_attr_name.dev_attr.attr,
- NULL,
-};
-
-static const struct attribute_group ad7476_attribute_group = {
- .attrs = ad7476_attributes,
-};
-
static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {
[ID_AD7466] = {
.channel[0] = IIO_CHAN(IIO_IN, 0, 1, 0, NULL, 0, 0,
/* Establish that the iio_dev is a child of the spi device */
st->indio_dev->dev.parent = &spi->dev;
- st->indio_dev->attrs = &ad7476_attribute_group;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->dev_data = (void *)(st);
st->indio_dev->driver_module = THIS_MODULE;
st->indio_dev->modes = INDIO_DIRECT_MODE;
*/
struct ad774x_chip_info {
- const char *name;
struct i2c_client *client;
struct iio_dev *indio_dev;
bool inter;
ad774x_show_cap_gain,
ad774x_store_cap_gain);
-static ssize_t ad774x_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad774x_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad774x_show_name, NULL, 0);
-
static struct attribute *ad774x_attributes[] = {
&iio_dev_attr_available_conversion_modes.dev_attr.attr,
&iio_dev_attr_conversion_mode.dev_attr.attr,
&iio_dev_attr_cap0_raw.dev_attr.attr,
&iio_dev_attr_capdac0_raw.dev_attr.attr,
&iio_dev_attr_capdac1_raw.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
i2c_set_clientdata(client, chip);
chip->client = client;
- chip->name = id->name;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
}
/* Establish that the iio_dev is a child of the i2c device */
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->attrs = &ad774x_attribute_group;
chip->indio_dev->event_attrs = &ad774x_event_attribute_group;
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7780_show_scale, NULL, 0);
-static ssize_t ad7780_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7780_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7780_show_name, NULL, 0);
-
static struct attribute *ad7780_attributes[] = {
&iio_dev_attr_in0_raw.dev_attr.attr,
&iio_dev_attr_in_scale.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
/* Establish that the iio_dev is a child of the spi device */
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &ad7780_attribute_group;
st->indio_dev->dev_data = (void *)(st);
st->indio_dev->driver_module = THIS_MODULE;
*/
struct ad7816_chip_info {
- const char *name;
struct spi_device *spi_dev;
struct iio_dev *indio_dev;
u16 rdwr_pin;
if (data > AD7816_CS_MAX && data != AD7816_CS_MASK) {
dev_err(&chip->spi_dev->dev, "Invalid channel id %lu for %s.\n",
- data, chip->name);
+ data, dev_info->name);
return -EINVAL;
- } else if (strcmp(chip->name, "ad7818") == 0 && data > 1) {
+ } else if (strcmp(dev_info->name, "ad7818") == 0 && data > 1) {
dev_err(&chip->spi_dev->dev,
"Invalid channel id %lu for ad7818.\n", data);
return -EINVAL;
- } else if (strcmp(chip->name, "ad7816") == 0 && data > 0) {
+ } else if (strcmp(dev_info->name, "ad7816") == 0 && data > 0) {
dev_err(&chip->spi_dev->dev,
"Invalid channel id %lu for ad7816.\n", data);
return -EINVAL;
static IIO_DEVICE_ATTR(value, S_IRUGO, ad7816_show_value, NULL, 0);
-static ssize_t ad7816_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7816_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7816_show_name, NULL, 0);
-
static struct attribute *ad7816_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_channel.dev_attr.attr,
&iio_dev_attr_value.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
dev_set_drvdata(&spi_dev->dev, chip);
chip->spi_dev = spi_dev;
- chip->name = spi_dev->modalias;
for (i = 0; i <= AD7816_CS_MAX; i++)
chip->oti_data[i] = 203;
chip->rdwr_pin = pins[0];
chip->convert_pin = pins[1];
chip->busy_pin = pins[2];
- ret = gpio_request(chip->rdwr_pin, chip->name);
+ ret = gpio_request(chip->rdwr_pin, spi_get_device_id(spi_dev)->name);
if (ret) {
dev_err(&spi_dev->dev, "Fail to request rdwr gpio PIN %d.\n",
chip->rdwr_pin);
goto error_free_chip;
}
gpio_direction_input(chip->rdwr_pin);
- ret = gpio_request(chip->convert_pin, chip->name);
+ ret = gpio_request(chip->convert_pin, spi_get_device_id(spi_dev)->name);
if (ret) {
dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n",
chip->convert_pin);
goto error_free_gpio_rdwr;
}
gpio_direction_input(chip->convert_pin);
- ret = gpio_request(chip->busy_pin, chip->name);
+ ret = gpio_request(chip->busy_pin, spi_get_device_id(spi_dev)->name);
if (ret) {
dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n",
chip->busy_pin);
ret = -ENOMEM;
goto error_free_gpio;
}
-
+ chip->indio_dev->name = spi_get_device_id(spi_dev)->name;
chip->indio_dev->dev.parent = &spi_dev->dev;
chip->indio_dev->attrs = &ad7816_attribute_group;
chip->indio_dev->event_attrs = &ad7816_event_attribute_group;
NULL,
&ad7816_event_handler,
IRQF_TRIGGER_LOW,
- chip->name,
+ chip->indio_dev->name,
chip->indio_dev);
if (ret)
goto error_unreg_dev;
}
dev_info(&spi_dev->dev, "%s temperature sensor and ADC registered.\n",
- chip->name);
+ chip->indio_dev->name);
return 0;
}
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad7887_show_scale, NULL, 0);
-static ssize_t ad7887_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad7887_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad7887_show_name, NULL, 0);
-
static struct attribute *ad7887_attributes[] = {
&iio_dev_attr_in0_raw.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_dev_attr_in_scale.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
/* Estabilish that the iio_dev is a child of the spi device */
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &ad7887_attribute_group;
st->indio_dev->dev_data = (void *)(st);
st->indio_dev->driver_module = THIS_MODULE;
static IIO_DEVICE_ATTR(in_scale, S_IRUGO, ad799x_show_scale, NULL, 0);
-static ssize_t ad799x_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad799x_state *st = iio_dev_get_devdata(dev_info);
- return sprintf(buf, "%s\n", st->client->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad799x_show_name, NULL, 0);
-
static struct attribute *ad7991_5_9_3_4_device_attrs[] = {
&iio_dev_attr_in0_raw.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
&iio_dev_attr_in2_raw.dev_attr.attr,
&iio_dev_attr_in3_raw.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
&iio_dev_attr_in_scale.dev_attr.attr,
NULL
};
static struct attribute *ad7992_device_attrs[] = {
&iio_dev_attr_in0_raw.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
&iio_dev_attr_in_scale.dev_attr.attr,
NULL
};
&iio_dev_attr_in5_raw.dev_attr.attr,
&iio_dev_attr_in6_raw.dev_attr.attr,
&iio_dev_attr_in7_raw.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
&iio_dev_attr_in_scale.dev_attr.attr,
NULL
};
*/
struct adt7310_chip_info {
- const char *name;
struct spi_device *spi_dev;
struct iio_dev *indio_dev;
u8 config;
static IIO_DEVICE_ATTR(value, S_IRUGO, adt7310_show_value, NULL, 0);
-static ssize_t adt7310_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct adt7310_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, adt7310_show_name, NULL, 0);
-
static struct attribute *adt7310_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_resolution.dev_attr.attr,
&iio_dev_attr_id.dev_attr.attr,
&iio_dev_attr_value.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
dev_set_drvdata(&spi_dev->dev, chip);
chip->spi_dev = spi_dev;
- chip->name = spi_dev->modalias;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
}
chip->indio_dev->dev.parent = &spi_dev->dev;
+ chip->indio_dev->name = spi_get_device_id(spi_dev)->name;
chip->indio_dev->attrs = &adt7310_attribute_group;
chip->indio_dev->event_attrs = adt7310_event_attribute_group;
chip->indio_dev->dev_data = (void *)chip;
NULL,
&adt7310_event_handler,
irq_flags,
- chip->name,
+ chip->indio_dev->name,
chip->indio_dev);
if (ret)
goto error_unreg_dev;
NULL,
&adt7310_event_handler,
adt7310_platform_data[1],
- chip->name,
+ chip->indio_dev->name,
chip->indio_dev);
if (ret)
goto error_unreg_ct_irq;
}
dev_info(&spi_dev->dev, "%s temperature sensor registered.\n",
- chip->name);
+ chip->indio_dev->name);
return 0;
*/
struct adt7410_chip_info {
- const char *name;
struct i2c_client *client;
struct iio_dev *indio_dev;
u8 config;
static IIO_DEVICE_ATTR(value, S_IRUGO, adt7410_show_value, NULL, 0);
-static ssize_t adt7410_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct adt7410_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, adt7410_show_name, NULL, 0);
-
static struct attribute *adt7410_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_resolution.dev_attr.attr,
&iio_dev_attr_id.dev_attr.attr,
&iio_dev_attr_value.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
i2c_set_clientdata(client, chip);
chip->client = client;
- chip->name = id->name;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
ret = -ENOMEM;
goto error_free_chip;
}
-
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->attrs = &adt7410_attribute_group;
chip->indio_dev->event_attrs = adt7410_event_attribute_group;
NULL,
&adt7410_event_handler,
IRQF_TRIGGER_LOW,
- chip->name,
+ id->name,
chip->indio_dev);
if (ret)
goto error_unreg_dev;
NULL,
&adt7410_event_handler,
adt7410_platform_data[1],
- chip->name,
+ id->name,
chip->indio_dev);
if (ret)
goto error_unreg_ct_irq;
*/
struct adt75_chip_info {
- const char *name;
struct i2c_client *client;
struct iio_dev *indio_dev;
u8 config;
static IIO_DEVICE_ATTR(value, S_IRUGO, adt75_show_value, NULL, 0);
-static ssize_t adt75_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct adt75_chip_info *chip = dev_info->dev_data;
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, adt75_show_name, NULL, 0);
-
static struct attribute *adt75_attributes[] = {
&iio_dev_attr_available_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_oneshot.dev_attr.attr,
&iio_dev_attr_value.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
i2c_set_clientdata(client, chip);
chip->client = client;
- chip->name = id->name;
chip->indio_dev = iio_allocate_device(0);
if (chip->indio_dev == NULL) {
goto error_free_chip;
}
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->attrs = &adt75_attribute_group;
chip->indio_dev->event_attrs = &adt75_event_attribute_group;
NULL,
&adt75_event_handler,
IRQF_TRIGGER_LOW,
- chip->name,
+ chip->indio_dev->name,
chip->indio_dev);
if (ret)
goto error_unreg_dev;
}
dev_info(&client->dev, "%s temperature sensor registered.\n",
- id->name);
+ chip->indio_dev->name);
return 0;
error_unreg_irq:
return 0;
}
-static ssize_t max1363_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct max1363_state *st = iio_priv(dev_get_drvdata(dev));
- return sprintf(buf, "%s\n", st->client->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, max1363_show_name, NULL, 0);
-
/* Applies to max1363 */
static const enum max1363_modes max1363_mode_list[] = {
_s0, _s1, _s2, _s3,
static struct iio_chan_spec max1136_channels[] = MAX1363_4X_CHANS(10);
static struct iio_chan_spec max1236_channels[] = MAX1363_4X_CHANS(12);
-static struct attribute *max1363_device_attrs[] = {
- &iio_dev_attr_name.dev_attr.attr,
- NULL
-};
-
-static struct attribute_group max1363_dev_attr_group = {
- .attrs = max1363_device_attrs,
-};
-
/* Appies to max1236, max1237 */
static const enum max1363_modes max1236_mode_list[] = {
_s0, _s1, _s2, _s3,
.modemask;
/* Estabilish that the iio_dev is a child of the i2c device */
indio_dev->dev.parent = &client->dev;
- indio_dev->attrs = &max1363_dev_attr_group;
+ indio_dev->name = id->name;
indio_dev->read_event_value = &max1363_read_thresh;
indio_dev->write_event_value = &max1363_write_thresh;
indio_dev->read_event_config = &max1363_read_event_config;
*/
struct adt7316_chip_info {
- const char *name;
struct iio_dev *indio_dev;
struct adt7316_bus bus;
u16 ldac_pin;
static IIO_DEVICE_ATTR(bus_type, S_IRUGO, adt7316_show_bus_type, NULL, 0);
-static ssize_t adt7316_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct adt7316_chip_info *chip = dev_info->dev_data;
-
- return sprintf(buf, "%s\n", chip->name);
-}
-
-static IIO_DEVICE_ATTR(name, S_IRUGO, adt7316_show_name, NULL, 0);
-
static struct attribute *adt7316_attributes[] = {
&iio_dev_attr_all_modes.dev_attr.attr,
&iio_dev_attr_mode.dev_attr.attr,
&iio_dev_attr_manufactorer_id.dev_attr.attr,
&iio_dev_attr_device_rev.dev_attr.attr,
&iio_dev_attr_bus_type.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
&iio_dev_attr_manufactorer_id.dev_attr.attr,
&iio_dev_attr_device_rev.dev_attr.attr,
&iio_dev_attr_bus_type.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
dev_set_drvdata(dev, chip);
chip->bus = *bus;
- chip->name = name;
if (name[4] == '3')
chip->id = ID_ADT7316 + (name[6] - '6');
chip->indio_dev->attrs = &adt7316_attribute_group;
chip->indio_dev->event_attrs = &adt7316_event_attribute_group;
}
+ chip->indio_dev->name = name;
chip->indio_dev->dev_data = (void *)chip;
chip->indio_dev->driver_module = THIS_MODULE;
chip->indio_dev->num_interrupt_lines = 1;
NULL,
&adt7316_event_handler,
chip->bus.irq_flags | IRQF_ONESHOT,
- chip->name,
+ chip->indio_dev->name,
chip->indio_dev);
if (ret)
goto error_unreg_dev;
}
dev_info(dev, "%s temperature sensor, ADC and DAC registered.\n",
- chip->name);
+ chip->indio_dev->name);
return 0;
}
static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5446_show_scale, NULL, 0);
-static ssize_t ad5446_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad5446_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad5446_show_name, NULL, 0);
-
static ssize_t ad5446_write_powerdown_mode(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
&iio_dev_attr_out0_powerdown.dev_attr.attr,
&iio_dev_attr_out_powerdown_mode.dev_attr.attr,
&iio_const_attr_out_powerdown_mode_available.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
/* Estabilish that the iio_dev is a child of the spi device */
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &ad5446_attribute_group;
st->indio_dev->dev_data = (void *)(st);
st->indio_dev->driver_module = THIS_MODULE;
}
static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5504_show_scale, NULL, 0);
-static ssize_t ad5504_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad5504_state *st = iio_dev_get_devdata(indio_dev);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad5504_show_name, NULL, 0);
-
#define IIO_DEV_ATTR_OUT_RW_RAW(_num, _show, _store, _addr) \
IIO_DEVICE_ATTR(out##_num##_raw, \
S_IRUGO | S_IWUSR, _show, _store, _addr)
&iio_dev_attr_out_powerdown_mode.dev_attr.attr,
&iio_const_attr_out_powerdown_mode_available.dev_attr.attr,
&iio_dev_attr_out_scale.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
&iio_dev_attr_out_powerdown_mode.dev_attr.attr,
&iio_const_attr_out_powerdown_mode_available.dev_attr.attr,
&iio_dev_attr_out_scale.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
goto error_disable_reg;
}
st->indio_dev->dev.parent = &spi->dev;
-
+ st->indio_dev->name = spi_get_device_id(st->spi)->name;
st->indio_dev->attrs = spi_get_device_id(st->spi)->driver_data
== ID_AD5501 ? &ad5501_attribute_group :
&ad5504_attribute_group;
}
static IIO_DEVICE_ATTR(out_scale, S_IRUGO, ad5624r_show_scale, NULL, 0);
-static ssize_t ad5624r_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct ad5624r_state *st = iio_dev_get_devdata(indio_dev);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->us)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad5624r_show_name, NULL, 0);
-
static IIO_DEV_ATTR_OUT_RAW(0, ad5624r_write_dac, AD5624R_ADDR_DAC0);
static IIO_DEV_ATTR_OUT_RAW(1, ad5624r_write_dac, AD5624R_ADDR_DAC1);
static IIO_DEV_ATTR_OUT_RAW(2, ad5624r_write_dac, AD5624R_ADDR_DAC2);
&iio_dev_attr_out_powerdown_mode.dev_attr.attr,
&iio_const_attr_out_powerdown_mode_available.dev_attr.attr,
&iio_dev_attr_out_scale.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
goto error_disable_reg;
}
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &ad5624r_attribute_group;
st->indio_dev->dev_data = (void *)(st);
st->indio_dev->driver_module = THIS_MODULE;
return ret ? ret : len;
}
-static ssize_t ad9832_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad9832_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad9832_show_name, NULL, 0);
-
/**
* see dds.h for further information
*/
&iio_dev_attr_dds0_freqsymbol.dev_attr.attr,
&iio_dev_attr_dds0_phasesymbol.dev_attr.attr,
&iio_dev_attr_dds0_out_enable.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
}
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &ad9832_attribute_group;
st->indio_dev->dev_data = (void *) st;
st->indio_dev->driver_module = THIS_MODULE;
return ret ? ret : len;
}
-static ssize_t ad9834_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *dev_info = dev_get_drvdata(dev);
- struct ad9834_state *st = iio_dev_get_devdata(dev_info);
-
- return sprintf(buf, "%s\n", spi_get_device_id(st->spi)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, ad9834_show_name, NULL, 0);
-
static ssize_t ad9834_show_out0_wavetype_available(struct device *dev,
struct device_attribute *attr,
char *buf)
&iio_dev_attr_dds0_out1_wavetype.dev_attr.attr,
&iio_dev_attr_dds0_out0_wavetype_available.dev_attr.attr,
&iio_dev_attr_dds0_out1_wavetype_available.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL,
};
}
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &ad9834_attribute_group;
st->indio_dev->dev_data = (void *) st;
st->indio_dev->driver_module = THIS_MODULE;
ADIS16080_DIN_TEMP);
static IIO_DEV_ATTR_IN_RAW(0, adis16080_read, ADIS16080_DIN_AIN1);
static IIO_DEV_ATTR_IN_RAW(1, adis16080_read, ADIS16080_DIN_AIN2);
-static IIO_CONST_ATTR(name, "adis16080");
static struct attribute *adis16080_attributes[] = {
&iio_dev_attr_gyro_z_raw.dev_attr.attr,
&iio_dev_attr_temp_raw.dev_attr.attr,
&iio_dev_attr_in0_raw.dev_attr.attr,
&iio_dev_attr_in1_raw.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
NULL
};
goto error_free_st;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16080_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_DEVICE_ATTR(temp_raw, S_IRUGO, adis16130_val_read, NULL,
ADIS16130_TEMPDATA);
-static IIO_CONST_ATTR(name, "adis16130");
-
static IIO_DEV_ATTR_GYRO_Z(adis16130_val_read, ADIS16130_RATEDATA);
static IIO_DEVICE_ATTR(gyro_z_type, S_IWUSR | S_IRUGO, adis16130_bitsmode_read,
static struct attribute *adis16130_attributes[] = {
&iio_dev_attr_temp_raw.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_gyro_z_raw.dev_attr.attr,
&iio_dev_attr_gyro_z_type.dev_attr.attr,
&iio_const_attr_gyro_z_type_available.dev_attr.attr,
goto error_free_st;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &adis16130_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_DEVICE_ATTR(sampling_frequency_available,
S_IRUGO, adis16260_read_frequency_available, NULL, 0);
-static IIO_CONST_ATTR_NAME("adis16260");
-
#define ADIS16260_GYRO_ATTR_SET(axis) \
IIO_DEV_ATTR_GYRO##axis(adis16260_read_14bit_signed, \
ADIS16260_GYRO_OUT); \
&iio_dev_attr_sampling_frequency.dev_attr.attr, \
&iio_dev_attr_sampling_frequency_available.dev_attr.attr, \
&iio_dev_attr_reset.dev_attr.attr, \
- &iio_const_attr_name.dev_attr.attr, \
NULL \
}; \
static const struct attribute_group adis16260_attribute_group##axis \
goto error_free_tx;
}
+ st->indio_dev->name = spi_get_device_id(st->us)->name;
st->indio_dev->dev.parent = &spi->dev;
if (pd && pd->direction)
switch (pd->direction) {
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("409 546 819 1638");
-static ssize_t adis16400_show_name(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct adis16400_state *st
- = iio_dev_get_devdata(dev_get_drvdata(dev));
- return sprintf(buf, "%s\n", spi_get_device_id(st->us)->name);
-}
-static IIO_DEVICE_ATTR(name, S_IRUGO, adis16400_show_name, NULL, 0);
-
enum adis16400_chan {
in_supply,
gyro_x,
&iio_dev_attr_sampling_frequency.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_dev_attr_name.dev_attr.attr,
NULL
};
}
st->variant = &adis16400_chips[spi_get_device_id(spi)->driver_data];
st->indio_dev->dev.parent = &spi->dev;
+ st->indio_dev->name = spi_get_device_id(spi)->name;
st->indio_dev->attrs = &adis16400_attribute_group;
st->indio_dev->channels = st->variant->channels;
st->indio_dev->num_channels = st->variant->num_channels;
return get_sensor_data(dev, buf, COMMMAND1_OPMODE_PROX_ONCE);
}
-/* Read name */
-static ssize_t show_name(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct iio_dev *indio_dev = dev_get_drvdata(dev);
- struct isl29018_chip *chip = indio_dev->dev_data;
-
- return sprintf(buf, "%s\n", chip->client->name);
-}
-
static IIO_DEVICE_ATTR(range, S_IRUGO | S_IWUSR, show_range, store_range, 0);
static IIO_CONST_ATTR(range_available, "1000 4000 16000 64000");
static IIO_CONST_ATTR(adc_resolution_available, "4 8 12 16");
static IIO_DEVICE_ATTR(illuminance0_input, S_IRUGO, show_lux, NULL, 0);
static IIO_DEVICE_ATTR(intensity_infrared_raw, S_IRUGO, show_ir, NULL, 0);
static IIO_DEVICE_ATTR(proximity_raw, S_IRUGO, show_proxim_ir, NULL, 0);
-static IIO_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
#define ISL29018_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr)
#define ISL29018_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr)
static struct attribute *isl29018_attributes[] = {
- ISL29018_DEV_ATTR(name),
ISL29018_DEV_ATTR(range),
ISL29018_CONST_ATTR(range_available),
ISL29018_DEV_ATTR(adc_resolution),
goto exit_free;
}
chip->indio_dev->attrs = &isl29108_group;
+ chip->indio_dev->name = id->name;
chip->indio_dev->dev.parent = &client->dev;
chip->indio_dev->dev_data = (void *)(chip);
chip->indio_dev->driver_module = THIS_MODULE;
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("27900 14000 7000 3500");
-static IIO_CONST_ATTR(name, "ade7753");
-
static struct attribute *ade7753_attributes[] = {
&iio_dev_attr_temp_raw.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_dev_attr_sampling_frequency.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_phcal.dev_attr.attr,
&iio_dev_attr_cfden.dev_attr.attr,
&iio_dev_attr_aenergy.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &ade7753_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26000 13000 65000 33000");
-static IIO_CONST_ATTR(name, "ade7754");
-
static struct attribute *ade7754_attributes[] = {
&iio_dev_attr_temp_raw.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_dev_attr_sampling_frequency.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_aenergy.dev_attr.attr,
&iio_dev_attr_laenergy.dev_attr.attr,
&iio_dev_attr_vaenergy.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &ade7754_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("26000 13000 65000 33000");
-static IIO_CONST_ATTR(name, "ade7758");
-
static struct attribute *ade7758_attributes[] = {
&iio_dev_attr_temp_raw.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_dev_attr_waveform_type.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_awatthr.dev_attr.attr,
&iio_dev_attr_bwatthr.dev_attr.attr,
&iio_dev_attr_cwatthr.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->attrs = &ade7758_attribute_group;
st->indio_dev->dev_data = (void *)(st);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("27900 14000 7000 3500");
-static IIO_CONST_ATTR(name, "ade7759");
-
static struct attribute *ade7759_attributes[] = {
&iio_dev_attr_temp_raw.dev_attr.attr,
&iio_const_attr_temp_offset.dev_attr.attr,
&iio_dev_attr_sampling_frequency.dev_attr.attr,
&iio_const_attr_sampling_frequency_available.dev_attr.attr,
&iio_dev_attr_reset.dev_attr.attr,
- &iio_const_attr_name.dev_attr.attr,
&iio_dev_attr_phcal.dev_attr.attr,
&iio_dev_attr_cfden.dev_attr.attr,
&iio_dev_attr_aenergy.dev_attr.attr,
goto error_free_tx;
}
+ st->indio_dev->name = spi->dev.driver->name;
st->indio_dev->dev.parent = &spi->dev;
st->indio_dev->num_interrupt_lines = 1;
#define IIO_DEV_ATTR_REV(_show) \
IIO_DEVICE_ATTR(revision, S_IRUGO, _show, NULL, 0)
-/**
- * IIO_DEV_ATTR_NAME - chip type dependent identifier
- * @_show: output method for the attribute
- **/
-#define IIO_DEV_ATTR_NAME(_show) \
- IIO_DEVICE_ATTR(name, S_IRUGO, _show, NULL, 0)
-
/**
* IIO_DEV_ATTR_RESET: resets the device
**/