Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3147458ybb; Mon, 6 Apr 2020 03:07:33 -0700 (PDT) X-Google-Smtp-Source: APiQypJ7Q2KIWX88n1LOy9gCiwRlqcRYABOqGNMV1t8Ta6otE7FV8MaDft+YG7dlxx8nIOMTPA1R X-Received: by 2002:aca:bac1:: with SMTP id k184mr12416211oif.157.1586167652949; Mon, 06 Apr 2020 03:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586167652; cv=none; d=google.com; s=arc-20160816; b=pPxUMKfaH3zFnPLBZixFPDlsGwsF550eAD9byKnQqNqb5I0+G95nL1F1mLJA08SRKI byKJWp1ehgQJElv9cB9tw3Yo8n57kNOH7A+PooBir8HJEXaElFzdnFVAISu0S73AgImD jhnpchBtTyyTEn8aMJTRe1tYsQvG2yDBaWvmvVSd/s4OnnTRTS4mvhI4k6qEgXT6qiHb Ck2BGOYXxb+jp6VKeCYvJhtQb1Cn2Km6qHF17aUOXC3f7Eveq/qXIkykhZEKERjNjIE+ lP22+Q0L2KRLV88U/pJ78hGH2XTcbSNjQGmdfbo51fahJiGgUKOlB/dATlmBqubkGXFS GveA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:dkim-signature; bh=udbZg0rfhq5obQgAPCHMOu7MfWPehMKnhUi5G4Oq/kI=; b=M8aqoOp8RybhKGqIP9vcfT6w8o0/yy2t57/p52cHhi4+92Ht83B2yZTV5UDH1H86nu g8RqxqWZ8TvrHLyRohVLD+iojxb12pffbVQrF8c+tvmU9sEnC8nWTNLZjgznOJgTS3sj 7kmu4pm5s68LfViMZ4Z183S/FGpRY5G/ybumjO6H5AEaS/dp15kCeHWUpj5Bpi7G/ZIp mgwnQoiQc3IW3vQmpbHqrHMJcVwaG14Clk0I+JEfYC38gq6PIKdlBK2JHI3nFTpoCCCd S3M5bh13LgkzXW+8XQgbzjDPOCzT13ZqCcsZce6VGxtxrm8YgaSB1cEkYU+tUxi+OwoR FlcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=BeTHKUaX; 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=axis.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si7731169otm.267.2020.04.06.03.07.20; Mon, 06 Apr 2020 03:07:32 -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 (test mode) header.i=@axis.com header.s=axis-central1 header.b=BeTHKUaX; 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=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbgDFKFi (ORCPT + 99 others); Mon, 6 Apr 2020 06:05:38 -0400 Received: from smtp2.axis.com ([195.60.68.18]:30270 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726858AbgDFKFi (ORCPT ); Mon, 6 Apr 2020 06:05:38 -0400 X-Greylist: delayed 430 seconds by postgrey-1.27 at vger.kernel.org; Mon, 06 Apr 2020 06:05:36 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; l=2524; q=dns/txt; s=axis-central1; t=1586167537; x=1617703537; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=udbZg0rfhq5obQgAPCHMOu7MfWPehMKnhUi5G4Oq/kI=; b=BeTHKUaXoo90+CNnosI/Y5nFWqP6R7jSYyr/SMZbHoFlhltHxWIn7Igu CUqBYUZKsjPRdBbadsoCKE69L6icnhjfdMt6km00GXZOetAkaHBPGZMf8 vzWxGXq9Ff+kJ1AZ4z99KSzYKzSGyFsOZL4kGZoaNN5h6XZNYrGsPI8t5 xvS2bF6IRj7gBWt9bI1+ihUv+SMs5lh1RvUR0qNvDhF6Lr6MrZAtvj+Vn CL6+3OzPOxG4WWogNhgYew0wEMAgDfvfO6igysN0ffp0EzCNl6XJAQExm mMwBu67OH5XxVekl4xNRIoEHUQkI+N5Ee2j5xE5Ubmnxx8Bob6Ly25111 A==; IronPort-SDR: 5Z4ylhPBGcYjVrTIdXrBHANuvFnZoUwtw+UfHA7gcaFU6I5aMMaoV/XUyApNtZkeyQMcd9irdw m5a0o3u9icKDD5zzFT+p2piK6VxmaZeDD52Hwxvj7mlHIrIB9zCDmOh/tP7DWeCLc6uzN0Dbc1 P3H9MJgHh5A5pa5heYuGvcgIFVicKpSl6Pt3FwhGmtVQbESMuOO3jvLK4y2F0AZZldzg1JrbSA lag4LfqbcIgzE2xTl/RaqYTZ//qPJ4d5UVT39AkTCoq5ZvHTDE0pNj93g3w5uvzAkalY9hUKzv FD4= X-IronPort-AV: E=Sophos;i="5.72,350,1580770800"; d="scan'208";a="7162607" Date: Mon, 6 Apr 2020 11:58:25 +0200 From: Vincent Whitchurch To: Daniel Lezcano CC: "rui.zhang@intel.com" , "amit.kucheria@verdurent.com" , "open list:THERMAL" , open list Subject: Re: [PATCH] thermal: core: Send a sysfs notification on trip points Message-ID: <20200406095825.a3mrkbjqlih6xa7d@axis.com> References: <20200402142116.22869-1-daniel.lezcano@linaro.org> <20200403144009.szjoss5ecleisg2f@axis.com> <20200406074525.2bhseq3n5bw7dd2t@axis.com> <62f5e0d0-155a-7520-cb1b-2113a2b711b3@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <62f5e0d0-155a-7520-cb1b-2113a2b711b3@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 06, 2020 at 11:45:10AM +0200, Daniel Lezcano wrote: > On 06/04/2020 09:45, Vincent Whitchurch wrote: > > On Fri, Apr 03, 2020 at 05:26:39PM +0200, Daniel Lezcano wrote: > >> On 03/04/2020 16:40, Vincent Whitchurch wrote: > >>> Normally sysfs_notify() is used to notify userspace that the > >>> value of the sysfs file has changed, but in this case it's > >>> being used on a sysfs file whose value never changes. I don't > >>> know if there are other drivers that do something similar. > >> > >> I think so: > >> > >> eg. > >> > >> drivers/hwmon/adt7x10.c: sysfs_notify(&dev->kobj, NULL, > >> "temp1_max_alarm"); drivers/hwmon/adt7x10.c: > >> sysfs_notify(&dev->kobj, NULL, "temp1_min_alarm"); > >> drivers/hwmon/adt7x10.c: sysfs_notify(&dev->kobj, NULL, > >> "temp1_crit_alarm"); > >> > >> drivers/hwmon/abx500.c: sysfs_notify(&data->pdev->dev.kobj, NULL, > >> alarm_node); drivers/hwmon/abx500.c: > >> sysfs_notify(&data->pdev->dev.kobj, NULL, alarm_node); > >> > >> drivers/hwmon/stts751.c: sysfs_notify(&priv->dev->kobj, NULL, > >> "temp1_max_alarm"); drivers/hwmon/stts751.c: > >> sysfs_notify(&priv->dev->kobj, NULL, "temp1_min_alarm"); > >> > >> There are also some other places I believe they are doing the > >> same like: > >> > >> drivers/md/md.c: sysfs_notify(&mddev->kobj, NULL, > >> "sync_completed"); drivers/md/md.c: sysfs_notify(&mddev->kobj, > >> NULL, "degraded"); > > > > AFAICS all these drivers (including the hwmon ones) use > > sysfs_notify() to notify that the value of the sysfs file has > > changed, unlike your proposed patch. > > Sorry, I don't have the same understanding: > > drivers/hwmon/adt7x10.c: > > - receives an interrupt because one of the programmed temperature is > reached > - reads the status to know which one and sends a sysfs notification In the sysfs file implementation, you can see that the value in the sysfs file changes based on the same condition: static ssize_t adt7x10_alarm_show(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); int ret; ret = adt7x10_read_byte(dev, ADT7X10_STATUS); if (ret < 0) return ret; return sprintf(buf, "%d\n", !!(ret & attr->index)); } static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, adt7x10_alarm, ADT7X10_STAT_T_HIGH); It's the same case with the other examples: the sysfs file's value changes. Anyway, as you say it probably doesn't matter as long as it is documented.