Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5859757ioo; Wed, 1 Jun 2022 14:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPjDoi8AJCcSKL1Xa2A1KooYOQ6xta5h0p7OlQDdA0rab/gw8v4jSF2vk/dikOmQbHWx8K X-Received: by 2002:a17:902:ccc9:b0:15b:c265:b7a0 with SMTP id z9-20020a170902ccc900b0015bc265b7a0mr1341744ple.107.1654118265795; Wed, 01 Jun 2022 14:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654118265; cv=none; d=google.com; s=arc-20160816; b=XmwVLmlfrk9OLSBg3smfrgs8RyQFVFTdX/OV9prs9vZUe6OPXdoWrG/THkEKNiT4yh Yj7FlltihpQ9c9BP7vxfqS7lmfvVxGuyMaqAwHeWVvq+CfMc4PTFDpnX0bPP0a6SFdID hblW8zqjplpCuHZKwWvIUhRCsGtXBzi8D29mMsyZqo7XTvJOcQM9bL1gjbk9IHvulCRm RAtzp5b99KHTpLbtPNYYNSI+bIEEng3OzLAFCXBnfCrpA4PkzZoEsL59VCQqsSOAkfIZ /rgf2XHWOv9oflpVOVr6mfYv1CRMrwaTHu5DQtw2SDdo7v/7Vqa487M4viFbhf3Y8N5o N4lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lpEPg/+bJzAIFhHoB1CcmfTndxeweAdcThja7v9H3Xc=; b=ASVNF/xOHEpv78sqj7Kf6EC4djXWlaXjACMjxw792d2J95rVWzWDwIhBWJLxVv4Fpx VWIOofz5x/FBZZUGXq+42m1fSfDIaM1xm0iPN27qacpu2qucnooS0gkq8//iVaSYKHil XNDwq+O1NBKQMvl0hLZ4P/CKvUksyUsIcWm/J0zV0nqJn9217+SSQpDZldfBKdANZuHG YU1McyLZ0IOvfkJ3fRFrPSVMkrW6kqdABUminXRk0Z5P6J6iPs0HB0p1SPLyDOSzdXX3 rwcHj6TybN5Uj4oNW5Fnki0vEDs3NXmMDTDETtl2aMo18LD7KIKWAcmUcc+WAmq+bj0o 62Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RAk5kWpQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j6-20020a654306000000b003fa5e1daaa7si3495218pgq.197.2022.06.01.14.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:17:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RAk5kWpQ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BB9C62E4C85; Wed, 1 Jun 2022 13:08:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353319AbiFANsN (ORCPT + 99 others); Wed, 1 Jun 2022 09:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353315AbiFANsL (ORCPT ); Wed, 1 Jun 2022 09:48:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA1A649CA1; Wed, 1 Jun 2022 06:48:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E0078614CE; Wed, 1 Jun 2022 13:48:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F41BC385A5; Wed, 1 Jun 2022 13:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654091289; bh=KiL5BvWqhNPGED68YvrkKSQgsDTtUC2fUGyGtvdLs4s=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=RAk5kWpQLTjo1aXif/PdOu8QT8gRwdT/X5oncbz9tpaM6osET27O46ImbGfIKqU15 G/9Buka6wSPgyAt2YY4KWnu6hv0K6aezFuE/JM1cNl3cMzRG6qA3lCCs3nc/Va3dLf PXqxh8ZpdFLKorRWE27U3TAUvwENNMNja8jIJwkEXtnmgXFikpsBPjIGx9nLxkf1+F A/wS3V7q85b+DjroBJxGvkfXRzaqFSuSDynkF3xcHpFBtJh2QESEad6ER/6qWmV7sX io2Ov2QpJFjCZGr0prunhs5kLS2agnAzKWi4msl1UnItEnxmCOIwuTZjU/fwUdbLfP mhwlrIOKyklYg== Message-ID: <29521c9c-90d3-03b9-cf6f-8519efcd007e@kernel.org> Date: Wed, 1 Jun 2022 08:48:07 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCHv2 1/2] i2c: designware: introduce a custom scl recovery for SoCFPGA platforms Content-Language: en-US To: Andy Shevchenko Cc: jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, robh+dt@kernel.org, krzk+dt@kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20220524135441.420600-1-dinguyen@kernel.org> From: Dinh Nguyen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/24/22 11:43, Andy Shevchenko wrote: > On Tue, May 24, 2022 at 08:54:40AM -0500, Dinh Nguyen wrote: >> The I2C pins on the SoCFPGA platforms do not go through a GPIO module, >> thus cannot be recovered by the default method of by doing a GPIO access. >> Only a reset of the I2C IP block can a recovery be successful. > > Better now, but see my additional comments. > > ... > >> + switch (dev->flags & MODEL_MASK) { >> + case MODEL_SOCFPGA: >> + rinfo->recover_bus = i2c_socfpga_scl_recovery; >> + break; >> + default: >> + rinfo->recover_bus = i2c_generic_scl_recovery; >> + break; >> + } > >> + adap->bus_recovery_info = rinfo; > > Usually we do not assign the pointer while data structure is incomplete. > That's said, please leave this line as it was. > > On top of that, why you can't move the above switch to the place where old > function was assigned? > The reason is the assignment of the recover_bus needs to get done before the call to devm_gpiod_get_optional(), otherwise, the assignment is not taking place because of an error after returning from devm_gpiod_get_optional(). Dinh