Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754322AbdLFJur (ORCPT ); Wed, 6 Dec 2017 04:50:47 -0500 Received: from mail-he1eur01on0126.outbound.protection.outlook.com ([104.47.0.126]:10368 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750812AbdLFJuk (ORCPT ); Wed, 6 Dec 2017 04:50:40 -0500 From: "Zhang, Sean C. (NSB - CN/Hangzhou)" To: David Daney , Jan Glauber , "david.daney@cavium.com" CC: "wsa@the-dreams.de" , "linux-i2c@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [Bug fix] octeon-i2c driver improvement [2/2] Thread-Topic: [Bug fix] octeon-i2c driver improvement [2/2] Thread-Index: AdNudzzBgpmDJsQORVmDhFwrtvjOdQ== Date: Wed, 6 Dec 2017 09:50:36 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [131.228.32.170] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1SPR01MB327;6:tDESqVMhjY8N6oYKEYjNwhVnR2W+M+U5TVT2n5FfZLgtRORjLcRU7TjFAVsM8VrybIpz/1f0GywdcQFUaWgr99ylNJ1zEg1vdyGNtCK6xkhtKlqycwM4yGLwz7NIG73vCTTYuAou6EoqLHmgfZ1a70SW7qxsHB6qmal6OiYJCyM4hoVopKt0yrJlyJBkRVh2zka8ILWVMCT+upqjbGHC6CnZKbnABLKZtFb05pxRhFFRAETvC1stnfae8bp4BX9eHbvA42px6RoEwRAlTW+s/Q81gR0Z3V5Ryx5g2PLjLtS1s7pn2viR/EDYcFtx2Cbx7fTLE7OI1wRFAOm90vfHDdSONC4rcwRX2VPA58An4jA=;5:RJb+jMwPeoKxt1qh2DjhZfjIf68eygJChbSFkAy2SP8+WPVrhZ8KglzfdS+nYIPZI8vp4Ccg8VtE8n+dPjVO4PPcklhm+V9J2MOgZ8Ox1K9q/4aNrrMwz8wGENnIerIyPm87sxctUN0DgPjI9crGfrfDj6kqRnpUY57Rla/DgLE=;24:BStedZFcCo8Puue6iZJnJctrEr4yn/WSF0mGzew3HWzb7CuB0mTb8SB+tcS+LJT+DrpQP+MC1cGPtBQwaZ/lhccLmb7EF6/cEBioQ+czYPY=;7:nXsAphdYb6V2H9cP+KCB4WYvuEbT8uADhIgok/Ldx8f7WdH0D3LCWqdKOn3PZgDkgJAu0NwsPjQilE5v+1jmu+WRQtasVWFgO3/RVSARZBk1FYG+pOX15Qvt68dOoMts3CUZY3+4UOhoUdDAy4yg7DatOFnhyfjOkRdq3QhNRFb1fO06S3TNsob7f+WtE2x539qJcs6off3fDPju9G9k50NUg10ojoF4IYmwkoycY04ouscZap4cdfCAuiQPYg/S x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: fc2f0dc8-5151-4b9e-19a6-08d53c8ecd5c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603286)(49563074);SRVR:VI1SPR01MB327; x-ms-traffictypediagnostic: VI1SPR01MB327: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sean.c.zhang@nokia-sbell.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(102415395)(6040450)(2401047)(8121501046)(5005006)(3231022)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011);SRVR:VI1SPR01MB327;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:VI1SPR01MB327; x-forefront-prvs: 05134F8B4F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39860400002)(346002)(376002)(199004)(189003)(6436002)(6506006)(33656002)(54906003)(110136005)(5890100001)(2501003)(97736004)(101416001)(5250100002)(4326008)(74316002)(3280700002)(305945005)(66066001)(99286004)(8936002)(53936002)(99936001)(316002)(2900100001)(7736002)(3660700001)(2906002)(86362001)(7696005)(14454004)(68736007)(105586002)(106356001)(478600001)(81156014)(81166006)(8676002)(25786009)(3846002)(6116002)(102836003)(9686003)(5660300001)(55016002);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1SPR01MB327;H:VI1PR0702MB3615.eurprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:0;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/mixed; boundary="_003_VI1PR0702MB3615214734CE3D595C4A58618E320VI1PR0702MB3615_" MIME-Version: 1.0 X-OriginatorOrg: nokia-sbell.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc2f0dc8-5151-4b9e-19a6-08d53c8ecd5c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2017 09:50:36.9774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1SPR01MB327 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 28911 Lines: 389 --_003_VI1PR0702MB3615214734CE3D595C4A58618E320VI1PR0702MB3615_ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 SGkgSmFuIGFuZCBEYXZpZCwNCg0KRm9yIG9jdGVvbi1pMmMgZHJpdmVyLCB0aGVyZSBoYXMgZHVw bGljYXRlZCBpbnRlcnJ1cHQgZGlzYWJsZSBpbiBvY3Rlb25faTJjX2lzcigpLA0Kb2N0ZW9uX2ky Y19obGNfd2FpdCgpIGFuZCBvY3Rlb25faTJjX3dhaXQoKSwgc2luY2Ugb2N0ZW9uX2kyY19obGNf d2FpdCgpIGFuZA0Kb2N0ZW9uX2kyY193YWl0KCkgaGFzIHBhaXIgb2YgaW50ZXJydXB0IGVuYWJs ZSBhbmQgZGlzYWJsZSwgc28gdGhlIGludGVycnVwdA0KZGlzYWJsZSBpbiBvY3Rlb25faTJjX2lz cigpIGlzIG5vdCBuZWNlc3NhcnkuIGF0dGFjaGVkIHBhdGNoIHJlbW92ZWQgdGhpcw0KdW5uZWNl c3NhcnkgaW50ZXJydXB0IGRpc2FibGUgc3RlcC4NCg0KUGxlYXNlIGhhdmUgdGltZSB0byByZXZp ZXcgaXQuIFRoYW5rcy4NCg0KQlINClNlYW4gWmhhbmcNCg== --_003_VI1PR0702MB3615214734CE3D595C4A58618E320VI1PR0702MB3615_ Content-Type: application/octet-stream; name="0001-i2c-octeon-driver-improvement.patch" Content-Description: 0001-i2c-octeon-driver-improvement.patch Content-Disposition: attachment; filename="0001-i2c-octeon-driver-improvement.patch"; size=1016; creation-date="Wed, 06 Dec 2017 09:34:56 GMT"; modification-date="Wed, 06 Dec 2017 09:34:56 GMT" Content-Transfer-Encoding: base64 RnJvbSA1YmNiNTFhODUxNTIyNGVkNzc1ZTQxZDk5ZmMzYzQxMDcyMzA3NWJiIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBoZ3Q0NjMgPHNlYW4uYy56aGFuZ0Bub2tpYS5jb20+CkRhdGU6 IFdlZCwgNiBEZWMgMjAxNyAxNzoyNjo1NyArMDgwMApTdWJqZWN0OiBbUEFUQ0hdIGkyYy1vY3Rl b24gZHJpdmVyIGltcHJvdmVtZW50OgogLSB0aGVyZSBoYXMgZHVwbGljYXRlZCBpbnRlcnJ1cHQg ZGlzYWJsZSBpbiBvY3Rlb25faTJjX2lzcigpLAogICBvY3Rlb25faTJjX2hsY193YWl0KCkgYW5k IG9jdGVvbl9pMmNfd2FpdCgpLCBzaW5jZQogICBvY3Rlb25faTJjX2hsY193YWl0KCkgYW5kIG9j dGVvbl9pMmNfd2FpdCgpIGhhcyBwYWlyIG9mIGludGVycnVwdAogICBlbmFibGUgYW5kIGRpc2Fi bGUsIHNvIHRoZSBpbnRlcnJ1cHQgZGlzYWJsZSBpbiBvY3Rlb25faTJjX2lzcigpCiAgIGlzIG5v dCBuZWNlc3NhcnkuCgpTaWduZWQtb2ZmLWJ5OiBoZ3Q0NjMgPHNlYW4uYy56aGFuZ0Bub2tpYS5j b20+Ci0tLQogZHJpdmVycy9pMmMvYnVzc2VzL2kyYy1vY3Rlb24tY29yZS5jIHwgICAgMSAtCiAx IGZpbGVzIGNoYW5nZWQsIDAgaW5zZXJ0aW9ucygrKSwgMSBkZWxldGlvbnMoLSkKCmRpZmYgLS1n aXQgYS9kcml2ZXJzL2kyYy9idXNzZXMvaTJjLW9jdGVvbi1jb3JlLmMgYi9kcml2ZXJzL2kyYy9i dXNzZXMvaTJjLW9jdGVvbi1jb3JlLmMKaW5kZXggMWQ4Nzc1Ny4uMTU4MjY5YiAxMDA2NDQKLS0t IGEvZHJpdmVycy9pMmMvYnVzc2VzL2kyYy1vY3Rlb24tY29yZS5jCisrKyBiL2RyaXZlcnMvaTJj L2J1c3Nlcy9pMmMtb2N0ZW9uLWNvcmUuYwpAQCAtMjUsNyArMjUsNiBAQCBpcnFyZXR1cm5fdCBv Y3Rlb25faTJjX2lzcihpbnQgaXJxLCB2b2lkICpkZXZfaWQpCiB7CiAJc3RydWN0IG9jdGVvbl9p MmMgKmkyYyA9IGRldl9pZDsKIAotCWkyYy0+aW50X2Rpc2FibGUoaTJjKTsKIAl3YWtlX3VwKCZp MmMtPnF1ZXVlKTsKIAogCXJldHVybiBJUlFfSEFORExFRDsKLS0gCjEuNy4xCgo= --_003_VI1PR0702MB3615214734CE3D595C4A58618E320VI1PR0702MB3615_ Content-Type: text/plain; name="i2c-octeon-core.c" Content-Description: i2c-octeon-core.c Content-Disposition: attachment; filename="i2c-octeon-core.c"; size=19194; creation-date="Wed, 06 Dec 2017 09:34:56 GMT"; modification-date="Wed, 06 Dec 2017 09:34:56 GMT" Content-Transfer-Encoding: base64 LyoKICogKEMpIENvcHlyaWdodCAyMDA5LTIwMTAKICogTm9raWEgU2llbWVucyBOZXR3b3Jrcywg bWljaGFlbC5sYXduaWNrLmV4dEBuc24uY29tCiAqCiAqIFBvcnRpb25zIENvcHlyaWdodCAoQykg MjAxMCAtIDIwMTYgQ2F2aXVtLCBJbmMuCiAqCiAqIFRoaXMgZmlsZSBjb250YWlucyB0aGUgc2hh cmVkIHBhcnQgb2YgdGhlIGRyaXZlciBmb3IgdGhlIGkyYyBhZGFwdGVyIGluCiAqIENhdml1bSBO ZXR3b3JrcycgT0NURU9OIHByb2Nlc3NvcnMgYW5kIFRodW5kZXJYIFNPQ3MuCiAqCiAqIFRoaXMg ZmlsZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1Ymxp YwogKiBMaWNlbnNlIHZlcnNpb24gMi4gVGhpcyBwcm9ncmFtIGlzIGxpY2Vuc2VkICJhcyBpcyIg d2l0aG91dCBhbnkKICogd2FycmFudHkgb2YgYW55IGtpbmQsIHdoZXRoZXIgZXhwcmVzcyBvciBp bXBsaWVkLgogKi8KCiNpbmNsdWRlIDxsaW51eC9kZWxheS5oPgojaW5jbHVkZSA8bGludXgvaTJj Lmg+CiNpbmNsdWRlIDxsaW51eC9pbnRlcnJ1cHQuaD4KI2luY2x1ZGUgPGxpbnV4L2tlcm5lbC5o PgojaW5jbHVkZSA8bGludXgvbW9kdWxlLmg+CgojaW5jbHVkZSAiaTJjLW9jdGVvbi1jb3JlLmgi CgovKiBpbnRlcnJ1cHQgc2VydmljZSByb3V0aW5lICovCmlycXJldHVybl90IG9jdGVvbl9pMmNf aXNyKGludCBpcnEsIHZvaWQgKmRldl9pZCkKewoJc3RydWN0IG9jdGVvbl9pMmMgKmkyYyA9IGRl dl9pZDsKCgl3YWtlX3VwKCZpMmMtPnF1ZXVlKTsKCglyZXR1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