Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7638970rdb; Thu, 4 Jan 2024 03:05:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGI0oXKAihNRiLjz2FiUXfakCPQDnGyOSvaV1bYyScM4XyMT8xpy5Ks4ZkmQ2eBYbFuNp6T X-Received: by 2002:a05:620a:2405:b0:781:2590:721c with SMTP id d5-20020a05620a240500b007812590721cmr327547qkn.58.1704366303140; Thu, 04 Jan 2024 03:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704366303; cv=none; d=google.com; s=arc-20160816; b=UBOd/aqd9MzButcm+o2Uh3mPl5dYBbniDzGfAUsXY0cCWiCeGxx/nQvPWizAyWSD0e XGEfFVVYPb+m6gEGcqiLXj2x/O7d1KX7TNTZ1M97c7V/C6dHlLbemA5192dHRF38/1cb JarC2L5bSf+cI1UZ/5f7m5ECvulA//H44qURVJKGdVILHTvCIRZ5lACBahjBPENARHMG 3+YAlokiy4aQRnWq1smSbxA4TSY1iXHM2idhEFTkkDlW87YzKZ/vKaL/UqYgKF5KAE76 T1IX77guGzCFja7/Op0qIXfbvWUL7XzJ7bmxgoD9T8PFgPb/LIiH9Cv5cHCMC0T6U+ot okrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=88DxGdXvIS9OSK+U/1zt5ZGP9CbZd6le+ieDnWAy0+E=; fh=kSZSpifhwOEwwEIiu760wFQYXIdILBsXdvs+rw9LmKk=; b=Sf35ZbSyAn5fvnYE5ItRfKHTzFQrW/ljWwAdV7hk3avK842l8M65XkfXccrTm5m0eb NVyrGvoYBDDaoNhhpEkBm4OBQtKu1FdCgUeHV48Jw1GxgRhpduyANlrV7r2rYGP6FH6X tLrG0VlmS/NiAkt1VGnS8tc5mj5NTRkAkIji0zFIvGGetkcLbMjSH03IGrg0lpwlyKkf VkwlEjkNePtsw/Nup6ecsuzT7Qov681M6tptsPZaKq0XJMRF7hWgIT9zuoCarBcOx4ro k7vaUUtitIl5iOYqzIHBAX8G8q65hLvbA/ZRJLZclEjR8NXpxbdx4WXjX/jPG5wrzqR8 yl7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MdCVG4B3; spf=pass (google.com: domain of linux-kernel+bounces-16560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16560-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id cx20-20020a05620a51d400b00781bac0c0b3si8885081qkb.396.2024.01.04.03.05.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 03:05:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MdCVG4B3; spf=pass (google.com: domain of linux-kernel+bounces-16560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16560-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 66C571C20984 for ; Thu, 4 Jan 2024 11:05:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6106F210F0; Thu, 4 Jan 2024 11:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MdCVG4B3" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B95C210E1; Thu, 4 Jan 2024 11:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FF52C433C7; Thu, 4 Jan 2024 11:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704366296; bh=iYIXWFcyvfJ4RuPN+ihhCi5AWNrSC9flkhBX8xC/WZQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MdCVG4B32fTqPy/GblbVN4TJxup14rRCQw+QTcbO+paPAjEMmlPodY2duJsiT97C4 5X0Bn8bwccFskbNV8dBFmtfJJ9TZ0nhteO5313s4sXRzYUJYQMmXhRpwNqo+C9wYlY 7lcEcy9aeXaA9uVyhM9bfNls3WLDwI/yolnjR5Zzz86rstkD41MZgPdrsMAGLW/0zN pbvWeLONeDbkqJHAukPSzsO/d12ysOcZxfUrcXEYuN6mVf8lilYbq/NKzw6KbdbsR6 Dd5jAwkfYMUTvzhWOgXNAtRYu8nmKRhSJeenXcQPBMyGgSN/BkeP0fHbLRSwAVkm32 5N5NvzlBICuqQ== Date: Thu, 4 Jan 2024 12:04:51 +0100 From: Andi Shyti To: Elad Nachman Cc: gregory.clement@bootlin.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, cyuval@marvell.com Subject: Re: [PATCH v3 1/1] i2c: busses: i2c-mv64xxx: fix arb-loss i2c lock Message-ID: References: <20231213151312.1165115-1-enachman@marvell.com> <20231213151312.1165115-2-enachman@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231213151312.1165115-2-enachman@marvell.com> Hi Elad, first of all it's very nice to see code so well documented :-) Thanks for the effort you put in it. ... > + /* > + * Start with arbitration lost soft reset enabled as to false. > + * Try to locate the necessary items in the device tree to > + * make this feature work. > + * Only after we verify that the device tree contains all of > + * the needed information and that it is sound and usable, > + * then we enable this flag. > + * This information should be defined, but the driver maintains > + * backward compatibility with old dts files, so it will not fail > + * the probe in case these are missing. > + */ > + drv_data->soft_reset = false; > + pc = pinctrl_get(&pd->dev); I'm not against using devm_pinctrl_get(), in my previous comments I was questioning whether it should be placed in the probe function (as you did). Placed there, iirc, it needed explicit release. Here, I don't think it does if you use the managed version. > + if (!IS_ERR(pc)) { > + drv_data->pc = pc; > + drv_data->i2c_mpp_state = > + pinctrl_lookup_state(pc, "default"); > + drv_data->i2c_gpio_state = > + pinctrl_lookup_state(pc, "gpio"); > + drv_data->scl_gpio = > + of_get_named_gpio(pd->dev.of_node, "scl-gpios", 0); > + drv_data->sda_gpio = > + of_get_named_gpio(pd->dev.of_node, "sda-gpios", 0); please use devm_gpio_get(...). > + if (!IS_ERR(drv_data->i2c_gpio_state) && > + !IS_ERR(drv_data->i2c_mpp_state) && > + gpio_is_valid(drv_data->scl_gpio) && > + gpio_is_valid(drv_data->sda_gpio)) { ... > + if (!IS_ERR(drv_data->pc)) > + pinctrl_put(drv_data->pc); > + if (drv_data->soft_reset) { > + devm_gpiod_put(drv_data->adapter.dev.parent, > + gpio_to_desc(drv_data->scl_gpio)); > + devm_gpiod_put(drv_data->adapter.dev.parent, > + gpio_to_desc(drv_data->sda_gpio)); if it's managed it doesn't need to be explicitely removed. Thanks, Andi