Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp579802ybm; Thu, 28 May 2020 09:55:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyacOvUjr1b/0/na0eWbU3XRG44NzVii6CIoPk3J85aEwXEi4VuPO93o1VIE1fd+Swg/p8j X-Received: by 2002:a17:906:eb02:: with SMTP id mb2mr3710648ejb.507.1590684914335; Thu, 28 May 2020 09:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590684914; cv=none; d=google.com; s=arc-20160816; b=n/yimwztzLmGdvVoJnU+BabXv/ceCRB/DOpsOTQNYn4IhoIc22nkE3lP4Paa68n8ah fOkzmRot49IZSQVEGzxQPfyMCHLQqG+scleCHYpc3lkR2sq0HvyvbuoEYA0Nl1gFbcKR ub1IdiHxOSniuCxGSLoYXPr/V5ZdV43s6IgYHjpvWLvXpJ4l20xjaBxu8OYGcPNTss0v fl+teOZYBAiWsf30cbAY8FeG/alBt4ZMpt0BtuQtoTyGzFrOcDqpMRO2/BCeQ3cr+dJb g7XGc6QOitk5DjPIundVlFE5cJGeaBrvHcQ7kps3KSkGMZg8ncekB1iWKZzP0BrYfjHb +kCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=HtAusP7H7FCOmXD0AJPhL0pz3Yk6Y+AVzGbR3KNH1U8=; b=j8cY1vya85fJMoI1cdEAADy7zTgN/9O7GaZ0UR7QTkAF4FiYIcnbXmP5avQiHLxD9l EHRd3PIE89j4gAdVQRi2tcPtgAd54Ml963gOb64R7iui93A0GqDjm6O9zcCW86OF2dWW Xw+EpI68xvbZxDfXW6PPXAY3E/ojMUD1BxetwdOCDAVKpXp5jepNP78abV1/j6AGlaeA zuR2jFfEMK4c4AtvczHzY7kdGCUhYnq9Wx4EYCbroOj5f9+HXq3wrsc5dFs/W7B3qz4+ MbnrGo7kCvcRYqcRqW6/N8nlMgNd2VW46F8mu27zZ6/5dLjyXlanvGenLDKwQ+WJCDYT 8fXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=dQH9ntwh; 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 dj24si1506301edb.266.2020.05.28.09.54.50; Thu, 28 May 2020 09:55:14 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=dQH9ntwh; 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 S2405231AbgE1QuY (ORCPT + 99 others); Thu, 28 May 2020 12:50:24 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:58342 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405212AbgE1QuX (ORCPT ); Thu, 28 May 2020 12:50:23 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1590684622; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=HtAusP7H7FCOmXD0AJPhL0pz3Yk6Y+AVzGbR3KNH1U8=; b=dQH9ntwhZArib7ZVl2bzYE/peCVcDtN9XcQkpIRoku4bQXTSOkhytuymsPL/tIrkqGOHFDad yeqvno0EUUDkzD5nMiGcTFGLvrGsvR4h5X8AIL0BcqNzAP8sNVIOAUKmOvNXyCxaPcl9hY3R sjvExdUFRteQd5FedHFsu3sA3w4= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 5ecfebc44776d1da6da45731 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 28 May 2020 16:50:12 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A06C6C433CA; Thu, 28 May 2020 16:50:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.1.102] (unknown [157.47.99.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jprakash) by smtp.codeaurora.org (Postfix) with ESMTPSA id 54FB0C433C9; Thu, 28 May 2020 16:50:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 54FB0C433C9 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jprakash@codeaurora.org Subject: Re: [PATCH V5 5/5] iio: adc: Clean up ADC code common to PMIC5 and PMIC7 To: Jonathan Cameron Cc: agross@kernel.org, bjorn.andersson@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mka@chromium.org, linus.walleij@linaro.org, Jonathan.Cameron@huawei.com, andy.shevchenko@gmail.com, amit.kucheria@verdurent.com, smohanad@codeaurora.org, kgunda@codeaurora.org, aghayal@codeaurora.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org References: <1590157452-27179-1-git-send-email-jprakash@codeaurora.org> <1590157452-27179-6-git-send-email-jprakash@codeaurora.org> <20200524130440.250edb2e@archlinux> From: Jishnu Prakash Message-ID: <0078a610-fed8-7a18-ecd1-27b8eb5a8feb@codeaurora.org> Date: Thu, 28 May 2020 22:20:02 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200524130440.250edb2e@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonathan, On 5/24/2020 5:34 PM, Jonathan Cameron wrote: > On Fri, 22 May 2020 19:54:12 +0530 > Jishnu Prakash wrote: > >> This commit includes the following changes: >> >> Add a common function used for read_raw callback for both PMIC5 >> and PMIC7 ADCs. >> >> Add exit function for ADC. > Hi Jishnu, > > I don't understand why one is needed, and if it is you can't do > what you have here without introducing some nasty races. > So if you need it clearly explain why in comments in the code > and also consider how it may race with new requests coming in etc > as the userspace interfaces are still visible. > > Move the eoc_irq addition to the structure here as well as makes > no sense in earlier patch. > > Thanks, > > Jonathan > > >> Add info_property under adc_data to more efficiently distinguish >> PMIC5 and PMIC7 ADCs. >> >> Signed-off-by: Jishnu Prakash >> --- >> drivers/iio/adc/qcom-spmi-adc5.c | 81 +++++++++++++++++++++----------------- >> drivers/iio/adc/qcom-vadc-common.h | 1 + >> 2 files changed, 46 insertions(+), 36 deletions(-) >> >> >> +static int adc5_exit(struct platform_device *pdev) >> +{ >> + struct adc5_chip *adc = platform_get_drvdata(pdev); >> + >> + if (adc->irq_eoc >= 0) >> + disable_irq(adc->irq_eoc); > So here you are disabling an irq? Why. We should be removing it > cleanly in the managed flow shortly anyway. If you did do this > here for some reason I'm not thinking of then you would have > a race against the userspace being removed on the unwind > of the iio device register. > >> + return 0; >> +} >> + You're right about the exit function, the actions done in it are not strictly required, so I'll remove it in the next post.