Fixes for v4.2-rc1

Two patches headed for stable:
 - Fix broken output scaling in mcp3021 driver
 - Fix attribute visibility in nct7802 driver
 One regression:
 - Fix name attribute in dell-smm-hwmon driver
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVlUqWAAoJEMsfJm/On5mBOroQAIK1zkWHIfHtQWffamVXtsat
 Pgms9nNr53DEb8qbR3u/UDvsEBCq9HtLVUx+LxO5Et0VC1Ef0+IFL90I1lPysat1
 OW1nVq5iBnuik+bbDRzuO0ZT+3t7Mmtn43R8PJ5rRQl/LrroVByrtBPdR5NjmaWn
 NEeI0n56t2JYsR3bv5ZV0CT0h1EuR7qj3eABqZsDI/jkQOsfV8R24bibVN8fb5iB
 ICgJk4uv4bWfKB1OmE7ScAlmQbUG+ISRnCuyIz3ty40ly7/Srq5ioi5EGOb73yAc
 CBGhw4BKRHJUD8jXm9Fa/iga2Pe/ta5yplOgHMbRrnATRs60NsfV+iP6ugMYv3pY
 iOYu5rF2FZ7j7e2s3HHVQeXEMhAcwZ3zJPCamt8WGDqNrMRm+o9a542z4mNppHKX
 JW5Grl4QrVe1ANWMaMSIndGAPmpST7dIb2Sxaw1OvpecKRlIUHflui1FQ0LDeesz
 u1XXcTDMdN7dVLcjvie8wAfIBjCUXRewrPohvVlZWVxDyinJz3OxRkQuNilK2FxT
 ZmvHTCj6ZgguCLFM6yyMX7fjmBV1xBSdPbwTQJooZpW3E8n53ZPo8MTFnMTWbrjU
 W1CwX3qwdd4vRDLVn9DL7CXMTAZd9XBMbPwIu/Tii27S6G7n9GlCsMGchmq3J3SN
 xhHnd5nbaxJVBzP82b0S
 =W19U
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-linus-v4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:
 "Two patches headed for stable:
   - Fix broken output scaling in mcp3021 driver
   - Fix attribute visibility in nct7802 driver

  One regression:
   - Fix name attribute in dell-smm-hwmon driver"

* tag 'hwmon-for-linus-v4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (mcp3021) Fix broken output scaling
  hwmon: (nct7802) fix visibility of temp3
  hwmon: (dell-smm-hwmon) Use a valid name attribute
This commit is contained in:
Linus Torvalds 2015-07-02 14:48:26 -07:00
commit 19127af9d8
3 changed files with 3 additions and 15 deletions

View File

@ -777,7 +777,7 @@ static int __init i8k_init_hwmon(void)
if (err >= 0)
i8k_hwmon_flags |= I8K_HWMON_HAVE_FAN2;
i8k_hwmon_dev = hwmon_device_register_with_groups(NULL, "dell-smm",
i8k_hwmon_dev = hwmon_device_register_with_groups(NULL, "dell_smm",
NULL, i8k_groups);
if (IS_ERR(i8k_hwmon_dev)) {
err = PTR_ERR(i8k_hwmon_dev);

View File

@ -31,14 +31,11 @@
/* output format */
#define MCP3021_SAR_SHIFT 2
#define MCP3021_SAR_MASK 0x3ff
#define MCP3021_OUTPUT_RES 10 /* 10-bit resolution */
#define MCP3021_OUTPUT_SCALE 4
#define MCP3221_SAR_SHIFT 0
#define MCP3221_SAR_MASK 0xfff
#define MCP3221_OUTPUT_RES 12 /* 12-bit resolution */
#define MCP3221_OUTPUT_SCALE 1
enum chips {
mcp3021,
@ -54,7 +51,6 @@ struct mcp3021_data {
u16 sar_shift;
u16 sar_mask;
u8 output_res;
u8 output_scale;
};
static int mcp3021_read16(struct i2c_client *client)
@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_client *client)
static inline u16 volts_from_reg(struct mcp3021_data *data, u16 val)
{
if (val == 0)
return 0;
val = val * data->output_scale - data->output_scale / 2;
return val * DIV_ROUND_CLOSEST(data->vdd,
(1 << data->output_res) * data->output_scale);
return DIV_ROUND_CLOSEST(data->vdd * val, 1 << data->output_res);
}
static ssize_t show_in_input(struct device *dev, struct device_attribute *attr,
@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_client *client,
data->sar_shift = MCP3021_SAR_SHIFT;
data->sar_mask = MCP3021_SAR_MASK;
data->output_res = MCP3021_OUTPUT_RES;
data->output_scale = MCP3021_OUTPUT_SCALE;
break;
case mcp3221:
data->sar_shift = MCP3221_SAR_SHIFT;
data->sar_mask = MCP3221_SAR_MASK;
data->output_res = MCP3221_OUTPUT_RES;
data->output_scale = MCP3221_OUTPUT_SCALE;
break;
}

View File

@ -547,7 +547,7 @@ static umode_t nct7802_temp_is_visible(struct kobject *kobj,
if (index >= 9 && index < 18 &&
(reg & 0x0c) != 0x04 && (reg & 0x0c) != 0x08) /* RD2 */
return 0;
if (index >= 18 && index < 27 && (reg & 0x30) != 0x10) /* RD3 */
if (index >= 18 && index < 27 && (reg & 0x30) != 0x20) /* RD3 */
return 0;
if (index >= 27 && index < 35) /* local */
return attr->mode;