Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp583736yba; Wed, 24 Apr 2019 06:25:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwC3qVR68nVGZLlfgbX7VYIBHO6Di02wKt/lt6Dx+VOvSQLsiGKcaNLo7ZYseyCwii90g1x X-Received: by 2002:a17:902:7b8e:: with SMTP id w14mr14480402pll.202.1556112309099; Wed, 24 Apr 2019 06:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556112309; cv=none; d=google.com; s=arc-20160816; b=OVQPcpjsGmONvsriBz0byPMgmcCaV0fAZwYsVRv3F/hQHQ8RVGxcyafxfdU+3uKbkS LFE64XVkRYqfEjW6DIRISBq3QA45c38bZIpN/mNwO9dinsr9htZ4Z/UJl767RFOi2P2C ixmIF9459Og/TX3qJTexVWoumJie26/m6g2THCBbbULKusldAlfzBfqBap7g4Sx9uH/n mPDy/aHcFmjd9o/hniKNA9piX8u3jp9V21S1Jn2tFNJE+RsK/61B7EvE7w9yog0NY9/B i2IoBXNWXUJqseAQ8o7S7V2Cz5NRucf/5gdK152z3gc2nYncYDwGPcsZgT/mDeIKJRHr Jwug== 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=zPRnHJyP7MBAi9zOcZR0+ZD+ek4HtjO6VwtIfrnPTfw=; b=kWiWih2iUQJ4NAZlksThPU7AeEfUoB7oemib8NSXTpEfP4wfL6nQ0wuFJ+tUBSAI16 lSVGWMNrMNcT1CVVje69fDJO2KH8mGhOkM25L/4NlOAJb+MggurvRTAft/TprcOXQDmJ KKBz9H21JyHwQU0oXW6OPz0vf3T+NMOoISeI+flxwKAWX6+eB5NeB57i9C71isiDlXWS 8xiQRI6G3I1HMwcrhVshmN+NPwWcy40IjlZiX1SEom4VxunGCgHvm1hjOKPHrjhuKae4 BBrLSF1gG7q4em7YoQQxXuZ3KQ8Lx6y0ouJHErz/ICMS98QTbiLiYNmzwkMRMQxeOtc6 Sx2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fx5JpxXZ; 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 j11si18634763plk.419.2019.04.24.06.24.53; Wed, 24 Apr 2019 06:25:09 -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=fx5JpxXZ; 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 S1728543AbfDXJbv (ORCPT + 99 others); Wed, 24 Apr 2019 05:31:51 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39130 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbfDXJbu (ORCPT ); Wed, 24 Apr 2019 05:31:50 -0400 Received: by mail-wm1-f67.google.com with SMTP id n25so4013767wmk.4 for ; Wed, 24 Apr 2019 02:31:48 -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=zPRnHJyP7MBAi9zOcZR0+ZD+ek4HtjO6VwtIfrnPTfw=; b=fx5JpxXZTKESXUcytCv2F5A2xeKMFyzC6c1QwdfROnEGMgD2nVWBuEmh79BtaojYws Tw3O+9/yAI5OFJDo4oDBG83RTcfymvuAP2YDYG5V9zd/39PBbiMlg+LV/RJB/ulihKi3 9OfcvWk31VHOL6hb+k6KJAvRSFGACmsO2Nc4V63ffjvrIciCj1PyfmxskkuGlxDhCpkx ifPQRTEQ3gCe3sV4zNhee1isWqGY/RSKes2rakAG+wiiGevhi9/Rpoqt/vTyh7J3yHvL YiAEwBQeigoKGnZYg727n8LWTm/6p//DO02Dxc0QdjsIxkWISQI0r7jqg9oZfZ3gclaf W7Dw== 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=zPRnHJyP7MBAi9zOcZR0+ZD+ek4HtjO6VwtIfrnPTfw=; b=OqyEAIFinyXzTmYtcmnNI0verx0QPyBm/zFI4cLTquecEE1DKZZkiOeHFvWQdABJUW mD3IP3QLQ3tk6ipadMWHx1KARmnAg76WhQUPS6LTAF0RKEpV7y/ZoX1ax4/2zQNN6N0J hYVQXl657yzAztKcpfJ7T6Dl8FIUIMqvQB73RA65NsAbrs0oRWS286xE9f3iE4PIIQXy vgrr3IXgGMbrphPm4qRMltcmUsgn4KO3DqNg96V+jDNw5wzigKnk9PJFt8W7LdDmcNFF oHw/gqiwiBpafbQIEoYvtsAtQrnKpidrp7w+3YDVdwGTgL6tBGYgk79/pz0OQaaGf/zZ Okgg== X-Gm-Message-State: APjAAAWYjxY7AesyyM1LskyILgkZRfjdLxrqo4rrZgfph3doUuCNxiP8 lHu1kEtf99b+tAAXnY6FgLBkfg== X-Received: by 2002:a7b:c769:: with SMTP id x9mr5979658wmk.103.1556098307752; Wed, 24 Apr 2019 02:31:47 -0700 (PDT) Received: from [192.168.0.44] (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.googlemail.com with ESMTPSA id g132sm16149811wme.3.2019.04.24.02.31.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 02:31:47 -0700 (PDT) Subject: Re: [PATCH v4 1/2] thermal: rcar_gen3_thermal: fix interrupt type To: Jiada Wang , rui.zhang@intel.com, edubezval@gmail.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, horms+renesas@verge.net.au, niklas.soderlund+renesas@ragnatech.se, geert+renesas@glider.be, sergei.shtylyov@cogentembedded.com, marek.vasut+renesas@gmail.com, kuninori.morimoto.gx@renesas.com, hien.dang.eb@renesas.com, fabrizio.castro@bp.renesas.com, dien.pham.ry@renesas.com, biju.das@bp.renesas.com, erosca@de.adit-jv.com, george_davis@mentor.com, joshua_frkuska@mentor.com References: <20190424051145.23072-1-jiada_wang@mentor.com> <20190424051145.23072-2-jiada_wang@mentor.com> From: Daniel Lezcano Message-ID: <1bdc45cd-12fb-e607-1ab5-f06a022b263e@linaro.org> Date: Wed, 24 Apr 2019 11:31:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190424051145.23072-2-jiada_wang@mentor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/04/2019 07:11, Jiada Wang wrote: > Currently IRQF_SHARED type interrupt line is allocated, but it > is not appropriate, as the interrupt line isn't shared between > different devices, instead IRQF_ONESHOT is the proper type. > > By changing interrupt type to IRQF_ONESHOT, now irq handler is > no longer needed, as clear of interrupt status can be done in > threaded interrupt context. > > Because IRQF_ONESHOT type interrupt line is kept disabled until > the threaded handler has been run, so there is no need to protect > read/write of REG_GEN3_IRQSTR with lock. > > Fixes: 7d4b269776ec6 ("enable hardware interrupts for trip points") > Signed-off-by: Jiada Wang Suggested-by: Daniel Lezcano Reviewed-by: Daniel Lezcano > --- > drivers/thermal/rcar_gen3_thermal.c | 38 +++++------------------------ > 1 file changed, 6 insertions(+), 32 deletions(-) > > diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c > index 88fa41cf16e8..065e16f53285 100644 > --- a/drivers/thermal/rcar_gen3_thermal.c > +++ b/drivers/thermal/rcar_gen3_thermal.c > @@ -14,7 +14,6 @@ > #include > #include > #include > -#include > #include > #include > > @@ -82,7 +81,6 @@ struct rcar_gen3_thermal_tsc { > struct rcar_gen3_thermal_priv { > struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; > unsigned int num_tscs; > - spinlock_t lock; /* Protect interrupts on and off */ > void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc); > }; > > @@ -232,38 +230,16 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data) > { > struct rcar_gen3_thermal_priv *priv = data; > u32 status; > - int i, ret = IRQ_HANDLED; > + int i; > > - spin_lock(&priv->lock); > for (i = 0; i < priv->num_tscs; i++) { > status = rcar_gen3_thermal_read(priv->tscs[i], REG_GEN3_IRQSTR); > rcar_gen3_thermal_write(priv->tscs[i], REG_GEN3_IRQSTR, 0); > if (status) > - ret = IRQ_WAKE_THREAD; > + thermal_zone_device_update(priv->tscs[i]->zone, > + THERMAL_EVENT_UNSPECIFIED); > } > > - if (ret == IRQ_WAKE_THREAD) > - rcar_thermal_irq_set(priv, false); > - > - spin_unlock(&priv->lock); > - > - return ret; > -} > - > -static irqreturn_t rcar_gen3_thermal_irq_thread(int irq, void *data) > -{ > - struct rcar_gen3_thermal_priv *priv = data; > - unsigned long flags; > - int i; > - > - for (i = 0; i < priv->num_tscs; i++) > - thermal_zone_device_update(priv->tscs[i]->zone, > - THERMAL_EVENT_UNSPECIFIED); > - > - spin_lock_irqsave(&priv->lock, flags); > - rcar_thermal_irq_set(priv, true); > - spin_unlock_irqrestore(&priv->lock, flags); > - > return IRQ_HANDLED; > } > > @@ -371,8 +347,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) > if (soc_device_match(r8a7795es1)) > priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1; > > - spin_lock_init(&priv->lock); > - > platform_set_drvdata(pdev, priv); > > /* > @@ -390,9 +364,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) > if (!irqname) > return -ENOMEM; > > - ret = devm_request_threaded_irq(dev, irq, rcar_gen3_thermal_irq, > - rcar_gen3_thermal_irq_thread, > - IRQF_SHARED, irqname, priv); > + ret = devm_request_threaded_irq(dev, irq, NULL, > + rcar_gen3_thermal_irq, > + IRQF_ONESHOT, irqname, priv); > if (ret) > return ret; > } > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog