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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1295C4338F for ; Thu, 5 Aug 2021 12:19:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76B986113E for ; Thu, 5 Aug 2021 12:19:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233472AbhHEMT1 (ORCPT ); Thu, 5 Aug 2021 08:19:27 -0400 Received: from mga14.intel.com ([192.55.52.115]:18318 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239378AbhHEMT1 (ORCPT ); Thu, 5 Aug 2021 08:19:27 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="213868702" X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="213868702" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 05:19:09 -0700 X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="442377892" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 05:19:07 -0700 Received: by lahna (sSMTP sendmail emulation); Thu, 05 Aug 2021 15:19:05 +0300 Date: Thu, 5 Aug 2021 15:19:05 +0300 From: Mika Westerberg To: Jean Delvare Cc: Heiner Kallweit , linux-i2c@vger.kernel.org Subject: Re: [PATCH 03/10] i2c: i801: Make p2sb_spinlock a mutex Message-ID: References: <7a1581de-7566-15da-d1af-08cbf8c5e46f@gmail.com> <2e727b49-b59b-fad9-6ed3-febc5b98b8d4@gmail.com> <20210805104939.1dd2995a@endymion> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210805104939.1dd2995a@endymion> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On Thu, Aug 05, 2021 at 10:49:39AM +0200, Jean Delvare wrote: > On Sun, 01 Aug 2021 16:18:38 +0200, Heiner Kallweit wrote: > > p2sb_spinlock is used in i801_add_tco_spt() only and in process context > > only. Therefore a mutex is sufficient, and we can make the definition > > local to i801_add_tco_spt(). > > Mika, no objection? No objections from my side :) Reviewed-by: Mika Westerberg > > Signed-off-by: Heiner Kallweit > > --- > > drivers/i2c/busses/i2c-i801.c | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c > > index bdb619bc0..504f02e1e 100644 > > --- a/drivers/i2c/busses/i2c-i801.c > > +++ b/drivers/i2c/busses/i2c-i801.c > > @@ -1492,12 +1492,11 @@ static const struct itco_wdt_platform_data spt_tco_platform_data = { > > .version = 4, > > }; > > > > -static DEFINE_SPINLOCK(p2sb_spinlock); > > - > > static struct platform_device * > > i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, > > struct resource *tco_res) > > { > > + static DEFINE_MUTEX(p2sb_mutex); > > To be on the safe side, we should explicitly #include . > > > struct resource *res; > > unsigned int devfn; > > u64 base64_addr; > > @@ -1510,7 +1509,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, > > * enumerated by the PCI subsystem, so we need to unhide/hide it > > * to lookup the P2SB BAR. > > */ > > - spin_lock(&p2sb_spinlock); > > + mutex_lock(&p2sb_mutex); > > > > devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 1); > > > > @@ -1528,7 +1527,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, > > /* Hide the P2SB device, if it was hidden before */ > > if (hidden) > > pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, hidden); > > - spin_unlock(&p2sb_spinlock); > > + mutex_unlock(&p2sb_mutex); > > > > res = &tco_res[1]; > > if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS) > > Reviewed-by: Jean Delvare > > -- > Jean Delvare > SUSE L3 Support