Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp692658rwl; Wed, 29 Mar 2023 07:18:45 -0700 (PDT) X-Google-Smtp-Source: AKy350bRilGH1o8lxPMrXjP5HwTmqdSImFCfHuW0VwoAAofjzemgZ1aPoCfOA9i4r1r9PJtWbqo4 X-Received: by 2002:a17:907:a808:b0:93f:fbe:c389 with SMTP id vo8-20020a170907a80800b0093f0fbec389mr16956033ejc.13.1680099525760; Wed, 29 Mar 2023 07:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680099525; cv=none; d=google.com; s=arc-20160816; b=cC7vfYV3z626tqr2b6Ql5Azlh7R2sQM4sCTUcF1vHaQYnrDWZwPCkKRpW7EOkm6c4N bHElEiHUFTKZA3dzCQTpkHgYqJsbZDBSzyi3v3s/BnMUKdkC0rZk6vJX6UOUGmrXhFsP +CfkZWFaReZSDgtYgfEHuEwetnDVl6M4YlpBHU7gB1l5bM+bI+JG11OwEAestMqES5J4 DWInIVrP97DxQlqfS8vq85zAfNGrUdx9yPGhGmUpKmY7cMoyVZvcwd2BRY4+poZNUVi9 4gVeKsNgk+qN+bdEylUPZQ396GgEmC3BB4iJJV15fq4N8NyxwhoDFlzZxl4GKb3SxYJC 0B3Q== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uTUf6BkZngdQ3r9jEyNaGwRa43+k0aO0FJGA7q5oZDk=; b=JKm6OdTBNVeKn80BfU0zi7x+YntQm9pnHCyd+jlkMAP7MqI5dNkk3aZKg2zIWRbagJ /AIDYvH96djXsHP1h0auHmrUFHV2DUUHrjKWvD6qrNaK6fXsfnMevlDl6F6HzK/KX7ru 2aW9stgUGDLPZZAJ11Ix1t1iS7b2/yvCrNeLOkJggTPznsnWUZu9XGud2ji+1rH0l53Y ORwtN4JPXPoyl3lQ2GQMLiFZfl1Ki4osDz3/T/Kf5l48XTj/WPgjtY4f9HWA3oVBdBRU yjTcr1Ue8l4deUCLDqb9ue2nz+UFrA+GupepNof358KRpqiVaxE5esAHWPuB71KCtwp1 krmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BYmOlVRp; 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 un2-20020a170907cb8200b0093defbd628fsi13537288ejc.1046.2023.03.29.07.18.15; Wed, 29 Mar 2023 07:18:45 -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=BYmOlVRp; 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 S230266AbjC2OLP (ORCPT + 99 others); Wed, 29 Mar 2023 10:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjC2OLE (ORCPT ); Wed, 29 Mar 2023 10:11:04 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B125D5253; Wed, 29 Mar 2023 07:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680099028; x=1711635028; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=yRXhs08yuvV+ck05F5xZeaWMZbutT7fFUJzulNNVt3s=; b=BYmOlVRp8DefrIiOa4JSwQKb8CbCdoaetXfsBNhAp1iqO7lBFXFYGV8X p5kbtMpX+7QE8CaEs7x3O6/zr9LHOpOCW31l8wclH0J9aBPu3bcZCGkkv Jlhav9S4khEoDH2R1Ih870fPgPWlWo2LIZHEZjXaM+LsM1ppfWyE1ecQx Gg1ztXeqEzO8unT3pKoCT+EX+OkM7u4z/IMjsIwd6RM/hbauWLdj2OIXY 4YPeYKlVpkfenKJaTeRDDg4IErVsxLeiSx9zm0dWsO1GOXyBQkdCgHey9 HwwBIjiGP8nCpTWSbhNiUw7MVG9fgDNKI9w+Jbz19EZ5EQ963Hew7u6h7 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="321278964" X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208";a="321278964" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 07:08:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10664"; a="714627361" X-IronPort-AV: E=Sophos;i="5.98,301,1673942400"; d="scan'208";a="714627361" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga008.jf.intel.com with ESMTP; 29 Mar 2023 07:08:46 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1phWTk-00A3NS-0O; Wed, 29 Mar 2023 17:08:44 +0300 Date: Wed, 29 Mar 2023 17:08:43 +0300 From: Andy Shevchenko To: "Sahin, Okan" Cc: Nuno =?iso-8859-1?Q?S=E1?= , Mark Brown , Lee Jones , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Jonathan Cameron , Lars-Peter Clausen , Cosmin Tanislav , Stephen Boyd , Caleb Connolly , Lad Prabhakar , "Bolboaca, Ramona" , ChiYuan Huang , "Tilki, Ibrahim" , William Breathitt Gray , Arnd Bergmann , ChiaEn Wu , Haibo Chen , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" Subject: Re: [PATCH v6 5/5] mfd: max77541: Add ADI MAX77541/MAX77540 PMIC Support Message-ID: References: <20230315175257.GJ9667@google.com> <60bbad1b38b8e3c9c3efefb0fb7b8d3cad7fa98c.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Tue, Mar 28, 2023 at 04:01:21PM +0000, Sahin, Okan wrote: > >On Tue, Mar 28, 2023 at 04:51:18PM +0200, Nuno S? wrote: > >> On Tue, 2023-03-28 at 17:35 +0300, Andy Shevchenko wrote: > >> > On Tue, Mar 28, 2023 at 04:18:30PM +0200, Nuno S? wrote: > >> > > On Tue, 2023-03-28 at 14:46 +0100, Mark Brown wrote: > >> > > > On Tue, Mar 28, 2023 at 03:26:44PM +0200, Nuno S? wrote: > >> > > > > >> > > > > IIRC, regmap_read() is not really reentrant and it is used in > >> > > > > the IIO driver on the sysfs interface. So, yeah, I think you > >> > > > > need the regmap lock and better just leave the config as is. > >> > > > > Yes, the lock is > >> > > > > opt- > >> > > > > out > >> > > > > so let's not disable it :) > >> > > > > >> > > > All the regmap operations are fully thread safe. > >> > > > >> > > Even if 'config->disable_locking' is set? I think that is what's > >> > > being discussed in here... > >> > > >> > In case the driver has its own lock to serialize IO how on earth the > >> > regmap lock is needed. That's what I asked the author of the driver. > >> > He told the code > >> > >> Well, if the driver has it's own locking, then sure we do not need > >> regmap's lock... > >> > >> > doesn't require the regmap lock, and I tend to believe the author. > >> > So, why to > >> > keep it? > >> > >> However, if you look at the adc driver, I can see plain regmap_read() > >> calls without any "outside" locking. > > > >Then author of the code should know what they are doing. Right? > Actually, I do not want to disable regmap lock that's why I did not update it. If you have something like func1() regmap_read(reg1) regmap_read/write(reg2) func2() regmap_read/write(regX) // X may or may not be 1 or 2 and func1() and func2() can be run in parallel then the code is racy. Do you have such in your code? -- With Best Regards, Andy Shevchenko