diff options
Diffstat (limited to 'drivers/staging/iio/adc/ad7314.c')
-rw-r--r-- | drivers/staging/iio/adc/ad7314.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/staging/iio/adc/ad7314.c b/drivers/staging/iio/adc/ad7314.c index bc34e29..a1f1b43 100644 --- a/drivers/staging/iio/adc/ad7314.c +++ b/drivers/staging/iio/adc/ad7314.c @@ -42,7 +42,6 @@ */ struct ad7314_chip_info { - const char *name; struct spi_device *spi_dev; struct iio_dev *indio_dev; s64 last_timestamp; @@ -155,7 +154,7 @@ static ssize_t ad7314_show_temperature(struct device *dev, 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) { @@ -181,22 +180,10 @@ static ssize_t ad7314_show_temperature(struct device *dev, 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, }; @@ -222,7 +209,6 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) 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) { @@ -230,6 +216,7 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) 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; @@ -240,7 +227,7 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) 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: |