All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Benson Leung <bleung@google.com>,
	Prashant Malani <pmalani@chromium.org>,
	Jameson Thies <jthies@google.com>,
	"Regupathy, Rajaram" <rajaram.regupathy@intel.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Won Chung <wonchung@google.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] usb: typec: Separate USB Power Delivery from USB Type-C
Date: Wed, 27 Apr 2022 09:30:30 +0200	[thread overview]
Message-ID: <YmjxFkpCwxz4fgqb@kroah.com> (raw)
In-Reply-To: <YmjlyxLk8wfziq9l@kuha.fi.intel.com>

On Wed, Apr 27, 2022 at 09:42:19AM +0300, Heikki Krogerus wrote:
> Hi,
> 
> On Tue, Apr 26, 2022 at 02:07:25PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Apr 25, 2022 at 03:49:44PM +0300, Heikki Krogerus wrote:
> > > --- /dev/null
> > > +++ b/drivers/usb/typec/pd.h
> > > @@ -0,0 +1,30 @@
> > > +/* SPDX-License-Identifier: GPL-2.0 */
> > > +
> > > +#ifndef __USB_POWER_DELIVERY__
> > > +#define __USB_POWER_DELIVERY__
> > > +
> > > +#include <linux/kobject.h>
> > 
> > Why kobject.h when:
> 
> Oops, that should now be "#include <linux/device.h>".
> 
> > > +
> > > +struct pd_capabilities {
> > > +	struct device dev;
> > 
> > This is a device?
> > 
> > > +	struct pd *pd;
> > > +	enum typec_role role;
> > > +};
> > > +
> > > +struct pd {
> > > +	struct device		dev;
> > > +	int			id;
> > > +
> > > +	u16			revision; /* 0300H = "3.0" */
> > 
> > So BCD?
> 
> Yes.
> 
> > > +	u16			version;
> > > +};
> > 
> > > +
> > > +#define to_pd_capabilities(o) container_of(o, struct pd_capabilities, dev)
> > > +#define to_pd(o) container_of(o, struct pd, dev)
> > > +
> > > +struct pd *pd_find(const char *name);
> > 
> > "struct pd" is just about the shortest structure name I've seen in the
> > kernel so far.  How about using some more letters?  :)
> 
> Okay, I'll make it usbpd.

How about some more vowels: "struct usb_power_delivery" please.  This
isn't the 1980's :)

> > > +
> > > +int pd_init(void);
> > > +void pd_exit(void);
> > 
> > The kobject question above goes to the code as well.  You are creating a
> > bunch of raw kobjects still, why?  This should all fit into the driver
> > model and kobjects shouldn't be needed.  Are you trying to nest too deep
> > in the attributes?  If so, kobjects will not work as userspace tools
> > will not realize they are there and are attributes at all.
> 
> They are not raw kobjects, they are all devices now. That header just
> needs to be fixed.

You have loads of kobject attributes in the .c file.  Either I read it
wrong, or you are doing something wrong, as that should never be the
case for a driver or device.

thanks,

greg k-h

  reply	other threads:[~2022-04-27  7:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 12:49 [PATCH v3 0/3] usb: typec: Separate USB PD from USB Type-C Heikki Krogerus
2022-04-25 12:49 ` [PATCH v3 1/3] usb: typec: Separate USB Power Delivery " Heikki Krogerus
2022-04-26 12:07   ` Greg Kroah-Hartman
2022-04-27  6:42     ` Heikki Krogerus
2022-04-27  7:30       ` Greg Kroah-Hartman [this message]
2022-04-27  8:17         ` Heikki Krogerus
2022-04-27  8:50           ` Greg Kroah-Hartman
2022-04-27 11:16             ` Heikki Krogerus
2022-04-25 12:49 ` [PATCH v3 2/3] usb: typec: USB Power Deliver helpers for ports and partners Heikki Krogerus
2022-04-25 12:49 ` [PATCH v3 3/3] usb: typec: tcpm: Register USB Power Delivery Capabilities 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=YmjxFkpCwxz4fgqb@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bleung@google.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=pmalani@chromium.org \
    --cc=rajaram.regupathy@intel.com \
    --cc=wonchung@google.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.