Re: [PATCH 2/3] USB: serial: ftdi_sio: pass port to quirk port_probe functions

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

 



On Wed, Sep 16, 2020 at 01:56:36AM +0000, Mychaela N. Falconia wrote:
> The original code passed only the pointer to the ftdi_private struct
> to quirk port_probe functions.  However, some quirks may need to be
> applied conditionally only to some channels of a multichannel FT2232x
> or FT4232H device, and if a given quirk's port_probe function needs
> to figure out which channel of a multichannel device is currently
> being considered, it needs access to the port pointer passed to the
> ftdi_sio_port_probe() function, so it can traverse USB data structures
> from there.
> 
> Signed-off-by: Mychaela N. Falconia <falcon@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/serial/ftdi_sio.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
> index 8d89a1650dad..cdf4f4e05fb2 100644
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -88,15 +88,17 @@ struct ftdi_private {
>  struct ftdi_sio_quirk {
>  	int (*probe)(struct usb_serial *);
>  	/* Special settings for probed ports. */
> -	void (*port_probe)(struct ftdi_private *);
> +	void (*port_probe)(struct usb_serial_port *, struct ftdi_private *);
>  };
 
>  static const struct ftdi_sio_quirk ftdi_jtag_quirk = {
>  	.probe	= ftdi_jtag_probe,
> @@ -2253,7 +2255,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
>  	mutex_init(&priv->cfg_lock);
>  
>  	if (quirk && quirk->port_probe)
> -		quirk->port_probe(priv);
> +		quirk->port_probe(port, priv);
>  
>  	usb_set_serial_port_data(port, priv);

I'd prefer setting the port data before calling quirk->port_probe and
just pass in the port structure.

Johan



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

  Powered by Linux