Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751873AbcDYWnQ (ORCPT ); Mon, 25 Apr 2016 18:43:16 -0400 Received: from mail-bl2on0076.outbound.protection.outlook.com ([65.55.169.76]:31472 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750816AbcDYWnN (ORCPT ); Mon, 25 Apr 2016 18:43:13 -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; Message-ID: <571E9A09.60409@caviumnetworks.com> Date: Mon, 25 Apr 2016 15:28:25 -0700 From: David Daney User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Wolfram Sang CC: Jan Glauber , , Subject: Re: [PATCH v7 03/15] i2c: octeon: Remove I2C_FUNC_SMBUS_QUICK support References: <1461594824-7215-1-git-send-email-jglauber@cavium.com> <1461594824-7215-4-git-send-email-jglauber@cavium.com> <20160425221621.GI1550@katana> In-Reply-To: <20160425221621.GI1550@katana> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [64.2.3.194] X-ClientProxiedBy: SN1PR07CA0035.namprd07.prod.outlook.com (10.162.170.173) To BN4PR07MB2130.namprd07.prod.outlook.com (10.164.63.12) X-MS-Office365-Filtering-Correlation-Id: 472cfc29-d796-4997-4637-08d36d58ed59 X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2130;2:uR/P8U/l0AFgRIPnxt4TB3pg0qi7/Su1a7hTjNSoixFqPJ5Y3gfy3V9Ae4UhLVEQR1edjGGq93/HI7AffxsAH+oFs8MzZZwd7Ta15Jfo5vF2giU8m22pQKNAfYkG6n//Ha+e/eCSJBOni72XfwrYl2REjQxDvWkuOa7E2qymANvnV7poHeJ9tPPwLqxlQTdz;3:A008Pr+Hh+vVxYnA3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grFE26wgcotgA0xoYUGnjbpGOBwFFHLAc7/Hu4uU7D08sfNAHIkkxyQH0yAJXrlHrIRYcf5zVUq/OSkmdbUn+h8+8DZcFF2IT05IBGrN6DjPR3PvJQqxHGgBcTucj2iQ/PXIqy9rh/auJjyQn0QMysSCIp9iuydYsJGuHsD0vzgrgdW3GHiqBLGySr6QvzQB1F6PXOZxV91UddpdhvjPY3IPcwtEN3H34XZkj4fy3n0+cbp6xkx7EpRC+MXcT6WRVjVbKZzhzeRcLjPHhm7eHpzF+toCUcY5gNG/rhBkBHJCOi8c74jge9146lldr5MuzMNSCCaDzLIS5QPmhwgAptAgAZdY2Si5M4RtTEQhQbAkEXAXB1wmbR+v1lijvvFfEfFxTJrENM61EnjLHxyyIKfDYqjKXSRiCGFw9EcMOf6Ta3zeVmZ8E/m1WuqA3/a8K1sxezvkN97qc7iotHac= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046);SRVR:BN4PR07MB2130;BCL:0;PCL:0;RULEID:;SRVR:BN4PR07MB2130; X-Microsoft-Exchange-Diagnostics: 1;BN4PR07MB2130;4:ycK8OWQKMFHrz4xYNCDG/08wuRFcH5fMBlNFrvkKchJ4ihc9TFpWTk/UaF/YkP/W//9oV27CF6732NR1DacbGCy9jbTBMfRhcDsSOhLBL510ThzUzFuj03D1Q1IQQOnqUGkqcK/APHSbND9WckK1Tn7+Nq1x+8/mFDDDHwALXYRuVRdOoYVOxHUHibxHbgQx5Vig5w6JRKC+Uzk4AKhN8I4gvFMEVZeH6NW/gmYsOJbsYo/ElO+5OsE+ahZkQpXrgjrnkN0CFDt3NMsWvdkQ4e1rlY3Wbl635T9gdu6PeQlMoav2qIzLLdWKBIWAEd4wi66oopGpNxUO6Gj+q/l9r8KZyvsPQpWm2Prm0cAH5b9NNHHRZW1hZl6uciZJtLUqiE5Td2JNI6DIz5WJtGKRJA== X-Forefront-PRVS: 0923977CCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(24454002)(377454003)(53416004)(92566002)(47776003)(42186005)(65956001)(65806001)(66066001)(76176999)(54356999)(36756003)(65816999)(50986999)(5008740100001)(6116002)(4326007)(64126003)(1096002)(5004730100002)(33656002)(586003)(50466002)(3846002)(19580395003)(81166005)(77096005)(230700001)(4001350100001)(23756003)(2906002)(19580405001)(110136002)(189998001)(83506001)(2950100001)(15760500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN4PR07MB2130;H:dl.caveonetworks.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?iso-8859-1?Q?1;BN4PR07MB2130;23:TE9l2uHEBb3VkLBlKtpHvfC2qBg7yNkopOVfjYi?= =?iso-8859-1?Q?v5gmLcPg2UmwScqrAcZzsCrK5JCiqK94WBwhLHFO2Qox1qic9R7ac/ZNuJ?= =?iso-8859-1?Q?Ody/MBJRrLx4FcQMRYH9/a0s7xUvXPyCI7ratin4Jc35zDczMFYJKNoiwb?= =?iso-8859-1?Q?hqR9WC7+M37iYb9mabN1x75zdSiCNZ1zI7ITdU5cbc+8GsF/lADDlypX6o?= =?iso-8859-1?Q?pQmLXo5/en/048A/LDuZKZgGp4j9ISS69J/q+j49XDN/Zb1dd02DUtB3CB?= =?iso-8859-1?Q?OwGgC+E4ax9C03GvwqhpBi/pgI699wMVVJNZlFDYU8IcTt0g/ic0UUVI5T?= =?iso-8859-1?Q?8XA1uCyrAAizaku0014l0Wt3mm2TdMUKfX5//U45KN4RzelUi7xM2OyfEA?= =?iso-8859-1?Q?Lf7RnnmFf4jyLWpRlxQlrInO/5S4Ck7ZwbZIrrLnIx6ebro7eKoh40Pap4?= =?iso-8859-1?Q?zv6nrijp/Jniw5qvHYh27eO0wZl4OJT9BjLJ/DD6iPwvnurWYMsuVrh9n7?= =?iso-8859-1?Q?YHHPfOLwnT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TYrwA+N9F5JtpEdxxxCbm4C/2zjTh+vdn1bNgqwHYTBVpNqKqz6liyMI2Lgx/BxvNQeVdsTB77Bzj/Wk69/4PDc1EHhkW88D7VZ28I6ljlqsV6ZdAnFRT SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2016 22:28:29.0972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2130 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2388 Lines: 64 On 04/25/2016 03:16 PM, Wolfram Sang wrote: > On Mon, Apr 25, 2016 at 04:33:32PM +0200, Jan Glauber wrote: >> SMBUS QUICK never worked for the read case, because EINVAL was returned >> for a zero length message. The hardware does not support SMBUS QUICK >> messages so disable the support and remove the zero length check. >> >> Signed-off-by: Jan Glauber > > I see better now and I think we need to drop this patch. It looks like > the driver supports only SMBUS_QUICK_WRITE which can be used for > scanning devices. The driver probably works with 'i2cdetect -q'. This > will regress if I apply the patch. > > It seems it can't do SMBUS_QUICK_READ thus the extra check in the code. > > I2C_FUNC_SMBUS_QUICK should have been split up in READ and WRITE to > support this scenario. > > Are my assumptions correct? I think you may be reading too much into the intent of the code. I don't know that anyone has ever run "i2cdetect -q" on these buses, I know that I haven't. Since I2C is inherently unprobable, we specify the presence of all devices from the device tree passed by system firmware. Runtime scanning for devices is not necessary. That said, it is not a big deal one way or the other with respect to this patch. If someone verifies that "i2cdetect -q" does something sensible, then there is probably no harm in dropping this patch. > > >> --- >> drivers/i2c/busses/i2c-octeon.c | 5 +---- >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c >> index 0f536a1..ad563cf 100644 >> --- a/drivers/i2c/busses/i2c-octeon.c >> +++ b/drivers/i2c/busses/i2c-octeon.c >> @@ -459,9 +459,6 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, >> int i, result, length = *rlength; >> bool final_read = false; >> >> - if (length < 1) >> - return -EINVAL; >> - >> octeon_i2c_data_write(i2c, (target << 1) | 1); >> octeon_i2c_ctl_write(i2c, TWSI_CTL_ENAB); >> >> @@ -597,7 +594,7 @@ static struct i2c_bus_recovery_info octeon_i2c_recovery_info = { >> >> static u32 octeon_i2c_functionality(struct i2c_adapter *adap) >> { >> - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | >> + return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) | >> I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_SMBUS_BLOCK_PROC_CALL; >> } >> >> -- >> 1.9.1 >>