public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pooja Katiyar <pooja.katiyar@intel.com>
Cc: linux-usb@vger.kernel.org, heikki.krogerus@linux.intel.com,
	dmitry.baryshkov@oss.qualcomm.com
Subject: Re: [PATCH v2 1/3] usb: typec: ucsi: Add support for message out data structure
Date: Sat, 28 Jun 2025 16:51:56 +0200	[thread overview]
Message-ID: <2025062813-untying-hesitancy-088a@gregkh> (raw)
In-Reply-To: <cc0b7701c4ea3d1001fefeb3df65caeb3e624722.1751042810.git.pooja.katiyar@intel.com>

On Fri, Jun 27, 2025 at 11:10:10AM -0700, Pooja Katiyar wrote:
> Add support for updating message out data structure for UCSI ACPI
> interface for UCSI 2.1 and UCSI 3.0 commands such as Set PDOs and
> LPM Firmware Update.
> 
> Additionally, update ucsi_send_command to accept message_out data
> and .sync_control function to pass message_out data to
> write_message_out function if the command is UCSI_SET_PDOS.

Normally when you say "additionally" that implies that the patch should
be split up into pieces.  Why not do that here?

And do you _really_ need to add a new parameter to all of these
functions?  It's now getting even worse, look at this:

>  		ret = ucsi_send_command(ucsi, val,
>  					&ucsi->debugfs->response,
> -					sizeof(ucsi->debugfs->response));
> +					sizeof(ucsi->debugfs->response), NULL);

You can kind of guess what the parameters mean before the NULL change,
but now you have to go look up "what is the last pointer for"
everywhere.

This feels very fragile and horrible to maintain over time, please
reconsider this type of api change.



>  		break;
>  	default:
>  		ret = -EOPNOTSUPP;
> diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c
> index 8aae80b457d7..93912719d915 100644
> --- a/drivers/usb/typec/ucsi/displayport.c
> +++ b/drivers/usb/typec/ucsi/displayport.c
> @@ -67,7 +67,7 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo)
>  	}
>  
>  	command = UCSI_GET_CURRENT_CAM | UCSI_CONNECTOR_NUMBER(dp->con->num);
> -	ret = ucsi_send_command(ucsi, command, &cur, sizeof(cur));
> +	ret = ucsi_send_command(ucsi, command, &cur, sizeof(cur), NULL);

See, why NULL?  What does it have to do with a command?  And why can't
whatever is in that pointer place be part of that command to start with?

>  int ucsi_sync_control_common(struct ucsi *ucsi, u64 command, u32 *cci,
> -			     void *data, size_t size)
> +			     void *data, size_t size, void *message_out)

So what is the difference between command, cci, data, and message_out?

Again, I think you need to reconsider this...

greg k-h

  parent reply	other threads:[~2025-06-28 14:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 18:10 [PATCH v2 0/3] usb: typec: ucsi: Add support for SET_PDOS command Pooja Katiyar
2025-06-27 18:10 ` [PATCH v2 1/3] usb: typec: ucsi: Add support for message out data structure Pooja Katiyar
2025-06-28  1:40   ` Dmitry Baryshkov
2025-07-01  9:03     ` Heikki Krogerus
2025-06-28 14:51   ` Greg KH [this message]
2025-07-01  8:46     ` Heikki Krogerus
2025-07-01  8:50       ` Dmitry Baryshkov
2025-07-01 10:05         ` Heikki Krogerus
2025-07-01 10:11           ` Dmitry Baryshkov
2025-07-01 12:51             ` Heikki Krogerus
2025-07-03  4:28               ` Katiyar, Pooja
2025-07-03 12:55                 ` Dmitry Baryshkov
2025-06-27 18:10 ` [PATCH v2 2/3] usb: typec: ucsi: Enable debugfs for message_out " Pooja Katiyar
2025-06-28  1:43   ` Dmitry Baryshkov
2025-06-27 18:10 ` [PATCH v2 3/3] usb: typec: ucsi: Add support for SET_PDOS command Pooja Katiyar
2025-06-28  1:43   ` Dmitry Baryshkov

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=2025062813-untying-hesitancy-088a@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pooja.katiyar@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox