Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp6014111imd; Wed, 31 Oct 2018 05:40:51 -0700 (PDT) X-Google-Smtp-Source: AJdET5e+N8A9k6vzOjshv4wG0cy4A921FG/hhoCuFFf76s3bm/sEA5bCpKQZhSNQMlvGMGabHWSc X-Received: by 2002:a63:af18:: with SMTP id w24mr3018159pge.385.1540989651555; Wed, 31 Oct 2018 05:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540989651; cv=none; d=google.com; s=arc-20160816; b=okeo0jDjIo74fEkpV4YX/qD0mRzADUbyoJvbjpUvE4w/L23mfuJZn0gk3UlOfR0aqp cz1bMD0qLsZ0uCgBL3dyiXf1lO4hmdiccTnYwnMz5q+LypZrC84aH5Au3LW9i3fvYtMT hdoJ7ezr23ENbnlUtqPzePFUQuYKcNwzPkcb++omAkz07bVt+vFEJ+mVg0sS9XP3tpN2 D/etVF3+HpWOItx+bZwdRqnYpdkbJ54IGyftJsklm8OXq+TyzhAoGJazk3v90aeD59rU MOETRs7zg2s/m4C9i1cj6plkJE6i/kBY3xQu/iDjAQMCO07ew2e8WihiljxxS1P2aTSK bzRg== 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=nMvVZWAVIIu2zWcHQ0LhRmMltioQ2g2ES4VdOmjOn9w=; b=yio84odRI8Oa8tQqagbWRYQL5T55RO20irIsooXbbrJLdiECZMHBsZEvA5Q/k+dfZc hNJ7D0yaZKsQCWxg4s9bfzt3haYt3635nZqWCe7totWsp6IIaRYotkq5mxP/LGveg3TA VdecZ5LBeNcA+heaFAY/XQqDa7q0ObSNw1cm/v2zQep6MWmWurirRutYBbTVOHbaSP16 lIrcy/80g/O9vh5pDoqJKGSY/oO7lKF9iO9fSOSE6+oYsLa+Mf4H+SjKyyv6nyUKusSv WovnAA0BehqFZbXglG8W3swPVsha2s6H61z+enUkJfIdBwPRrD2VLuZLeQis2vCXoHr7 ivaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CxbEQTHc; 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 o12-v6si25932634plk.360.2018.10.31.05.40.35; Wed, 31 Oct 2018 05:40:51 -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=CxbEQTHc; 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 S1728974AbeJaViE (ORCPT + 99 others); Wed, 31 Oct 2018 17:38:04 -0400 Received: from mail-ua1-f68.google.com ([209.85.222.68]:43795 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728650AbeJaViE (ORCPT ); Wed, 31 Oct 2018 17:38:04 -0400 Received: by mail-ua1-f68.google.com with SMTP id c89so5813742uac.10 for ; Wed, 31 Oct 2018 05:40:12 -0700 (PDT) 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=nMvVZWAVIIu2zWcHQ0LhRmMltioQ2g2ES4VdOmjOn9w=; b=CxbEQTHcnhXyFblSb1jwc+3NPkVeok3IXEgnSV76l96Grwlmf7GECS0b6GaKVgkMAD UUtKLEr/rukNuTaBqUYJ6p2XPOXR47WL4y2VaXnc+Ktdaj80i8DlTmjfi7JjewkKABSF Gj+4nFRNQnsejCZGnu8HKDG+TwH1XsCw+4xRs= 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=nMvVZWAVIIu2zWcHQ0LhRmMltioQ2g2ES4VdOmjOn9w=; b=tHvwJH2jDf9/Coq3oWASJnSL1iiSfjOqq2zutJhNHGvO+Ss+iZbM1fvJJRm3GCyjQ3 C/FtZSwHLGcAOLn3SpeuXU3T3WKIEpiiqqd4V9AiYSTC/YMFWddGsBFUBahaoXSbQqeS jwZao96M7I5lZOWl8I8n2RhZxjN3aYTBNPNcPco8XPRG6UDXuO1N5cIMTa2QvcCcz7Ac RuIAJVzAIYXbEgySqwBdJrRDx/sko2VMubhGRFH61BV9NPpaBvDyWmlUxfsXxX0gLfj8 wiYTd3xK6amIXKYEVz9TRfY+9CVjaFj/XH3wOddnRxDNsQmhvD8VsxKok+2edKYeqYL4 NzkA== X-Gm-Message-State: AGRZ1gJ+8jjpPN2DX9BuOswkPoga6T+e39lsHkmXfuPNeyZiTd08K217 aEF6gZ1PmCgnMwNayokiY6ZYN1Lgx5gYZUzSRppQjw== X-Received: by 2002:ab0:26cb:: with SMTP id b11mr1196815uap.112.1540989611651; Wed, 31 Oct 2018 05:40:11 -0700 (PDT) MIME-Version: 1.0 References: <1539791563-5959-1-git-send-email-b.zolnierkie@samsung.com> <1539791563-5959-5-git-send-email-b.zolnierkie@samsung.com> In-Reply-To: <1539791563-5959-5-git-send-email-b.zolnierkie@samsung.com> From: Amit Kucheria Date: Wed, 31 Oct 2018 18:10:00 +0530 Message-ID: Subject: Re: [PATCH v2 04/17] thermal: separate sensor registration and enable+check operations To: Bartlomiej Zolnierkiewicz Cc: Zhang Rui , Eduardo Valentin , Eric Anholt , Stefan Wahren , Markus Mayer , bcm-kernel-feedback-list@broadcom.com, Heiko Stuebner , Thierry Reding , Jonathan Hunter , Keerthy , Masahiro Yamada , Jun Nie , Baoyou Xie , Shawn Guo , Linux PM list , LKML 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 > --- a/drivers/hwmon/hwmon.c > +++ b/drivers/hwmon/hwmon.c > @@ -161,6 +161,11 @@ static int hwmon_thermal_add_sensor(struct device *dev, > if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV)) > return PTR_ERR(tzd); > > + if (!IS_ERR(tzd)) { > + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED); > + thermal_zone_device_check(tzd); > + } > + > return 0; > } > #else > diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c > index c52d07c..d423b0f 100644 > --- a/drivers/hwmon/ntc_thermistor.c > +++ b/drivers/hwmon/ntc_thermistor.c > @@ -647,6 +647,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev) > &ntc_of_thermal_ops); > if (IS_ERR(tz)) > dev_dbg(dev, "Failed to register to thermal fw.\n"); > + else { > + thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); > + thermal_zone_device_check(tz); > + } Use the negative check here as above to get rid of the 'else' statement? > return 0; > } > diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c > index 111d521..ad5c5d7 100644 > --- a/drivers/hwmon/scpi-hwmon.c > +++ b/drivers/hwmon/scpi-hwmon.c > @@ -288,6 +288,10 @@ static int scpi_hwmon_probe(struct platform_device *pdev) > */ > if (IS_ERR(z)) > devm_kfree(dev, zone); > + else { > + thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED); > + thermal_zone_device_check(z); > + } Use the negative check here (!IS_ERR(z)) as above to get rid of the 'else' statement? The memory is allocated through devm_kzalloc so it doesn't need to be explicitly freed. > } > > return 0; > diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c > index 04d7147..ff67f72 100644 > --- a/drivers/iio/adc/sun4i-gpadc-iio.c > +++ b/drivers/iio/adc/sun4i-gpadc-iio.c > @@ -659,6 +659,11 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) > PTR_ERR(info->tzd)); > return PTR_ERR(info->tzd); > } > + if (!IS_ERR(info->tzd)) { > + thermal_zone_set_mode(info->tzd, > + THERMAL_DEVICE_ENABLED); > + thermal_zone_device_check(info->tzd); > + } > }