[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160525113058.GC27570@kuha.fi.intel.com>
Date: Wed, 25 May 2016 14:30:58 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Felipe Balbi <felipe.balbi@...ux.intel.com>,
Oliver Neukum <oneukum@...e.com>,
Rajaram R <rajaram.officemail@...il.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [RFC PATCHv2] usb: USB Type-C Connector Class
Hi,
On Tue, May 24, 2016 at 06:42:09AM -0700, Guenter Roeck wrote:
> > +struct typec_capability {
> > + enum typec_data_role role;
> > + unsigned int usb_pd:1;
> > + struct typec_altmode *alt_modes;
> > + unsigned int audio_accessory:1;
> > + unsigned int debug_accessory:1;
> > +
> > + int (*fix_role)(struct typec_port *,
> > + enum typec_data_role);
> > +
> > + int (*dr_swap)(struct typec_port *);
> > + int (*pr_swap)(struct typec_port *);
> > + int (*vconn_swap)(struct typec_port *);
> > +
>
> The function parameter in those calls is all but useless to the caller.
> It needs to store the typec_port returned from typec_register(), create a
> list of ports, and then search through this list each time one of the
> functions is called. This is quite expensive for no good reason.
>
> Previously, with typec_port exported, the called code could use the stored
> caps pointer to map to its internal data structures. This is no longer
> possible.
True, the API now is in practice broken.
> I think it would be useful to provide a better means for the called function
> to identify its context. Maybe provide a pointer to the private data in
> the registration function and use it as parameter in the callback functions ?
Sounds reasonable.
Thanks,
--
heikki
Powered by blists - more mailing lists