Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2957839pxa; Tue, 18 Aug 2020 02:38:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHCm9uzguBZF0JRPzcp2aN2BVRZ1IzDefeCxGhq0z4HT6dmteqvQ8UigP/osZX5GqA2TuJ X-Received: by 2002:aa7:d155:: with SMTP id r21mr18151400edo.87.1597743482337; Tue, 18 Aug 2020 02:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597743482; cv=none; d=google.com; s=arc-20160816; b=WtYAQvaZozTVzNyP3cWea/zo/HSrcn8oRAP5rXxhuDNDgXP3UwizDl29XU+LkvXZVw lIlNzZNw6vg4oZ0ZytBTkpUq3BTi+WFHGkvhiqN6+bHyvjQSDgc2HEpARjuI5fEHyNjU URirDiiNMnequnaQPwqfxnKWYEl4e0st5f1K6+WcoGUxm3N4W2wIzqX4TK1qw6ADhGIV rMISlh01/vB3UOIqGdbpmTfv+Xe+NLOgelzlCVK6DG+6aCRdH4+XXtYu/t1ba+05gUHd /TqOKzMA908QxXjq3JPGTf+R2CTx2MjxSM7PRL9QnATAZKULTglJYInDm01c1eZmUsQN 0kCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=WlLbNhqJh6Yeimf7bTUZNHe7nuPBZKY9zQqlPtAti5c=; b=UAaJcUGBXrhPeQ+RD5j7jdsaYPBLZnA1H10ewcJ16HF2VUqk9F+inL7mJAuvLXf26B 4F7kp+oAoIJCXQxRt+JRN96lCCMXQn41T0Mk92PKvuh1ykN4xMxRz/ECZgoHDlg/eMUV LnFywsKiZIUT/Gwmp7QC1jzOnbNwQHdBY5hfWjMzj2D4UGkJfwYR7GF7AAPVMK1P8S4A im4BOkh4HxHVoTThGpRgpD7t6mZ1Z84rV3V8yBvS6tc8AyO1N+xxc6VyYQVp20IVtH7l Q4pYZilwH9+Wv+YHVRBy7HWgBH+3ZbMwlFV4FUBJlLsrSabQ1zE1GRJBTCwbFNeDRKdq f9Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kncx4qd2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lc20si12895273ejb.468.2020.08.18.02.37.37; Tue, 18 Aug 2020 02:38:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kncx4qd2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726483AbgHRJgS (ORCPT + 99 others); Tue, 18 Aug 2020 05:36:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:38204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726165AbgHRJgR (ORCPT ); Tue, 18 Aug 2020 05:36:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F1A72078B; Tue, 18 Aug 2020 09:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597743376; bh=jf7Mx1Ot8arfUuf6gg/Wk5ylCL0JP7drPzwJqzU4itw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kncx4qd2AeaHd89DpmQpPvAWG2MJRYJkGWXg7bKYSHDqCKc3NXVxtfyxGvaKapyL7 OOmMHwYltbvwO8xVLm4X924GpUWRtTwD6omZKLuFCTWymoLruGjkXM4KV/Q323bOPz +8BbwgbRO1Z7qEgQblVXZ5XIaL9o9UzrTS9NLlsw= Date: Tue, 18 Aug 2020 11:36:40 +0200 From: Greg Kroah-Hartman To: Sergey Korolev Cc: Al Viro , Rob Gill , Bastien Nocera , Alan Stern , Johan Hovold , Nishad Kamdar , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: core: remove polling for /sys/kernel/debug/usb/devices Message-ID: <20200818093640.GC34785@kroah.com> References: <20200809161233.13135-1-s.korolev@ndmsystems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200809161233.13135-1-s.korolev@ndmsystems.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 09, 2020 at 07:12:30PM +0300, Sergey Korolev wrote: > The latest reference to usbfs_conn_disc_event() removed in > commit fb28d58b72aa ("USB: remove CONFIG_USB_DEVICEFS") > in 2012 and now a user poll() waits infinitely for content changes. > > Signed-off-by: Sergey Korolev > --- > drivers/usb/core/devices.c | 41 -------------------------------------- > drivers/usb/core/usb.h | 1 - > 2 files changed, 42 deletions(-) > > diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c > index 696b2b692b83..1ef2de6e375a 100644 > --- a/drivers/usb/core/devices.c > +++ b/drivers/usb/core/devices.c > @@ -39,7 +39,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -97,22 +96,6 @@ static const char format_endpt[] = > /* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */ > "E: Ad=%02x(%c) Atr=%02x(%-4s) MxPS=%4d Ivl=%d%cs\n"; > > -/* > - * Wait for an connect/disconnect event to happen. We initialize > - * the event counter with an odd number, and each event will increment > - * the event counter by two, so it will always _stay_ odd. That means > - * that it will never be zero, so "event 0" will never match a current > - * event, and thus 'poll' will always trigger as readable for the first > - * time it gets called. > - */ > -static struct device_connect_event { > - atomic_t count; > - wait_queue_head_t wait; > -} device_event = { > - .count = ATOMIC_INIT(1), > - .wait = __WAIT_QUEUE_HEAD_INITIALIZER(device_event.wait) > -}; > - > struct class_info { > int class; > char *class_name; > @@ -146,12 +129,6 @@ static const struct class_info clas_info[] = { > > /*****************************************************************/ > > -void usbfs_conn_disc_event(void) > -{ > - atomic_add(2, &device_event.count); > - wake_up(&device_event.wait); > -} > - > static const char *class_decode(const int class) > { > int ix; > @@ -623,25 +600,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, > return total_written; > } > > -/* Kernel lock for "lastev" protection */ > -static __poll_t usb_device_poll(struct file *file, > - struct poll_table_struct *wait) > -{ > - unsigned int event_count; > - > - poll_wait(file, &device_event.wait, wait); > - > - event_count = atomic_read(&device_event.count); > - if (file->f_version != event_count) { > - file->f_version = event_count; > - return EPOLLIN | EPOLLRDNORM; > - } > - > - return 0; > -} > - > const struct file_operations usbfs_devices_fops = { > .llseek = no_seek_end_llseek, > .read = usb_device_read, > - .poll = usb_device_poll, > }; > diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h > index 98e7d1ee63dc..c893f54a3420 100644 > --- a/drivers/usb/core/usb.h > +++ b/drivers/usb/core/usb.h > @@ -191,7 +191,6 @@ extern const struct attribute_group *usb_interface_groups[]; > extern struct usb_driver usbfs_driver; > extern const struct file_operations usbfs_devices_fops; > extern const struct file_operations usbdev_file_operations; > -extern void usbfs_conn_disc_event(void); > > extern int usb_devio_init(void); > extern void usb_devio_cleanup(void); Why not fix this up instead? The debugfs file can be polled and this should be fixed to accurately handle that. It's kind of proof though that no one really cares about this option in that no one has noticed it being gone for so long, so if you don't want to fix it, I will just take this patch for now. Let me know. thanks, greg k-h