Skip to content

Commit

Permalink
hwmon: (adcxx) Simplify show_name function
Browse files Browse the repository at this point in the history
Display device name using to_spi_device(dev)->modalias instead of computing it
from the number of ADC channels. This is cleaner and reduces code size.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Guenter Roeck committed Sep 24, 2012
1 parent e2d8c2b commit cc00e4d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/hwmon/adcxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ static ssize_t adcxx_set_max(struct device *dev,
static ssize_t adcxx_show_name(struct device *dev, struct device_attribute
*devattr, char *buf)
{
struct spi_device *spi = to_spi_device(dev);
struct adcxx *adc = spi_get_drvdata(spi);

return sprintf(buf, "adcxx%ds\n", adc->channels);
return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
}

static struct sensor_device_attribute ad_input[] = {
Expand Down

0 comments on commit cc00e4d

Please sign in to comment.