All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Mychaela N. Falconia" <falcon@freecalypso.org>
Cc: Johan Hovold <johan@kernel.org>,
	linux-usb@vger.kernel.org, mychaela.falconia@gmail.com
Subject: Re: [PATCH 2/3] USB: serial: ftdi_sio: pass port to quirk port_probe functions
Date: Tue, 29 Sep 2020 12:15:16 +0200	[thread overview]
Message-ID: <20200929101516.GR24441@localhost> (raw)
In-Reply-To: <20200916015637.32BAC3740245@freecalypso.org>

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@freecalypso.org>
> ---
>  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

      reply	other threads:[~2020-09-29 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  1:56 [PATCH 2/3] USB: serial: ftdi_sio: pass port to quirk port_probe functions Mychaela N. Falconia
2020-09-29 10:15 ` Johan Hovold [this message]

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=20200929101516.GR24441@localhost \
    --to=johan@kernel.org \
    --cc=falcon@freecalypso.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mychaela.falconia@gmail.com \
    /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.