Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1293589iol; Fri, 10 Jun 2022 04:40:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmEyk7X+mC+s8KEWAJqfH46Y1gTRzcmT8CnVg+mqFYng6/rJAd3cDOoxJqFFPXnmDbCVNi X-Received: by 2002:a05:6402:1d51:b0:41f:cf6c:35a5 with SMTP id dz17-20020a0564021d5100b0041fcf6c35a5mr51356212edb.25.1654861218070; Fri, 10 Jun 2022 04:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654861218; cv=none; d=google.com; s=arc-20160816; b=az5SIhpKeUuL72UfP1gIonyL08yw1Jmlr9hPYNQfQtgDkbf1QFdT3Utjxphj2bb/Es 5FisbLUJeLn9Pj+Xm7d2fEEphHr1wzM3B7aecTzkZAGq4rEEn+gqFMOrE0Ts65Ooo+nZ RnQkKN0PZH0ZkEpcGz2o+91vwB75lw23/2FmLTUDI9HVPpf2Q6adMMtlL2hOg9rHe5sG QcemdqcDDLGFzSOvAPV3tqAjvhKXND17OdTxeDAm++qO4WoYCkI1ScF+orD20udv+gIb 1KmBggC4ZowjAtYEqZckchWdYu5bAiM00yki5S6d7sgPxSHBcZb0OreB0cYg5Aeft/tl T04A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cikYKJmOBCCRdBhEDr9ODeXI3oFCn+kyiaEhNLINpcA=; b=f0PUyYJH3mP7WukORSRTbF4ZFoyhxcYQFFRcnRZXliexTgzzS3sz5+YnaSj/mL4Xew BiXXdtzZ0iWa+yhX8vYPGynGPldgAKbcrsgu6+gemZboAt9cejZXxLBSjonhuClaMG+J 9Ah7nj5lIe1aeCE6+Ge/QEx3yBPvfibBbqvF+8xzGgzGLq8aLOR1kPIKXA0qKFNhDDD1 5YVi0TjQn6mCvLK0dReQoJ9DJxHOvUL0w/C/AAANvn5H3bMwKGwmgPuiyXSncTX8EQnJ 7/8bShMLSqpFZRe4DfyP65hx6LFsx1odNmoDy9cx44wYFFPupnvm8VhM7WqNxJhgICi7 fkSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TNnIxDKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo2-20020a170906d04200b006fec70620b2si19918289ejb.16.2022.06.10.04.39.46; Fri, 10 Jun 2022 04:40:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TNnIxDKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245170AbiFJLhZ (ORCPT + 99 others); Fri, 10 Jun 2022 07:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349403AbiFJLgV (ORCPT ); Fri, 10 Jun 2022 07:36:21 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3969B7379F; Fri, 10 Jun 2022 04:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654860980; x=1686396980; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=BaJK94QL2EJ4pVw/Z5IuDzny/xtsePE9Jfqj65UM6Eo=; b=TNnIxDKAY2fRPk7FUz7pvykn8wPdkkZCU8/KhrQgf1jmTOD20DsWXYDJ QPbT6xGpwPlbfxXoquXeyZhTsaZuEGqtcJ/t84XfcZRwxMI6CMRqQzJ6h bmGbNTeu+Tllbg8Pwlc2WnqPbcNOdS9KwwrZdx3IseswwimUKKaryFRyQ wkpSj6IvUo9xzrC69cilxoq5447EpTxNJYvoXgg0J0cOB9PSf/OwoyWLZ 6sS4BsIIk6IV7u5AB7nQW4YjQBkyKr5MQUZ4KlK2cB1tfrGxWGEFKsLnl Vrnhiv/BPZ0gN0isW3dZERjukDHJxB2frZGr5enV88XloyvYjDR3mHSQV A==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="341664632" X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="341664632" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 04:36:19 -0700 X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="724928331" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 04:36:14 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nzcw0-000YjT-06; Fri, 10 Jun 2022 14:36:12 +0300 Date: Fri, 10 Jun 2022 14:36:11 +0300 From: Andy Shevchenko To: Dinh Nguyen 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 Subject: Re: [PATCHv2 1/2] i2c: designware: introduce a custom scl recovery for SoCFPGA platforms Message-ID: References: <20220524135441.420600-1-dinguyen@kernel.org> <29521c9c-90d3-03b9-cf6f-8519efcd007e@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29521c9c-90d3-03b9-cf6f-8519efcd007e@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Wed, Jun 01, 2022 at 08:48:07AM -0500, Dinh Nguyen wrote: > On 5/24/22 11:43, Andy Shevchenko wrote: > > On Tue, May 24, 2022 at 08:54:40AM -0500, Dinh Nguyen wrote: ... > > > + 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(). Update commit message accordingly then. Also consider moving GPIO request part in the code, maybe it will bring better looking / grouped code. Try and see, then choose the best one. -- With Best Regards, Andy Shevchenko