From: Rolf Eike Beer <eike@sf-mail.de>
To: Constantin Baranov <const@mimas.ru>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] hwmon: Driver for SCSI/ATA temperature sensors
Date: Sun, 13 Sep 2009 10:04:11 +0200 [thread overview]
Message-ID: <200909131004.19489.eike@sf-mail.de> (raw)
In-Reply-To: <20090913040104.ab1d0b69.const@mimas.ru>
[-- Attachment #1: Type: Text/Plain, Size: 1285 bytes --]
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;
> +}
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-09-13 8:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-12 23:01 [PATCH] hwmon: Driver for SCSI/ATA temperature sensors Constantin Baranov
2009-09-13 8:04 ` Rolf Eike Beer [this message]
2009-09-13 11:56 ` Constantin Baranov
2009-09-13 14:00 ` James Bottomley
2009-09-14 15:00 ` Pavel Machek
2009-09-15 5:57 ` Julian Calaby
2009-09-16 17:43 ` Constantin Baranov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200909131004.19489.eike@sf-mail.de \
--to=eike@sf-mail.de \
--cc=const@mimas.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).