Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp103799rwa; Fri, 19 Aug 2022 23:30:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Iq2lresqbZdkWVJhevyrn2Y08lyqoFU/FW2Ya5tb1X45ffHg9C75t+V29yfKH+MNYRD/g X-Received: by 2002:a05:6402:524c:b0:43e:aba4:a42d with SMTP id t12-20020a056402524c00b0043eaba4a42dmr8592155edd.328.1660977033821; Fri, 19 Aug 2022 23:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660977033; cv=none; d=google.com; s=arc-20160816; b=v54QwRShuoUYA0Xrc06eCoAUYlKYJJdfemdI6jMsEjaBwbAmEw50jlTg1N+BdRUssM ebNFIKwlUp0sZzGCuW5dlgERO/o+fdp3Km69LJV1pVDCw/cFYL8uXy3d/sTHTs6tzjpi wBnVNH5kvsi35e4gmbEhEBnazBwGRYcjP2K65PsIEF0iMk4PS9Tlh6dfWn/TCshBVTQS cfRRrHpvIxP4hYP3DCmP+KdhUFXgKOWeMi96e6LmlUAKhQPG6sf7J2FaSPIqVF6kMXtH VYnwREzoL4HPX3qQSDB3YeMxB9BGWOQa3Cocpuqr0jPszWhX96T0qktSy7WFpl8leuXY 6sCA== 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:from:in-reply-to :references:mime-version:dkim-signature; bh=O5H3NCo6c2sI896OI2qUmNcKpYKB6FY4w84s2zmB7Rs=; b=zhgdSTPdMZ1mzb+nSzs0WA/5aswyjA7sYE1/poWcGRKpARy8zDaWSBVmT0JkhCLkgM aQvLnsgUxhXLFj1cb6ywp0SeXTYfKLZ6Zi+RnHs91qciMl5mau3cs8NiQYzhu9MIDibO Y3vgLday4jHuZKLREhQyQFouT1/ffzUOT+C7lAXRgU40+QkqgxQ4+URGPGTLV/g91Xhh KLkuiiEF+Qrw1AYKrp+WJ5mQqcllaLaRC2HzI1G27KWiCq1B4mt2MUF24ocpohw4Hx0Z 7tIh8Vm1H5bT05Rxm+21hhqH7K4X8lE4f7KJUcIiIuwXa0OoYN9qE4bHd56XbQXniFt1 jYGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lb0kfgEt; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd10-20020a1709069b8a00b007306064f323si4926234ejc.531.2022.08.19.23.30.07; Fri, 19 Aug 2022 23:30:33 -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=@gmail.com header.s=20210112 header.b=Lb0kfgEt; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244665AbiHTG0U (ORCPT + 99 others); Sat, 20 Aug 2022 02:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiHTG0T (ORCPT ); Sat, 20 Aug 2022 02:26:19 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A807A0620; Fri, 19 Aug 2022 23:26:17 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id e4so4784531qvr.2; Fri, 19 Aug 2022 23:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=O5H3NCo6c2sI896OI2qUmNcKpYKB6FY4w84s2zmB7Rs=; b=Lb0kfgEtqSO3013nnlp+S0yRzBttPC++241BWvhKSn+GXL00V6kt21m4BMWAxRJFK/ cDxGKgn1kNbrHgBlp7x1BBVvR0s9fsAaBbyaFVpTaBzIboUpiM9orInc/pwJhCy7J9H9 aTsOwBuqGsxgLo+E40u6uuTEZLe/QA2DjLDg7YddAsJNccTXKX8WywSiuWwVbQpINz2G Pf8CzGJtgUPL5sluADNfwvg3QrPBepJ4k8uSQJCJ9ktDX1OGqQyvKbPYkGMWdpTCWKvc BlOR/f9Qz0rhCQO1pkBJFI8DjPrpco71I79Nc0frKtRA+FVt50kmQaNiXb6zBipdeVsg RTuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=O5H3NCo6c2sI896OI2qUmNcKpYKB6FY4w84s2zmB7Rs=; b=QMXG+abDdJGtaBioGIchvUdAec3+1A9B5fSnu3ROIgWxkLUB4DJIQUmKVeMEy4Tu37 BZ9J98I/5MOhGfD7lCqF4GfNwTOy+RPqBWTkQu6JQL8nklxfEDbnwbdm8+/oIA+cGG4j BM7gz9QMWpdoA3uPPL2FBSjDvV/9MLfZzAQLS/LPMnpIdPQDdEBUlupimE6rI9UnQDm9 Bm6Bn1zqFx+w0kMRE1ufgEwjKYZhKO+hdbWZ37Ozi4m7vTDk9l4YrbL/5YtFBkRlh6Yj ub8xSQ7/SN3d+/2D/nMTjOjPjuVmphUcKAOdKa2z6CWFyynZSS/XFk/UzkZr5po8oJ9i MvaA== X-Gm-Message-State: ACgBeo32O5X3WV6xwFD5R4eSyPiC2wFLKlaefVmzcQTnAokABGGe4cp6 QiULS6qAWV0u+XxGe48vrA1kHsqz5/dFoCjbFKIuF1sL4WDUGQ== X-Received: by 2002:a05:6214:e69:b0:476:b991:586f with SMTP id jz9-20020a0562140e6900b00476b991586fmr8793340qvb.48.1660976776589; Fri, 19 Aug 2022 23:26:16 -0700 (PDT) MIME-Version: 1.0 References: <3fd11489356b1c73a3d7b4bd9dec7e12c9fe8788.1660934107.git.mazziesaccount@gmail.com> <795d16f2-4dee-7492-4a87-e928020efebe@fi.rohmeurope.com> In-Reply-To: <795d16f2-4dee-7492-4a87-e928020efebe@fi.rohmeurope.com> From: Andy Shevchenko Date: Sat, 20 Aug 2022 09:25:40 +0300 Message-ID: Subject: Re: [PATCH v3 08/14] iio: bmg160_core: Simplify using devm_regulator_*get_enable() To: "Vaittinen, Matti" Cc: Matti Vaittinen , Jonathan Cameron , Lars-Peter Clausen , Miaoqian Lin , Andy Shevchenko , Xiang wangx , linux-iio , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Sat, Aug 20, 2022 at 9:19 AM Vaittinen, Matti wrote: > On 8/20/22 02:30, Andy Shevchenko wrote: > > On Fri, Aug 19, 2022 at 10:21 PM Matti Vaittinen > > wrote: ... > >> struct bmg160_data *data; > >> struct iio_dev *indio_dev; > >> int ret; > >> + static const char * const regulators[] = {"vdd", "vddio"}; > > > > Please, keep this following the "longest line first" rule. Note, in > > This was not following the (IMO slightly silly) rule even prior my > patch. I can for sure move my line up - but that won't give you the > "reverse X-mas tree". What do you mean by this? In the above case the rule does exactly give you "reversed xmas tree order". What did I miss? > I don't have any real objections on changing the styling though - I > don't expect this to be merged before the dependency is in rc1 - so I > guess I will anyways need to respin this for next cycle. I can do the > styling then. Fine with me. > > this case you even can move it out of the function, so we will see > > clearly that this is (not a hidden) global variable. > > Here I do disagree with you. Moving the array out of the function makes > it _much_ less obvious it is not used outside this function. Reason for > making is "static const" is to allow the data be placed in read-only > area (thanks to Guenter who originally gave me this tip). "static" in C language means two things (that's what come to my mind): - for functions this tells that a function is not used outside of the module; - for variables that it is a _global_ variable. Hiding static inside functions is not a good coding practice since it hides scope of the variable. And if you look into the kernel code, I believe the use you are proposing is in minority. -- With Best Regards, Andy Shevchenko