RE: [PATCH v6 05/15] usb: typec: add API to get typec basic port power and data config

2018-05-29 Thread Jun Li
Hi
> -Original Message-
> From: kbuild test robot [mailto:l...@intel.com]
> Sent: 2018年5月30日 12:26
> To: Jun Li 
> Cc: kbuild-...@01.org; robh...@kernel.org; gre...@linuxfoundation.org;
> heikki.kroge...@linux.intel.com; li...@roeck-us.net;
> cw00.c...@samsung.com; a.ha...@samsung.com; shufan_...@richtek.com;
> Peter Chen ; garsi...@embeddedor.com;
> gso...@gmail.com; Jun Li ; linux-usb@vger.kernel.org;
> devicet...@vger.kernel.org; dl-linux-imx 
> Subject: Re: [PATCH v6 05/15] usb: typec: add API to get typec basic port 
> power
> and data config
> 
> Hi Li,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on usb/usb-testing] [also build test ERROR on v4.17-rc7
> next-20180529] [cannot apply to staging/staging-testing] [if your patch is
> applied to the wrong git tree, please drop us a note to help improve the
> system]
> 
> url:
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithu
> b.com%2F0day-ci%2Flinux%2Fcommits%2FLi-Jun%2Fstaging-typec-tcpci-move-
> out-of-staging%2F20180530-110011=02%7C01%7Cjun.li%40nxp.com%7
> C56116c50269f48ac2af208d5c5e590b3%7C686ea1d3bc2b4c6fa92cd99c5c301
> 635%7C0%7C0%7C636632515483673101=0DFAYwcBjlLN1SmO%2BvCG
> s1YLoyjLCjlh89TTyHH1TFs%3D=0
> base:
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.ke
> rnel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fgregkh%2Fusb.git=
> 02%7C01%7Cjun.li%40nxp.com%7C56116c50269f48ac2af208d5c5e590b3%7C6
> 86ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636632515483673101
> ata=OJnSzPSGMdKkV9w2wT8a7OjwKIME2g0VGmVxJerIhTc%3D=0
> usb-testing
> config: i386-randconfig-x017-201821 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
> 
> All error/warnings (new ones prefixed by >>):
> 
>In file included from include/linux/linkage.h:7:0,
> from include/linux/kernel.h:7,
> from include/linux/list.h:9,
> from include/linux/kobject.h:19,
> from include/linux/device.h:16,
> from drivers/usb/typec/class.c:9:
> >> drivers/usb/typec/class.c:1274:19: error: 'typec_find_power_type'
> undeclared here (not in a function); did you mean 'typec_find_power_role'?
> EXPORT_SYMBOL_GPL(typec_find_power_type);
>   ^
>include/linux/export.h:65:16: note: in definition of macro
> '___EXPORT_SYMBOL'
>  extern typeof(sym) sym;  \
>^~~
> >> drivers/usb/typec/class.c:1274:1: note: in expansion of macro
> 'EXPORT_SYMBOL_GPL'
> EXPORT_SYMBOL_GPL(typec_find_power_type);
> ^
> >> drivers/usb/typec/class.c:1288:19: error: 'typec_find_preferred_role'
> undeclared here (not in a function); did you mean 'typec_find_power_role'?
> EXPORT_SYMBOL_GPL(typec_find_preferred_role);
>   ^
>include/linux/export.h:65:16: note: in definition of macro
> '___EXPORT_SYMBOL'
>  extern typeof(sym) sym;  \
>^~~
>drivers/usb/typec/class.c:1288:1: note: in expansion of macro
> 'EXPORT_SYMBOL_GPL'
> EXPORT_SYMBOL_GPL(typec_find_preferred_role);
> ^
> >> drivers/usb/typec/class.c:1303:19: error: 'typec_find_data_type' undeclared
> here (not in a function); did you mean 'typec_find_power_type'?
> EXPORT_SYMBOL_GPL(typec_find_data_type);
>   ^
>include/linux/export.h:65:16: note: in definition of macro
> '___EXPORT_SYMBOL'
>  extern typeof(sym) sym;  \
>^~~
>drivers/usb/typec/class.c:1303:1: note: in expansion of macro
> 'EXPORT_SYMBOL_GPL'
> EXPORT_SYMBOL_GPL(typec_find_data_type);
> ^
> 
> vim +1274 drivers/usb/typec/class.c

Will fix all above 3 export symbol mismatch.

Li Jun
> 
>   1260
>   1261/**
>   1262 * typec_find_port_power_role - Get the typec port power 
> capability
>   1263 * @name: port power capability string
>   1264 *
>   1265 * This routine is used to find the typec_port_type by its 
> string name.
>   1266 *
>   1267 * Returns typec_port_type if success, otherwise negative error
> code.
>   1268 */
>   1269int typec_find_port_power_role(const char *name)
>   1270{
>   1271return match_string(typec_port_types,
> ARRAY_SIZE(typec_port_types),
>   1272name);
>   1273}
> > 1274EXPORT_SYMBOL_GPL(typec_find_power_type);
>   1275
>   1276/**
>   

Re: [PATCH v6 05/15] usb: typec: add API to get typec basic port power and data config

2018-05-29 Thread kbuild test robot
Hi Li,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.17-rc7 next-20180529]
[cannot apply to staging/staging-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Li-Jun/staging-typec-tcpci-move-out-of-staging/20180530-110011
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
usb-testing
config: i386-randconfig-x017-201821 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:7:0,
from include/linux/kernel.h:7,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from drivers/usb/typec/class.c:9:
>> drivers/usb/typec/class.c:1274:19: error: 'typec_find_power_type' undeclared 
>> here (not in a function); did you mean 'typec_find_power_role'?
EXPORT_SYMBOL_GPL(typec_find_power_type);
  ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
 extern typeof(sym) sym;  \
   ^~~
>> drivers/usb/typec/class.c:1274:1: note: in expansion of macro 
>> 'EXPORT_SYMBOL_GPL'
EXPORT_SYMBOL_GPL(typec_find_power_type);
^
>> drivers/usb/typec/class.c:1288:19: error: 'typec_find_preferred_role' 
>> undeclared here (not in a function); did you mean 'typec_find_power_role'?
EXPORT_SYMBOL_GPL(typec_find_preferred_role);
  ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
 extern typeof(sym) sym;  \
   ^~~
   drivers/usb/typec/class.c:1288:1: note: in expansion of macro 
'EXPORT_SYMBOL_GPL'
EXPORT_SYMBOL_GPL(typec_find_preferred_role);
^
>> drivers/usb/typec/class.c:1303:19: error: 'typec_find_data_type' undeclared 
>> here (not in a function); did you mean 'typec_find_power_type'?
EXPORT_SYMBOL_GPL(typec_find_data_type);
  ^
   include/linux/export.h:65:16: note: in definition of macro '___EXPORT_SYMBOL'
 extern typeof(sym) sym;  \
   ^~~
   drivers/usb/typec/class.c:1303:1: note: in expansion of macro 
'EXPORT_SYMBOL_GPL'
EXPORT_SYMBOL_GPL(typec_find_data_type);
^

vim +1274 drivers/usb/typec/class.c

  1260  
  1261  /**
  1262   * typec_find_port_power_role - Get the typec port power capability
  1263   * @name: port power capability string
  1264   *
  1265   * This routine is used to find the typec_port_type by its string name.
  1266   *
  1267   * Returns typec_port_type if success, otherwise negative error code.
  1268   */
  1269  int typec_find_port_power_role(const char *name)
  1270  {
  1271  return match_string(typec_port_types, 
ARRAY_SIZE(typec_port_types),
  1272  name);
  1273  }
> 1274  EXPORT_SYMBOL_GPL(typec_find_power_type);
  1275  
  1276  /**
  1277   * typec_find_power_role - Find the typec one specific power role
  1278   * @name: power role string
  1279   *
  1280   * This routine is used to find the typec_role by its string name.
  1281   *
  1282   * Returns typec_role if success, otherwise negative error code.
  1283   */
  1284  int typec_find_power_role(const char *name)
  1285  {
  1286  return match_string(typec_roles, ARRAY_SIZE(typec_roles), name);
  1287  }
> 1288  EXPORT_SYMBOL_GPL(typec_find_preferred_role);
  1289  
  1290  /**
  1291   * typec_find_port_data_role - Get the typec port data capability
  1292   * @name: port data capability string
  1293   *
  1294   * This routine is used to find the typec_port_data by its string name.
  1295   *
  1296   * Returns typec_port_data if success, otherwise negative error code.
  1297   */
  1298  int typec_find_port_data_role(const char *name)
  1299  {
  1300  return match_string(typec_data_caps, 
ARRAY_SIZE(typec_data_caps),
  1301  name);
  1302  }
> 1303  EXPORT_SYMBOL_GPL(typec_find_data_type);
  1304  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


RE: [PATCH 13/22] USB: chipidea: no need to check return value of debugfs_create functions

2018-05-29 Thread Peter Chen
 
> 
> When calling debugfs functions, there is no need to ever check the return 
> value.  The
> function can work or not, but the code logic should never do something 
> different
> based on this.
> 
> Cc: Peter Chen 
> Signed-off-by: Greg Kroah-Hartman 

Tested on imx6sx-sdb board.

Acked-by: Peter Chen 

> ---
>  drivers/usb/chipidea/ci.h|  2 +-
>  drivers/usb/chipidea/core.c  |  4 +--
>  drivers/usb/chipidea/debug.c | 56 ++--
>  3 files changed, 17 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index
> 98b7cb3d0064..0bf244d50544 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -450,7 +450,7 @@ void hw_phymode_configure(struct ci_hdrc *ci);
> 
>  void ci_platform_configure(struct ci_hdrc *ci);
> 
> -int dbg_create_files(struct ci_hdrc *ci);
> +void dbg_create_files(struct ci_hdrc *ci);
> 
>  void dbg_remove_files(struct ci_hdrc *ci);
>  #endif   /* __DRIVERS_USB_CHIPIDEA_CI_H */
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index
> 33ae87fa3ff3..85fc6db48e44 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -1062,9 +1062,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>   ci_hdrc_otg_fsm_start(ci);
> 
>   device_set_wakeup_capable(>dev, true);
> - ret = dbg_create_files(ci);
> - if (ret)
> - goto stop;
> + dbg_create_files(ci);
> 
>   ret = sysfs_create_group(>kobj, _attr_group);
>   if (ret)
> diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index
> ce648cb3ed94..fcc91a338875 100644
> --- a/drivers/usb/chipidea/debug.c
> +++ b/drivers/usb/chipidea/debug.c
> @@ -340,54 +340,28 @@ DEFINE_SHOW_ATTRIBUTE(ci_registers);
>   *
>   * This function returns an error code
>   */
> -int dbg_create_files(struct ci_hdrc *ci)
> +void dbg_create_files(struct ci_hdrc *ci)
>  {
> - struct dentry *dent;
> -
>   ci->debugfs = debugfs_create_dir(dev_name(ci->dev), NULL);
> - if (!ci->debugfs)
> - return -ENOMEM;
> -
> - dent = debugfs_create_file("device", S_IRUGO, ci->debugfs, ci,
> -_device_fops);
> - if (!dent)
> - goto err;
> -
> - dent = debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs,
> -ci, _port_test_fops);
> - if (!dent)
> - goto err;
> -
> - dent = debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci,
> -_qheads_fops);
> - if (!dent)
> - goto err;
> 
> - dent = debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci,
> -_requests_fops);
> - if (!dent)
> - goto err;
> + debugfs_create_file("device", S_IRUGO, ci->debugfs, ci,
> + _device_fops);
> + debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs, ci,
> + _port_test_fops);
> + debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci,
> + _qheads_fops);
> + debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci,
> + _requests_fops);
> 
>   if (ci_otg_is_fsm_mode(ci)) {
> - dent = debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci,
> - _otg_fops);
> - if (!dent)
> - goto err;
> + debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci,
> + _otg_fops);
>   }
> 
> - dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci,
> -_role_fops);
> - if (!dent)
> - goto err;
> -
> - dent = debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci,
> - _registers_fops);
> -
> - if (dent)
> - return 0;
> -err:
> - debugfs_remove_recursive(ci->debugfs);
> - return -ENOMEM;
> + debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci,
> + _role_fops);
> + debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci,
> + _registers_fops);
>  }
> 
>  /**
> --
> 2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 20/22] USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions

2018-05-29 Thread Robert Jarzmik
Greg Kroah-Hartman  writes:

> When calling debugfs functions, there is no need to ever check the
> return value.  The function can work or not, but the code logic should
> never do something different based on this.
>
> There is also no need to keep the file dentries around at all, so remove
> those variables from the device structure.
>
> Cc: Daniel Mack 
> Cc: Haojian Zhuang 
> Cc: Robert Jarzmik 
> Cc: Felipe Balbi 
> Signed-off-by: Greg Kroah-Hartman 
Acked-by: Robert Jarzmik 

Cheers.

--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND][PATCH v6 1/2] usb/gadget/uvc-configfs Fix linked flag in a format not being set when format is linked into streaming header

2018-05-29 Thread Joel Pepper
While checks are in place to avoid attributes and children of a format
being manipulated after the format is linked into the streaming header,
the linked flag was never actually set, invalidating the protections.

Signed-off-by: Joel Pepper 
---
 drivers/usb/gadget/function/uvc_configfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index c9b8cc4a..7a98f9f 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -760,6 +760,7 @@ static int uvcg_streaming_header_allow_link(struct 
config_item *src,
format_ptr->fmt = target_fmt;
list_add_tail(_ptr->entry, _hdr->formats);
++src_hdr->num_fmt;
+   ++target_fmt->linked;
 
 out:
mutex_unlock(>lock);
@@ -797,6 +798,8 @@ static void uvcg_streaming_header_drop_link(struct 
config_item *src,
break;
}
 
+   --target_fmt->linked;
+
 out:
mutex_unlock(>lock);
mutex_unlock(su_mutex);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND][PATCH v6 2/2] usb/gadget/uvc-configfs Fix host unable to negotiate framesizes other than first

2018-05-29 Thread Joel Pepper
- Add bFrameIndex as a UVCG_FRAME_ATTR_RO for each frame size.
- Automatically assign ascending bFrameIndex to each frame in a format.

Before all "bFrameindex" attributes were set to "1" with no way to
configure the gadget otherwise. This resulted in the host always
negotiating for bFrameIndex 1 (i.e. the first framesize of the gadget).
After the negotiation the host driver will set the user or application
selected framesize, while the gadget is actually set to the first
framesize.

Now, when the containing format is linked into the streaming header,
iterate over all child frame descriptors and assign ascending indices.
The automatically assigned indices can be read from the new read only
bFrameIndex configsfs attribute in each frame descriptor item.

Signed-off-by: Joel Pepper 
---

v2: Add the new attribute to both MJPEG and uncompressed frame descriptors
in Documentation/ABI, with note that it was added only in a later
kernel version

v3: Changed from simply allowing user to set the value for bFrameIndex to
automatically assigning correct distinct frame indexes. Changed
bFrameIndex from RW to RO

v4: Actually include updated patch

v5: bFrameIndex now returns -EBUSY if the parent fmt is not linked yet

 Documentation/ABI/testing/configfs-usb-gadget-uvc | 18 +++
 drivers/usb/gadget/function/uvc_configfs.c| 64 +++
 2 files changed, 82 insertions(+)

diff --git a/Documentation/ABI/testing/configfs-usb-gadget-uvc 
b/Documentation/ABI/testing/configfs-usb-gadget-uvc
index 1ba0d0f..86c9b2e 100644
--- a/Documentation/ABI/testing/configfs-usb-gadget-uvc
+++ b/Documentation/ABI/testing/configfs-usb-gadget-uvc
@@ -194,6 +194,14 @@ Description:   Specific MJPEG frame descriptors
bmCapabilities  - still image support, fixed frame-rate
support
 
+Date:  May 2018
+KernelVersion: 4.17
+
+   bFrameIndex - unique id for this framedescriptor;
+   only defined after parent format is
+   linked into the streaming header;
+   read-only
+
 What:  
/config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed
 Date:  Dec 2014
 KernelVersion: 4.0
@@ -241,6 +249,16 @@ Description:   Specific uncompressed frame descriptors
bmCapabilities  - still image support, fixed frame-rate
support
 
+Date:   May 2018
+KernelVersion:  4.17
+
+bFrameIndex - unique id for this framedescriptor;
+only defined after parent format is
+linked into the streaming header;
+read-only
+
+
+
 What:  /config/usb-gadget/gadget/functions/uvc.name/streaming/header
 Date:  Dec 2014
 KernelVersion: 4.0
diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 7a98f9f..37b4a14 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -32,6 +32,7 @@ static struct configfs_attribute prefix##attr_##cname = { \
 }
 
 static inline struct f_uvc_opts *to_f_uvc_opts(struct config_item *item);
+static void __uvcg_fmt_set_indices(struct config_group *fmt);
 
 /* control/header/ */
 DECLARE_UVC_HEADER_DESCRIPTOR(1);
@@ -751,6 +752,8 @@ static int uvcg_streaming_header_allow_link(struct 
config_item *src,
if (!target_fmt)
goto out;
 
+   __uvcg_fmt_set_indices(to_config_group(target));
+
format_ptr = kzalloc(sizeof(*format_ptr), GFP_KERNEL);
if (!format_ptr) {
ret = -ENOMEM;
@@ -991,8 +994,46 @@ end:   
\
\
 UVC_ATTR(uvcg_frame_, cname, aname);
 
+
+static ssize_t uvcg_frame_b_frame_index_show(struct config_item *item,
+   char *page)
+{
+   struct uvcg_frame *f = to_uvcg_frame(item);
+   struct uvcg_format *fmt;
+   struct f_uvc_opts *opts;
+   struct config_item *opts_item;
+   struct config_item *fmt_item;
+   struct mutex *su_mutex = >item.ci_group->cg_subsys->su_mutex;
+   int result;
+
+   mutex_lock(su_mutex); /* for navigating configfs hierarchy */
+
+   fmt_item = f->item.ci_parent;
+   fmt = to_uvcg_format(fmt_item);
+
+   if (!fmt->linked) {
+   result = -EBUSY;
+   goto out;
+   }
+
+   opts_item = fmt_item->ci_parent->ci_parent->ci_parent;
+   opts = to_f_uvc_opts(opts_item);
+
+   mutex_lock(>lock);
+   result = sprintf(page, "%d\n", f->frame.b_frame_index);
+   mutex_unlock(>lock);
+
+out:
+   mutex_unlock(su_mutex);
+   return result;
+}
+

[RESEND][PATCH v6 0/2] usb/gadget/uvc-configs Fix host unable to negotiate framesizes other than first​

2018-05-29 Thread Joel Pepper
This patch set is mostly concerned with fixing a bug with the driver
setting incorrect bFrameIndexes, for details refer to the second patch.
However part of the fix also depends on fixing an unrelated bug,
which involved the "linked" flag on formats not beig set.

v6: This is mostly a resubmit of v5 which got buried ahead of the last merge 
window and never got reviewed. The addition to the Documentation has been 
updated to reflect this. Also moved version comments out of the actual commit 
message (Thanks, Felipe.)

(Technically, this is the second resend, because the first resend got buried 
too.)

Joel Pepper (2):
  usb/gadget/uvc-configfs Fix linked flag in a format not being set when
format is linked into streaming header
  usb/gadget/uvc-configfs Fix host unable to negotiate framesizes other
than first

 Documentation/ABI/testing/configfs-usb-gadget-uvc | 18 ++
 drivers/usb/gadget/function/uvc_configfs.c| 67 +++
 2 files changed, 85 insertions(+)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/22] USB: mon: no need to check return value of debugfs_create functions

2018-05-29 Thread Fredrik Noring
Hi Greg,

On Tue, May 29, 2018 at 06:51:54PM +0200, Greg Kroah-Hartman wrote:
> On Tue, May 29, 2018 at 11:34:34AM -0500, Pete Zaitcev wrote:
> > On Tue, 29 May 2018 17:30:50 +0200
> > Greg Kroah-Hartman  wrote:
> > 
> > > When calling debugfs functions, there is no need to ever check the
> > > return value.  The function can work or not, but the code logic should
> > > never do something different based on this.
> > 
> > Okay, fair enough. And the code works, surprisingly, even when the
> > debugfs is disabled (well, according to my review). I just have one
> > question - wouldn't it be cleaner to deprecate and remove the text
> > API altogether?
> 
> If you think we can do that, sure!  But what's the odds that someone
> still uses it?  This patch doesn't change any real functionality.

I had some use of this text API last year, when I also discovered and
submitted and fix for its data corruption problems described in commit
a5f596830e27e "usb: usbmon: Read text within supplied buffer size".

A significant disadvantage with the text API is, as far as I understand it,
that it can drop events (due to its buffering limit) without informing API
readers (via event sequence numbers or some such).

I've found a couple of USB bugs/problems (commit d6c931ea32dc0 "USB: OHCI:
Fix NULL dereference in HCDs using HCD_LOCAL_MEM" for instance) and I'm
still investigating at least one bug possibly related to lost interrupts
where some kind of probing method could be helpful.

However, I would explore other kernel probing methods for that. Not only
because I'm curious but also because I have the impression that there are
more powerful methods available than this text API. Would you recommend
any alternatives?

Fredrik
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/22] USB: mon: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
On Tue, May 29, 2018 at 11:34:34AM -0500, Pete Zaitcev wrote:
> On Tue, 29 May 2018 17:30:50 +0200
> Greg Kroah-Hartman  wrote:
> 
> > When calling debugfs functions, there is no need to ever check the
> > return value.  The function can work or not, but the code logic should
> > never do something different based on this.
> 
> Okay, fair enough. And the code works, surprisingly, even when the
> debugfs is disabled (well, according to my review). I just have one
> question - wouldn't it be cleaner to deprecate and remove the text
> API altogether?

If you think we can do that, sure!  But what's the odds that someone
still uses it?  This patch doesn't change any real functionality.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/22] USB: typec: fsusb302: no need to check return value of debugfs_create_dir()

2018-05-29 Thread Guenter Roeck
On Tue, May 29, 2018 at 06:27:03PM +0200, Greg Kroah-Hartman wrote:
> On Tue, May 29, 2018 at 09:15:30AM -0700, Guenter Roeck wrote:
> > On Tue, May 29, 2018 at 05:30:47PM +0200, Greg Kroah-Hartman wrote:
> > > When calling debugfs functions, there is no need to ever check the
> > > return value.  The function can work or not, but the code logic should
> > > never do something different based on this.
> > > 
> > > Clean up the fsusb302 driver to not care about the dentry being created,
> > > or if the root directory was created, as the code should work properly
> > > either way.  We do not need to save the dentry anymore as things are
> > > properly cleaned up when we remove the root directory.
> > > 
> > > Note, this driver seems to only work for one device per system,
> > > otherwise the debugfs directories are going to get confused when a
> > > device is removed.
> > > 
> > > Cc: Heikki Krogerus 
> > > Cc: Guenter Roeck 
> > > Cc: Hans de Goede 
> > > Cc: Andy Shevchenko 
> > > Cc: Adam Thomson 
> > > Signed-off-by: Greg Kroah-Hartman 
> > > ---
> > >  drivers/usb/typec/fusb302/fusb302.c | 24 +++-
> > >  1 file changed, 7 insertions(+), 17 deletions(-)
> > > 
> > > diff --git a/drivers/usb/typec/fusb302/fusb302.c 
> > > b/drivers/usb/typec/fusb302/fusb302.c
> > > index 9c1eba9ea004..07b07ddf6af0 100644
> > > --- a/drivers/usb/typec/fusb302/fusb302.c
> > > +++ b/drivers/usb/typec/fusb302/fusb302.c
> > > @@ -117,7 +117,6 @@ struct fusb302_chip {
> > >   u32 snk_pdo[PDO_MAX_OBJECTS];
> > >  
> > >  #ifdef CONFIG_DEBUG_FS
> > > - struct dentry *dentry;
> > >   /* lock for log buffer access */
> > >   struct mutex logbuffer_lock;
> > >   int logbuffer_head;
> > > @@ -215,33 +214,26 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug);
> > >  
> > >  static struct dentry *rootdir;
> > >  
> > > -static int fusb302_debugfs_init(struct fusb302_chip *chip)
> > > +static void fusb302_debugfs_init(struct fusb302_chip *chip)
> > >  {
> > >   mutex_init(>logbuffer_lock);
> > > - if (!rootdir) {
> > > + if (!rootdir)
> > >   rootdir = debugfs_create_dir("fusb302", NULL);
> > > - if (!rootdir)
> > > - return -ENOMEM;
> > > - }
> > > -
> > > - chip->dentry = debugfs_create_file(dev_name(chip->dev),
> > > -S_IFREG | 0444, rootdir,
> > > -chip, _debug_fops);
> > >  
> > > - return 0;
> > > + debugfs_create_file(dev_name(chip->dev), S_IFREG | 0444, rootdir, chip,
> > > + _debug_fops);
> > >  }
> > >  
> > >  static void fusb302_debugfs_exit(struct fusb302_chip *chip)
> > >  {
> > > - debugfs_remove(chip->dentry);
> > > - debugfs_remove(rootdir);
> > > + debugfs_remove_recursive(rootdir);
> > 
> > The idea was that debugfs_remove() would only remove the root directory
> > if nothing else was in it. This was the reason for the preceding
> > debugfs_remove(chip->dentry) followed by debugfs_remove(). Your patch
> > changes this behavior. "... this driver seems to only work for one
> > device per system" is introduced by your patch and was not previously
> > the case.
> 
> Ah, that makes more sense.  Nice hack :)
> 
> Why not just have a new directory per device like "most" drivers have?
> That would make this a bit simpler to manage.  Mind of I change the code
> that way?  Hm, you still end up having to save off a dentry that way,
> ah, it's the same either way...
> 

I personally prefer some kind of grouping, such as done for regulators.
Of course, that is easier if there is a subsystem behind it. No strong
opinion either way. And, yes, you'll still need to store dentry somewhere
to be able to remove it.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/22] USB: mon: no need to check return value of debugfs_create functions

2018-05-29 Thread Pete Zaitcev
On Tue, 29 May 2018 17:30:50 +0200
Greg Kroah-Hartman  wrote:

> When calling debugfs functions, there is no need to ever check the
> return value.  The function can work or not, but the code logic should
> never do something different based on this.

Okay, fair enough. And the code works, surprisingly, even when the
debugfs is disabled (well, according to my review). I just have one
question - wouldn't it be cleaner to deprecate and remove the text
API altogether?

-- Pete
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/22] USB: typec: fsusb302: no need to check return value of debugfs_create_dir()

2018-05-29 Thread Greg Kroah-Hartman
On Tue, May 29, 2018 at 09:15:30AM -0700, Guenter Roeck wrote:
> On Tue, May 29, 2018 at 05:30:47PM +0200, Greg Kroah-Hartman wrote:
> > When calling debugfs functions, there is no need to ever check the
> > return value.  The function can work or not, but the code logic should
> > never do something different based on this.
> > 
> > Clean up the fsusb302 driver to not care about the dentry being created,
> > or if the root directory was created, as the code should work properly
> > either way.  We do not need to save the dentry anymore as things are
> > properly cleaned up when we remove the root directory.
> > 
> > Note, this driver seems to only work for one device per system,
> > otherwise the debugfs directories are going to get confused when a
> > device is removed.
> > 
> > Cc: Heikki Krogerus 
> > Cc: Guenter Roeck 
> > Cc: Hans de Goede 
> > Cc: Andy Shevchenko 
> > Cc: Adam Thomson 
> > Signed-off-by: Greg Kroah-Hartman 
> > ---
> >  drivers/usb/typec/fusb302/fusb302.c | 24 +++-
> >  1 file changed, 7 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/usb/typec/fusb302/fusb302.c 
> > b/drivers/usb/typec/fusb302/fusb302.c
> > index 9c1eba9ea004..07b07ddf6af0 100644
> > --- a/drivers/usb/typec/fusb302/fusb302.c
> > +++ b/drivers/usb/typec/fusb302/fusb302.c
> > @@ -117,7 +117,6 @@ struct fusb302_chip {
> > u32 snk_pdo[PDO_MAX_OBJECTS];
> >  
> >  #ifdef CONFIG_DEBUG_FS
> > -   struct dentry *dentry;
> > /* lock for log buffer access */
> > struct mutex logbuffer_lock;
> > int logbuffer_head;
> > @@ -215,33 +214,26 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug);
> >  
> >  static struct dentry *rootdir;
> >  
> > -static int fusb302_debugfs_init(struct fusb302_chip *chip)
> > +static void fusb302_debugfs_init(struct fusb302_chip *chip)
> >  {
> > mutex_init(>logbuffer_lock);
> > -   if (!rootdir) {
> > +   if (!rootdir)
> > rootdir = debugfs_create_dir("fusb302", NULL);
> > -   if (!rootdir)
> > -   return -ENOMEM;
> > -   }
> > -
> > -   chip->dentry = debugfs_create_file(dev_name(chip->dev),
> > -  S_IFREG | 0444, rootdir,
> > -  chip, _debug_fops);
> >  
> > -   return 0;
> > +   debugfs_create_file(dev_name(chip->dev), S_IFREG | 0444, rootdir, chip,
> > +   _debug_fops);
> >  }
> >  
> >  static void fusb302_debugfs_exit(struct fusb302_chip *chip)
> >  {
> > -   debugfs_remove(chip->dentry);
> > -   debugfs_remove(rootdir);
> > +   debugfs_remove_recursive(rootdir);
> 
> The idea was that debugfs_remove() would only remove the root directory
> if nothing else was in it. This was the reason for the preceding
> debugfs_remove(chip->dentry) followed by debugfs_remove(). Your patch
> changes this behavior. "... this driver seems to only work for one
> device per system" is introduced by your patch and was not previously
> the case.

Ah, that makes more sense.  Nice hack :)

Why not just have a new directory per device like "most" drivers have?
That would make this a bit simpler to manage.  Mind of I change the code
that way?  Hm, you still end up having to save off a dentry that way,
ah, it's the same either way...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 02/22] USB: typec: fsusb302: no need to check return value of debugfs_create_dir()

2018-05-29 Thread Guenter Roeck
On Tue, May 29, 2018 at 05:30:47PM +0200, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value.  The function can work or not, but the code logic should
> never do something different based on this.
> 
> Clean up the fsusb302 driver to not care about the dentry being created,
> or if the root directory was created, as the code should work properly
> either way.  We do not need to save the dentry anymore as things are
> properly cleaned up when we remove the root directory.
> 
> Note, this driver seems to only work for one device per system,
> otherwise the debugfs directories are going to get confused when a
> device is removed.
> 
> Cc: Heikki Krogerus 
> Cc: Guenter Roeck 
> Cc: Hans de Goede 
> Cc: Andy Shevchenko 
> Cc: Adam Thomson 
> Signed-off-by: Greg Kroah-Hartman 
> ---
>  drivers/usb/typec/fusb302/fusb302.c | 24 +++-
>  1 file changed, 7 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/usb/typec/fusb302/fusb302.c 
> b/drivers/usb/typec/fusb302/fusb302.c
> index 9c1eba9ea004..07b07ddf6af0 100644
> --- a/drivers/usb/typec/fusb302/fusb302.c
> +++ b/drivers/usb/typec/fusb302/fusb302.c
> @@ -117,7 +117,6 @@ struct fusb302_chip {
>   u32 snk_pdo[PDO_MAX_OBJECTS];
>  
>  #ifdef CONFIG_DEBUG_FS
> - struct dentry *dentry;
>   /* lock for log buffer access */
>   struct mutex logbuffer_lock;
>   int logbuffer_head;
> @@ -215,33 +214,26 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug);
>  
>  static struct dentry *rootdir;
>  
> -static int fusb302_debugfs_init(struct fusb302_chip *chip)
> +static void fusb302_debugfs_init(struct fusb302_chip *chip)
>  {
>   mutex_init(>logbuffer_lock);
> - if (!rootdir) {
> + if (!rootdir)
>   rootdir = debugfs_create_dir("fusb302", NULL);
> - if (!rootdir)
> - return -ENOMEM;
> - }
> -
> - chip->dentry = debugfs_create_file(dev_name(chip->dev),
> -S_IFREG | 0444, rootdir,
> -chip, _debug_fops);
>  
> - return 0;
> + debugfs_create_file(dev_name(chip->dev), S_IFREG | 0444, rootdir, chip,
> + _debug_fops);
>  }
>  
>  static void fusb302_debugfs_exit(struct fusb302_chip *chip)
>  {
> - debugfs_remove(chip->dentry);
> - debugfs_remove(rootdir);
> + debugfs_remove_recursive(rootdir);

The idea was that debugfs_remove() would only remove the root directory
if nothing else was in it. This was the reason for the preceding
debugfs_remove(chip->dentry) followed by debugfs_remove(). Your patch
changes this behavior. "... this driver seems to only work for one
device per system" is introduced by your patch and was not previously
the case.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/22] USB: core: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Johan Hovold 
Cc: Kai-Heng Feng 
Cc: Peter Chen 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/core/usb.c | 26 +-
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 0adb6345ff2e..623be3174fb3 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1167,30 +1167,16 @@ static struct notifier_block usb_bus_nb = {
 struct dentry *usb_debug_root;
 EXPORT_SYMBOL_GPL(usb_debug_root);
 
-static struct dentry *usb_debug_devices;
-
-static int usb_debugfs_init(void)
+static void usb_debugfs_init(void)
 {
usb_debug_root = debugfs_create_dir("usb", NULL);
-   if (!usb_debug_root)
-   return -ENOENT;
-
-   usb_debug_devices = debugfs_create_file("devices", 0444,
-   usb_debug_root, NULL,
-   _devices_fops);
-   if (!usb_debug_devices) {
-   debugfs_remove(usb_debug_root);
-   usb_debug_root = NULL;
-   return -ENOENT;
-   }
-
-   return 0;
+   debugfs_create_file("devices", 0444, usb_debug_root, NULL,
+   _devices_fops);
 }
 
 static void usb_debugfs_cleanup(void)
 {
-   debugfs_remove(usb_debug_devices);
-   debugfs_remove(usb_debug_root);
+   debugfs_remove_recursive(usb_debug_root);
 }
 
 /*
@@ -1205,9 +1191,7 @@ static int __init usb_init(void)
}
usb_init_pool_max();
 
-   retval = usb_debugfs_init();
-   if (retval)
-   goto out;
+   usb_debugfs_init();
 
usb_acpi_register();
retval = bus_register(_bus_type);
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/22] USB: mtu3: no need to check return value of debugfs_create_dir()

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Chunfeng Yun 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/mtu3/mtu3_dr.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c
index 8c3bbf732bc4..ac60e9c8564e 100644
--- a/drivers/usb/mtu3/mtu3_dr.c
+++ b/drivers/usb/mtu3/mtu3_dr.c
@@ -378,10 +378,6 @@ static void ssusb_debugfs_init(struct ssusb_mtk *ssusb)
struct dentry *root;
 
root = debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
-   if (!root) {
-   dev_err(ssusb->dev, "create debugfs root failed\n");
-   return;
-   }
ssusb->dbgfs_root = root;
 
debugfs_create_file("mode", 0644, root, ssusb, _mode_fops);
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/22] USB: fhci-hcd: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the host controller structure.

Cc: Felipe Balbi 
Cc: Andy Shevchenko 
Cc: Johan Hovold 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/fhci-dbg.c | 23 +--
 drivers/usb/host/fhci.h |  2 --
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/fhci-dbg.c b/drivers/usb/host/fhci-dbg.c
index ebf9bb219f75..100048b3bd17 100644
--- a/drivers/usb/host/fhci-dbg.c
+++ b/drivers/usb/host/fhci-dbg.c
@@ -83,27 +83,14 @@ void fhci_dfs_create(struct fhci_hcd *fhci)
struct device *dev = fhci_to_hcd(fhci)->self.controller;
 
fhci->dfs_root = debugfs_create_dir(dev_name(dev), usb_debug_root);
-   if (!fhci->dfs_root) {
-   WARN_ON(1);
-   return;
-   }
-
-   fhci->dfs_regs = debugfs_create_file("regs", S_IFREG | S_IRUGO,
-   fhci->dfs_root, fhci, _dfs_regs_fops);
 
-   fhci->dfs_irq_stat = debugfs_create_file("irq_stat",
-   S_IFREG | S_IRUGO, fhci->dfs_root, fhci,
-   _dfs_irq_stat_fops);
-
-   WARN_ON(!fhci->dfs_regs || !fhci->dfs_irq_stat);
+   debugfs_create_file("regs", S_IFREG | S_IRUGO, fhci->dfs_root, fhci,
+   _dfs_regs_fops);
+   debugfs_create_file("irq_stat", S_IFREG | S_IRUGO, fhci->dfs_root, fhci,
+   _dfs_irq_stat_fops);
 }
 
 void fhci_dfs_destroy(struct fhci_hcd *fhci)
 {
-   if (!fhci->dfs_root)
-   return;
-
-   debugfs_remove(fhci->dfs_irq_stat);
-   debugfs_remove(fhci->dfs_regs);
-   debugfs_remove(fhci->dfs_root);
+   debugfs_remove_recursive(fhci->dfs_root);
 }
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h
index e7ec41d62410..2ce5031d866d 100644
--- a/drivers/usb/host/fhci.h
+++ b/drivers/usb/host/fhci.h
@@ -262,8 +262,6 @@ struct fhci_hcd {
 #ifdef CONFIG_FHCI_DEBUG
int usb_irq_stat[13];
struct dentry *dfs_root;
-   struct dentry *dfs_regs;
-   struct dentry *dfs_irq_stat;
 #endif
 };
 
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/22] USB: chipidea: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Peter Chen 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/chipidea/ci.h|  2 +-
 drivers/usb/chipidea/core.c  |  4 +--
 drivers/usb/chipidea/debug.c | 56 ++--
 3 files changed, 17 insertions(+), 45 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 98b7cb3d0064..0bf244d50544 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -450,7 +450,7 @@ void hw_phymode_configure(struct ci_hdrc *ci);
 
 void ci_platform_configure(struct ci_hdrc *ci);
 
-int dbg_create_files(struct ci_hdrc *ci);
+void dbg_create_files(struct ci_hdrc *ci);
 
 void dbg_remove_files(struct ci_hdrc *ci);
 #endif /* __DRIVERS_USB_CHIPIDEA_CI_H */
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 33ae87fa3ff3..85fc6db48e44 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -1062,9 +1062,7 @@ static int ci_hdrc_probe(struct platform_device *pdev)
ci_hdrc_otg_fsm_start(ci);
 
device_set_wakeup_capable(>dev, true);
-   ret = dbg_create_files(ci);
-   if (ret)
-   goto stop;
+   dbg_create_files(ci);
 
ret = sysfs_create_group(>kobj, _attr_group);
if (ret)
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
index ce648cb3ed94..fcc91a338875 100644
--- a/drivers/usb/chipidea/debug.c
+++ b/drivers/usb/chipidea/debug.c
@@ -340,54 +340,28 @@ DEFINE_SHOW_ATTRIBUTE(ci_registers);
  *
  * This function returns an error code
  */
-int dbg_create_files(struct ci_hdrc *ci)
+void dbg_create_files(struct ci_hdrc *ci)
 {
-   struct dentry *dent;
-
ci->debugfs = debugfs_create_dir(dev_name(ci->dev), NULL);
-   if (!ci->debugfs)
-   return -ENOMEM;
-
-   dent = debugfs_create_file("device", S_IRUGO, ci->debugfs, ci,
-  _device_fops);
-   if (!dent)
-   goto err;
-
-   dent = debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs,
-  ci, _port_test_fops);
-   if (!dent)
-   goto err;
-
-   dent = debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci,
-  _qheads_fops);
-   if (!dent)
-   goto err;
 
-   dent = debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci,
-  _requests_fops);
-   if (!dent)
-   goto err;
+   debugfs_create_file("device", S_IRUGO, ci->debugfs, ci,
+   _device_fops);
+   debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs, ci,
+   _port_test_fops);
+   debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci,
+   _qheads_fops);
+   debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci,
+   _requests_fops);
 
if (ci_otg_is_fsm_mode(ci)) {
-   dent = debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci,
-   _otg_fops);
-   if (!dent)
-   goto err;
+   debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci,
+   _otg_fops);
}
 
-   dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci,
-  _role_fops);
-   if (!dent)
-   goto err;
-
-   dent = debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci,
-   _registers_fops);
-
-   if (dent)
-   return 0;
-err:
-   debugfs_remove_recursive(ci->debugfs);
-   return -ENOMEM;
+   debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci,
+   _role_fops);
+   debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci,
+   _registers_fops);
 }
 
 /**
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/22] USB: dwc3: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/dwc3/debugfs.c | 43 ++
 1 file changed, 11 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index 2f07be1e1f31..df8e73ec3342 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -716,9 +716,6 @@ static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep 
*dep,
struct dentry   *dir;
 
dir = debugfs_create_dir(dep->name, parent);
-   if (IS_ERR_OR_NULL(dir))
-   return;
-
dwc3_debugfs_create_endpoint_files(dep, dir);
 }
 
@@ -740,49 +737,31 @@ static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 
*dwc,
 void dwc3_debugfs_init(struct dwc3 *dwc)
 {
struct dentry   *root;
-   struct dentry   *file;
-
-   root = debugfs_create_dir(dev_name(dwc->dev), NULL);
-   if (IS_ERR_OR_NULL(root)) {
-   if (!root)
-   dev_err(dwc->dev, "Can't create debugfs root\n");
-   return;
-   }
-   dwc->root = root;
 
dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL);
-   if (!dwc->regset) {
-   debugfs_remove_recursive(root);
+   if (!dwc->regset)
return;
-   }
 
dwc->regset->regs = dwc3_regs;
dwc->regset->nregs = ARRAY_SIZE(dwc3_regs);
dwc->regset->base = dwc->regs - DWC3_GLOBALS_REGS_START;
 
-   file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset);
-   if (!file)
-   dev_dbg(dwc->dev, "Can't create debugfs regdump\n");
+   root = debugfs_create_dir(dev_name(dwc->dev), NULL);
+   dwc->root = root;
+
+   debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset);
 
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) {
-   file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root,
-   dwc, _mode_fops);
-   if (!file)
-   dev_dbg(dwc->dev, "Can't create debugfs mode\n");
+   debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, dwc,
+   _mode_fops);
}
 
if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) ||
IS_ENABLED(CONFIG_USB_DWC3_GADGET)) {
-   file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root,
-   dwc, _testmode_fops);
-   if (!file)
-   dev_dbg(dwc->dev, "Can't create debugfs testmode\n");
-
-   file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR,
-   root, dwc, _link_state_fops);
-   if (!file)
-   dev_dbg(dwc->dev, "Can't create debugfs link_state\n");
-
+   debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, dwc,
+   _testmode_fops);
+   debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, dwc,
+   _link_state_fops);
dwc3_debugfs_create_endpoint_dirs(dwc, root);
}
 }
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/22] USB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Kevin Cernekee 
Cc: Felipe Balbi 
Cc: Florian Fainelli 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 37 
 1 file changed, 5 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c 
b/drivers/usb/gadget/udc/bcm63xx_udc.c
index 3a8df8601074..c1fcc77403ea 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -288,8 +288,6 @@ struct bcm63xx_req {
  * @ep0_reply: Pending reply from gadget driver.
  * @ep0_request: Outstanding ep0 request.
  * @debugfs_root: debugfs directory: /sys/kernel/debug/.
- * @debugfs_usbd: debugfs file "usbd" for controller state.
- * @debugfs_iudma: debugfs file "usbd" for IUDMA state.
  */
 struct bcm63xx_udc {
spinlock_t  lock;
@@ -330,8 +328,6 @@ struct bcm63xx_udc {
struct usb_request  *ep0_request;
 
struct dentry   *debugfs_root;
-   struct dentry   *debugfs_usbd;
-   struct dentry   *debugfs_iudma;
 };
 
 static const struct usb_ep_ops bcm63xx_udc_ep_ops;
@@ -2247,34 +2243,16 @@ DEFINE_SHOW_ATTRIBUTE(bcm63xx_iudma_dbg);
  */
 static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc)
 {
-   struct dentry *root, *usbd, *iudma;
+   struct dentry *root;
 
if (!IS_ENABLED(CONFIG_USB_GADGET_DEBUG_FS))
return;
 
root = debugfs_create_dir(udc->gadget.name, NULL);
-   if (IS_ERR(root) || !root)
-   goto err_root;
-
-   usbd = debugfs_create_file("usbd", 0400, root, udc,
-   _usbd_dbg_fops);
-   if (!usbd)
-   goto err_usbd;
-   iudma = debugfs_create_file("iudma", 0400, root, udc,
-   _iudma_dbg_fops);
-   if (!iudma)
-   goto err_iudma;
-
udc->debugfs_root = root;
-   udc->debugfs_usbd = usbd;
-   udc->debugfs_iudma = iudma;
-   return;
-err_iudma:
-   debugfs_remove(usbd);
-err_usbd:
-   debugfs_remove(root);
-err_root:
-   dev_err(udc->dev, "debugfs is not available\n");
+
+   debugfs_create_file("usbd", 0400, root, udc, _usbd_dbg_fops);
+   debugfs_create_file("iudma", 0400, root, udc, _iudma_dbg_fops);
 }
 
 /**
@@ -2285,12 +2263,7 @@ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc 
*udc)
  */
 static void bcm63xx_udc_cleanup_debugfs(struct bcm63xx_udc *udc)
 {
-   debugfs_remove(udc->debugfs_iudma);
-   debugfs_remove(udc->debugfs_usbd);
-   debugfs_remove(udc->debugfs_root);
-   udc->debugfs_iudma = NULL;
-   udc->debugfs_usbd = NULL;
-   udc->debugfs_root = NULL;
+   debugfs_remove_recursive(udc->debugfs_root);
 }
 
 /***
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/22] USB: ohci: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the host controller structure.

Cc: Alan Stern 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/ohci-dbg.c | 45 -
 drivers/usb/host/ohci-hcd.c |  5 -
 drivers/usb/host/ohci.h |  3 ---
 3 files changed, 9 insertions(+), 44 deletions(-)

diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index ac7d4ac34b02..d3ee1f52aaab 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -762,50 +762,23 @@ static int debug_registers_open(struct inode *inode, 
struct file *file)
 static inline void create_debug_files (struct ohci_hcd *ohci)
 {
struct usb_bus *bus = _to_hcd(ohci)->self;
+   struct dentry *root;
 
-   ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root);
-   if (!ohci->debug_dir)
-   goto dir_error;
+   root = debugfs_create_dir(bus->bus_name, ohci_debug_root);
+   ohci->debug_dir = root;
 
-   ohci->debug_async = debugfs_create_file("async", S_IRUGO,
-   ohci->debug_dir, ohci,
-   _async_fops);
-   if (!ohci->debug_async)
-   goto async_error;
-
-   ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
-  ohci->debug_dir, ohci,
-  _periodic_fops);
-   if (!ohci->debug_periodic)
-   goto periodic_error;
-
-   ohci->debug_registers = debugfs_create_file("registers", S_IRUGO,
-   ohci->debug_dir, ohci,
-   _registers_fops);
-   if (!ohci->debug_registers)
-   goto registers_error;
+   debugfs_create_file("async", S_IRUGO, root, ohci, _async_fops);
+   debugfs_create_file("periodic", S_IRUGO, root, ohci,
+   _periodic_fops);
+   debugfs_create_file("registers", S_IRUGO, root, ohci,
+   _registers_fops);
 
ohci_dbg (ohci, "created debug files\n");
-   return;
-
-registers_error:
-   debugfs_remove(ohci->debug_periodic);
-periodic_error:
-   debugfs_remove(ohci->debug_async);
-async_error:
-   debugfs_remove(ohci->debug_dir);
-dir_error:
-   ohci->debug_periodic = NULL;
-   ohci->debug_async = NULL;
-   ohci->debug_dir = NULL;
 }
 
 static inline void remove_debug_files (struct ohci_hcd *ohci)
 {
-   debugfs_remove(ohci->debug_registers);
-   debugfs_remove(ohci->debug_periodic);
-   debugfs_remove(ohci->debug_async);
-   debugfs_remove(ohci->debug_dir);
+   debugfs_remove_recursive(ohci->debug_dir);
 }
 
 /*-*/
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 4806e0f9e8d4..210181fd98d2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1258,10 +1258,6 @@ static int __init ohci_hcd_mod_init(void)
set_bit(USB_OHCI_LOADED, _hcds_loaded);
 
ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root);
-   if (!ohci_debug_root) {
-   retval = -ENOENT;
-   goto error_debug;
-   }
 
 #ifdef PS3_SYSTEM_BUS_DRIVER
retval = ps3_ohci_driver_register(_SYSTEM_BUS_DRIVER);
@@ -1318,7 +1314,6 @@ static int __init ohci_hcd_mod_init(void)
 #endif
debugfs_remove(ohci_debug_root);
ohci_debug_root = NULL;
- error_debug:
 
clear_bit(USB_OHCI_LOADED, _hcds_loaded);
return retval;
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 508a803139dd..ef4813bfc5bf 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -431,9 +431,6 @@ struct ohci_hcd {
struct work_struct  nec_work;   /* Worker for NEC quirk */
 
struct dentry   *debug_dir;
-   struct dentry   *debug_async;
-   struct dentry   *debug_periodic;
-   struct dentry   *debug_registers;
 
/* platform-specific data -- must come last */
unsigned long   priv[0] __aligned(sizeof(s64));
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/22] USB: dwc2: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Minas Harutyunyan 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/dwc2/debugfs.c | 78 --
 1 file changed, 16 insertions(+), 62 deletions(-)

diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c
index 7e6618ad9f21..d0bdb7997557 100644
--- a/drivers/usb/dwc2/debugfs.c
+++ b/drivers/usb/dwc2/debugfs.c
@@ -294,52 +294,30 @@ DEFINE_SHOW_ATTRIBUTE(ep);
 static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg)
 {
struct dentry *root;
-   struct dentry *file;
unsigned int epidx;
 
root = hsotg->debug_root;
 
/* create general state file */
-
-   file = debugfs_create_file("state", 0444, root, hsotg, _fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "%s: failed to create state\n", __func__);
-
-   file = debugfs_create_file("testmode", 0644, root, hsotg,
-  _fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "%s: failed to create testmode\n",
-   __func__);
-
-   file = debugfs_create_file("fifo", 0444, root, hsotg, _fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "%s: failed to create fifo\n", __func__);
+   debugfs_create_file("state", 0444, root, hsotg, _fops);
+   debugfs_create_file("testmode", 0644, root, hsotg, _fops);
+   debugfs_create_file("fifo", 0444, root, hsotg, _fops);
 
/* Create one file for each out endpoint */
for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
struct dwc2_hsotg_ep *ep;
 
ep = hsotg->eps_out[epidx];
-   if (ep) {
-   file = debugfs_create_file(ep->name, 0444,
-  root, ep, _fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "failed to create %s debug 
file\n",
-   ep->name);
-   }
+   if (ep)
+   debugfs_create_file(ep->name, 0444, root, ep, _fops);
}
/* Create one file for each in endpoint. EP0 is handled with out eps */
for (epidx = 1; epidx < hsotg->num_of_eps; epidx++) {
struct dwc2_hsotg_ep *ep;
 
ep = hsotg->eps_in[epidx];
-   if (ep) {
-   file = debugfs_create_file(ep->name, 0444,
-  root, ep, _fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "failed to create %s debug 
file\n",
-   ep->name);
-   }
+   if (ep)
+   debugfs_create_file(ep->name, 0444, root, ep, _fops);
}
 }
 #else
@@ -792,32 +770,14 @@ DEFINE_SHOW_ATTRIBUTE(dr_mode);
 int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
 {
int ret;
-   struct dentry   *file;
+   struct dentry   *root;
 
-   hsotg->debug_root = debugfs_create_dir(dev_name(hsotg->dev), NULL);
-   if (!hsotg->debug_root) {
-   ret = -ENOMEM;
-   goto err0;
-   }
+   root = debugfs_create_dir(dev_name(hsotg->dev), NULL);
+   hsotg->debug_root = root;
 
-   file = debugfs_create_file("params", 0444,
-  hsotg->debug_root,
-  hsotg, _fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "%s: failed to create params\n", __func__);
-
-   file = debugfs_create_file("hw_params", 0444,
-  hsotg->debug_root,
-  hsotg, _params_fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "%s: failed to create hw_params\n",
-   __func__);
-
-   file = debugfs_create_file("dr_mode", 0444,
-  hsotg->debug_root,
-  hsotg, _mode_fops);
-   if (IS_ERR(file))
-   dev_err(hsotg->dev, "%s: failed to create dr_mode\n", __func__);
+   debugfs_create_file("params", 0444, root, hsotg, _fops);
+   debugfs_create_file("hw_params", 0444, root, hsotg, _params_fops);
+   debugfs_create_file("dr_mode", 0444, root, hsotg, _mode_fops);
 
/* Add gadget debugfs nodes */
dwc2_hsotg_create_debug(hsotg);
@@ -826,24 +786,18 @@ int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
GFP_KERNEL);
if (!hsotg->regset) {
ret = -ENOMEM;
-   goto err1;
+   goto err;
}
 
hsotg->regset->regs = dwc2_regs;
hsotg->regset->nregs = ARRAY_SIZE(dwc2_regs);
   

[PATCH 22/22] USB: gadget: udc: s3c2410_udc: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi 
Cc: Li Yang 
Cc: Nicolas Ferre 
Cc: Robert Jarzmik 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/udc/s3c2410_udc.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c 
b/drivers/usb/gadget/udc/s3c2410_udc.c
index f154f49e98c8..8bf5ad7a59ad 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.c
+++ b/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -1871,13 +1871,9 @@ static int s3c2410_udc_probe(struct platform_device 
*pdev)
if (retval)
goto err_add_udc;
 
-   if (s3c2410_udc_debugfs_root) {
-   udc->regs_info = debugfs_create_file("registers", S_IRUGO,
-   s3c2410_udc_debugfs_root,
-   udc, _udc_debugfs_fops);
-   if (!udc->regs_info)
-   dev_warn(dev, "debugfs file creation failed\n");
-   }
+   udc->regs_info = debugfs_create_file("registers", S_IRUGO,
+s3c2410_udc_debugfs_root, udc,
+_udc_debugfs_fops);
 
dev_dbg(dev, "probe ok\n");
 
@@ -1994,11 +1990,6 @@ static int __init udc_init(void)
dprintk(DEBUG_NORMAL, "%s\n", gadget_name);
 
s3c2410_udc_debugfs_root = debugfs_create_dir(gadget_name, NULL);
-   if (IS_ERR(s3c2410_udc_debugfs_root)) {
-   pr_err("%s: debugfs dir creation failed %ld\n",
-   gadget_name, PTR_ERR(s3c2410_udc_debugfs_root));
-   s3c2410_udc_debugfs_root = NULL;
-   }
 
retval = platform_driver_register(_driver_24x0);
if (retval)
@@ -2014,7 +2005,7 @@ static int __init udc_init(void)
 static void __exit udc_exit(void)
 {
platform_driver_unregister(_driver_24x0);
-   debugfs_remove(s3c2410_udc_debugfs_root);
+   debugfs_remove_recursive(s3c2410_udc_debugfs_root);
 }
 
 module_init(udc_init);
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/22] USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Felipe Balbi 
Cc: Andy Shevchenko 
Cc: "Paul E. McKenney" 
Cc: Mark Rutland 
Cc: Jaejoong Kim 
Cc: Li Yang 
Cc: Johan Hovold 
Cc: Robert Jarzmik 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/udc/gr_udc.c | 7 ++-
 drivers/usb/gadget/udc/gr_udc.h | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
index ca83c15d8ea4..729e60e49564 100644
--- a/drivers/usb/gadget/udc/gr_udc.c
+++ b/drivers/usb/gadget/udc/gr_udc.c
@@ -209,15 +209,12 @@ static void gr_dfs_create(struct gr_udc *dev)
const char *name = "gr_udc_state";
 
dev->dfs_root = debugfs_create_dir(dev_name(dev->dev), NULL);
-   dev->dfs_state = debugfs_create_file(name, 0444, dev->dfs_root, dev,
-_dfs_fops);
+   debugfs_create_file(name, 0444, dev->dfs_root, dev, _dfs_fops);
 }
 
 static void gr_dfs_delete(struct gr_udc *dev)
 {
-   /* Handles NULL and ERR pointers internally */
-   debugfs_remove(dev->dfs_state);
-   debugfs_remove(dev->dfs_root);
+   debugfs_remove_recursive(dev->dfs_root);
 }
 
 #else /* !CONFIG_USB_GADGET_DEBUG_FS */
diff --git a/drivers/usb/gadget/udc/gr_udc.h b/drivers/usb/gadget/udc/gr_udc.h
index 3e913268c8c5..417ad2aa2cc7 100644
--- a/drivers/usb/gadget/udc/gr_udc.h
+++ b/drivers/usb/gadget/udc/gr_udc.h
@@ -217,7 +217,6 @@ struct gr_udc {
spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */
 
struct dentry *dfs_root;
-   struct dentry *dfs_state;
 };
 
 #define to_gr_udc(gadget)  (container_of((gadget), struct gr_udc, gadget))
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/22] USB: musb: clean up debugfs file and directory creation

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Because of this, lots of init functions do not need to have return
values, so this cleans up a lot of unused error handling code that never
could have triggered in the past.

Cc: Bin Liu 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/musb/musb_core.c|  5 +---
 drivers/usb/musb/musb_debug.h   |  5 ++--
 drivers/usb/musb/musb_debugfs.c | 44 ++---
 drivers/usb/musb/musb_dsps.c|  9 +--
 4 files changed, 11 insertions(+), 52 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 5cc64980058b..b7d56272f9d1 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2387,9 +2387,7 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
if (status < 0)
goto fail3;
 
-   status = musb_init_debugfs(musb);
-   if (status < 0)
-   goto fail4;
+   musb_init_debugfs(musb);
 
status = sysfs_create_group(>controller->kobj, _attr_group);
if (status)
@@ -2404,7 +2402,6 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
 fail5:
musb_exit_debugfs(musb);
 
-fail4:
musb_gadget_cleanup(musb);
musb_host_cleanup(musb);
 
diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h
index 5e0f079dde21..c444a80fe1da 100644
--- a/drivers/usb/musb/musb_debug.h
+++ b/drivers/usb/musb/musb_debug.h
@@ -20,12 +20,11 @@
 void musb_dbg(struct musb *musb, const char *fmt, ...);
 
 #ifdef CONFIG_DEBUG_FS
-int musb_init_debugfs(struct musb *musb);
+void musb_init_debugfs(struct musb *musb);
 void musb_exit_debugfs(struct musb *musb);
 #else
-static inline int musb_init_debugfs(struct musb *musb)
+static inline void musb_init_debugfs(struct musb *musb)
 {
-   return 0;
 }
 static inline void musb_exit_debugfs(struct musb *musb)
 {
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index e2050cac3eae..f42858e2b54c 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -321,48 +321,18 @@ static const struct file_operations musb_softconnect_fops 
= {
.release= single_release,
 };
 
-int musb_init_debugfs(struct musb *musb)
+void musb_init_debugfs(struct musb *musb)
 {
-   struct dentry   *root;
-   struct dentry   *file;
-   int ret;
+   struct dentry *root;
 
root = debugfs_create_dir(dev_name(musb->controller), NULL);
-   if (!root) {
-   ret = -ENOMEM;
-   goto err0;
-   }
-
-   file = debugfs_create_file("regdump", S_IRUGO, root, musb,
-   _regdump_fops);
-   if (!file) {
-   ret = -ENOMEM;
-   goto err1;
-   }
-
-   file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR,
-   root, musb, _test_mode_fops);
-   if (!file) {
-   ret = -ENOMEM;
-   goto err1;
-   }
-
-   file = debugfs_create_file("softconnect", S_IRUGO | S_IWUSR,
-   root, musb, _softconnect_fops);
-   if (!file) {
-   ret = -ENOMEM;
-   goto err1;
-   }
-
musb->debugfs_root = root;
 
-   return 0;
-
-err1:
-   debugfs_remove_recursive(root);
-
-err0:
-   return ret;
+   debugfs_create_file("regdump", S_IRUGO, root, musb, _regdump_fops);
+   debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, musb,
+   _test_mode_fops);
+   debugfs_create_file("softconnect", S_IRUGO | S_IWUSR, root, musb,
+   _softconnect_fops);
 }
 
 void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index cfe6bfcbeb5d..fb871eabcc10 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -399,24 +399,17 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
 static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue)
 {
struct dentry *root;
-   struct dentry *file;
char buf[128];
 
sprintf(buf, "%s.dsps", dev_name(musb->controller));
root = debugfs_create_dir(buf, NULL);
-   if (!root)
-   return -ENOMEM;
glue->dbgfs_root = root;
 
glue->regset.regs = dsps_musb_regs;
glue->regset.nregs = ARRAY_SIZE(dsps_musb_regs);
glue->regset.base = musb->ctrl_base;
 
-   file = debugfs_create_regset32("regdump", S_IRUGO, root, >regset);
-   if (!file) {
-   debugfs_remove_recursive(root);
-   return -ENOMEM;
-   }
+   debugfs_create_regset32("regdump", S_IRUGO, root, >regset);
return 0;
 }
 
-- 
2.17.0

--
To unsubscribe 

[PATCH 06/22] USB: uhci: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Alan Stern 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/uhci-hcd.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index f9c3947577fc..6218bfe54f52 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -590,14 +590,10 @@ static int uhci_start(struct usb_hcd *hcd)
init_waitqueue_head(>waitqh);
 
 #ifdef UHCI_DEBUG_OPS
-   dentry = debugfs_create_file(hcd->self.bus_name,
-   S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root,
-   uhci, _debug_operations);
-   if (!dentry) {
-   dev_err(uhci_dev(uhci), "couldn't create uhci debugfs entry\n");
-   return -ENOMEM;
-   }
-   uhci->dentry = dentry;
+   uhci->dentry = debugfs_create_file(hcd->self.bus_name,
+  S_IFREG|S_IRUGO|S_IWUSR,
+  uhci_debugfs_root, uhci,
+  _debug_operations);
 #endif
 
uhci->frame = dma_zalloc_coherent(uhci_dev(uhci),
@@ -882,8 +878,6 @@ static int __init uhci_hcd_init(void)
if (!errbuf)
goto errbuf_failed;
uhci_debugfs_root = debugfs_create_dir("uhci", usb_debug_root);
-   if (!uhci_debugfs_root)
-   goto debug_failed;
 #endif
 
uhci_up_cachep = kmem_cache_create("uhci_urb_priv",
@@ -918,7 +912,6 @@ static int __init uhci_hcd_init(void)
 #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
debugfs_remove(uhci_debugfs_root);
 
-debug_failed:
kfree(errbuf);
 
 errbuf_failed:
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/22] USB: imx21-hcd: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi 
Cc: Johan Hovold 
Cc: Andy Shevchenko 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/imx21-dbg.c | 44 
 1 file changed, 10 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/host/imx21-dbg.c b/drivers/usb/host/imx21-dbg.c
index a213ed6f07b5..7fcf1d9dd7f3 100644
--- a/drivers/usb/host/imx21-dbg.c
+++ b/drivers/usb/host/imx21-dbg.c
@@ -417,46 +417,22 @@ DEFINE_SHOW_ATTRIBUTE(debug_isoc);
 
 static void create_debug_files(struct imx21 *imx21)
 {
-   imx21->debug_root = debugfs_create_dir(dev_name(imx21->dev), NULL);
-   if (!imx21->debug_root)
-   goto failed_create_rootdir;
+   struct dentry *root;
 
-   if (!debugfs_create_file("status", S_IRUGO,
-   imx21->debug_root, imx21, _status_fops))
-   goto failed_create;
+   root = debugfs_create_dir(dev_name(imx21->dev), NULL);
+   imx21->debug_root = root;
 
-   if (!debugfs_create_file("dmem", S_IRUGO,
-   imx21->debug_root, imx21, _dmem_fops))
-   goto failed_create;
-
-   if (!debugfs_create_file("etd", S_IRUGO,
-   imx21->debug_root, imx21, _etd_fops))
-   goto failed_create;
-
-   if (!debugfs_create_file("statistics", S_IRUGO,
-   imx21->debug_root, imx21, _statistics_fops))
-   goto failed_create;
-
-   if (!debugfs_create_file("isoc", S_IRUGO,
-   imx21->debug_root, imx21, _isoc_fops))
-   goto failed_create;
-
-   return;
-
-failed_create:
-   debugfs_remove_recursive(imx21->debug_root);
-
-failed_create_rootdir:
-   imx21->debug_root = NULL;
+   debugfs_create_file("status", S_IRUGO, root, imx21, _status_fops);
+   debugfs_create_file("dmem", S_IRUGO, root, imx21, _dmem_fops);
+   debugfs_create_file("etd", S_IRUGO, root, imx21, _etd_fops);
+   debugfs_create_file("statistics", S_IRUGO, root, imx21,
+   _statistics_fops);
+   debugfs_create_file("isoc", S_IRUGO, root, imx21, _isoc_fops);
 }
 
-
 static void remove_debug_files(struct imx21 *imx21)
 {
-   if (imx21->debug_root) {
-   debugfs_remove_recursive(imx21->debug_root);
-   imx21->debug_root = NULL;
-   }
+   debugfs_remove_recursive(imx21->debug_root);
 }
 
 #endif
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/22] USB: isp116x-hcd: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Olav Kongas 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/isp116x-hcd.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 4602ed801f0a..74da136d322a 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1198,14 +1198,11 @@ static int isp116x_debug_show(struct seq_file *s, void 
*unused)
 }
 DEFINE_SHOW_ATTRIBUTE(isp116x_debug);
 
-static int create_debug_file(struct isp116x *isp116x)
+static void create_debug_file(struct isp116x *isp116x)
 {
isp116x->dentry = debugfs_create_file(hcd_name,
  S_IRUGO, NULL, isp116x,
  _debug_fops);
-   if (!isp116x->dentry)
-   return -ENOMEM;
-   return 0;
 }
 
 static void remove_debug_file(struct isp116x *isp116x)
@@ -1215,8 +1212,8 @@ static void remove_debug_file(struct isp116x *isp116x)
 
 #else
 
-#definecreate_debug_file(d)0
-#defineremove_debug_file(d)do{}while(0)
+static inline void create_debug_file(struct isp116x *isp116x) { }
+static inline void remove_debug_file(struct isp116x *isp116x) { }
 
 #endif /* CONFIG_DEBUG_FS */
 
@@ -1643,16 +1640,10 @@ static int isp116x_probe(struct platform_device *pdev)
 
device_wakeup_enable(hcd->self.controller);
 
-   ret = create_debug_file(isp116x);
-   if (ret) {
-   ERR("Couldn't create debugfs entry\n");
-   goto err7;
-   }
+   create_debug_file(isp116x);
 
return 0;
 
-  err7:
-   usb_remove_hcd(hcd);
   err6:
usb_put_hcd(hcd);
   err5:
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/22] USB: fotg210-hcd: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi 
Cc: Alan Stern 
Cc: Johan Hovold 
Cc: Kuppuswamy Sathyanarayanan 
Cc: Vasyl Gomonovych 
Cc: Mariusz Skamra 
Cc: "Gustavo A. R. Silva" 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/fotg210-hcd.c | 34 +-
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index d8abf401918a..e64eb47770c8 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -844,28 +844,16 @@ static int debug_registers_open(struct inode *inode, 
struct file *file)
 static inline void create_debug_files(struct fotg210_hcd *fotg210)
 {
struct usb_bus *bus = _to_hcd(fotg210)->self;
+   struct dentry *root;
 
-   fotg210->debug_dir = debugfs_create_dir(bus->bus_name,
-   fotg210_debug_root);
-   if (!fotg210->debug_dir)
-   return;
-
-   if (!debugfs_create_file("async", S_IRUGO, fotg210->debug_dir, bus,
-   _async_fops))
-   goto file_error;
-
-   if (!debugfs_create_file("periodic", S_IRUGO, fotg210->debug_dir, bus,
-   _periodic_fops))
-   goto file_error;
+   root = debugfs_create_dir(bus->bus_name, fotg210_debug_root);
+   fotg210->debug_dir = root;
 
-   if (!debugfs_create_file("registers", S_IRUGO, fotg210->debug_dir, bus,
-   _registers_fops))
-   goto file_error;
-
-   return;
-
-file_error:
-   debugfs_remove_recursive(fotg210->debug_dir);
+   debugfs_create_file("async", S_IRUGO, root, bus, _async_fops);
+   debugfs_create_file("periodic", S_IRUGO, root, bus,
+   _periodic_fops);
+   debugfs_create_file("registers", S_IRUGO, root, bus,
+   _registers_fops);
 }
 
 static inline void remove_debug_files(struct fotg210_hcd *fotg210)
@@ -5686,10 +5674,6 @@ static int __init fotg210_hcd_init(void)
sizeof(struct fotg210_itd));
 
fotg210_debug_root = debugfs_create_dir("fotg210", usb_debug_root);
-   if (!fotg210_debug_root) {
-   retval = -ENOENT;
-   goto err_debug;
-   }
 
retval = platform_driver_register(_hcd_driver);
if (retval < 0)
@@ -5699,7 +5683,7 @@ static int __init fotg210_hcd_init(void)
 clean:
debugfs_remove(fotg210_debug_root);
fotg210_debug_root = NULL;
-err_debug:
+
clear_bit(USB_EHCI_LOADED, _hcds_loaded);
return retval;
 }
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/22] USB: typec: tcpm: no need to check return value of debugfs_create_dir()

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Clean up the tcpm.c code to not care about this, turns out no one was
even checking the return value of this function, so it didn't matter.

Note, I do not think this code can be removed in a running system, as
the debugfs root directory will stick around, that should be fixed
someday...

Cc: Heikki Krogerus 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/typec/tcpm.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 0ccd2ce1eb59..8a201dd53d36 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -566,21 +566,16 @@ DEFINE_SHOW_ATTRIBUTE(tcpm_debug);
 
 static struct dentry *rootdir;
 
-static int tcpm_debugfs_init(struct tcpm_port *port)
+static void tcpm_debugfs_init(struct tcpm_port *port)
 {
mutex_init(>logbuffer_lock);
/* /sys/kernel/debug/tcpm/usbcX */
-   if (!rootdir) {
+   if (!rootdir)
rootdir = debugfs_create_dir("tcpm", NULL);
-   if (!rootdir)
-   return -ENOMEM;
-   }
 
port->dentry = debugfs_create_file(dev_name(port->dev),
   S_IFREG | 0444, rootdir,
   port, _debug_fops);
-
-   return 0;
 }
 
 static void tcpm_debugfs_exit(struct tcpm_port *port)
@@ -595,7 +590,7 @@ static void tcpm_log(const struct tcpm_port *port, const 
char *fmt, ...) { }
 __printf(2, 3)
 static void tcpm_log_force(struct tcpm_port *port, const char *fmt, ...) { }
 static void tcpm_log_source_caps(struct tcpm_port *port) { }
-static int tcpm_debugfs_init(const struct tcpm_port *port) { return 0; }
+static void tcpm_debugfs_init(const struct tcpm_port *port) { }
 static void tcpm_debugfs_exit(const struct tcpm_port *port) { }
 
 #endif
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/22] USB: typec: fsusb302: no need to check return value of debugfs_create_dir()

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Clean up the fsusb302 driver to not care about the dentry being created,
or if the root directory was created, as the code should work properly
either way.  We do not need to save the dentry anymore as things are
properly cleaned up when we remove the root directory.

Note, this driver seems to only work for one device per system,
otherwise the debugfs directories are going to get confused when a
device is removed.

Cc: Heikki Krogerus 
Cc: Guenter Roeck 
Cc: Hans de Goede 
Cc: Andy Shevchenko 
Cc: Adam Thomson 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/typec/fusb302/fusb302.c | 24 +++-
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/typec/fusb302/fusb302.c 
b/drivers/usb/typec/fusb302/fusb302.c
index 9c1eba9ea004..07b07ddf6af0 100644
--- a/drivers/usb/typec/fusb302/fusb302.c
+++ b/drivers/usb/typec/fusb302/fusb302.c
@@ -117,7 +117,6 @@ struct fusb302_chip {
u32 snk_pdo[PDO_MAX_OBJECTS];
 
 #ifdef CONFIG_DEBUG_FS
-   struct dentry *dentry;
/* lock for log buffer access */
struct mutex logbuffer_lock;
int logbuffer_head;
@@ -215,33 +214,26 @@ DEFINE_SHOW_ATTRIBUTE(fusb302_debug);
 
 static struct dentry *rootdir;
 
-static int fusb302_debugfs_init(struct fusb302_chip *chip)
+static void fusb302_debugfs_init(struct fusb302_chip *chip)
 {
mutex_init(>logbuffer_lock);
-   if (!rootdir) {
+   if (!rootdir)
rootdir = debugfs_create_dir("fusb302", NULL);
-   if (!rootdir)
-   return -ENOMEM;
-   }
-
-   chip->dentry = debugfs_create_file(dev_name(chip->dev),
-  S_IFREG | 0444, rootdir,
-  chip, _debug_fops);
 
-   return 0;
+   debugfs_create_file(dev_name(chip->dev), S_IFREG | 0444, rootdir, chip,
+   _debug_fops);
 }
 
 static void fusb302_debugfs_exit(struct fusb302_chip *chip)
 {
-   debugfs_remove(chip->dentry);
-   debugfs_remove(rootdir);
+   debugfs_remove_recursive(rootdir);
 }
 
 #else
 
 static void fusb302_log(const struct fusb302_chip *chip,
const char *fmt, ...) { }
-static int fusb302_debugfs_init(const struct fusb302_chip *chip) { return 0; }
+static void fusb302_debugfs_init(const struct fusb302_chip *chip) { }
 static void fusb302_debugfs_exit(const struct fusb302_chip *chip) { }
 
 #endif
@@ -1773,9 +1765,7 @@ static int fusb302_probe(struct i2c_client *client,
return -EPROBE_DEFER;
}
 
-   ret = fusb302_debugfs_init(chip);
-   if (ret < 0)
-   return ret;
+   fusb302_debugfs_init(chip);
 
chip->wq = create_singlethread_workqueue(dev_name(chip->dev));
if (!chip->wq) {
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/22] USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Daniel Mack 
Cc: Haojian Zhuang 
Cc: Robert Jarzmik 
Cc: Felipe Balbi 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 43 -
 drivers/usb/gadget/udc/pxa27x_udc.h |  3 --
 2 files changed, 6 insertions(+), 40 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c 
b/drivers/usb/gadget/udc/pxa27x_udc.c
index a58242e901df..014233252299 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -205,50 +205,19 @@ DEFINE_SHOW_ATTRIBUTE(eps_dbg);
 
 static void pxa_init_debugfs(struct pxa_udc *udc)
 {
-   struct dentry *root, *state, *queues, *eps;
+   struct dentry *root;
 
root = debugfs_create_dir(udc->gadget.name, NULL);
-   if (IS_ERR(root) || !root)
-   goto err_root;
-
-   state = debugfs_create_file("udcstate", 0400, root, udc,
-   _dbg_fops);
-   if (!state)
-   goto err_state;
-   queues = debugfs_create_file("queues", 0400, root, udc,
-   _dbg_fops);
-   if (!queues)
-   goto err_queues;
-   eps = debugfs_create_file("epstate", 0400, root, udc,
-   _dbg_fops);
-   if (!eps)
-   goto err_eps;
-
udc->debugfs_root = root;
-   udc->debugfs_state = state;
-   udc->debugfs_queues = queues;
-   udc->debugfs_eps = eps;
-   return;
-err_eps:
-   debugfs_remove(eps);
-err_queues:
-   debugfs_remove(queues);
-err_state:
-   debugfs_remove(root);
-err_root:
-   dev_err(udc->dev, "debugfs is not available\n");
+
+   debugfs_create_file("udcstate", 0400, root, udc, _dbg_fops);
+   debugfs_create_file("queues", 0400, root, udc, _dbg_fops);
+   debugfs_create_file("epstate", 0400, root, udc, _dbg_fops);
 }
 
 static void pxa_cleanup_debugfs(struct pxa_udc *udc)
 {
-   debugfs_remove(udc->debugfs_eps);
-   debugfs_remove(udc->debugfs_queues);
-   debugfs_remove(udc->debugfs_state);
-   debugfs_remove(udc->debugfs_root);
-   udc->debugfs_eps = NULL;
-   udc->debugfs_queues = NULL;
-   udc->debugfs_state = NULL;
-   udc->debugfs_root = NULL;
+   debugfs_remove_recursive(udc->debugfs_root);
 }
 
 #else
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h 
b/drivers/usb/gadget/udc/pxa27x_udc.h
index 1128d39a4255..13b2977399ab 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.h
+++ b/drivers/usb/gadget/udc/pxa27x_udc.h
@@ -476,9 +476,6 @@ struct pxa_udc {
 #endif
 #ifdef CONFIG_USB_GADGET_DEBUG_FS
struct dentry   *debugfs_root;
-   struct dentry   *debugfs_state;
-   struct dentry   *debugfs_queues;
-   struct dentry   *debugfs_eps;
 #endif
 };
 #define to_pxa(g)  (container_of((g), struct pxa_udc, gadget))
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/22] USB: ehci-hcd: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Alan Stern 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/host/ehci-dbg.c | 30 --
 drivers/usb/host/ehci-hcd.c |  5 -
 2 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 3ed75aaa09d9..7619cfb06883 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1028,29 +1028,15 @@ static inline void create_debug_files(struct ehci_hcd 
*ehci)
struct usb_bus *bus = _to_hcd(ehci)->self;
 
ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root);
-   if (!ehci->debug_dir)
-   return;
 
-   if (!debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus,
-   _async_fops))
-   goto file_error;
-
-   if (!debugfs_create_file("bandwidth", S_IRUGO, ehci->debug_dir, bus,
-   _bandwidth_fops))
-   goto file_error;
-
-   if (!debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus,
-   _periodic_fops))
-   goto file_error;
-
-   if (!debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus,
-   _registers_fops))
-   goto file_error;
-
-   return;
-
-file_error:
-   debugfs_remove_recursive(ehci->debug_dir);
+   debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus,
+   _async_fops);
+   debugfs_create_file("bandwidth", S_IRUGO, ehci->debug_dir, bus,
+   _bandwidth_fops);
+   debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus,
+   _periodic_fops);
+   debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus,
+   _registers_fops);
 }
 
 static inline void remove_debug_files(struct ehci_hcd *ehci)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d927adf3afcd..89c47ae5c7d3 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1311,10 +1311,6 @@ static int __init ehci_hcd_init(void)
 
 #ifdef CONFIG_DYNAMIC_DEBUG
ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root);
-   if (!ehci_debug_root) {
-   retval = -ENOENT;
-   goto err_debug;
-   }
 #endif
 
 #ifdef PLATFORM_DRIVER
@@ -1361,7 +1357,6 @@ static int __init ehci_hcd_init(void)
 #ifdef CONFIG_DYNAMIC_DEBUG
debugfs_remove(ehci_debug_root);
ehci_debug_root = NULL;
-err_debug:
 #endif
clear_bit(USB_EHCI_LOADED, _hcds_loaded);
return retval;
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/22] USB: udc: atmel_usba_udc: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

There is also no need to keep the file dentries around at all, so remove
those variables from the device structure.

Cc: Nicolas Ferre 
Cc: Felipe Balbi 
Cc: Alexandre Belloni 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 71 -
 drivers/usb/gadget/udc/atmel_usba_udc.h |  4 --
 2 files changed, 11 insertions(+), 64 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 2f586f2bda7e..a4d99bf50f2f 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -206,94 +206,45 @@ static void usba_ep_init_debugfs(struct usba_udc *udc,
struct dentry *ep_root;
 
ep_root = debugfs_create_dir(ep->ep.name, udc->debugfs_root);
-   if (!ep_root)
-   goto err_root;
ep->debugfs_dir = ep_root;
 
-   ep->debugfs_queue = debugfs_create_file("queue", 0400, ep_root,
-   ep, _dbg_fops);
-   if (!ep->debugfs_queue)
-   goto err_queue;
-
-   if (ep->can_dma) {
-   ep->debugfs_dma_status
-   = debugfs_create_u32("dma_status", 0400, ep_root,
-   >last_dma_status);
-   if (!ep->debugfs_dma_status)
-   goto err_dma_status;
-   }
-   if (ep_is_control(ep)) {
-   ep->debugfs_state
-   = debugfs_create_u32("state", 0400, ep_root,
-   >state);
-   if (!ep->debugfs_state)
-   goto err_state;
-   }
-
-   return;
-
-err_state:
+   debugfs_create_file("queue", 0400, ep_root, ep, _dbg_fops);
if (ep->can_dma)
-   debugfs_remove(ep->debugfs_dma_status);
-err_dma_status:
-   debugfs_remove(ep->debugfs_queue);
-err_queue:
-   debugfs_remove(ep_root);
-err_root:
-   dev_err(>udc->pdev->dev,
-   "failed to create debugfs directory for %s\n", ep->ep.name);
+   debugfs_create_u32("dma_status", 0400, ep_root,
+  >last_dma_status);
+   if (ep_is_control(ep))
+   debugfs_create_u32("state", 0400, ep_root, >state);
 }
 
 static void usba_ep_cleanup_debugfs(struct usba_ep *ep)
 {
-   debugfs_remove(ep->debugfs_queue);
-   debugfs_remove(ep->debugfs_dma_status);
-   debugfs_remove(ep->debugfs_state);
-   debugfs_remove(ep->debugfs_dir);
-   ep->debugfs_dma_status = NULL;
-   ep->debugfs_dir = NULL;
+   debugfs_remove_recursive(ep->debugfs_dir);
 }
 
 static void usba_init_debugfs(struct usba_udc *udc)
 {
-   struct dentry *root, *regs;
+   struct dentry *root;
struct resource *regs_resource;
 
root = debugfs_create_dir(udc->gadget.name, NULL);
-   if (IS_ERR(root) || !root)
-   goto err_root;
udc->debugfs_root = root;
 
regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM,
CTRL_IOMEM_ID);
 
if (regs_resource) {
-   regs = debugfs_create_file_size("regs", 0400, root, udc,
-   _dbg_fops,
-   resource_size(regs_resource));
-   if (!regs)
-   goto err_regs;
-   udc->debugfs_regs = regs;
+   debugfs_create_file_size("regs", 0400, root, udc,
+_dbg_fops,
+resource_size(regs_resource));
}
 
usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0));
-
-   return;
-
-err_regs:
-   debugfs_remove(root);
-err_root:
-   udc->debugfs_root = NULL;
-   dev_err(>pdev->dev, "debugfs is not available\n");
 }
 
 static void usba_cleanup_debugfs(struct usba_udc *udc)
 {
usba_ep_cleanup_debugfs(to_usba_ep(udc->gadget.ep0));
-   debugfs_remove(udc->debugfs_regs);
-   debugfs_remove(udc->debugfs_root);
-   udc->debugfs_regs = NULL;
-   udc->debugfs_root = NULL;
+   debugfs_remove_recursive(udc->debugfs_root);
 }
 #else
 static inline void usba_ep_init_debugfs(struct usba_udc *udc,
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h 
b/drivers/usb/gadget/udc/atmel_usba_udc.h
index d7eb7cf4fd5c..030bf797cd25 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -287,9 +287,6 @@ struct usba_ep {
 #ifdef CONFIG_USB_GADGET_DEBUG_FS
u32 last_dma_status;
struct dentry   *debugfs_dir;
-   struct dentry   *debugfs_queue;
-   struct dentry

[PATCH 21/22] USB: gadget: udc: renesas_usb3: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Felipe Balbi 
Cc: Yoshihiro Shimoda 
Cc: Simon Horman 
Cc: Geert Uytterhoeven 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/gadget/udc/renesas_usb3.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c 
b/drivers/usb/gadget/udc/renesas_usb3.c
index 5caf78bbbf7c..977ea1a02cf9 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2391,22 +2391,10 @@ static const struct file_operations 
renesas_usb3_b_device_fops = {
 static void renesas_usb3_debugfs_init(struct renesas_usb3 *usb3,
  struct device *dev)
 {
-   struct dentry *root, *file;
+   usb3->dentry = debugfs_create_dir(dev_name(dev), NULL);
 
-   root = debugfs_create_dir(dev_name(dev), NULL);
-   if (IS_ERR_OR_NULL(root)) {
-   dev_info(dev, "%s: Can't create the root\n", __func__);
-   return;
-   }
-
-   file = debugfs_create_file("b_device", 0644, root, usb3,
-  _usb3_b_device_fops);
-   if (!file) {
-   dev_info(dev, "%s: Can't create debugfs mode\n", __func__);
-   debugfs_remove_recursive(root);
-   } else {
-   usb3->dentry = root;
-   }
+   debugfs_create_file("b_device", 0644, usb3->dentry, usb3,
+   _usb3_b_device_fops);
 }
 
 /*--- platform_driver */
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/22] USB: mon: no need to check return value of debugfs_create functions

2018-05-29 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

We do need to save the dentries for these files, so keep them around,
but no need to check if they are "valid" or not, as the code works just
as well either way.

Cc: Pete Zaitcev 
Cc: Philippe Ombredanne 
Cc: Fredrik Noring 
Cc: Kate Stewart 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/usb/mon/mon_text.c | 37 +++--
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 984f7e12a6a5..bc5ecd5ff565 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -700,7 +700,6 @@ static const struct file_operations mon_fops_text_u = {
 
 int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus)
 {
-   struct dentry *d;
enum { NAMESZ = 10 };
char name[NAMESZ];
int busnum = ubus? ubus->busnum: 0;
@@ -713,42 +712,32 @@ int mon_text_add(struct mon_bus *mbus, const struct 
usb_bus *ubus)
rc = snprintf(name, NAMESZ, "%dt", busnum);
if (rc <= 0 || rc >= NAMESZ)
goto err_print_t;
-   d = debugfs_create_file(name, 0600, mon_dir, mbus,
+   mbus->dent_t = debugfs_create_file(name, 0600, mon_dir, mbus,
 _fops_text_t);
-   if (d == NULL)
-   goto err_create_t;
-   mbus->dent_t = d;
}
 
rc = snprintf(name, NAMESZ, "%du", busnum);
if (rc <= 0 || rc >= NAMESZ)
goto err_print_u;
-   d = debugfs_create_file(name, 0600, mon_dir, mbus, _fops_text_u);
-   if (d == NULL)
-   goto err_create_u;
-   mbus->dent_u = d;
+   mbus->dent_u = debugfs_create_file(name, 0600, mon_dir, mbus,
+  _fops_text_u);
 
rc = snprintf(name, NAMESZ, "%ds", busnum);
if (rc <= 0 || rc >= NAMESZ)
goto err_print_s;
-   d = debugfs_create_file(name, 0600, mon_dir, mbus, _fops_stat);
-   if (d == NULL)
-   goto err_create_s;
-   mbus->dent_s = d;
+   mbus->dent_s = debugfs_create_file(name, 0600, mon_dir, mbus,
+  _fops_stat);
 
return 1;
 
-err_create_s:
 err_print_s:
debugfs_remove(mbus->dent_u);
mbus->dent_u = NULL;
-err_create_u:
 err_print_u:
if (ubus != NULL) {
debugfs_remove(mbus->dent_t);
mbus->dent_t = NULL;
}
-err_create_t:
 err_print_t:
return 0;
 }
@@ -756,8 +745,7 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus 
*ubus)
 void mon_text_del(struct mon_bus *mbus)
 {
debugfs_remove(mbus->dent_u);
-   if (mbus->dent_t != NULL)
-   debugfs_remove(mbus->dent_t);
+   debugfs_remove(mbus->dent_t);
debugfs_remove(mbus->dent_s);
 }
 
@@ -775,18 +763,7 @@ static void mon_text_ctor(void *mem)
 
 int __init mon_text_init(void)
 {
-   struct dentry *mondir;
-
-   mondir = debugfs_create_dir("usbmon", usb_debug_root);
-   if (IS_ERR(mondir)) {
-   /* debugfs not available, but we can use usbmon without it */
-   return 0;
-   }
-   if (mondir == NULL) {
-   printk(KERN_NOTICE TAG ": unable to create usbmon directory\n");
-   return -ENOMEM;
-   }
-   mon_dir = mondir;
+   mon_dir = debugfs_create_dir("usbmon", usb_debug_root);
return 0;
 }
 
-- 
2.17.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Patches for "Renesas uPD72020x workaround" don't work

2018-05-29 Thread Mathias Nyman

On 29.05.2018 15:50, Marcus Mönius wrote:

Hello,

as described here (https://bbs.archlinux.org/viewtopic.php?pid=1787759#p1787759 
) the patches
for the Renesas host controller 
(https://www.spinics.net/lists/linux-usb/msg169384.html 
)
didn't work for me:
I compiled the current kernel (4.16.11) with the three patches and a cherry pick
(fa31b3cb2ae143aa6e26974fcbe75689da60bdbe), but my Renesas USB 3.0
express card didn't work. I tried it with no kernel parameters and with either
kernel parameter intel_iommu=on or intel_iommu=igfx_off. But it didn't work.



Do you have any logs of 4.16 + Renesas v3 patches?.


When I use kernel 4.12.7 or kernel 4.12.8 with:

git checkout v4.12.8
git revert 0e1f0eaed6c20db41ff61e024b361ee3ec9d686c #revert the noted commit
git cherry-pick 854e55ad289efe7991f0ada85d5846f5afb9 #cherry-pick a commit 
needed to build with gcc 8

git cherry-pick ad343a98e74e85aa91d844310e797f96fee6983b


The express card only works, when I boot linux with the card inserted.
When I reinsert it while running, it does not work anymore.



How about v4.16 without 0e1f0ea? (reverting it) how does that behave?

-Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Patches for "Renesas uPD72020x workaround" don't work

2018-05-29 Thread Marcus Mönius

Hello,

as described here 
(https://bbs.archlinux.org/viewtopic.php?pid=1787759#p1787759 
) the patches
for the Renesas host 
controller (https://www.spinics.net/lists/linux-usb/msg169384.html 
)

didn't work for me:
I compiled the current kernel (4.16.11) with the three patches and a 
cherry pick

(fa31b3cb2ae143aa6e26974fcbe75689da60bdbe), but my Renesas USB 3.0
express card didn't work. I tried it with no kernel parameters and with 
either

kernel parameter intel_iommu=on or intel_iommu=igfx_off. But it didn't work.

When I use kernel 4.12.7 or kernel 4.12.8 with:

git checkout v4.12.8
git revert 0e1f0eaed6c20db41ff61e024b361ee3ec9d686c #revert the noted commit
git cherry-pick 854e55ad289efe7991f0ada85d5846f5afb9 #cherry-pick a 
commit needed to build with gcc 8


git cherry-pick ad343a98e74e85aa91d844310e797f96fee6983b


The express card only works, when I boot linux with the card inserted.
When I reinsert it while running, it does not work anymore.


Cheers
Marcus
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[usb:debugfs_cleanup 109/109] drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 'RTL_DEBUGFS_ADD_CORE'

2018-05-29 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
debugfs_cleanup
head:   1c66923f2afb1578348d1f92ce01c1b9f5216dd4
commit: 1c66923f2afb1578348d1f92ce01c1b9f5216dd4 [109/109] usb: debugfs cleanup 
- try 2
config: i386-allmodconfig (attached as .config)
compiler: gcc-8 (Debian 8.1.0-3) 8.1.0
reproduce:
git checkout 1c66923f2afb1578348d1f92ce01c1b9f5216dd4
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/rtlwifi/debug.c: In function 'rtl_debug_add_one':
   drivers/staging/rtlwifi/debug.c:534:9: error: invalid operands to binary & 
(have 'struct dentry *' and 'struct rtl_debugfs_priv')
_debug_priv_ ##name, \
^
>> drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
>> drivers/staging/rtlwifi/debug.c:565:2: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_0);
 ^~~
   drivers/staging/rtlwifi/debug.c:535:9: warning: passing argument 4 of 
'debugfs_create_file' discards 'const' qualifier from pointer target type 
[-Wdiscarded-qualifiers]
_ops_ ##fopname); \
^~
>> drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
>> drivers/staging/rtlwifi/debug.c:565:2: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_0);
 ^~~
   In file included from include/net/cfg80211.h:17,
from include/net/mac80211.h:24,
from drivers/staging/rtlwifi/wifi.h:36,
from drivers/staging/rtlwifi/debug.c:25:
   include/linux/debugfs.h:61:16: note: expected 'void *' but argument is of 
type 'const struct file_operations *'
struct dentry *debugfs_create_file(const char *name, umode_t mode,
   ^~~
   drivers/staging/rtlwifi/debug.c:533:3: error: too few arguments to function 
'debugfs_create_file'
  debugfs_create_file(#name, mode, parent  \
  ^~~
>> drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
>> drivers/staging/rtlwifi/debug.c:565:2: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_0);
 ^~~
   In file included from include/net/cfg80211.h:17,
from include/net/mac80211.h:24,
from drivers/staging/rtlwifi/wifi.h:36,
from drivers/staging/rtlwifi/debug.c:25:
   include/linux/debugfs.h:61:16: note: declared here
struct dentry *debugfs_create_file(const char *name, umode_t mode,
   ^~~
   drivers/staging/rtlwifi/debug.c:534:9: error: invalid operands to binary & 
(have 'struct dentry *' and 'struct rtl_debugfs_priv')
_debug_priv_ ##name, \
^
>> drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:566:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_1);
 ^~~
   drivers/staging/rtlwifi/debug.c:535:9: warning: passing argument 4 of 
'debugfs_create_file' discards 'const' qualifier from pointer target type 
[-Wdiscarded-qualifiers]
_ops_ ##fopname); \
^~
>> drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:566:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_1);
 ^~~
   In file included from include/net/cfg80211.h:17,
from include/net/mac80211.h:24,
from drivers/staging/rtlwifi/wifi.h:36,
from drivers/staging/rtlwifi/debug.c:25:
   include/linux/debugfs.h:61:16: note: expected 'void *' but argument is of 
type 'const struct file_operations *'
struct dentry *debugfs_create_file(const char *name, umode_t mode,
   ^~~
   drivers/staging/rtlwifi/debug.c:533:3: error: too few arguments to function 
'debugfs_create_file'
  debugfs_create_file(#name, mode, parent  \
  ^~~
>> drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
>> 'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:566:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_1);
 ^~~

[usb:debugfs_cleanup 109/109] drivers/staging/rtlwifi/debug.c:534:9: error: invalid operands to binary & (have 'struct dentry *' and 'struct rtl_debugfs_priv')

2018-05-29 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
debugfs_cleanup
head:   1c66923f2afb1578348d1f92ce01c1b9f5216dd4
commit: 1c66923f2afb1578348d1f92ce01c1b9f5216dd4 [109/109] usb: debugfs cleanup 
- try 2
config: i386-randconfig-i0-201821 (attached as .config)
compiler: gcc-8 (Debian 8.1.0-3) 8.1.0
reproduce:
git checkout 1c66923f2afb1578348d1f92ce01c1b9f5216dd4
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/staging/rtlwifi/debug.c: In function 'rtl_debug_add_one':
>> drivers/staging/rtlwifi/debug.c:534:9: error: invalid operands to binary & 
>> (have 'struct dentry *' and 'struct rtl_debugfs_priv')
_debug_priv_ ##name, \
^
   drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:565:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_0);
 ^~~
>> drivers/staging/rtlwifi/debug.c:535:9: warning: passing argument 4 of 
>> 'debugfs_create_file' discards 'const' qualifier from pointer target type 
>> [-Wdiscarded-qualifiers]
_ops_ ##fopname); \
^~
   drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:565:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_0);
 ^~~
   In file included from include/net/cfg80211.h:17,
from include/net/mac80211.h:24,
from drivers/staging/rtlwifi/wifi.h:36,
from drivers/staging/rtlwifi/debug.c:25:
   include/linux/debugfs.h:61:16: note: expected 'void *' but argument is of 
type 'const struct file_operations *'
struct dentry *debugfs_create_file(const char *name, umode_t mode,
   ^~~
>> drivers/staging/rtlwifi/debug.c:533:3: error: too few arguments to function 
>> 'debugfs_create_file'
  debugfs_create_file(#name, mode, parent  \
  ^~~
   drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:565:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_0);
 ^~~
   In file included from include/net/cfg80211.h:17,
from include/net/mac80211.h:24,
from drivers/staging/rtlwifi/wifi.h:36,
from drivers/staging/rtlwifi/debug.c:25:
   include/linux/debugfs.h:61:16: note: declared here
struct dentry *debugfs_create_file(const char *name, umode_t mode,
   ^~~
>> drivers/staging/rtlwifi/debug.c:534:9: error: invalid operands to binary & 
>> (have 'struct dentry *' and 'struct rtl_debugfs_priv')
_debug_priv_ ##name, \
^
   drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:566:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_1);
 ^~~
>> drivers/staging/rtlwifi/debug.c:535:9: warning: passing argument 4 of 
>> 'debugfs_create_file' discards 'const' qualifier from pointer target type 
>> [-Wdiscarded-qualifiers]
_ops_ ##fopname); \
^~
   drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:566:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_1);
 ^~~
   In file included from include/net/cfg80211.h:17,
from include/net/mac80211.h:24,
from drivers/staging/rtlwifi/wifi.h:36,
from drivers/staging/rtlwifi/debug.c:25:
   include/linux/debugfs.h:61:16: note: expected 'void *' but argument is of 
type 'const struct file_operations *'
struct dentry *debugfs_create_file(const char *name, umode_t mode,
   ^~~
>> drivers/staging/rtlwifi/debug.c:533:3: error: too few arguments to function 
>> 'debugfs_create_file'
  debugfs_create_file(#name, mode, parent  \
  ^~~
   drivers/staging/rtlwifi/debug.c:539:3: note: in expansion of macro 
'RTL_DEBUGFS_ADD_CORE'
  RTL_DEBUGFS_ADD_CORE(name, S_IFREG | 0444, common)
  ^~~~
   drivers/staging/rtlwifi/debug.c:566:2: note: in expansion of macro 
'RTL_DEBUGFS_ADD'
 RTL_DEBUGFS_ADD(mac_1);
 

Re: [usb:debugfs_cleanup 109/109] drivers/usb/typec/tcpm.c:580:9: warning: 'return' with a value, in function returning void

2018-05-29 Thread Greg Kroah-Hartman
On Tue, May 29, 2018 at 05:32:48PM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
> debugfs_cleanup
> head:   7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54
> commit: 7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54 [109/109] usb: debugfs 
> cleanup
> config: i386-randconfig-s1-201821 (attached as .config)
> compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
> reproduce:
> git checkout 7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54
> # save the attached .config to linux build tree
> make ARCH=i386 
> 
> All warnings (new ones prefixed by >>):
> 
>drivers/usb/typec/tcpm.c: In function 'tcpm_debugfs_init':
> >> drivers/usb/typec/tcpm.c:580:9: warning: 'return' with a value, in 
> >> function returning void
>  return 0;
> ^
>drivers/usb/typec/tcpm.c:569:13: note: declared here
> static void tcpm_debugfs_init(struct tcpm_port *port)
> ^

For the linux-usb crowd, this is a bug in one of my in-work patches, no
need to worry...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[usb:debugfs_cleanup 109/109] drivers/usb/typec/tcpm.c:580:9: warning: 'return' with a value, in function returning void

2018-05-29 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git 
debugfs_cleanup
head:   7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54
commit: 7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54 [109/109] usb: debugfs cleanup
config: i386-randconfig-s1-201821 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
git checkout 7b3bcbfe0aeedeec64c83cf9655273e8f42f1c54
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/usb/typec/tcpm.c: In function 'tcpm_debugfs_init':
>> drivers/usb/typec/tcpm.c:580:9: warning: 'return' with a value, in function 
>> returning void
 return 0;
^
   drivers/usb/typec/tcpm.c:569:13: note: declared here
static void tcpm_debugfs_init(struct tcpm_port *port)
^

vim +/return +580 drivers/usb/typec/tcpm.c

f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  568  
7b3bcbfe drivers/usb/typec/tcpm.c Greg Kroah-Hartman 2018-05-29  569  
static void tcpm_debugfs_init(struct tcpm_port *port)
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  570  {
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  571
mutex_init(>logbuffer_lock);
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  572
/* /sys/kernel/debug/tcpm/usbcX */
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  573
if (!rootdir)
7b3bcbfe drivers/usb/typec/tcpm.c Greg Kroah-Hartman 2018-05-29  574
rootdir = debugfs_create_dir("tcpm", NULL);
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  575  
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  576
port->dentry = debugfs_create_file(dev_name(port->dev),
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  577
   S_IFREG | 0444, rootdir,
9e902c59 drivers/usb/typec/tcpm.c Andy Shevchenko2018-02-14  578
   port, _debug_fops);
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  579  
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27 @580
return 0;
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  581  }
f0690a25 drivers/staging/typec/tcpm.c Guenter Roeck  2017-04-27  582  

:: The code at line 580 was first introduced by commit
:: f0690a25a140b853b1842fa80faf828601bb47e8 staging: typec: USB Type-C Port 
Manager (tcpm)

:: TO: Guenter Roeck 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: Fwd: usb: uas: device reset most the time while enumeration- usb3.0

2018-05-29 Thread Tushar Nimkar

Hi,

On 2018-05-28 18:12, Oliver Neukum wrote:

Am Donnerstag, den 24.05.2018, 20:13 +0530 schrieb Tushar Nimkar:

We have built SCSI as module will it cause any problem to enable
CONFIG_SCSI_SCAN_ASYNC ?


No, that should work. But the failure is bizzare. You say

yes there is no problem! I have run some test over night.

synchronous scanning fails, but async scan works?

yes!
Can you check for other host too? I have only dwc3 (3.0a)
That's why my patch(shared already) was working as it was synchronous 
scanning.


Regards
Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
Best Regards,
Tushar R Nimkar

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member of Code Aurora Forum, hosted by The Linux Foundation


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html