[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2E89032DDAA8B9408CB92943514A0337014C1E2892@SW-EX-MBX01.diasemi.com>
Date: Thu, 22 Mar 2018 10:27:37 +0000
From: Adam Thomson <Adam.Thomson.Opensource@...semi.com>
To: Guenter Roeck <linux@...ck-us.net>,
Adam Thomson <Adam.Thomson.Opensource@...semi.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sre@...nel.org>,
"Hans de Goede" <hdegoede@...hat.com>, Jun Li <jun.li@....com>
CC: "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Support Opensource" <Support.Opensource@...semi.com>
Subject: RE: [PATCH v5 3/5] power: supply: Add 'usb_type' property and
supporting code
On 22 March 2018 04:08, Guenter Roeck wrote:
> > +static ssize_t power_supply_show_usb_type(struct device *dev,
> > + enum power_supply_usb_type
> *usb_types,
> > + ssize_t num_usb_types,
> > + union power_supply_propval *value,
> > + char *buf)
> > +{
> > + enum power_supply_usb_type usb_type;
> > + ssize_t count = 0;
> > + bool match = false;
> > + int i;
> > +
> > + if ((!usb_types) || (num_usb_types <= 0)) {
>
> Unnecessary ( )
Fine, can remove.
>
> > + dev_warn(dev, "driver has no valid connected types\n");
>
> Are those warnings useful or do they just clog the log ? Either case, if that happens,
> wouldn't it be better to detect the situation during registration and abort ?
This is added as an optional property for supply drivers. This will only show
up if a supply driver adds the USB_TYPE property to its list, and then someone
attempts to access it. Actually there's no current checking for the psy_desc
information provided to the register function, so for example if it's NULL then
the kernel will dump when it tries to dereference. I'll take a look at this and
see if I can add something, including checks on the usb_type property.
Powered by blists - more mailing lists