Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbcDNIKa (ORCPT ); Thu, 14 Apr 2016 04:10:30 -0400 Received: from mail-bn1on0095.outbound.protection.outlook.com ([157.56.110.95]:27889 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751742AbcDNIKW (ORCPT ); Thu, 14 Apr 2016 04:10:22 -0400 Authentication-Results: the-dreams.de; dkim=none (message not signed) header.d=none;the-dreams.de; dmarc=none action=none header.from=caviumnetworks.com; Date: Thu, 14 Apr 2016 10:10:05 +0200 From: Jan Glauber To: Wolfram Sang CC: , , David Daney Subject: Re: [PATCH v6 06/19] i2c: octeon: Improve error status checking Message-ID: <20160414081005.GC2532@hardcore> References: <20160413085519.GF1563@katana> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160413085519.GF1563@katana> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [109.193.45.40] X-ClientProxiedBy: AM3PR08CA0065.eurprd08.prod.outlook.com (10.163.23.161) To SN2PR07MB2590.namprd07.prod.outlook.com (10.167.15.20) X-MS-Office365-Filtering-Correlation-Id: 34f87d04-871f-4178-737f-08d3643c3819 X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2590;2:mYXD1FbA7mw2uFJtWBep4/iZqtfFWscwUX4P3DxHkGntOoAUNyRke0JajsrY9tgSgP18PR1EydMDwQ+6vfTISX7iMWWEWEQL+6PLeDRIpokckCK3mNTFZ6tWcZFbfCXJ2yAwIQd02PFJO7NfDnWASzAsItgYnXq3IIGwFa2tkZS4PEJ6NxkdW/pjNFbzUx/m;3:q1KIgZWtTzQKoFAbNoqVKxkrJ5X6ul+65OSmB5OgFkIupsXo49rJTCeR0Et4ciVfOGTkUua0diPP6Wz8QIL7OKrr7Ne7yFF/QRY/kdngNERcIIEcQvwNwaEDZDZlo2RP;25:HfwjmiEVmOTS969D56qikzSn+foMI3xya1VDgVR2rkKICO88lVKahPZSwoHYQW2z11Qf6pYvn4OrYSR71snKwLDS8qObUF6L2/L8kAN7KmiY4x18jmvMhVtgjXd6Z+VfmY5rA9vJ1Eh1ixpXKQFezqttaF/I9EmGQd6ODWwkwIsorFpxS00BBinwrb5yMJGri/12Qra1RMhxiiUrCTZapaVZW/u1M7rcNoUP+ZfB7uziGrMI4V8bEblXmr9/YnfpPhxHs/M+aaBRyUfaEM56CqPu1BxGCEGOFjHVpJorcdAEM9VdN1YTcg/5UFsGLsIwG6PSMp9IFNPaCasnPCwGnw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR07MB2590; X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2590;20:al/U8H7wokuCUBh9n7+IrnTp1WJh46r1P1pxJUU3BgTBWoc41iGcsDZRlJDKr847qikUIPegxDD4utEjwpzJhiQQxiWfIXPryPxaWmjh4GsdtIU7mVwpBgNUtvlHRiTMxx/W4L9Qo9ztz7I0xPid+H0lUeIbEswIdDEKmP5VYRQhGg+HJ0O35OcdpnQMb+dSsfPzGd6cHX0R2jkTY/wh2kwxzHNwk67YxBKQ5qh5ObNtU7w04cVXSmLr/Plf+FERX2OpV/JDTcyydC9H98WNvMv6DY14va4jE9SPNbp5XgaUQJXqsiGNSnuecP2KAL3mAuNBI1xuwG1qXxKagivSNf1IVywqLJjF0cyGnqJn5G10Cts83JNCEQeZJ/B5P8LAJBcA49FQB0fRd64iWZcEDv5GnkZXj3MlKsIwz/qSZQKN8mX5Yel7in00clJo26/CDrLkZ5eeZ5+0v1qaLqgpgPxY2l2s788gJhjCgF/eMwrYJLIXtLo1GnAMMdp45/xoC+F3Ln6KNFUuGECBa7m7+03ml4UTdf2BSEcs+3/WV/+VD+ayZGe/WP3afF2EaQCMhn/d2qL1tCq12zH2orrsOU5sih+DF2Nf/2NdwHFzODY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:SN2PR07MB2590;BCL:0;PCL:0;RULEID:;SRVR:SN2PR07MB2590; X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2590;4:zSBZ4qpjDp8Ai3XJ1RJpQSIqRqmyBzin5HrXlFprwIL941pk0G+0yeJLk8kUVqGgrW54/3IgVzjhwdq/WvRWgefu1yhAA8yMW/bfi0K41CmJH4UGt/lugF2o7ixosLwExAt8ZC8SZWpCglKjY6XtjfB2xtRHx2CXZl/L2+CbyXSopd1lSZ1ug5/dQKWIcHGbnwgaZfj0/xjeNzxwP2kyPtT8NnJ6+ItuE0IUoiTnXh8yY3uOjDntHm8Pv5bGUir77ian3brweotZ4go80NNCOGqbMEF2nNN3cW5T297SWGEvWPVHPld3OkTaZsN2ZlwOyh3FVl18bXtNwInxoPWOwY9hqVKSETp6WDD8nzg/hEP8U7X5jZW8hLV9b2L7JuAJ X-Forefront-PRVS: 0912297777 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(24454002)(46406003)(81166005)(5008740100001)(86362001)(1076002)(23726003)(76176999)(50986999)(54356999)(189998001)(4001350100001)(586003)(33656002)(33716001)(3846002)(164054004)(6116002)(2950100001)(2906002)(9686002)(5004730100002)(4001430100002)(50466002)(4326007)(77096005)(42186005)(92566002)(1096002)(97756001)(47776003)(110136002)(107886002)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2590;H:hardcore;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR07MB2590;23:+YNijyrbn5FzAj05wZsQ5zxtmIKlS4v4ctm+n9Tcf?= =?us-ascii?Q?w73zye1ossEvnsbykLfjrQDyB3QvWEts3UcfOHvQZUHgPal2C44prh+tGaqe?= =?us-ascii?Q?c9cQO4HreltkwzH7BMIpCtf7Eo8YJ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nostics: 1;SN2PR07MB2590;5:KthTzW1+JzZMnm3/an98prDTtE9CZ65+VyLESEMVBmeUl/kBJ4jB7t3NPkHKYbc5yNkgGE1lRQaRIVXYmCYTQwpqu6enIDG6fNVzDtUZeixnJh9T5QTxK0w7j0IqrlI3xw/vMVdskKEdWmCbGG4ohb0qd1mcODPqA3+1OOjIqMF1as6JWzep62SkjCSECYoy;24:qbu4CHFLvMbXiGZb+wOkiK1CE0+WSQa5z5OiOwZe+MBRwr6+Bx55xriE39UEK/xNWUohQRfAp6iOf//RHAYijrutrP9EbfEw0RHFnJ6/f9I=;7:lKypCzERAhPYz725eE/PIjhqYQZNPDrYuFRJJlTQJx6JkqqjRww4IyhiY6sWEMzGc8mkeJ5XwYO9xalQ9gr7ZfoWDlV+helKb3zFdmjRVELzrMiOUZy78Sp+vXmndIXCPycBpCK8tFBP0yRy3OseRgbQOT7cW3lqoSPyhHyT9sTVAjHdsCyPMJGvTOBTXOOxaQjc8ViGgmVnzi/DYnCI1vWIUbCF5UKofEvOUhoYB8g= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2016 08:10:17.7941 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2590 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1736 Lines: 81 On Wed, Apr 13, 2016 at 10:55:20AM +0200, Wolfram Sang wrote: > > Please have a look at Documentation/i2c/fault-codes. -EAGAIN is only for > arbitration loss. > > > + /* ACK allowed on pre-terminal bytes only */ > > + case STAT_RXDATA_ACK: > > + if (!final_read) > > + return 0; > > + return -EAGAIN; > > + > > + /* NAK allowed on terminal byte only */ > > + case STAT_RXDATA_NAK: > > + if (final_read) > > + return 0; > > + return -EAGAIN; > > -EIO? Can this happen? It is the master who sends the NAK, so we are in > control of that. If it happens not in the final_read part then it is an error, so -EIO would be better suited. Also for the other error codes I will follow your suggestion. Should I resend the whole series or will you review the other patches before? Thanks, Jan > > + > > + /* Arbitration lost */ > > + case STAT_LOST_ARB_38: > > + case STAT_LOST_ARB_68: > > + case STAT_LOST_ARB_78: > > + case STAT_LOST_ARB_B0: > > + return -EAGAIN; > > OK. > > > + > > + /* Being addressed as slave, should back off & listen */ > > + case STAT_SLAVE_60: > > + case STAT_SLAVE_70: > > + case STAT_GENDATA_ACK: > > + case STAT_GENDATA_NAK: > > + return -EIO; > > -EOPNOTSUPP? > > > + > > + /* Core busy as slave */ > > + case STAT_SLAVE_80: > > + case STAT_SLAVE_88: > > + case STAT_SLAVE_A0: > > + case STAT_SLAVE_A8: > > + case STAT_SLAVE_LOST: > > + case STAT_SLAVE_NAK: > > + case STAT_SLAVE_ACK: > > + return -EIO; > > -EOPNOTSUPP? > > > + case STAT_TXDATA_NAK: > > -EIO? > > > + case STAT_TXADDR_NAK: > > + case STAT_RXADDR_NAK: > > + case STAT_AD2W_NAK: > > -ENXIO? > > > + return -EAGAIN; > > + default: > > + dev_err(i2c->dev, "unhandled state: %d\n", stat); > > + return -EIO; > > OK. >