From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3D40EB64D8 for ; Wed, 14 Jun 2023 22:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231864AbjFNWYo (ORCPT ); Wed, 14 Jun 2023 18:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjFNWYo (ORCPT ); Wed, 14 Jun 2023 18:24:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CBBB2119 for ; Wed, 14 Jun 2023 15:24:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E830F60B07 for ; Wed, 14 Jun 2023 22:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7DFFC433C0; Wed, 14 Jun 2023 22:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686781482; bh=qoa+VJi801V2D+8foVYekXDC3VkXd0IGRfPw1DddNTE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kj+kMqI7WC+anIi+xtPWMScaRAf+Jc9bp+RBbzCLQPOcbl7Lw94cxPDbY7pxXtKjD FUzekyAebHJHJumXR6sLMvI0y/NMN408GjbiByHVkZqpZhRcCGuBW3YTOYC24Klw+0 FW3g5GiSxYsmj7Hq1lQJY2eUxni7SvatTpb8qXk2RIb1dGfSw5NuMTnbyOqDRseECb 5UO55cbSWpEMtFmjg7y6QYiduQg/kWSmxmf3g1X/Vcy9xARxJHbqCIAvQVbOaeLcpe apRQcvnoVKodjVtsgzmpBf9W1DcWGsfAF8etV0RqjBqxiJoBKYaqfP76U5IHixLxzN kBYgrTlWv6iPQ== Date: Thu, 15 Jun 2023 00:24:39 +0200 From: Andi Shyti To: Heiner Kallweit Cc: Jean Delvare , "linux-i2c@vger.kernel.org" Subject: Re: [PATCH 1/4] i2c: i801: Use i2c_mark_adapter_suspended/resumed Message-ID: <20230614222439.i7uw3dai3why7bk2@intel.intel> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Hi Heiner, On Sat, Mar 04, 2023 at 10:31:23PM +0100, Heiner Kallweit wrote: > When entering the shutdown/remove/suspend callbacks, at first we should > ensure that transfers are finished and I2C core can't start further > transfers. Use i2c_mark_adapter_suspended() for this purpose. > > Signed-off-by: Heiner Kallweit > --- > drivers/i2c/busses/i2c-i801.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c > index ac5326747..d6a0c3b53 100644 > --- a/drivers/i2c/busses/i2c-i801.c > +++ b/drivers/i2c/busses/i2c-i801.c > @@ -1773,6 +1773,8 @@ static void i801_remove(struct pci_dev *dev) > { > struct i801_priv *priv = pci_get_drvdata(dev); > > + i2c_mark_adapter_suspended(&priv->adapter); > + > outb_p(priv->original_hstcnt, SMBHSTCNT(priv)); > i801_disable_host_notify(priv); > i801_del_mux(priv); > @@ -1796,6 +1798,8 @@ static void i801_shutdown(struct pci_dev *dev) > { > struct i801_priv *priv = pci_get_drvdata(dev); > > + i2c_mark_adapter_suspended(&priv->adapter); > + is this really needed in the shutdown and remove function? I'm OK with it, though. > /* Restore config registers to avoid hard hang on some systems */ > outb_p(priv->original_hstcnt, SMBHSTCNT(priv)); > i801_disable_host_notify(priv); > @@ -1807,6 +1811,7 @@ static int i801_suspend(struct device *dev) > { > struct i801_priv *priv = dev_get_drvdata(dev); > > + i2c_mark_adapter_suspended(&priv->adapter); > outb_p(priv->original_hstcnt, SMBHSTCNT(priv)); > pci_write_config_byte(priv->pci_dev, SMBHSTCFG, priv->original_hstcfg); > return 0; > @@ -1818,6 +1823,7 @@ static int i801_resume(struct device *dev) > > i801_setup_hstcfg(priv); > i801_enable_host_notify(&priv->adapter); > + i2c_mark_adapter_resumed(&priv->adapter); BTW, I see that very few drivers are using suspended and resumed and I wonder why. Should these perhaps be added in the basic pm functions? I'm OK to r-b this, but i want first Jean to give it an ack. Andi