Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp12089yba; Thu, 25 Apr 2019 17:04:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/ryJRQ9GqLZSWqsmgHuWyUchfmB23J4jEwiDG5pgjv0j2phALGH9FP1eb/x7jYaoofKMM X-Received: by 2002:a17:902:a706:: with SMTP id w6mr42316126plq.91.1556237072763; Thu, 25 Apr 2019 17:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556237072; cv=none; d=google.com; s=arc-20160816; b=kv5R0loKv62q7CqBejyZiof0eh8nIP02EyjN2Dp0XNYJo/12rsW/Y5u0BGF4Zig7U7 7RG43aHI5mw52VyNS9yUJRw3qYRpTQNSWRpkJF8HHIAf2hmmJI8hcVPX2JcYM67bGLDN mazBw49CF/j40I+gVvc2tHSPtji6lrm0+9qbLH8qekXrliuf9wLmIGBTarsXEjNmtG+P iG07L3YUKM61pmR1bWLyp35OkhbJJnfRFkFKa1efkH02aKC05UqZD5m0NBBKlMFvZ89F nvTfF/cNaF80vWc6aaGWlXgERsBDcQ6H1oijQXHjxB0OLLoRckiOBibXyXisM/jnwKEo p17w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Tt8mNhXexP5cg9uhSRxxyNlGYkAskhLpxbV2LkdxD6Y=; b=nhVS5xU+AM2mRXhTdgoGROVHyNQMeudwG7KPB8xTS1hyM4HJd5KRxOQw7r7tyNyjqm Z+hlZ+paGAxRLqrGkyoMg+4kD8uNRCigpbcF4pMqjyaKZGV4NDDd3Vk0gMX6+/op1Kiz 8wsTRWTR1BjtDZgoWxnA1fYYEv12cJ7XBkdIf+b4hjwUlPUQ78pXEvtVknoMqxrGqcbl x+aA6k7xkr6+XEXxHQ4LesXn6vAkpeaIhXtB2iappryylYsYk56NS7QI15HCFrRJDWbv kpLq4YI/NuLvExrcxitM6K51JUm7SH1RxFOJFX03MSIXe8DUxIefJVfeoS55zkUvTrL6 w6Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sSaG+QmX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id n2si5266029pgp.564.2019.04.25.17.04.18; Thu, 25 Apr 2019 17:04:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sSaG+QmX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2387488AbfDYToF (ORCPT + 99 others); Thu, 25 Apr 2019 15:44:05 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52982 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbfDYToE (ORCPT ); Thu, 25 Apr 2019 15:44:04 -0400 Received: by mail-wm1-f68.google.com with SMTP id j13so727171wmh.2 for ; Thu, 25 Apr 2019 12:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Tt8mNhXexP5cg9uhSRxxyNlGYkAskhLpxbV2LkdxD6Y=; b=sSaG+QmXd+R5NUJEYgAPBcCi/9L6KrZYAMO6Wxet44YSiAA95Y2zEqQTRxEXLRfC90 C6IWDFNP+CgOuQmsdeqGcTN2K5GyXiB/pypQ1gReN5z72cfK++GZN1mnJpeSl/pG4ljQ 3bwxXykXAViZ20dfbg8o1pp4gMja6eXm2+WCyni1jTKbO61t8fKRxH+KYc2AhRiHw/+U SK3cvjdbDN6zT0F4ml5tyuKgVE7NS/Ia2Q04kSaeLzk3sKPpTe20TAyDZfolekf0VqOY 1E7NKDbayBxaKKEckHgd3Z7qvcDk1nVLjyuAnjS7CQqJD4vyEbP1KaKTya5BQVgmXffe +Mzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Tt8mNhXexP5cg9uhSRxxyNlGYkAskhLpxbV2LkdxD6Y=; b=dzknYsL7lEaIEuQCL7ZKgVivPPXJmpwZPGD01UXquulEa2qZ56PSB5riYT9futBcQ5 KpgONhhBR2u5ZKSONLz8WsTH39nieQtU/upQm5iUuwRCy1Xsjti+wcpHSz1Anj4t3TD3 EA8yF9kOlP+ShbxS4lD2IcjkZWx/AADCz/lqPSThf0zKuQi/hUOYsn+vMCE1zCC+j1rn O0DFYT0GkppUDchJyJ/Cx4C+hV7JbsvTmMeaGJTrenQzBxi6I4TkjAYXyrUP2XaG76LU NX4lBfE9K6WxL3Z6WskMygwn1n0eg5VCiVjyJ/j06kwg7efd8D2E0BpLIEmsKOOYHRgK ho6A== X-Gm-Message-State: APjAAAUWhbz3o/S8XCZSLvt6yXfEqlUzdaKs9cH6eobd4Fvp3zbRNt+h j+YTcHJHfNm8OwYpbrHeKhe0gg== X-Received: by 2002:a1c:9691:: with SMTP id y139mr4467449wmd.64.1556221442727; Thu, 25 Apr 2019 12:44:02 -0700 (PDT) Received: from [192.168.1.2] (200.red-83-34-200.dynamicip.rima-tde.net. [83.34.200.200]) by smtp.gmail.com with ESMTPSA id g19sm21039391wmh.17.2019.04.25.12.44.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 12:44:01 -0700 (PDT) Subject: Re: [PATCH 2/3] drivers: regulator: qcom: add PMS405 SPMI regulator To: Mark Brown Cc: lgirdwood@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, bjorn.andersson@linaro.org, vinod.koul@linaro.org, niklas.cassel@linaro.org, khasim.mohammed@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <1548675904-18324-1-git-send-email-jorge.ramirez-ortiz@linaro.org> <1548675904-18324-3-git-send-email-jorge.ramirez-ortiz@linaro.org> <20190204090301.GC23441@sirena.org.uk> <95276ca0-6896-a595-867a-184a518fa31f@linaro.org> <20190425183736.GF23183@sirena.org.uk> From: Jorge Ramirez Message-ID: <022b3c6a-e356-3c5a-3c46-c6edcf4f8cd5@linaro.org> Date: Thu, 25 Apr 2019 21:44:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190425183736.GF23183@sirena.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/25/19 20:37, Mark Brown wrote: > On Fri, Apr 19, 2019 at 07:29:48PM +0200, Jorge Ramirez wrote: >> On 2/4/19 10:03, Mark Brown wrote: > >>>> + /* we know we only have one range for this type */ >>>> + if (vreg->logical_type == SPMI_REGULATOR_LOGICAL_TYPE_HFS430) >>>> + return range; > >>> Rather than have special casing for the logical type in here it seems >>> better to just provide a specific op for this logical type, you could >>> always make _find_range() call into that one if you really want code >>> reuse here. You already have separate ops for this regulator type >>> anyway. > >> sorry I dont quite understand your point. > > If you need to skip the majority of the contents of the function for > some regulators just define a separate function for those regulators and > give them different ops structures rather than using the same ops > structure and handling it in the functions. sure this is 101 as a general rule: but this is not applicable to the situation that I described in my original note, so I dont think you read my points. > >> But also I am not sure I see the benefits with respect to the proposed >> change... > > The benefit is that the selection of which operations to use is done in > only one place (the selection of the ops structure) rather than in > multiple places (the selection of the ops structure and the contents of > the operations). all right, how do you propose that we handle spmi_regulator_select_voltage_same_range() then? the way I see it, if I follow your suggestion and since we are not allowed to extend spmi_regulator_find_range(), the only options are: 1) duplicate verbatim this whole function (spmi_regulator_select_voltage_same_range) with a minor change (this amount of code duplication in the kernel seems rather unnecessary to me) 2) modify the struct spmi_regulator definition with a new operation that calls a different implementation of find range (seems a massive overkill) because both seem wrong to me, can you confirm that you are ok with one of those two options? or if not give an alternative? But I still would like to understand why you think it is wrong extending spmi_regulator_find_range() to support HFS430. Are you saying that this function should not exist for this regulator? Sure the HFS430 doesnt use the register SPMI_COMMON_REG_VOLTAGE_RANGE and therefore doesnt need to use it to find its range....but that doesnt mean that the semantics of spmi_regulator_find_range are invalid. The way I understand your concern, you seem to be assuming that spmi_regulator_find_range means something like spmi_regulator_find_range_from_reg_voltage but that is not the case or if it is maybe it should be renamed.....