Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp486067pxj; Fri, 7 May 2021 13:10:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwThAvqugLglHj2ZqlTHKt4VMQswmpZcIQhMsN6jy8w0InZgtW8QtC5yjjZE8SZe99qNOFI X-Received: by 2002:a63:120f:: with SMTP id h15mr11819641pgl.217.1620418235048; Fri, 07 May 2021 13:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620418235; cv=none; d=google.com; s=arc-20160816; b=ET2hA/vYxBywGcvoG6ajkJndmhPo25qXo7x29pAkBE+qhX568tf1RSrrrvZu1GvpO0 7aAwfgS16ZarIaYd/+fqqBuEwJX+XJe3KuQgUdFpsjAfAIORFBVRC5vXYowaBBAjnpUp OKlnQCtv5eQLbAMnGEconvr6wnHC4NDrfNCHNZPrMITnM6TLWXs7zvbZrfrYcV/ZdfMD K2EE8qDqoqJGApo90EDUSTjOMpaBSiSDDJHZWSaNSLjfcFV7vy73fohS6gYPLtB/79mP rcohG9B4oN2dQRd+s5jXHsGkCQSzLCA3KNZdgCQe7b0wholVQ7nD5s34RTICdpgaBg0k 692Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=r1kPto3KzlNbAX0lDy+fl0HZN7GLrSQn6mvGXMGR828=; b=iD+dz565RTrN+rvp6yh3VDbMDNbtcUuJDU5YXgXQwVYQVMZ1WPnL5JLnB8kLWSixnL hlrk6w+w7ku+NxuUE72KBb9uyM4ZaghjRvu2WF7gb37DAc4Gv09jlbKewgoPg7G+qy+E /sC/nPLPIMA28ztiGx/a05XNKYWy6uEwi7zB2U8iwjbcxQIECkE49gSlnwrzpzdDMlTd wVyMYwMQnqOAhtlBBy4BzUsbd35Jwmr6/KWFJ5vJAtn6fzRJN/0nanLljCgdLoyd59lr Ds/5pwG4hsJwvaKkkzpN6jnTUDhdXOZwu2GHyDA3FWNXDuTfKp7G0LqStyMZBuk+tKaa yPMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oNy6r+su; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d126si7733536pfc.97.2021.05.07.13.10.22; Fri, 07 May 2021 13:10:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oNy6r+su; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbhEGUKY (ORCPT + 99 others); Fri, 7 May 2021 16:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbhEGUKX (ORCPT ); Fri, 7 May 2021 16:10:23 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39ACBC061574 for ; Fri, 7 May 2021 13:09:22 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id 65-20020a9d03470000b02902808b4aec6dso8943375otv.6 for ; Fri, 07 May 2021 13:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=r1kPto3KzlNbAX0lDy+fl0HZN7GLrSQn6mvGXMGR828=; b=oNy6r+suTKQ6IrZyOFUnSIXNr8ggFi3mCsRTPsy9sJPYKtAWUVzfbztR29TBqVsAxb /G4Ac8umSTo9PlhWtWoYkKZt552l80dDgB7oqf//7tWNlU+1WCu5JTQQsybILeF7Zcsj DrP/vJDQ+kqU47Yv1cEL7MpZRHQmwD8NE6ONE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=r1kPto3KzlNbAX0lDy+fl0HZN7GLrSQn6mvGXMGR828=; b=F5exJ7qHNerv0DWD8vHQfHFm8dcDuokHyiV6+mjAwdw/JWbPTZaKFtY+8XcaXUG/Dk hxCgCyTypIEexB0bdNPq+G9DayyLUAd8srSi8QUy7rDKhVoQXF0jTo+3Bltg/DJm3Dsi P9t1gwT6TwPkwYv/XGRLLA+7uVlQ5PKsLVRVQ/jM5ZBDaeJFOGYVmI0LMRSvTyevFIG8 HJ4uTCkTUqCBsAYr/+vqi4cpA0TgxkgZ6jbsBTYAtGtuEevTk1nYi2A7LNJQ+YQgjEDD VU5OhRAzx3gP6h+Q5luZSSVc9P6cBYLpvHCd6h9oDFTQRy2MQgZOu8BPWK9SW1wLnYpF mUJA== X-Gm-Message-State: AOAM533/PQ4v36BzfPfvFKfqA7YV+TZTLULymyx7jYDzmM2VCo78WPDn Clo5V4Nv5DRaI7xhFX5iLGmz90OdQKT9zGJp+OwE1A== X-Received: by 2002:a9d:1ea9:: with SMTP id n38mr10001438otn.233.1620418161680; Fri, 07 May 2021 13:09:21 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 7 May 2021 13:09:21 -0700 MIME-Version: 1.0 In-Reply-To: References: From: Stephen Boyd User-Agent: alot/0.9.1 Date: Fri, 7 May 2021 13:09:21 -0700 Message-ID: Subject: Re: [PATCH V9] i2c: i2c-qcom-geni: Add shutdown callback for i2c To: rojay@codeaurora.org Cc: wsa@kernel.org, dianders@chromium.org, saiprakash.ranjan@codeaurora.org, gregkh@linuxfoundation.org, mka@chromium.org, skananth@codeaurora.org, msavaliy@qti.qualcomm.com, skakit@codeaurora.org, rnayak@codeaurora.org, agross@kernel.org, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, sumit.semwal@linaro.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting rojay@codeaurora.org (2021-05-07 03:07:42) > On 2021-05-05 07:08, Stephen Boyd wrote: > > Quoting Roja Rani Yarubandi (2021-04-20 04:13:55) > > > In fact, where is that code? I'd expect to see i2c_del_adapter() in > > here > > so we know the adapter can't accept transfers anymore. Maybe > > i2c_del_adapter() could be called, and then there's nothing to do after > > that? This whole patch is trying to rip the adapter out from under the > > i2c core framework, when we should take the opposite approach and > > remove > > it from the core framework so that it can't transfer anything anymore > > and thus the IOMMU can remove the mapping. > > > > IIUC about probe/remove/shutdown calls, during "remove" we will unplug > the > device with opposite calls to "probe's" plug operations. > For example i2c_add_adapter() from 'probe' and i2c_del_adapter() from > 'remove'. > For "shutdown", as system is going to shutdown, there is no need of > unplug > operations to be done. > > And also, I had a glance on other upstream i2c drivers, and noticed > "i2c-i801.c" > driver has i2c_del_adapter() called from remove callback but not from > shutdown > callback. Sure, other drivers could also be broken. > > And actually I tried calling i2c_del_adapter() from geni_i2c_shutdown(), > and it resulted in below WARNING trace > [ 90.320282] Call trace: > [ 90.322807] _regulator_put+0xc4/0xcc > [ 90.326583] regulator_bulk_free+0x48/0x6c > [ 90.330808] devm_regulator_bulk_release+0x20/0x2c > [ 90.335744] release_nodes+0x1d0/0x244 > [ 90.339609] devres_release_all+0x3c/0x54 > [ 90.343735] device_release_driver_internal+0x108/0x194 > [ 90.349109] device_release_driver+0x24/0x30 > [ 90.353510] bus_remove_device+0xd0/0xf4 > [ 90.357548] device_del+0x1a8/0x2f8 > [ 90.361143] device_unregister+0x1c/0x34 > [ 90.365181] __unregister_client+0x78/0x88 > [ 90.369397] device_for_each_child+0x64/0xb4 > [ 90.373797] i2c_del_adapter+0xf0/0x1d4 > [ 90.377745] geni_i2c_shutdown+0x9c/0xc0 > [ 90.381783] platform_drv_shutdown+0x28/0x34 > [ 90.386182] device_shutdown+0x148/0x1f0 > > Can you please suggest me what might be missing here? > It looks like some device that is on the i2c bus is putting a regulator in the remove path without disabling it. Can you print out which device driver it is and fix that driver to call regulator_disable() on the driver remove path? I'll try locally and see if I can find the driver too.