public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Pooja Katiyar <pooja.katiyar@intel.com>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 1/3] usb: typec: ucsi: Add support for message out data structure
Date: Tue, 1 Jul 2025 13:05:06 +0300	[thread overview]
Message-ID: <aGOy0qEUXQ7Rl3Cw@kuha.fi.intel.com> (raw)
In-Reply-To: <de4c73cc-2aaf-4987-a49c-dff2f38ba0f6@oss.qualcomm.com>

On Tue, Jul 01, 2025 at 11:50:21AM +0300, Dmitry Baryshkov wrote:
> On 01/07/2025 11:46, Heikki Krogerus wrote:
> > Hi,
> > 
> > On Sat, Jun 28, 2025 at 04:51:56PM +0200, Greg KH wrote:
> > > 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.
> > 
> > So I think what Pooja was proposing in the first version of this
> > series, where you had a dedicated function for filling the
> > message_out, was better after all.
> > 
> > Pooja, I'm really sorry about this, but can you revert back to that,
> > and send it as v3? Let's start over.
> 
> But that breaks the sync_control logic - currently it is possible to handle
> the command in .sync_control completely. If for any reason we need to
> implement workarounds for commands using MESSAGE_OUT field, we'd have to
> introduce additional logic (which we just got rid of).

Okay. So how about a data structure for the entire mailbox that we can
pass to these functions?

struct ucsi_mailbox {
        u32 cci;
        u64 control;
        void *message_in;
        size_t message_in_size;
        void *message_out;
        size_t message_out_size;
};

thanks,

-- 
heikki

  reply	other threads:[~2025-07-01 10:05 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
2025-07-01  8:46     ` Heikki Krogerus
2025-07-01  8:50       ` Dmitry Baryshkov
2025-07-01 10:05         ` Heikki Krogerus [this message]
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=aGOy0qEUXQ7Rl3Cw@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --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