Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Abhishek Pandit-Subedi" <abhishekpandit@chromium.org>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Łukasz Bartosik" <ukaszb@chromium.org>,
	"Benson Leung" <bleung@chromium.org>,
	"Jameson Thies" <jthies@google.com>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH v3 1/4] usb: typec: Add attribute file showing the supported USB modes of the port
Date: Fri, 11 Oct 2024 16:59:02 +0300	[thread overview]
Message-ID: <ZwkvJkOZHvvLMxvj@kuha.fi.intel.com> (raw)
In-Reply-To: <2024101155-goes-demote-f6f6@gregkh>

On Fri, Oct 11, 2024 at 03:07:21PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Oct 11, 2024 at 03:43:59PM +0300, Heikki Krogerus wrote:
> > +What:		/sys/class/typec/<port>/usb_capability
> > +Date:		May 2024
> 
> It's a bit past May 2024 :)

Yes. I'm sorry about that.

> > +static ssize_t
> > +usb_capability_show(struct device *dev, struct device_attribute *attr, char *buf)
> > +{
> > +	enum usb_mode mode = to_typec_port(dev)->usb_mode;
> > +	u8 cap = to_typec_port(dev)->cap->usb_capability;
> > +	int len = 0;
> > +	int i;
> > +
> > +	for (i = USB_MODE_USB2; i < USB_MODE_USB4 + 1; i++) {
> > +		if (!(BIT(i - 1) & cap))
> > +			continue;
> > +
> > +		if (i == mode)
> > +			len += sysfs_emit_at(buf, len, "[%s] ", usb_modes[i]);
> > +		else
> > +			len += sysfs_emit_at(buf, len, "%s ", usb_modes[i]);
> > +	}
> > +
> > +	buf[len - 1] = '\n';
> 
> Nit, shouldn't this be another call to sysfs_emit_at()?

Yes.

> > @@ -240,6 +251,7 @@ struct typec_partner_desc {
> >   * @port_type_set: Set port type
> >   * @pd_get: Get available USB Power Delivery Capabilities.
> >   * @pd_set: Set USB Power Delivery Capabilities.
> > + * @default_usb_mode_set: USB Mode to be used by default with Enter_USB Message
> >   */
> >  struct typec_operations {
> >  	int (*try_role)(struct typec_port *port, int role);
> > @@ -250,6 +262,7 @@ struct typec_operations {
> >  			     enum typec_port_type type);
> >  	struct usb_power_delivery **(*pd_get)(struct typec_port *port);
> >  	int (*pd_set)(struct typec_port *port, struct usb_power_delivery *pd);
> > +	int (*default_usb_mode_set)(struct typec_port *port, enum usb_mode mode);
> 
> Naming is hard, but usually it's "noun_verb" so wouldn't this be just
> "mode_set_default"?  We know it's usb :)
> 
> But why default, why not just "mode_set"?  or "set_mode" given you have
> "try_role" here, but then you have "pd_set".  Ick, I don't know, it's
> your code, so your call, nevermind...

I think I'll just change it this back to the way it was in the last
version, and drop "default" from the name.

thanks,

-- 
heikki

  reply	other threads:[~2024-10-11 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 12:43 [PATCH v3 0/4] usb: typec: USB Modes Heikki Krogerus
2024-10-11 12:43 ` [PATCH v3 1/4] usb: typec: Add attribute file showing the supported USB modes of the port Heikki Krogerus
2024-10-11 13:07   ` Greg Kroah-Hartman
2024-10-11 13:59     ` Heikki Krogerus [this message]
2024-10-15  2:38       ` Abhishek Pandit-Subedi
2024-10-15 12:12         ` Heikki Krogerus
2024-10-11 12:44 ` [PATCH v3 2/4] usb: typec: Add attribute file showing the USB Modes of the partner Heikki Krogerus
2024-10-11 13:09   ` Greg Kroah-Hartman
2024-10-11 14:04     ` Heikki Krogerus
2024-10-15  4:07       ` Abhishek Pandit-Subedi
2024-10-15 12:13         ` Heikki Krogerus
2024-10-11 12:44 ` [PATCH v3 3/4] usb: typec: ucsi: Supply the USB capabilities to the ports Heikki Krogerus
2024-10-11 12:44 ` [PATCH v3 4/4] usb: typec: ucsi: Add support for the partner USB Modes Heikki Krogerus
2024-10-11 13:11   ` Greg Kroah-Hartman
2024-10-11 14:04     ` Heikki Krogerus

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=ZwkvJkOZHvvLMxvj@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abhishekpandit@chromium.org \
    --cc=bleung@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jthies@google.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=ukaszb@chromium.org \
    /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