diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-09-11 16:34:29 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-09-24 00:08:35 -0400 |
commit | 860f37319e9a1141b041ca2e77ca121dccde4b93 (patch) | |
tree | 55c1d127794cd5d6a3466b904c27cabab5af6c82 | |
parent | cc00e4ddbf00d5ee6d8b7df6d4b04d98f3d99af5 (diff) |
hwmon: (lm70) Simplify show_name function
Instead of using a switch statement to determine the device name, use
to_spi_device(dev)->modalias to simplify the code and reduce module size.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/lm70.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index 789753d0df79..2d1777a03edb 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -124,26 +124,7 @@ static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL); | |||
124 | static ssize_t lm70_show_name(struct device *dev, struct device_attribute | 124 | static ssize_t lm70_show_name(struct device *dev, struct device_attribute |
125 | *devattr, char *buf) | 125 | *devattr, char *buf) |
126 | { | 126 | { |
127 | struct lm70 *p_lm70 = dev_get_drvdata(dev); | 127 | return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); |
128 | int ret; | ||
129 | |||
130 | switch (p_lm70->chip) { | ||
131 | case LM70_CHIP_LM70: | ||
132 | ret = sprintf(buf, "lm70\n"); | ||
133 | break; | ||
134 | case LM70_CHIP_TMP121: | ||
135 | ret = sprintf(buf, "tmp121\n"); | ||
136 | break; | ||
137 | case LM70_CHIP_LM71: | ||
138 | ret = sprintf(buf, "lm71\n"); | ||
139 | break; | ||
140 | case LM70_CHIP_LM74: | ||
141 | ret = sprintf(buf, "lm74\n"); | ||
142 | break; | ||
143 | default: | ||
144 | ret = -EINVAL; | ||
145 | } | ||
146 | return ret; | ||
147 | } | 128 | } |
148 | 129 | ||
149 | static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL); | 130 | static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL); |