Re: [PATCH 1/4] PHY: Add .notify() into struct usb_phy

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

 



On Sat, May 19, 2012 at 10:45:34AM -0400, Alan Stern wrote:
> On Sat, 19 May 2012, Greg Kroah-Hartman wrote:
> 
> > On Sat, May 19, 2012 at 10:33:20AM -0400, Alan Stern wrote:
> > > On Fri, 18 May 2012, Greg Kroah-Hartman wrote:
> > > 
> > > > Again, be specific, it looks like you want 2 different callbacks here,
> > > > right?  Then make them:
> > > > 	int	notify_connect(struct usb_phy *phy);
> > > > 	int	notify_disconnect(struct usb_phy *phy);
> > > > that should be all that you need.
> > > 
> > > Actually, it seems likely that this routine will get called whenever a 
> > > connect-change event occurs.  The client may not be immediately aware 
> > > of whether the port is now connected or disconnected; it would be 
> > > simpler to use the same routine in both cases and pass the current port 
> > > status as an argument:
> > > 
> > > 	notify_connect_change(struct usb_phy *phy, int connected);
> > 
> > If the client doesn't know if it connected or not, what will you set the
> > 'connected' variable to?
> 
> The call would be something like this:
> 
> 	if (pstatus & PORT_CSC)
> 		notify_connect_change(phy, pstatus & PORT_CONNECT);
Reasonable. So where can we put this code?

Thanks
Richard
> 
> That seems better than
> 
> 	if (pstatus & PORT_CSC) {
> 		if (pstatus & PORT_CONNECT)
> 			notify_connected(phy);
> 		else
> 			notify_disconnected(phy);
> 	}
> 
> Alan Stern
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux