Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8397776imu; Thu, 15 Nov 2018 10:52:27 -0800 (PST) X-Google-Smtp-Source: AJdET5c6SkeiWgeTyX/LSVU1BWUmKiVw0eh+f8vR49Tz72IURhq2qNI7VLqvwjdaIcNctUdqMeed X-Received: by 2002:a17:902:b401:: with SMTP id x1-v6mr7592965plr.237.1542307947133; Thu, 15 Nov 2018 10:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542307947; cv=none; d=google.com; s=arc-20160816; b=evJTSPZ96DPd1V0LJWgW9PVsrQMLjzlXKKm0MZElpfneLzzuz7fNjMC1Lp/owa7UAd w/CjuBFF6/0yJ7JDH8SRsC8TZLCVqInKkrREjIcbYwRwdy0oFSyA/3hcTTVGzUdznZtQ aIehId54Cnbe6SwsyI2+rS7wo/yv6c5j4tB15cfS7wXHNXDuVekkvJX+GLpZ9CwwvTuJ 7HrklPznRmk0r6v5c/Pj+xFEITDZK4CYpz9Ru6y8bRxrIQTtgw34yCaQQwroh5Kzv6xW ZRXLRReGrY6LW75iMGrGOhAMrizqBoyjQwWPhzOv1dc9Xcr1H5DYVw/Dp2tBZ3fx5qdJ +D3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:message-id:date:thread-index:thread-topic:subject :cc:to:from:dkim-signature; bh=R2KF4IPhTpX/fbWruyTvzcie5+EU1hDGIhBx3vxFr0M=; b=pChtVWsPf5L6n8M2K2WwKAucglUjfMgRJd4RslLr+8wJhNGCAx3ZlJOoixLXqqyPb9 SccmNKXOSWfEIOCWfIpNhcp+yb0j35xgmBHElBjz59eCRZC/t5EG26Z9oFRVUYysam1W wiEpvZNAx0kkrcKI5lveGKM/RntHzngRUcWlc2tZdEAwtnV2zpro5i9S88dfL5K5bVb5 z9Qmzxpq2pgmi1fa54EnDOqjqF+no/LRL1unj6fuCC5uWYmVCctU4lu8q8v4byOyphg+ YXHWFeneoRoKsyA4PGirC5Cl6bK1LETVHaU4V+90fiH3wsJ0j993YAfcTkFCMTVWZTYu 9PdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@impinj.com header.s=selector1 header.b=GZhDGb+l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=impinj.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l66si2257787pfi.5.2018.11.15.10.52.12; Thu, 15 Nov 2018 10:52:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@impinj.com header.s=selector1 header.b=GZhDGb+l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=impinj.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725930AbeKPFAT (ORCPT + 99 others); Fri, 16 Nov 2018 00:00:19 -0500 Received: from mail-eopbgr780098.outbound.protection.outlook.com ([40.107.78.98]:60000 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725741AbeKPFAS (ORCPT ); Fri, 16 Nov 2018 00:00:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R2KF4IPhTpX/fbWruyTvzcie5+EU1hDGIhBx3vxFr0M=; b=GZhDGb+lCP5wYuoN0uk8iARw7T6ieVBszVsl8OCIkGUv1s9Ypzt+zZLVquBVUrDPD6MSfYwDy8iu2rX5f/hYcao9P2RBdMP3qzq6E4CwC0mhQdqIfQNBZ2iBSeVCqFbvjuonDGQilOLwtVHTRksquj26ske9Z5idZKtX41QasLU= Received: from MWHPR0601MB3708.namprd06.prod.outlook.com (10.167.236.38) by MWHPR0601MB3771.namprd06.prod.outlook.com (10.167.236.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.45; Thu, 15 Nov 2018 18:51:18 +0000 Received: from MWHPR0601MB3708.namprd06.prod.outlook.com ([fe80::f51a:d8dd:1aad:3bf9]) by MWHPR0601MB3708.namprd06.prod.outlook.com ([fe80::f51a:d8dd:1aad:3bf9%3]) with mapi id 15.20.1294.045; Thu, 15 Nov 2018 18:51:18 +0000 From: Trent Piepho To: "linux-rtc@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Trent Piepho , Alessandro Zummo , Alexandre Belloni Subject: [PATCH] rtc: isl1208: Use i2c block read/write routines Thread-Topic: [PATCH] rtc: isl1208: Use i2c block read/write routines Thread-Index: AQHUfRQxmCihUIuU6Eek4SQwI9t8BA== Date: Thu, 15 Nov 2018 18:51:18 +0000 Message-ID: <20181115185102.24046-1-tpiepho@impinj.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR14CA0028.namprd14.prod.outlook.com (2603:10b6:300:12b::14) To MWHPR0601MB3708.namprd06.prod.outlook.com (2603:10b6:301:7c::38) authentication-results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [216.207.205.253] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR0601MB3771;6:gSlfhTmwubLz1FJ2/ACq2YA7K2kkvMsQfE/QcPuvnv7Gpx4UTutvAo0VoofuWnX64puyOo0aeDy3j7DaPd19qs+hCwfOGwXR1oiPs2010cJmvHCp1kyXpc3UK7qWzfLtzKZXpy5cAMOSmPWg2+ryZci6ePLO+hVyOBJ0ep9iSsaGm2r4T41vHeQiOwxhbACK7IUfCwUpEof1qcfE5l0t+7QR7EiJRrd2HW1i4tRCXahFn3dlOmqqPvoAQLEFxoKHXOZz70Np6KPUIBVhnpt5L2seCpZd/HOtByoYPddAbX37aOtD+heN6lDLAxk/b0pL+qAxwpeAluDPjx16yRZQTIfyt+6cIsKaBQ9vPQnsQwLjGrQvUMg86XZFWOWvqQkkRqUhSD+NMJ6SeNZ6XcwFmCCDX/9twpgs3e3E5rjvR7cyn8skYg5zc7ffgSlkyA8EgSGwCA4hTSCilc8HYcyugw==;5:Dq7ijgBzq43vhea6vnuUlRDbJQLz7igfurh6GxkHoS1pntXAxHsfabGchxuH8vAp2J6pN4k1K1UexxqluOQZ36HQvk2XJni1ZfnU9BuodwdBOY+xMn89XGKDVhiN9f+WmFHFHIf9ZODPqGIbsv/XdXhfBlPme4r76HI1orxi0ik=;7:jamDfbEAWwbtLYdk08f0zvxsok0xAWvSBp8dSnjgF76MTO2SYfHCxqx+XG48k6vJJL2bt2wiXRanSNJontLzZoPJo973ghtap7zgDWn7GPE4BoEoM5A4/xO2LC/c4sZ29wL8z0YGWsXCb0OvjJ93xA== x-ms-office365-filtering-correlation-id: a5a81e63-8113-4c93-0a28-08d64b2b537c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:MWHPR0601MB3771; x-ms-traffictypediagnostic: MWHPR0601MB3771: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231415)(944501410)(52105112)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:MWHPR0601MB3771;BCL:0;PCL:0;RULEID:;SRVR:MWHPR0601MB3771; x-forefront-prvs: 08572BD77F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(136003)(366004)(346002)(376002)(39850400004)(396003)(199004)(189003)(6512007)(1857600001)(53936002)(52116002)(486006)(3846002)(6116002)(386003)(6506007)(86362001)(14444005)(99286004)(54906003)(8676002)(71190400001)(68736007)(71200400001)(36756003)(256004)(6486002)(110136005)(476003)(2616005)(4326008)(2900100001)(6436002)(5660300001)(2501003)(8936002)(106356001)(316002)(478600001)(97736004)(66066001)(2906002)(1076002)(102836004)(26005)(305945005)(186003)(81166006)(81156014)(7736002)(105586002)(14454004)(25786009);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR0601MB3771;H:MWHPR0601MB3708.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ZjSKjn3y5hrZd5VhVESj5J9RaPa6xVcBgDTmW9uz5Ncp/XHuvGZqf2mjxXC/McSzBOtzcMLV8epnUWJ98vEKu/2DBP1qZ9GcsE+vPQF8iKh145oRFbXJyn8xe05ZzIBns81PkXiHn6x0rK/lW0n1sN8u1SIqc8F6L9KhaB1OQ9GdZfaoJwg8ZJl5CCbryYqqV/+bG1lUBXj8ENxz3Qrdtmwj2Th9rM6lxFZ5rfiycBFl+ASzSRTNCQ9a5l0iugbh0SPSBXmfzHGhjqMTPi5ew0yObFlKEfEu7xMlYRDjfYMu55trVk9kj1NhlyH7mX/Mxlasju+WmanRjlvpXZlWFBwCIUgD5kHDwAdFnWC/g+w= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5a81e63-8113-4c93-0a28-08d64b2b537c X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2018 18:51:18.5996 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0601MB3771 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Linux i2c layer has functions to execute common SMBUS/I2C transactions. The register access code here is identical to the I2C read/write block data routines. Cc: Alessandro Zummo Cc: Alexandre Belloni Signed-off-by: Trent Piepho --- drivers/rtc/rtc-isl1208.c | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index ec5ef518a09b..37ab3e1d25f5 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -84,29 +84,13 @@ static int isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], unsigned len) { - u8 reg_addr[1] =3D { reg }; - struct i2c_msg msgs[2] =3D { - { - .addr =3D client->addr, - .len =3D sizeof(reg_addr), - .buf =3D reg_addr - }, - { - .addr =3D client->addr, - .flags =3D I2C_M_RD, - .len =3D len, - .buf =3D buf - } - }; int ret; =20 WARN_ON(reg > ISL1219_REG_YRT); WARN_ON(reg + len > ISL1219_REG_YRT + 1); =20 - ret =3D i2c_transfer(client->adapter, msgs, 2); - if (ret > 0) - ret =3D 0; - return ret; + ret =3D i2c_smbus_read_i2c_block_data(client, reg, len, buf); + return (ret < 0) ? ret : 0; } =20 /* block write */ @@ -114,26 +98,13 @@ static int isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], unsigned len) { - u8 i2c_buf[ISL1208_REG_USR2 + 2]; - struct i2c_msg msgs[1] =3D { - { - .addr =3D client->addr, - .len =3D len + 1, - .buf =3D i2c_buf - } - }; int ret; =20 WARN_ON(reg > ISL1219_REG_YRT); WARN_ON(reg + len > ISL1219_REG_YRT + 1); =20 - i2c_buf[0] =3D reg; - memcpy(&i2c_buf[1], &buf[0], len); - - ret =3D i2c_transfer(client->adapter, msgs, 1); - if (ret > 0) - ret =3D 0; - return ret; + ret =3D i2c_smbus_write_i2c_block_data(client, reg, len, buf); + return (ret < 0) ? ret : 0; } =20 /* simple check to see whether we have a isl1208 */ --=20 2.14.4