Am Sonntag 13 September 2009 01:01:04 schrieb Constantin Baranov: > The scsitemp module attaches a device to each SCSI device > and registers it in hwmon. Currently the only method of > reading temperature is ATA SMART. Adding support of the > pure SCSI methods is provided. That sounds useful. Do you have any nagios rules or something similar around that make use of this? > +static int scsitemp_ata_temp_input(struct scsitemp *st, long *temp) > +{ > + static const u8 cdb[16] = { > + ATA_16, 0x08, 0x0e, 0x00, > + ATA_SMART_READ_VALUES, 0x00, 0x01, 0x00, > + 0x00, 0x00, ATA_SMART_LBAM_PASS, 0x00, > + ATA_SMART_LBAH_PASS, 0x00, ATA_CMD_SMART, 0x00, > + }; > + > + u8 values[512]; > + unsigned len = sizeof(values); > + unsigned nattrs, i; > + int err; > + > + err = scsitemp_execute(st, cdb, values, &len); > + if (err) > + goto out; How about directly doing "return err;" here? This would make the label superfluous and tthe code a bit more obvious. > + err = -ENXIO; > + nattrs = min_t(unsigned, 30, len / 12); > + for (i = 0; i < nattrs; i++) { > + u8 *attr = values + i * 12; > + > + if (attr[2] == 194) { > + *temp = attr[7] * 1000; > + err = 0; > + break; > + } > + } > + > +out: > + return err; > +}