Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp165818pxu; Thu, 7 Jan 2021 01:19:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzATVR3/+7BJ1zvXFnUEnX2b+CVCnAoDW6kYFeP4exoZoQN8jf51DzY8Je9QyW7swziSQmG X-Received: by 2002:aa7:d2d3:: with SMTP id k19mr998228edr.28.1610011168071; Thu, 07 Jan 2021 01:19:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610011168; cv=none; d=google.com; s=arc-20160816; b=G4SbH5PSw2InrRI9vRz0TcWFJRC1ULkK+x7rwbrhn5adK7kYKNa3OZdr8zCbo0ZsDG RmOl9t9IrA1/95NsmBinGclJ8CMWhgwQNy/Gac9rO35+8r14Gi6yysLWwvq8SDo+RwgE CfONoDG0ysWGwD7i9IkP04do97f2fRlmlsgQ+qSwoyc0UiQ1DaZbVeunxJN9IYO46u8d U879HnTEz4r7sseJTlE6lxbV1jeSwGyaJubXzAkNGpbeHZGO5Dfhuj+5q73RTYhmLYxd DohL1lHoikeb9Ap3FhJBkfFUhs+57JC6aFlLSZm8EMfdL0TCvniT9T2iKDUSmNnFh+DM vxFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=u7Wjxbf5ysC/zSoqr2Fc3hWDiimnZPyU8LcA6kBxBCk=; b=gse6ZRQEhuVMMQCdOkAWvHLCTMV9xV+M8BBt/H/SnjIq9kHswJEyDCWh+Gau6GUS/T 9BKFDTVA5SA3ewiFzRRqhHngtBSv7uM44EwqO/5NXzHPKcn6o+PENKamOTnhyCippjXc KxBevA1h5Er98CcbifhFASjaMUBr+bYEn7d2mbRY2mD9vJWFs/cLryh8gUXV5dbQnxD7 HOwGeO+UAo0dlmF21J/8u9xIRzNRnooTgNCKVEE5mW1GjGMBheGlZZd0gj0a7PoKLpKP jscpdVrfawTsoSLkefiKJs3jAD61b9/v00b2vS0MuuRpu+QB76wBX2CgQyDBw8EWWAjW Tb1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kZi7+ScM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si2130484edq.205.2021.01.07.01.19.04; Thu, 07 Jan 2021 01:19:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kZi7+ScM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbhAGJQ7 (ORCPT + 99 others); Thu, 7 Jan 2021 04:16:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:44378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbhAGJQ6 (ORCPT ); Thu, 7 Jan 2021 04:16:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B09AF2312E; Thu, 7 Jan 2021 09:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610010978; bh=OEOK2cLcu8Rs1Ti+sJvJCut6L+tJsNZ58wiR33kb3B8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kZi7+ScM3q5aj1jeNkMlp04Pg7wVx4ShJ0zoNzuUe1M+3AWWO+LHvjKnfulIwiklW Gl59u+rb8kYcJwepxbaY9OlVmBjdfFcaYqPwxuv68JXXdPhTR7eAy9l5JwSWMaFVBF pfTPuEZ6LU6QJp9JY6u3te9xiwcqOKyTVlqS6wiw= Date: Thu, 7 Jan 2021 10:17:38 +0100 From: Greg KH To: Prashant Malani Cc: linux-usb@vger.kernel.org, Heikki Krogerus , Benson Leung , open list Subject: Re: [PATCH] usb: typec: Send uevent for num_altmodes update Message-ID: References: <20210107034904.4112029-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210107034904.4112029-1-pmalani@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 06, 2021 at 07:49:04PM -0800, Prashant Malani wrote: > Generate a change uevent when the "number_of_alternate_modes" sysfs file > for partners and plugs is updated by a port driver. > > Cc: Heikki Krogerus > Cc: Benson Leung > Signed-off-by: Prashant Malani > --- > drivers/usb/typec/class.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index ebfd3113a9a8..8f77669f9cf4 100644 > --- a/drivers/usb/typec/class.c > +++ b/drivers/usb/typec/class.c > @@ -766,6 +766,7 @@ int typec_partner_set_num_altmodes(struct typec_partner *partner, int num_altmod > return ret; > > sysfs_notify(&partner->dev.kobj, NULL, "number_of_alternate_modes"); > + kobject_uevent(&partner->dev.kobj, KOBJ_CHANGE); Shouldn't the sysfs_notify() handle the "something has changed" logic good enough for userspace, as obviously someone is polling on the thing (otherwise we wouldn't be calling sysfs_notify...) The kobject itself hasn't "changed", but rather an individual attribute has changed. We don't want to create uevents for every individual sysfs attribute changing values, do we? What is preventing a normal "monitor the sysfs file" logic from working here for anyone who wants to know that the alternate modes have changed? thanks, greg k-h