Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1737464pxb; Sat, 15 Jan 2022 22:45:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwguHR9lvYpGChwvIGB53Ggeu9R2+BdWCbckGyiBVJt1Y741v4X5anVTqSVn81XO00AkS/C X-Received: by 2002:a05:6a00:a20:b0:4bb:95f6:93b3 with SMTP id p32-20020a056a000a2000b004bb95f693b3mr15973369pfh.77.1642315549977; Sat, 15 Jan 2022 22:45:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642315549; cv=none; d=google.com; s=arc-20160816; b=roK/b4XkY5/lMYtEI67y4FAh1UMI/1G3tSeLwow2E09ncFuGwg8CtYOddi9G5PvbVT 2/DFiZO9VHL7OZjr9iJS8vpnRYasGNP+wa3N2CtFXL/oinSfp3OwGI/53qX8RnvtaZjk BZGVWwaH+eZeTbfavJW32LBtXeXCcQX67NiJWZQSd+qOPY3+T5Lrb+E2+00adVwQvZMO RKm1y4AgWMqjDo4A94r8MY/HNi/N8cyFPKFEKOn2HciujLkZQJUjp26hrKlcpb9ypn2G uVuk2pOTjW9ABXKl996x5LGf1LxASGm/KLmIg+OFdPlMjekz8GqxHQap9JEYb63qghWk uiug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=uF0JaX4WUpC5IfTOUmZS8L4O70TpuxFLbZ0VyIwF9JA=; b=DNw6+KNFEkM4lfVHV2wjMMnWlFyn07tx/kbvX1TZOBAOp2b9PPzKjIqNeoW1CfgunQ cr32BTBrUk7VT6ljdK6EWMddcFpkRBzC0+wK7eR4zhw3SBiYJnUd+2DlXBLQWyTKAFpa hpDQRMbc4t25MChuUs9yAOXYy5hmj4g+HPPMnaJKPOyKZ9dseC8QmZ9ZFaoEff0V4L07 cYlbrea8P1yM1PIQueuDcV9d4iTV2Xd6xKYVo0360y6vTkxHDPtTYivl6RDxZXunzy// asmKe0nl+Dq2mescUiw2fSS3loNc8wRGEPvuEz3as6Vek5ayW+nc8IdiEK1UYFJGIIEx NbFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv3si9602207pjb.185.2022.01.15.22.45.38; Sat, 15 Jan 2022 22:45:49 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231771AbiAONAy (ORCPT + 99 others); Sat, 15 Jan 2022 08:00:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbiAONAw (ORCPT ); Sat, 15 Jan 2022 08:00:52 -0500 Received: from balrog.mythic-beasts.com (balrog.mythic-beasts.com [IPv6:2a00:1098:0:82:1000:0:2:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FCBC061574; Sat, 15 Jan 2022 05:00:52 -0800 (PST) Received: from [81.101.6.87] (port=35384 helo=jic23-huawei) by balrog.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1n8ifi-000779-8I; Sat, 15 Jan 2022 13:00:46 +0000 Date: Sat, 15 Jan 2022 13:06:26 +0000 From: Jonathan Cameron To: Caleb Connolly Cc: Lars-Peter Clausen , Rob Herring , Andy Gross , Bjorn Andersson , Lee Jones , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, sumit.semwal@linaro.org, amit.pundir@linaro.org, john.stultz@linaro.org Subject: Re: [PATCH v3 1/7] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Message-ID: <20220115130626.2c018335@jic23-huawei> In-Reply-To: <53e76d68-3e47-f221-b5c4-5e29a958c5fc@linaro.org> References: <20220106173131.3279580-1-caleb.connolly@linaro.org> <20220106173131.3279580-2-caleb.connolly@linaro.org> <20220109165743.7e01e226@jic23-huawei> <53e76d68-3e47-f221-b5c4-5e29a958c5fc@linaro.org> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BlackCat-Spam-Score: 19 X-Spam-Status: No, score=1.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Jan 2022 11:46:39 +0000 Caleb Connolly wrote: > On 09/01/2022 16:57, Jonathan Cameron wrote: > > On Thu, 6 Jan 2022 17:31:25 +0000 > > Caleb Connolly wrote: > > > >> Some PMIC functions such as the RRADC need to be aware of the PMIC > >> chip revision information to implement errata or otherwise adjust > >> behaviour, export the PMIC information to enable this. > >> > >> This is specifically required to enable the RRADC to adjust > >> coefficients based on which chip fab the PMIC was produced in, > >> this can vary per unique device and therefore has to be read at > >> runtime. > >> > >> Signed-off-by: Caleb Connolly > > Hi Caleb, > > > > Some comments inline. > Hi Jonathan, > > Thanks for the feedback, I had a question about one of your points below. Miss read on my part. > >> > >> static const struct regmap_config spmi_regmap_config = { > >> @@ -144,22 +122,38 @@ static const struct regmap_config spmi_regmap_config = { > >> static int pmic_spmi_probe(struct spmi_device *sdev) > >> { > >> struct regmap *regmap; > >> + struct qcom_spmi_pmic *pmic; > >> > >> regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config); > >> if (IS_ERR(regmap)) > >> return PTR_ERR(regmap); > >> > >> + pmic = devm_kzalloc(&sdev->dev, sizeof(*pmic), GFP_KERNEL); > >> + if (!pmic) > >> + return -ENOMEM; > > > > Within the code visible here, why can't this just be on the stack? > I allocated on the heap beacuse the data has to be read by other drivers > (it's handed over in spmi_device_set_drvdata() below). I don't have a > whole lot of C experience so please forgive the potentially ignorant > questions - is it ok to allocate on the stack if the object needs to > have a lifetime longer than the function? You are of course correct. I just missed the set_drvdata call when reading this and thought it was just being used for the print! Oops.