Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2405111ybv; Mon, 24 Feb 2020 04:45:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzL1WmJ51Oymz30zjcuxg4lCKC+ai6g7XRJ/gduBwSRmWGrPKYm5borIAsWjsNqPZZDnJA7 X-Received: by 2002:a9d:4d99:: with SMTP id u25mr26716155otk.216.1582548303753; Mon, 24 Feb 2020 04:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582548303; cv=none; d=google.com; s=arc-20160816; b=tQ+YfmsRTge6KtyNhPP9x+yqL7ynyVGrJ8zwMy5rJ/hjrWkqiPI/V8K/0w1e8e3WZi Ad+Af2U1Ogn+6EbrN3k1jBe87m0Ck8wUXiz7OdpEIyCJbVgHWVb8NfxuILGPRkJ60FkV AM3G1QvOXs++eFB9o0Yl5Q+RO0hUEbWhvK+1SIEgqKR3TA8hRmWLGm8vxLVjS/tWtYDP M2hq9v2RtNim+nEI50zPC6mt50PMyeJVouUdT3Wo/ZmWlyfU+v0Xm1A6DmSAQDCxZddt G8unYYx3m17kLq1kif4aU3mdVd+kTLYbt0TuMya5A+94FPbefbpOcuWTDKKFb57e30lP F1AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=RqVbf+yX/EbyvbniGxwMX8pWWpjIuygOZP3gXQQJI6A=; b=nnURrw87MAG2HyjuasWE1GPJCnqeal0x1nQ82dSYPr9x3K77/+X63gQPt2Ia2aAIKR OVT8BoeBMwp1kUtn491ekuF1J4puW8jNF4cRZbhcbmcVVCe/NHz1KC0c3qKrFpZ1Rt+5 zEsqJq+VkxkC8syPY3qEftD1hapxhXgpt13SiRig29jxZoyxCthDYwvjlI86kPp7cSWf EDtKgYtbwNmPp5Fj+AAZQ0cNwwtTsV0Xxh5t/6RNPPPFDaGdyyztSyTiv+KZdW0CCTHk RXGJ+J9gk4t95mrkk+LY6LM4kyn3tBKIBjerQTPpx6ingXwAFaAWFF2kEF7+mu12U6fG SRcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z+j2VuAg; 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 q131si5006560oig.203.2020.02.24.04.44.49; Mon, 24 Feb 2020 04:45:03 -0800 (PST) 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=Z+j2VuAg; 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 S1727378AbgBXMoQ (ORCPT + 99 others); Mon, 24 Feb 2020 07:44:16 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39132 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbgBXMoQ (ORCPT ); Mon, 24 Feb 2020 07:44:16 -0500 Received: by mail-lf1-f65.google.com with SMTP id n30so5902484lfh.6 for ; Mon, 24 Feb 2020 04:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RqVbf+yX/EbyvbniGxwMX8pWWpjIuygOZP3gXQQJI6A=; b=Z+j2VuAgzOlGqCmnW0/EjPQxScny4nAUkCwxEWWYOzl7DpD41nUrZt7FioRvJuLp02 V0GhSfEHSso6sGY6K1Fq5QsljoxjTyoGX0/X1rzWZJREXO6SXttbIcpbLSJEZyxQtizz UW4UVfMNZNXUf1P5u/lL+WxC5ZJ1A28h/jSbuIGGnVafqIbg0+6K7Lky1CzxZWbHkZ+H rddz54pHjaWmcLEw0Nutdg1+gMPnzXhRrDa3CNjajUpTyxtJy0kHiB/nFjHLF8RSmqbn frvnAnHYSYICNZgkY6gugFWm7/DgE2aLabr7OZHtbrjH/es3i5W/8KsOtQ01V5jwZNY0 +2Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RqVbf+yX/EbyvbniGxwMX8pWWpjIuygOZP3gXQQJI6A=; b=Kd0XcECOTKOGGMQoOl5GE/CtQihNuHZwmT0nw8mF3qvniBCN8BSk9kHwKYVfXjMod0 0Z5gDon+052W4yKkaiBvc6lZfTTeOK5AIjA/Z7bKEnjGrbKbfZFhnHSvAqJJW1AwkX0h v3QhOI2/eS7x/fEu9tDYNEUsxfzdTjutFsB/7c3aDBFQnwln3vFOJC/G6blKhqH4UGaf vxNs2SNojQfV+cwdOdEPE3h3NstVi97uVAiWetuL8vxYtTmNIXRLCR02miZQiAASA18r RueS9DQOy8282naD2tDjNI2uHqplWA7v2ONEqbT9f9yPbL0CWpNaG9sqPr0lvgHm3ELp WiaA== X-Gm-Message-State: APjAAAXy6dYG6TE5VY209vzOtOu9YButKzsp9jiIkXUE5/NPtTnx7hHE kSJDYrn/sfzkvUIf8Mci3ywy7B2QXnUTGCo2xiDClQ== X-Received: by 2002:a19:6d13:: with SMTP id i19mr26465541lfc.6.1582548253189; Mon, 24 Feb 2020 04:44:13 -0800 (PST) MIME-Version: 1.0 References: <4f5a4175371ac7973061cd4f9d19674ac308672c.1582048155.git.amit.kucheria@linaro.org> <158215713699.184098.4863049384855658604@swboyd.mtv.corp.google.com> In-Reply-To: <158215713699.184098.4863049384855658604@swboyd.mtv.corp.google.com> From: Amit Kucheria Date: Mon, 24 Feb 2020 18:14:02 +0530 Message-ID: Subject: Re: [PATCH v5 5/8] drivers: thermal: tsens: Add critical interrupt support To: Stephen Boyd Cc: Andy Gross , Bjorn Andersson , Daniel Lezcano , linux-arm-msm , Linux Kernel Mailing List , sivaa@codeaurora.org, Amit Kucheria , Linux PM list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 20, 2020 at 5:35 AM Stephen Boyd wrote: > > Quoting Amit Kucheria (2020-02-18 10:12:09) > > diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c > > index 0e7cf5236932..5b003d598234 100644 > > --- a/drivers/thermal/qcom/tsens.c > > +++ b/drivers/thermal/qcom/tsens.c > > @@ -125,6 +125,28 @@ static int tsens_register(struct tsens_priv *priv) > > goto err_put_device; > > } > > > > + if (priv->feat->crit_int) { > > + irq_crit = platform_get_irq_byname(pdev, "critical"); > > + if (irq_crit < 0) { > > + ret = irq_crit; > > + /* For old DTs with no IRQ defined */ > > + if (irq_crit == -ENXIO) > > + ret = 0; > > + goto err_crit_int; > > + } > > + ret = devm_request_threaded_irq(&pdev->dev, irq_crit, > > + NULL, tsens_critical_irq_thread, > > + IRQF_ONESHOT, > > + dev_name(&pdev->dev), priv); > > + if (ret) { > > + dev_err(&pdev->dev, "%s: failed to get critical irq\n", __func__); > > + goto err_crit_int; > > + } > > + > > + enable_irq_wake(irq_crit); > > + } > > + > > +err_crit_int: > > Why use a goto? Can't this be done with if-else statements? > > if (priv->feat->crit_int) { > irq_crit = platform_get_irq_byname(pdev, "critical"); > if (irq_crit < 0) { > ... > } else { > ret = devm_request_threaded_irq(&pdev->dev, irq_crit, > NULL, tsens_critical_irq_thread, > IRQF_ONESHOT, > dev_name(&pdev->dev), priv); > if (ret) > dev_err(&pdev->dev, "%s: failed to get critical irq\n", __func__); > else > enable_irq_wake(irq_crit); > } > } > > Or if the nesting is so deep that we need goto labels then perhaps it > needs to be another function. So the if-else form only slightly improved the readability. But moving it to a function made it much better, IMO. So I went with that. Thanks for the review. Regards, Amit > > enable_irq_wake(irq); > > > > err_put_device: