]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
hwmon: (lm70) Simplify show_name function
authorGuenter Roeck <linux@roeck-us.net>
Tue, 11 Sep 2012 20:34:29 +0000 (13:34 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 24 Sep 2012 04:08:35 +0000 (21:08 -0700)
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>
drivers/hwmon/lm70.c

index 789753d0df79a55d13ec9668d38c2f13f2252521..2d1777a03edb645c4c39fed210efe34e659f8c11 100644 (file)
@@ -124,26 +124,7 @@ static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL);
 static ssize_t lm70_show_name(struct device *dev, struct device_attribute
                              *devattr, char *buf)
 {
-       struct lm70 *p_lm70 = dev_get_drvdata(dev);
-       int ret;
-
-       switch (p_lm70->chip) {
-       case LM70_CHIP_LM70:
-               ret = sprintf(buf, "lm70\n");
-               break;
-       case LM70_CHIP_TMP121:
-               ret = sprintf(buf, "tmp121\n");
-               break;
-       case LM70_CHIP_LM71:
-               ret = sprintf(buf, "lm71\n");
-               break;
-       case LM70_CHIP_LM74:
-               ret = sprintf(buf, "lm74\n");
-               break;
-       default:
-               ret = -EINVAL;
-       }
-       return ret;
+       return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
 }
 
 static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);