Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751425AbZIMILE (ORCPT ); Sun, 13 Sep 2009 04:11:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750981AbZIMILD (ORCPT ); Sun, 13 Sep 2009 04:11:03 -0400 Received: from mail.sf-mail.de ([62.27.20.61]:60931 "EHLO mail.sf-mail.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750849AbZIMILB (ORCPT ); Sun, 13 Sep 2009 04:11:01 -0400 From: Rolf Eike Beer To: Constantin Baranov Subject: Re: [PATCH] hwmon: Driver for SCSI/ATA temperature sensors Date: Sun, 13 Sep 2009 10:04:11 +0200 User-Agent: KMail/1.12.1 (Linux/2.6.31-rc8-29-default; KDE/4.3.1; x86_64; ; ) Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org References: <20090913040104.ab1d0b69.const@mimas.ru> In-Reply-To: <20090913040104.ab1d0b69.const@mimas.ru> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5475248.XWu9tlgf66"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200909131004.19489.eike@sf-mail.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2019 Lines: 70 --nextPart5475248.XWu9tlgf66 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 aroun= d=20 that make use of this? > +static int scsitemp_ata_temp_input(struct scsitemp *st, long *temp) > +{ > + static const u8 cdb[16] =3D { > + 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 =3D sizeof(values); > + unsigned nattrs, i; > + int err; > + > + err =3D scsitemp_execute(st, cdb, values, &len); > + if (err) > + goto out; How about directly doing "return err;" here? This would make the label=20 superfluous and tthe code a bit more obvious. > + err =3D -ENXIO; > + nattrs =3D min_t(unsigned, 30, len / 12); > + for (i =3D 0; i < nattrs; i++) { > + u8 *attr =3D values + i * 12; > + > + if (attr[2] =3D=3D 194) { > + *temp =3D attr[7] * 1000; > + err =3D 0; > + break; > + } > + } > + > +out: > + return err; > +} --nextPart5475248.XWu9tlgf66 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEABECAAYFAkqsp4MACgkQXKSJPmm5/E6CLwCfYbSFY6w6DJtUxXtTth6b+w9a NcYAoIOHKbvWF3dKuqjgQ6TrGxRFgvne =40Wg -----END PGP SIGNATURE----- --nextPart5475248.XWu9tlgf66-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/