All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-usb@vger.kernel.org,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Benson Leung <bleung@chromium.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: typec: Send uevent for num_altmodes update
Date: Thu, 7 Jan 2021 10:17:38 +0100	[thread overview]
Message-ID: <X/bRstJuBYaLz4PK@kroah.com> (raw)
In-Reply-To: <20210107034904.4112029-1-pmalani@chromium.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 <heikki.krogerus@linux.intel.com>
> Cc: Benson Leung <bleung@chromium.org>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
> ---
>  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

  reply	other threads:[~2021-01-07  9:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07  3:49 [PATCH] usb: typec: Send uevent for num_altmodes update Prashant Malani
2021-01-07  9:17 ` Greg KH [this message]
2021-01-07  9:50   ` Prashant Malani
2021-01-07 10:57     ` Greg KH
2021-01-07 13:21       ` Greg KH
2021-01-09 22:28         ` [RFC] removing explicit #define DEBUG Tom Rix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X/bRstJuBYaLz4PK@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bleung@chromium.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pmalani@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.