diff for duplicates of <20100906181229.2e25db07@hyperion.delvare> diff --git a/a/1.txt b/N1/1.txt index ffb3c10..705a730 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -111,14 +111,14 @@ this is a feature unique to these chips. > + && data->kind != max6695) > + > +#define lm90_have_local_temp_ext(data) \ -> + (data->kind = max6657 || data->kind = max6646 \ -> + || data->kind = max6695) +> + (data->kind == max6657 || data->kind == max6646 \ +> + || data->kind == max6695) > + > +#define lm90_have_remote_limit_ext(data) \ > + (data->kind != max6657 && data->kind != max6646 \ > + && data->kind != max6680 && data->kind != max6695) > + -> +#define lm90_have_emergency(data) (data->kind = max6695) +> +#define lm90_have_emergency(data) (data->kind == max6695) Makes the code more readable, I agree, but OTOH it hides complexity. Such tests are OK during probe or remove, as they happen only once, but @@ -223,7 +223,7 @@ And 58 too, no? > else > data->temp8[nr] = temp_to_s8(val); > + -> + if (data->kind = max6695 && nr >= 6) { +> + if (data->kind == max6695 && nr >= 6) { > + lm90_read_reg(client, LM90_REG_R_CONFIG1, &config); > + i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, > + config | 0x08); @@ -231,7 +231,7 @@ And 58 too, no? > + > i2c_smbus_write_byte_data(client, reg[nr], data->temp8[nr]); > + -> + if (data->kind = max6695 && nr >= 6) +> + if (data->kind == max6695 && nr >= 6) > + i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, config); > + > mutex_unlock(&data->update_lock); @@ -248,11 +248,11 @@ And 58 too, no? > if (err < 0) > @@ -462,19 +519,31 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, > mutex_lock(&data->update_lock); -> if (data->kind = adt7461) +> if (data->kind == adt7461) > data->temp11[nr] = temp_to_u16_adt7461(data, val); -> - else if (data->kind = max6657 || data->kind = max6680) +> - else if (data->kind == max6657 || data->kind == max6680) > - data->temp11[nr] = temp_to_s8(val) << 8; -> else if (data->kind = max6646) +> else if (data->kind == max6646) > data->temp11[nr] = temp_to_u8(val) << 8; > + else if (!lm90_have_remote_limit_ext(data)) > + data->temp11[nr] = temp_to_s8(val) << 8; @@ -260,7 +260,7 @@ And 58 too, no? > data->temp11[nr] = temp_to_s16(val); > > - i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], -> + if (data->kind = max6695 && nr >= 6) { +> + if (data->kind == max6695 && nr >= 6) { > + /* select output channel 2 */ > + lm90_read_reg(client, LM90_REG_R_CONFIG1, &config); > + i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, @@ -281,7 +281,7 @@ thing. > + i2c_smbus_write_byte_data(client, reg[(nr - offset) * 2 + 1], > data->temp11[nr] & 0xff); > + -> + if (data->kind = max6695 && nr >= 6) +> + if (data->kind == max6695 && nr >= 6) > + i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, > + config); > + @@ -379,8 +379,8 @@ point of the detection is undesirable. At the very least, it will slow down driver probing for other devices. You should read the register only on Maxim chips. -> if ((address = 0x4C || address = 0x4D) -> && man_id = 0x01) { /* National Semiconductor */ +> if ((address == 0x4C || address == 0x4D) +> && man_id == 0x01) { /* National Semiconductor */ > int reg_config2; > @@ -770,6 +900,22 @@ static int lm90_detect(struct i2c_client *new_client, > name = "max6657"; @@ -402,13 +402,13 @@ device ID register really isn't that hard :( > + * one of those registers exists (and thus returns a value > + * different to the previous reading). > + */ -> + if (chip_id = 0x01 -> + && (reg_config1 & 0x10) = 0x00 +> + if (chip_id == 0x01 +> + && (reg_config1 & 0x10) == 0x00 > + && reg_emerg != reg_convrate Note that there is a remote chance that both values are equal even though the registers are different. Of course this would mean a very -low emergency limit (below 10°C), is this the reason why you're +low emergency limit (below 10°C), is this the reason why you're ignoring this case? I'm not even sure what you are trying to protect yourself against. @@ -453,7 +453,7 @@ I think 0x187c would be just as readable, wouldn't it? > + goto exit_remove_base; > + } > + -> + if (data->kind = max6695) { +> + if (data->kind == max6695) { Don't we want lm90_have_temp3(data) or similar for this? @@ -480,7 +480,7 @@ Please align on opening parenthesis as the rest of the code does. > return 0; > > exit_remove_files: -> + if (data->kind = max6695) +> + if (data->kind == max6695) > + sysfs_remove_group(&new_client->dev.kobj, &lm90_temp3_group); > +exit_remove_emergency: > + if (lm90_have_emergency(data)) @@ -497,13 +497,13 @@ and removed last too. > device_remove_file(&new_client->dev, &dev_attr_pec); > exit_free: > @@ -913,6 +1084,12 @@ static void lm90_init_client(struct i2c_client *client) -> if (data->kind = max6680) +> if (data->kind == max6680) > config |= 0x18; > > + /* > + * Select external channel 1 for max6695 > + */ -> + if (data->kind = max6695) +> + if (data->kind == max6695) > + config &= ~0x08; > + > config &= 0xBF; /* run */ @@ -515,7 +515,7 @@ and removed last too. > hwmon_device_unregister(data->hwmon_dev); > + if (lm90_have_emergency(data)) > + sysfs_remove_group(&client->dev.kobj, &lm90_emergency_group); -> + if (data->kind = max6695) +> + if (data->kind == max6695) > + sysfs_remove_group(&client->dev.kobj, &lm90_temp3_group); > sysfs_remove_group(&client->dev.kobj, &lm90_group); > device_remove_file(&client->dev, &dev_attr_pec); @@ -537,12 +537,12 @@ lm90_remove. > + u8 config, alarms, alarms2 = 0; > > lm90_read_reg(client, LM90_REG_R_STATUS, &alarms); -> - if ((alarms & 0x7f) = 0) { +> - if ((alarms & 0x7f) == 0) { > + -> + if (data->kind = max6695) +> + if (data->kind == max6695) > + lm90_read_reg(client, LM90_REG_R_STATUS2, &alarms2); > + -> + if ((alarms & 0x7f) = 0 && (alarms2 & 0xfe) = 0) { +> + if ((alarms & 0x7f) == 0 && (alarms2 & 0xfe) == 0) { > dev_info(&client->dev, "Everything OK\n"); > } else { > if (alarms & 0x61) @@ -573,43 +573,43 @@ all chips, which could be avoided. > lm90_read_reg(client, LM90_REG_R_REMOTE_CRIT, &data->temp8[3]); > lm90_read_reg(client, LM90_REG_R_TCRIT_HYST, &data->temp_hyst); > -> - if (data->kind = max6657 || data->kind = max6646) { +> - if (data->kind == max6657 || data->kind == max6646) { > + if (lm90_have_local_temp_ext(data)) { > lm90_read16(client, LM90_REG_R_LOCAL_TEMP, > MAX6657_REG_R_LOCAL_TEMPL, > &data->temp11[4]); > @@ -1033,29 +1223,63 @@ static struct lm90_data *lm90_update_device(struct device *dev) > -> if (lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH, &h) = 0) { +> if (lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH, &h) == 0) { > data->temp11[1] = h << 8; > - if (data->kind != max6657 && data->kind != max6680 > - && data->kind != max6646 > + if (lm90_have_remote_limit_ext(data) > && lm90_read_reg(client, LM90_REG_R_REMOTE_LOWL, -> &l) = 0) +> &l) == 0) > data->temp11[1] |= l; > } -> if (lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHH, &h) = 0) { +> if (lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHH, &h) == 0) { > data->temp11[2] = h << 8; > - if (data->kind != max6657 && data->kind != max6680 > - && data->kind != max6646 > + if (lm90_have_remote_limit_ext(data) > && lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHL, -> &l) = 0) +> &l) == 0) > data->temp11[2] |= l; > } > > - if (data->kind != max6657 && data->kind != max6646) { > + if (lm90_have_offset(data)) { > if (lm90_read_reg(client, LM90_REG_R_REMOTE_OFFSH, -> &h) = 0 +> &h) == 0 > && lm90_read_reg(client, LM90_REG_R_REMOTE_OFFSL, -> &l) = 0) +> &l) == 0) > data->temp11[3] = (h << 8) | l; > } > - lm90_read_reg(client, LM90_REG_R_STATUS, &data->alarms); > + -> + if (data->kind = max6695) { +> + if (data->kind == max6695) { > + u8 config; > + > + lm90_read_reg(client, LM90_REG_R_LOCAL_EMERG, @@ -667,8 +667,3 @@ readable, feel free, I have no objection! -- Jean Delvare - -_______________________________________________ -lm-sensors mailing list -lm-sensors@lm-sensors.org -http://lists.lm-sensors.org/mailman/listinfo/lm-sensors diff --git a/a/content_digest b/N1/content_digest index 8e0c902..bbfa361 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,7 +1,7 @@ "ref\01283639675-31714-1-git-send-email-guenter.roeck@ericsson.com\0" "From\0Jean Delvare <khali@linux-fr.org>\0" - "Subject\0Re: [lm-sensors] [PATCH] hwmon: Add support for max6695 and max6696\0" - "Date\0Mon, 06 Sep 2010 16:12:29 +0000\0" + "Subject\0Re: [PATCH] hwmon: Add support for max6695 and max6696 to lm90 driver\0" + "Date\0Mon, 6 Sep 2010 18:12:29 +0200\0" "To\0Guenter Roeck <guenter.roeck@ericsson.com>\0" "Cc\0Andrew Morton <akpm@linux-foundation.org>" lm-sensors@lm-sensors.org @@ -122,14 +122,14 @@ "> +\t\t && data->kind != max6695)\n" "> +\n" "> +#define lm90_have_local_temp_ext(data) \\\n" - "> +\t\t(data->kind = max6657 || data->kind = max6646 \\\n" - "> +\t\t || data->kind = max6695)\n" + "> +\t\t(data->kind == max6657 || data->kind == max6646 \\\n" + "> +\t\t || data->kind == max6695)\n" "> +\n" "> +#define lm90_have_remote_limit_ext(data) \\\n" "> +\t\t(data->kind != max6657 && data->kind != max6646 \\\n" "> +\t\t && data->kind != max6680 && data->kind != max6695)\n" "> +\n" - "> +#define lm90_have_emergency(data) (data->kind = max6695)\n" + "> +#define lm90_have_emergency(data) (data->kind == max6695)\n" "\n" "Makes the code more readable, I agree, but OTOH it hides complexity.\n" "Such tests are OK during probe or remove, as they happen only once, but\n" @@ -234,7 +234,7 @@ "> \telse\n" "> \t\tdata->temp8[nr] = temp_to_s8(val);\n" "> +\n" - "> +\tif (data->kind = max6695 && nr >= 6) {\n" + "> +\tif (data->kind == max6695 && nr >= 6) {\n" "> +\t\tlm90_read_reg(client, LM90_REG_R_CONFIG1, &config);\n" "> +\t\ti2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,\n" "> +\t\t\t\t\t config | 0x08);\n" @@ -242,7 +242,7 @@ "> +\n" "> \ti2c_smbus_write_byte_data(client, reg[nr], data->temp8[nr]);\n" "> +\n" - "> +\tif (data->kind = max6695 && nr >= 6)\n" + "> +\tif (data->kind == max6695 && nr >= 6)\n" "> +\t\ti2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, config);\n" "> +\n" "> \tmutex_unlock(&data->update_lock);\n" @@ -259,11 +259,11 @@ "> \tif (err < 0)\n" "> @@ -462,19 +519,31 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,\n" "> \tmutex_lock(&data->update_lock);\n" - "> \tif (data->kind = adt7461)\n" + "> \tif (data->kind == adt7461)\n" "> \t\tdata->temp11[nr] = temp_to_u16_adt7461(data, val);\n" - "> -\telse if (data->kind = max6657 || data->kind = max6680)\n" + "> -\telse if (data->kind == max6657 || data->kind == max6680)\n" "> -\t\tdata->temp11[nr] = temp_to_s8(val) << 8;\n" - "> \telse if (data->kind = max6646)\n" + "> \telse if (data->kind == max6646)\n" "> \t\tdata->temp11[nr] = temp_to_u8(val) << 8;\n" "> +\telse if (!lm90_have_remote_limit_ext(data))\n" "> +\t\tdata->temp11[nr] = temp_to_s8(val) << 8;\n" @@ -271,7 +271,7 @@ "> \t\tdata->temp11[nr] = temp_to_s16(val);\n" "> \n" "> -\ti2c_smbus_write_byte_data(client, reg[(nr - 1) * 2],\n" - "> +\tif (data->kind = max6695 && nr >= 6) {\n" + "> +\tif (data->kind == max6695 && nr >= 6) {\n" "> +\t\t/* select output channel 2 */\n" "> +\t\tlm90_read_reg(client, LM90_REG_R_CONFIG1, &config);\n" "> +\t\ti2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,\n" @@ -292,7 +292,7 @@ "> +\t\ti2c_smbus_write_byte_data(client, reg[(nr - offset) * 2 + 1],\n" "> \t\t\t\t\t data->temp11[nr] & 0xff);\n" "> +\n" - "> +\tif (data->kind = max6695 && nr >= 6)\n" + "> +\tif (data->kind == max6695 && nr >= 6)\n" "> +\t\ti2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,\n" "> +\t\t\t\t\t config);\n" "> +\n" @@ -390,8 +390,8 @@ "down driver probing for other devices. You should read the register\n" "only on Maxim chips.\n" "\n" - "> \tif ((address = 0x4C || address = 0x4D)\n" - "> \t && man_id = 0x01) { /* National Semiconductor */\n" + "> \tif ((address == 0x4C || address == 0x4D)\n" + "> \t && man_id == 0x01) { /* National Semiconductor */\n" "> \t\tint reg_config2;\n" "> @@ -770,6 +900,22 @@ static int lm90_detect(struct i2c_client *new_client,\n" "> \t\t\tname = \"max6657\";\n" @@ -413,13 +413,13 @@ "> +\t\t * one of those registers exists (and thus returns a value\n" "> +\t\t * different to the previous reading).\n" "> +\t\t */\n" - "> +\t\tif (chip_id = 0x01\n" - "> +\t\t && (reg_config1 & 0x10) = 0x00\n" + "> +\t\tif (chip_id == 0x01\n" + "> +\t\t && (reg_config1 & 0x10) == 0x00\n" "> +\t\t && reg_emerg != reg_convrate\n" "\n" "Note that there is a remote chance that both values are equal even\n" "though the registers are different. Of course this would mean a very\n" - "low emergency limit (below 10\303\202\302\260C), is this the reason why you're\n" + "low emergency limit (below 10\302\260C), is this the reason why you're\n" "ignoring this case?\n" "\n" "I'm not even sure what you are trying to protect yourself against.\n" @@ -464,7 +464,7 @@ "> +\t\t\tgoto exit_remove_base;\n" "> +\t}\n" "> +\n" - "> +\tif (data->kind = max6695) {\n" + "> +\tif (data->kind == max6695) {\n" "\n" "Don't we want lm90_have_temp3(data) or similar for this?\n" "\n" @@ -491,7 +491,7 @@ "> \treturn 0;\n" "> \n" "> exit_remove_files:\n" - "> +\tif (data->kind = max6695)\n" + "> +\tif (data->kind == max6695)\n" "> +\t\tsysfs_remove_group(&new_client->dev.kobj, &lm90_temp3_group);\n" "> +exit_remove_emergency:\n" "> +\tif (lm90_have_emergency(data))\n" @@ -508,13 +508,13 @@ "> \tdevice_remove_file(&new_client->dev, &dev_attr_pec);\n" "> exit_free:\n" "> @@ -913,6 +1084,12 @@ static void lm90_init_client(struct i2c_client *client)\n" - "> \tif (data->kind = max6680)\n" + "> \tif (data->kind == max6680)\n" "> \t\tconfig |= 0x18;\n" "> \n" "> +\t/*\n" "> +\t * Select external channel 1 for max6695\n" "> +\t */\n" - "> +\tif (data->kind = max6695)\n" + "> +\tif (data->kind == max6695)\n" "> +\t\tconfig &= ~0x08;\n" "> +\n" "> \tconfig &= 0xBF;\t/* run */\n" @@ -526,7 +526,7 @@ "> \thwmon_device_unregister(data->hwmon_dev);\n" "> +\tif (lm90_have_emergency(data))\n" "> +\t\tsysfs_remove_group(&client->dev.kobj, &lm90_emergency_group);\n" - "> +\tif (data->kind = max6695)\n" + "> +\tif (data->kind == max6695)\n" "> +\t\tsysfs_remove_group(&client->dev.kobj, &lm90_temp3_group);\n" "> \tsysfs_remove_group(&client->dev.kobj, &lm90_group);\n" "> \tdevice_remove_file(&client->dev, &dev_attr_pec);\n" @@ -548,12 +548,12 @@ "> +\tu8 config, alarms, alarms2 = 0;\n" "> \n" "> \tlm90_read_reg(client, LM90_REG_R_STATUS, &alarms);\n" - "> -\tif ((alarms & 0x7f) = 0) {\n" + "> -\tif ((alarms & 0x7f) == 0) {\n" "> +\n" - "> +\tif (data->kind = max6695)\n" + "> +\tif (data->kind == max6695)\n" "> +\t\tlm90_read_reg(client, LM90_REG_R_STATUS2, &alarms2);\n" "> +\n" - "> +\tif ((alarms & 0x7f) = 0 && (alarms2 & 0xfe) = 0) {\n" + "> +\tif ((alarms & 0x7f) == 0 && (alarms2 & 0xfe) == 0) {\n" "> \t\tdev_info(&client->dev, \"Everything OK\\n\");\n" "> \t} else {\n" "> \t\tif (alarms & 0x61)\n" @@ -584,43 +584,43 @@ "> \t\tlm90_read_reg(client, LM90_REG_R_REMOTE_CRIT, &data->temp8[3]);\n" "> \t\tlm90_read_reg(client, LM90_REG_R_TCRIT_HYST, &data->temp_hyst);\n" "> \n" - "> -\t\tif (data->kind = max6657 || data->kind = max6646) {\n" + "> -\t\tif (data->kind == max6657 || data->kind == max6646) {\n" "> +\t\tif (lm90_have_local_temp_ext(data)) {\n" "> \t\t\tlm90_read16(client, LM90_REG_R_LOCAL_TEMP,\n" "> \t\t\t\t MAX6657_REG_R_LOCAL_TEMPL,\n" "> \t\t\t\t &data->temp11[4]);\n" "> @@ -1033,29 +1223,63 @@ static struct lm90_data *lm90_update_device(struct device *dev)\n" "> \n" - "> \t\tif (lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH, &h) = 0) {\n" + "> \t\tif (lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH, &h) == 0) {\n" "> \t\t\tdata->temp11[1] = h << 8;\n" "> -\t\t\tif (data->kind != max6657 && data->kind != max6680\n" "> -\t\t\t && data->kind != max6646\n" "> +\t\t\tif (lm90_have_remote_limit_ext(data)\n" "> \t\t\t && lm90_read_reg(client, LM90_REG_R_REMOTE_LOWL,\n" - "> \t\t\t\t\t &l) = 0)\n" + "> \t\t\t\t\t &l) == 0)\n" "> \t\t\t\tdata->temp11[1] |= l;\n" "> \t\t}\n" - "> \t\tif (lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHH, &h) = 0) {\n" + "> \t\tif (lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHH, &h) == 0) {\n" "> \t\t\tdata->temp11[2] = h << 8;\n" "> -\t\t\tif (data->kind != max6657 && data->kind != max6680\n" "> -\t\t\t && data->kind != max6646\n" "> +\t\t\tif (lm90_have_remote_limit_ext(data)\n" "> \t\t\t && lm90_read_reg(client, LM90_REG_R_REMOTE_HIGHL,\n" - "> \t\t\t\t\t &l) = 0)\n" + "> \t\t\t\t\t &l) == 0)\n" "> \t\t\t\tdata->temp11[2] |= l;\n" "> \t\t}\n" "> \n" "> -\t\tif (data->kind != max6657 && data->kind != max6646) {\n" "> +\t\tif (lm90_have_offset(data)) {\n" "> \t\t\tif (lm90_read_reg(client, LM90_REG_R_REMOTE_OFFSH,\n" - "> \t\t\t\t\t &h) = 0\n" + "> \t\t\t\t\t &h) == 0\n" "> \t\t\t && lm90_read_reg(client, LM90_REG_R_REMOTE_OFFSL,\n" - "> \t\t\t\t\t &l) = 0)\n" + "> \t\t\t\t\t &l) == 0)\n" "> \t\t\t\tdata->temp11[3] = (h << 8) | l;\n" "> \t\t}\n" "> -\t\tlm90_read_reg(client, LM90_REG_R_STATUS, &data->alarms);\n" "> +\n" - "> +\t\tif (data->kind = max6695) {\n" + "> +\t\tif (data->kind == max6695) {\n" "> +\t\t\tu8 config;\n" "> +\n" "> +\t\t\tlm90_read_reg(client, LM90_REG_R_LOCAL_EMERG,\n" @@ -677,11 +677,6 @@ "readable, feel free, I have no objection!\n" "\n" "-- \n" - "Jean Delvare\n" - "\n" - "_______________________________________________\n" - "lm-sensors mailing list\n" - "lm-sensors@lm-sensors.org\n" - http://lists.lm-sensors.org/mailman/listinfo/lm-sensors + Jean Delvare -a444720dd3c455eeddcd4010ceca37c83def2e2c1c83c24a55d9a32a3c06f206 +5887037e32e26822d319e6ec61651af11f428557b25bac0791ed78991e4a4418
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.