Re: [PATCHv15 2/3] usb: USB Type-C connector class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> writes:
> On Wed, Jan 25, 2017 at 10:39:17AM -0800, Guenter Roeck wrote:
>> On Mon, Jan 23, 2017 at 04:44:23PM +0200, Felipe Balbi wrote:
>> > 
>> > Hi,
>> > 
>> > Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> writes:
>> > > +static void typec_report_identity(struct device *dev)
>> > > +{
>> > > +	sysfs_notify(&dev->kobj, "identity", "id_header");
>> > > +	sysfs_notify(&dev->kobj, "identity", "cert_stat");
>> > > +	sysfs_notify(&dev->kobj, "identity", "product");
>> > 
>> > if you sysfs_notify() all three everytime this might cause issues for
>> > userspace pollers. What will happen is that you're gonna change
>> > e.g. id_header and threads polling id_header, cert_stat and product will
>> > be notified of what's supposed to be new data. Maybe this should know
>> > what it's notifying and only notify what actually changed. Seems like
>> > just passing one extra char * argument is enough:
>> > 
>> > static void typec_report_identity(struct device *dev, const char *prop)
>> > {
>> > 	sysfs_notify(&dev->kobj, "identity", prop);
>> > }
>> > 
>> I must admit that I am kind of lost here. In practice all three values are
>> provided by the PD protocol in a single message, meaning they are all updated
>> at the same time. The result of this code is that I have to call the function
>> three times, each time providing what I think should be a class-internal string
>> as parameter (the low level code should not really be concerned about the
>> sysfs attribute names). What exactly are we gaining from this ?
>
> Felipe, please correct me if I'm wrong, but I believe you just did not
> know that all the values are provided in a single message.

right, that's the reason.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux