Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp886328pxb; Wed, 27 Oct 2021 14:28:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLZU8z9Lbc6fbwIGX08Vy0YhXNcDQnjpi76m2b4Il2Wped1Q6lBBlU4vB/gqv31Hxj0OHX X-Received: by 2002:a50:d802:: with SMTP id o2mr412930edj.331.1635370130044; Wed, 27 Oct 2021 14:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370130; cv=none; d=google.com; s=arc-20160816; b=PJu/x59NvFVIMevtknQnkZOc7R5gqNkss1IzVNflc1/L9KKuXyivKi6pIwtC7Zadmp vN7wcUBXGR+goCWP6mcmd3DuY7jwBNZQF/RTqvOXWK2OEJT+CieVQXYOq9YThj264/ly BxOAOz4OBTJGkxVzAkztFNUYb0xcyDRvO6uJmVR4UuNhVL5uYUHu4t7WGfYaeAWLywM8 UNfOeizJym9I/PpUENv9p1cSvECQBDIf17E2TUCOqvfgpDFNX4Gr5Uwr6HJqPL8pesCZ obwklYFO5kLVM1p7PfU2ji76vmI0Jq5j4NL3FxODXoVD4nDahaQeBeHAYrHssFV1bfpf lHjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UdVaTsodMMYginVrZpW44w/IBiUpOzJWzGs+CDuRvjI=; b=QnW+88hYUeoL5URGGUw6CCJHZ3QblOzhglzitqq4lvfk+CQ9bZRPjL8c1CB7QaW9KI +oPxqmBV9WNnhZPOk1jfwHvScVCtHPggVXgE3Z7rwJDlInmj8bZm7lyWkV06smSWU+Qh mZOvQ6ZOk8thB7OaNvpgRrVUlUwWhXGQ+NKD9ZWqxySPomqcm9x2qrWjXMumZr38ZeRD 6T1eH6GOMe1gdidwu20+H5TG4brUC3ENgYvQkAgeumrcsGaLp1fxtkX6Pn2oHyqkIEOJ LtCNV/n94rk1m2kxqKWjNOulZyasZPST9HqjuDLu1zN+Gp9/W9R8yI0rrst7JKYs0BPM Omvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VkItuuHd; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kz7si1108940ejc.714.2021.10.27.14.28.26; Wed, 27 Oct 2021 14:28:50 -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=@linaro.org header.s=google header.b=VkItuuHd; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231829AbhJ0NrD (ORCPT + 97 others); Wed, 27 Oct 2021 09:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbhJ0NrA (ORCPT ); Wed, 27 Oct 2021 09:47:00 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC42AC061767 for ; Wed, 27 Oct 2021 06:44:34 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id g205-20020a1c20d6000000b0032cc6bbd505so5737454wmg.5 for ; Wed, 27 Oct 2021 06:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=UdVaTsodMMYginVrZpW44w/IBiUpOzJWzGs+CDuRvjI=; b=VkItuuHdr5AVQhI8+5DWjpbWyyEUPBPZOqcspXgcYLbnjsoK95nIWTw3ypTsTpqCOS O5VFsLBzga0QfVk2bPewAKBsD3xKWS8vV0jJomJHsvze3TflcJlxfVBhixanYwpZbURM D750Ag+ueh57X3pVyuBu1Q4rmwJyZC8d+k+ke4CpIFblqxUpCaOp0MfOeAsJENKp8uZ5 nN+OxsbJBwzsnmFT0L8yySw8BW6PfqyvD6Y25/mNWAzp6P7WVrLPBZTxNm6QllBAQ4V1 REH5DrjRHPPgfIzTboARku10z9YINYw2cauESiBpb47tu32+SXppw8O9JbzCmtWDMFQT rUUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=UdVaTsodMMYginVrZpW44w/IBiUpOzJWzGs+CDuRvjI=; b=jVQFa8ElR9l9dEYNxRi4ueK3PeoiPjpfziWaqKsKI+YO3Ttp1Kv+90gkMgkoQfXpzY sjBkq/E0SU8ULPoH6JGywUYa5wpPM21KtG4gsPHa4S6Z/8+thLkMVbfzSXl5WYkkkT6m U9S+8mOiVR74mmb1QjG1Y4KAoEtbLdQifK18BOMBaN24XOYvsPHmSNkk7V5oAPC66qFc PSRnUQDbQ8gq682sTCx/CA8gKJiknE1PiQHbW/qxY6YRu/aS4pZXj/rVa+Z4WWiSaFtY zy6d0TyUBXRRhlH5ihPRQJfggEyP/8FYtBEwUHxThKmMDNOaqA0uflQud3yhFJdpXPBC olCQ== X-Gm-Message-State: AOAM532Nh/Zi5yVHPPLds8vU0l5xy0sdmr4zbLYfGHlWFBEfKxIbpv0W y0XwOCyW5BqnUUMyFrWw/FRFgQ== X-Received: by 2002:a05:600c:40c4:: with SMTP id m4mr811612wmh.164.1635342273172; Wed, 27 Oct 2021 06:44:33 -0700 (PDT) Received: from google.com ([95.148.6.207]) by smtp.gmail.com with ESMTPSA id n10sm1764616wmq.24.2021.10.27.06.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 06:44:32 -0700 (PDT) Date: Wed, 27 Oct 2021 14:44:30 +0100 From: Lee Jones To: Luca Ceresoli Cc: linux-kernel@vger.kernel.org, Rob Herring , Alessandro Zummo , Alexandre Belloni , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Wim Van Sebroeck , Guenter Roeck , devicetree@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, Chiwoong Byun , Laxman Dewangan , Randy Dunlap Subject: Re: [PATCH v2 6/9] mfd: max77714: Add driver for Maxim MAX77714 PMIC Message-ID: References: <20211019145919.7327-1-luca@lucaceresoli.net> <20211019145919.7327-7-luca@lucaceresoli.net> <3520ff3d-1ec0-5500-7fee-538afa25d413@lucaceresoli.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3520ff3d-1ec0-5500-7fee-538afa25d413@lucaceresoli.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 Oct 2021, Luca Ceresoli wrote: > Hi Lee, > > On 21/10/21 20:43, Lee Jones wrote: > > On Tue, 19 Oct 2021, Luca Ceresoli wrote: > [...] > >> diff --git a/drivers/mfd/max77714.c b/drivers/mfd/max77714.c > >> new file mode 100644 > >> index 000000000000..4b49d16fe199 > >> --- /dev/null > >> +++ b/drivers/mfd/max77714.c > >> @@ -0,0 +1,165 @@ > >> +// SPDX-License-Identifier: GPL-2.0-only > >> +/* > >> + * Maxim MAX77714 MFD Driver > >> + * > >> + * Copyright (C) 2021 Luca Ceresoli > >> + * Author: Luca Ceresoli > >> + */ > >> + > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> +#include > >> + > >> +struct max77714 { > >> + struct device *dev; > >> + struct regmap *regmap; > >> + struct regmap_irq_chip_data *irq_data; > > > > Is this used outside of .probe()? > > No. Then you don't need to store it in a struct. [...] > >> + /* Internal Crystal Load Capacitance, indexed by value of 32KLOAD bits */ > >> + static const unsigned int load_cap[4] = {0, 10, 12, 22}; > > > > Probably best to define these magic numbers. > > Since these numbers do not appear anywhere else I don't find added value in: > > #define MAX77714_LOAD_CAP_0 0 > #define MAX77714_LOAD_CAP_10 10 > #define MAX77714_LOAD_CAP_12 12 > #define MAX77714_LOAD_CAP_22 22 > [...] > static const unsigned int load_cap[4] = { > MAX77714_LOAD_CAP_0, > MAX77714_LOAD_CAP_10, > MAX77714_LOAD_CAP_12, > MAX77714_LOAD_CAP_12, > }; I don't find value in that nomenclature either! :) I was suggesting that you used better, more forthcoming names. LOAD_CAPACITANCE_00_pF LOAD_CAPACITANCE_10_pF LOAD_CAPACITANCE_12_pF LOAD_CAPACITANCE_22_pF > besides adding lots of lines and lots of "MAX77714_LOAD_CAP_". Even > worse, there is potential for copy-paste errors -- can you spot it? ;) Yes. Straight away. > Finally, consider this is not even global but local to a small function. > > But I'd rather add the unit ("pF") to either the comment line of the > array name (load_cap -> load_cap_pf) for clarity. Would that be OK for you? I did have to read the code again to get a handle on things (probably not a good sign). To keep things simple, just add "/* pF */" onto the end of the load_cap line for now. That should clear things up at first glance. -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog