Received: by 10.192.165.148 with SMTP id m20csp4792859imm; Tue, 1 May 2018 04:03:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4CgzPxog4+cmyR68FppAYiKput6PIP7vBcE6OQjEadsEjYL5ieuKGblnByjd1IKNLBtq/ X-Received: by 2002:a63:5f05:: with SMTP id t5-v6mr12377401pgb.165.1525172591353; Tue, 01 May 2018 04:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525172591; cv=none; d=google.com; s=arc-20160816; b=ONV4kT5zRCTqJFePBYz2BVccwE57MTUuxcGBcgyoFWGsoBLiCuyPbWSIjvkk2KNr+d 9ExDQWKYCDN+32CyCMjQ0LZxz44jj1+/9Sb08sdbO3WP3vdKqI5FSJxaYfWWFuRgO7Af XPDUsHS7PXVzLtAApekIpExL/UR26KnnlFBLCWiK1a+Xw9bMDNkV2XMs0oV4eQWoZ42l npl8ig/YZDlTTZJbL6fT4yJdCoJtUPbyrzfRMzEPrmTqnUnchcVQ+b5xvQ6ny17zABIX J2t4rMOLNmiJwrH5yZNHhm1d38vOofkVcIy7nv1I+xaG48aRt8mzU30+5XKwA7a8evjs 9T5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=iPpvuXgrlgWqAJgGZX+SQqIFlUkBli0bM6unopNo8b4=; b=mmPgyCCHFKrAwH6GvYvG1Cir8DGTxocQsNA8G6xKGz2Uv7HkmksYy1bNbhY7l7iolU VYiRknn2qaxDoi+vrsSIQHzwQGMlDrr9MMsNEpH0X7mAAfv1OUj5hZAv0gU8feJwNs3k nDltGxFx6xKbFM12xFsZd2xZzUpMyietYJXmZwWEc1r29GfxPgrpfd8jXHQESqZOp7vV /7wrB1pbbJV8vXzhZ3Lokjrf57HSc7eiujUSc3BMpAkNgE8vFw3Tv6/HkRyTxPcATz2K D0ehv9/XhgoA+SLOHZDvRZDtGzProBI/XaPcTQha90H5GMY5gnfmAf3jvq6daDXJsqRq I1hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UMTSeGF/; 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 c30-v6si7831574pgn.56.2018.05.01.04.02.57; Tue, 01 May 2018 04:03:11 -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=UMTSeGF/; 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 S1754571AbeEALCq (ORCPT + 99 others); Tue, 1 May 2018 07:02:46 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:32936 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753700AbeEALCo (ORCPT ); Tue, 1 May 2018 07:02:44 -0400 Received: by mail-wm0-f65.google.com with SMTP id x12so14535561wmc.0 for ; Tue, 01 May 2018 04:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=iPpvuXgrlgWqAJgGZX+SQqIFlUkBli0bM6unopNo8b4=; b=UMTSeGF/RmbbqFB7so5sZZZuBK5D8O/tRi6qord5qhGBPYXBZJIMA1sAorxPKCglPo E9qO+dgcgBoQJ4zEaxhxVifkFjpPEPR7A31oCfUYZMwl3aazYNZIGoR6akpl62TY0FKt zJerDJhvEmZOHoVDZh7rjzO81CcfctpipKbLc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=iPpvuXgrlgWqAJgGZX+SQqIFlUkBli0bM6unopNo8b4=; b=gy3j+nDV/vvcUBSrn2vqB1KQZIrkn5PtofTxYZVF6uj0V5NOt2NXbN6Vec+2590OPP quBnyzBkxztAGkvpp/JeQzsOFrEXDsc97qxksmGZImIqGQXIiOxxutb4RCE0y2OrNxBO oXiwELrGK7UpIgibAVZ8SfQeRqGBr5ldMxfxwdLDO/PrQY9BS4R9//gBjmI9QcPc/PV8 Vc7BxsMjIWLURuUNjXvbQU7IFDzchKhZzjbXpH7UYAM/JBSokonoEDDLO3OyXOapl9Ci HiEgn24nQjX+NWeXAZ2cjLI3OESMpmP/i2CqBKALZvTjQc2jf9ZNhr91x9z9q0gmjoKF 0RWg== X-Gm-Message-State: ALQs6tBOTibPUQ7x8i32j4fMxlyD8JMg/toCKAu6qhq7XsM7gGuY2EmA St8MSIYf7bF6Pu5DXbHUHs5yPg== X-Received: by 10.28.109.90 with SMTP id i87mr1225673wmc.12.1525172562832; Tue, 01 May 2018 04:02:42 -0700 (PDT) Received: from mai ([37.169.202.92]) by smtp.gmail.com with ESMTPSA id t203sm9487926wmt.33.2018.05.01.04.02.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 04:02:42 -0700 (PDT) Date: Tue, 1 May 2018 13:02:39 +0200 From: Daniel Lezcano To: Bartlomiej Zolnierkiewicz Cc: Eduardo Valentin , Zhang Rui , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 16/18] thermal: exynos: cleanup code for enabling threshold interrupts Message-ID: <20180501110239.GM27619@mai> References: <1524743493-28113-1-git-send-email-b.zolnierkie@samsung.com> <1524743493-28113-17-git-send-email-b.zolnierkie@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1524743493-28113-17-git-send-email-b.zolnierkie@samsung.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 26, 2018 at 01:51:31PM +0200, Bartlomiej Zolnierkiewicz wrote: > Cleanup code for enabling threshold interrupts in ->tmu_control > method implementations. > > There should be no functional changes caused by this patch. > > Signed-off-by: Bartlomiej Zolnierkiewicz > --- > drivers/thermal/samsung/exynos_tmu.c | 101 ++++++++++++----------------------- > 1 file changed, 34 insertions(+), 67 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c > index abe0737..9639acf 100644 > --- a/drivers/thermal/samsung/exynos_tmu.c > +++ b/drivers/thermal/samsung/exynos_tmu.c > @@ -76,9 +76,6 @@ > #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 > > #define EXYNOS_TMU_INTEN_RISE0_SHIFT 0 > -#define EXYNOS_TMU_INTEN_RISE1_SHIFT 4 > -#define EXYNOS_TMU_INTEN_RISE2_SHIFT 8 > -#define EXYNOS_TMU_INTEN_RISE3_SHIFT 12 > #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 > > #define EXYNOS_EMUL_TIME 0x57F0 > @@ -136,13 +133,6 @@ > #define EXYNOS7_TMU_TEMP_MASK 0x1ff > #define EXYNOS7_PD_DET_EN_SHIFT 23 > #define EXYNOS7_TMU_INTEN_RISE0_SHIFT 0 > -#define EXYNOS7_TMU_INTEN_RISE1_SHIFT 1 > -#define EXYNOS7_TMU_INTEN_RISE2_SHIFT 2 > -#define EXYNOS7_TMU_INTEN_RISE3_SHIFT 3 > -#define EXYNOS7_TMU_INTEN_RISE4_SHIFT 4 > -#define EXYNOS7_TMU_INTEN_RISE5_SHIFT 5 > -#define EXYNOS7_TMU_INTEN_RISE6_SHIFT 6 > -#define EXYNOS7_TMU_INTEN_RISE7_SHIFT 7 > #define EXYNOS7_EMUL_DATA_SHIFT 7 > #define EXYNOS7_EMUL_DATA_MASK 0x1ff > > @@ -615,29 +605,27 @@ static void exynos4210_tmu_control(struct platform_device *pdev, bool on) > { > struct exynos_tmu_data *data = platform_get_drvdata(pdev); > struct thermal_zone_device *tz = data->tzd; > - unsigned int con, interrupt_en; > + unsigned int con, interrupt_en = 0, i; > > con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); > > if (on) { > - con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); > - interrupt_en = > - (of_thermal_is_trip_valid(tz, 3) > - << EXYNOS_TMU_INTEN_RISE3_SHIFT) | > - (of_thermal_is_trip_valid(tz, 2) > - << EXYNOS_TMU_INTEN_RISE2_SHIFT) | > - (of_thermal_is_trip_valid(tz, 1) > - << EXYNOS_TMU_INTEN_RISE1_SHIFT) | > - (of_thermal_is_trip_valid(tz, 0) > - << EXYNOS_TMU_INTEN_RISE0_SHIFT); > + for (i = 0; i < data->ntrip; i++) { > + if (!of_thermal_is_trip_valid(tz, i)) > + continue; > + > + interrupt_en |= > + (1 << (EXYNOS_TMU_INTEN_RISE0_SHIFT + i * 4)); > + } As EXYNOS_TMU_INTEN_RISE0_SHIFT is equal to zero, may be you can replace this by BITS(i * 4) ? Same comments for exynos5433 and exynos7 below. I don't know which one was intended : ((EXYNOS_TMU_INTEN_RISE0_SHIFT + i) * 4) or (EXYNOS_TMU_INTEN_RISE0_SHIFT + (i * 4)) but if it is the former it is lucky it works because the macro is zero. Is it possible to have the registers layout, that would facilitate the review. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog