Re: [PATCH] drivers/hid: Convert timers to use timer_setup()
Switch to using the new timer_setup() and from_timer() for drivers/hid/* Cc: Kees Cook Signed-off-by: Allen Pais Ignore the patch. I send out a wrong one by mistake. -- 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] usb: usbatm: Convert timers to use timer_setup()
> In preparation for unconditionally passing the struct timer_list pointer to > all timer callbacks, switch to using the new timer_setup() and from_timer() > to pass the timer pointer explicitly. Additionally corrects and on-stack > timer usage. > > Cc: Greg Kroah-Hartman > Cc: Duncan Sands > Cc: Allen Pais > Cc: "Gustavo A. R. Silva" > Cc: accessrunner-gene...@lists.sourceforge.net > Cc: linux-usb@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Allen Pais > --- > drivers/usb/atm/cxacru.c | 23 --- > drivers/usb/atm/speedtch.c | 16 > drivers/usb/atm/usbatm.c | 10 +- > 3 files changed, 29 insertions(+), 20 deletions(-) > > diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c > index 600a670b4feb..53c00d035e31 100644 > --- a/drivers/usb/atm/cxacru.c > +++ b/drivers/usb/atm/cxacru.c > @@ -560,21 +560,30 @@ static void cxacru_blocking_completion(struct urb *urb) > complete(urb->context); > } > > -static void cxacru_timeout_kill(unsigned long data) > +struct cxacru_timer { > + struct timer_list timer; > + struct urb *urb; > +}; > + > +static void cxacru_timeout_kill(struct timer_list *t) > { > - usb_unlink_urb((struct urb *) data); > + struct cxacru_timer *timer = from_timer(timer, t, timer); > + > + usb_unlink_urb(timer->urb); > } > > static int cxacru_start_wait_urb(struct urb *urb, struct completion *done, > int *actual_length) > { > - struct timer_list timer; > + struct cxacru_timer timer = { > + .urb = urb, > + }; > > - setup_timer(&timer, cxacru_timeout_kill, (unsigned long)urb); > - timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT); > - add_timer(&timer); > + timer_setup_on_stack(&timer.timer, cxacru_timeout_kill, 0); > + mod_timer(&timer.timer, jiffies + msecs_to_jiffies(CMD_TIMEOUT)); > wait_for_completion(done); > - del_timer_sync(&timer); > + del_timer_sync(&timer.timer); > + destroy_timer_on_stack(&timer.timer); > > if (actual_length) > *actual_length = urb->actual_length; > diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c > index 091db9b281f5..b7fb4beed2b8 100644 > --- a/drivers/usb/atm/speedtch.c > +++ b/drivers/usb/atm/speedtch.c > @@ -571,9 +571,10 @@ static void speedtch_check_status(struct work_struct > *work) > } > } > > -static void speedtch_status_poll(unsigned long data) > +static void speedtch_status_poll(struct timer_list *t) > { > - struct speedtch_instance_data *instance = (void *)data; > + struct speedtch_instance_data *instance = > + from_timer(instance, t, status_check_timer); > > schedule_work(&instance->status_check_work); > > @@ -584,9 +585,10 @@ static void speedtch_status_poll(unsigned long data) > atm_warn(instance->usbatm, "Too many failures - disabling > line status polling\n"); > } > > -static void speedtch_resubmit_int(unsigned long data) > +static void speedtch_resubmit_int(struct timer_list *t) > { > - struct speedtch_instance_data *instance = (void *)data; > + struct speedtch_instance_data *instance = from_timer(instance, t, > +resubmit_timer); > struct urb *int_urb = instance->int_urb; > int ret; > > @@ -874,13 +876,11 @@ static int speedtch_bind(struct usbatm_data *usbatm, > usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); > > INIT_WORK(&instance->status_check_work, speedtch_check_status); > - setup_timer(&instance->status_check_timer, speedtch_status_poll, > - (unsigned long)instance); > + timer_setup(&instance->status_check_timer, speedtch_status_poll, 0); > instance->last_status = 0xff; > instance->poll_delay = MIN_POLL_DELAY; > > - setup_timer(&instance->resubmit_timer, speedtch_resubmit_int, > - (unsigned long)instance); > + timer_setup(&instance->resubmit_timer, speedtch_resubmit_int, 0); > > instance->int_urb = usb_alloc_urb(0, GFP_KERNEL); > > diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c > index 8607af758bbd..31a4e4824f23 100644 > --- a/drivers/usb/atm/usbatm.c > +++ b/drivers/usb/atm/usbatm.c > @@ -1003,18 +1003,18 @@ static int usbatm_heavy_init(struct usbatm_data > *instance) > return 0; > } > > -static void usbatm_tasklet_sched
UAS kernel bug
This is from ver-linux: If some fields are empty or look unusual you may have an old version. Compare to the current minimal requirements in Documentation/Changes. Linux torr 4.4.2-smp #1 SMP Tue Feb 23 12:20:39 PST 2016 i686 Intel(R) Core(TM)2 Quad CPU @ 2.66GHz GenuineIntel GNU/Linux GNU C 4.8.2 GNU Make3.82 Binutils2.23.52.0.1.20130226 Util-linux 2.21.2 Mount 2.21.2 Module-init-tools 15 E2fsprogs 1.42.8 Jfsutils1.1.15 Reiserfsprogs 3.6.23 Xfsprogs3.1.11 Pcmciautils 017 Quota-tools 3.17 PPP 2.4.5 Linux C Library 2.17 Dynamic linker (ldd)2.17 Linux C++ Library 6.0.18 Procps 3.2.8 Net-tools 1.60 Kbd 1.15.3 Console-tools 1.15.3 oprofile 0.9.7 Sh-utils8.21 Udev182 Wireless-tools 29 Modules Loaded 8250_fintek acpi_cpufreq agpgart button coretemp drm ehci_hcd ehci_pci enclosure evdev firewire_core firewire_ohci fjes forcedeth hid hid_generic hid_ortek hwmon i2c_core i2c_dev i2c_nforce2 ip_tables iptable_filter ipv6 irqbypass joydev kvm kvm_intel lp nf_conntrack nf_conntrack_ipv4 nf_defrag_ipv4 nv_tco nvidia nvidia_modeset ohci_hcd ohci_pci parport parport_pc pcspkr ppdev processor psmouse serio_raw ses sg shpchp sky2 snd snd_hda_codec snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_core snd_hda_intel snd_hwdep snd_pcm snd_timer soundcore st tpm tpm_tis uas usb_storage usbhid x_tables xhci_hcd xhci_pci xt_conntrack xt_tcpudp This is from dmesg: [75437.219739] usb 4-3: new SuperSpeed USB device number 7 using xhci_hcd [75437.236285] usb 4-3: New USB device found, idVendor=0bc2, idProduct=ab34 [75437.236289] usb 4-3: New USB device strings: Mfr=2, Product=3, SerialNumber=1 [75437.236293] usb 4-3: Product: Backup+ Desk [75437.236296] usb 4-3: Manufacturer: Seagate [75437.236299] usb 4-3: SerialNumber: NA7ER274 [75437.243185] scsi host13: uas [75437.243196] kworker/0:0: page allocation failure: order:6, mode:0x208c020 [75437.243201] CPU: 0 PID: 14356 Comm: kworker/0:0 Tainted: P O 4.4.2-smp #1 [75437.243204] Hardware name: EVGA 122-CK-NF68/122-CK-NF68, BIOS 6.00 PG 09/04/2008 [75437.243210] Workqueue: usb_hub_wq hub_event [75437.243214] d69a5990 c15ffbd1 d69a59b8 c1118250 c1a9ea78 [75437.243222] eff7220c 0006 0208c020 0040 f79fce18 0030 f79fce18 d69a5a74 [75437.243229] c111af96 0208c020 0006 0020 eff71f00 eff71f00 0200 [75437.243236] Call Trace: [75437.243244] [] dump_stack+0x41/0x60 [75437.243249] [] warn_alloc_failed+0xb0/0xf0 [75437.243253] [] __alloc_pages_nodemask+0x736/0x8d0 [75437.243259] [] alloc_pages_current+0x7b/0xf0 [75437.243263] [] alloc_kmem_pages+0x14/0x80 [75437.243267] [] kmalloc_order+0x14/0x40 [75437.243270] [] kmalloc_order_trace+0x1b/0x90 [75437.243275] [] __kmalloc+0x174/0x220 [75437.243284] [] ? xhci_alloc_streams+0x4b3/0x5b0 [xhci_hcd] [75437.243289] [] init_tag_map+0x31/0xa0 [75437.243293] [] ? __blk_queue_init_tags+0x29/0x80 [75437.243297] [] __blk_queue_init_tags+0x3b/0x80 [75437.243301] [] blk_init_tags+0x13/0x20 [75437.243306] [] scsi_add_host_with_dma+0x72/0x300 [75437.243312] [] uas_probe+0x54e/0x5e0 [uas] [75437.243317] [] usb_probe_interface+0x152/0x250 [75437.243322] [] driver_probe_device+0x1c3/0x290 [75437.243326] [] ? usb_match_id+0x49/0x60 [75437.243330] [] __device_attach_driver+0x5b/0x70 [75437.243334] [] ? driver_allows_async_probing+0x30/0x30 [75437.243338] [] bus_for_each_drv+0x47/0x80 [75437.243342] [] __device_attach+0x9d/0xf0 [75437.243346] [] ? driver_allows_async_probing+0x30/0x30 [75437.243349] [] device_initial_probe+0x12/0x20 [75437.243353] [] bus_probe_device+0x6f/0x80 [75437.243356] [] device_add+0x3d5/0x580 [75437.243360] [] usb_set_configuration+0x480/0x740 [75437.243365] [] generic_probe+0x2c/0xa0 [75437.243370] [] ? sysfs_create_link+0x25/0x40 [75437.243373] [] usb_probe_device+0x1b/0x30 [75437.243377] [] driver_probe_device+0x1c3/0x290 [75437.243381] [] __device_attach_driver+0x5b/0x70 [75437.243385] [] ? driver_allows_async_probing+0x30/0x30 [75437.243389] [] bus_for_each_drv+0x47/0x80 [75437.243393] [] __device_attach+0x9d/0xf0 [75437.243396] [] ? driver_allows_async_probing+0x30/0x30 [75437.243400] [] device_initial_probe+0x12/0x20 [75437.243403] [] bus_probe_device+0x6f/0x80 [75437.243407] [] device_add+0x3d5/0x580 [75437.243411] [] ? usb_new_device+0x1f7/0x5f0 [75437.243415] [] usb_new_device+0x26e/0x5f0 [75437.243419] [] hub_event+0xb5f/0xf30 [75437.243425] [] process_one_work+0x117/0x360 [75437.243429] [] worker_thread+0xed/0x410 [75437.243433] [] ? process_one_work+0x360/0x360 [75437.243436] [] kthread+0xa1/0xc0 [75437.243451] [] ret_from_ker
UAS kernel bug
I submitted a bug report about the UAS module crashing earlier today (about 13 hours ago). It was suggested by greg k-h that a patch be made to uas.c: I changed: .can_queue = 65535 /* Is there a limit on the _host_ ? */ to .can_queue = MAX_CMNDS /* Is there a limit on the _host_ ? */ At the time I received the message the machine had just started a backup that lasted the 13 hours. I rebooted the machine and it seems that the patch was successful. The kernel module uas did not crash, and a usb_storage device was created. Thank you. -- 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
If interested
My name is Mr. Allen, I have a Business Proposal of Four million five hundred thousand united states dollars for you to handle with me from my bank. I will need you to assist me in executing this Business .
[PATCH] drivers/hid: Convert timers to use timer_setup()
Switch to using the new timer_setup() and from_timer() for drivers/hid/* Cc: Kees Cook Signed-off-by: Allen Pais --- Note: This patch is only compile tested. drivers/hid/hid-appleir.c | 8 drivers/hid/hid-multitouch.c | 6 +++--- drivers/hid/hid-prodikeys.c| 7 +++ drivers/hid/hid-wiimote-core.c | 6 +++--- drivers/hid/usbhid/hid-core.c | 8 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c index 07cbc70..f5f4a93 100644 --- a/drivers/hid/hid-appleir.c +++ b/drivers/hid/hid-appleir.c @@ -173,9 +173,9 @@ static void battery_flat(struct appleir *appleir) dev_err(&appleir->input_dev->dev, "possible flat battery?\n"); } -static void key_up_tick(unsigned long data) +static void key_up_tick(struct timer_list *t) { - struct appleir *appleir = (struct appleir *)data; + struct appleir *appleir = from_timer(applier, t, key_up_timer); struct hid_device *hid = appleir->hid; unsigned long flags; @@ -303,8 +303,8 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id) hid->quirks |= HID_QUIRK_HIDINPUT_FORCE; spin_lock_init(&appleir->lock); - setup_timer(&appleir->key_up_timer, - key_up_tick, (unsigned long) appleir); + timer_setup(&appleir->key_up_timer, + key_up_tick, 0); hid_set_drvdata(hid, appleir); diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 9e8c4d2..b5117a8 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1246,9 +1246,9 @@ static void mt_release_contacts(struct hid_device *hid) td->num_received = 0; } -static void mt_expired_timeout(unsigned long arg) +static void mt_expired_timeout(struct timer_list *t) { - struct hid_device *hdev = (void *)arg; + struct hid_device *hdev = from_timer(hdev, t, release_timer); struct mt_device *td = hid_get_drvdata(hdev); /* @@ -1331,7 +1331,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) */ hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; - setup_timer(&td->release_timer, mt_expired_timeout, (long)hdev); + timer_setup(&td->release_timer, mt_expired_timeout, 0); ret = hid_parse(hdev); if (ret != 0) diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index 49c4bd3..87eda34 100644 --- a/drivers/hid/hid-prodikeys.c +++ b/drivers/hid/hid-prodikeys.c @@ -239,9 +239,9 @@ static void pcmidi_send_note(struct pcmidi_snd *pm, return; } -static void pcmidi_sustained_note_release(unsigned long data) +static void pcmidi_sustained_note_release(struct timer_list *t) { - struct pcmidi_sustain *pms = (struct pcmidi_sustain *)data; + struct pcmidi_sustain *pms = from_timer(pms, t, timer); pcmidi_send_note(pms->pm, pms->status, pms->note, pms->velocity); pms->in_use = 0; @@ -256,8 +256,7 @@ static void init_sustain_timers(struct pcmidi_snd *pm) pms = &pm->sustained_notes[i]; pms->in_use = 0; pms->pm = pm; - setup_timer(&pms->timer, pcmidi_sustained_note_release, - (unsigned long)pms); + timer_setup(&pms->timer, pcmidi_sustained_note_release, 0); } } diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c index d003914..579884e 100644 --- a/drivers/hid/hid-wiimote-core.c +++ b/drivers/hid/hid-wiimote-core.c @@ -1226,9 +1226,9 @@ static void wiimote_schedule(struct wiimote_data *wdata) spin_unlock_irqrestore(&wdata->state.lock, flags); } -static void wiimote_init_timeout(unsigned long arg) +static void wiimote_init_timeout(struct timer_list *t) { - struct wiimote_data *wdata = (void*)arg; + struct wiimote_data *wdata = from_timer(wdata, t, timer); wiimote_schedule(wdata); } @@ -1740,7 +1740,7 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev) wdata->state.cmd_battery = 0xff; INIT_WORK(&wdata->init_worker, wiimote_init_worker); - setup_timer(&wdata->timer, wiimote_init_timeout, (long)wdata); + timer_setup(&wdata->timer, wiimote_init_timeout, 0); return wdata; } diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 045b5da..640dfb93 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -101,10 +101,10 @@ static int hid_start_in(struct hid_device *hid) } /* I/O retry timer routine */ -static void hid_retry_timeout(unsigned long _hid) +static void hid_retry_timeout(struct timer_list *t) { - struct hid_device *hid = (struct hid_device *) _hid; - struct usbhid_device *usb
[PATCH] drivers/hid: Convert timers to use timer_setup()
Switch to using the new timer_setup() and from_timer() for drivers/hid/* Cc: Kees Cook Signed-off-by: Allen Pais --- Note:This patch is only compile tested. drivers/hid/hid-appleir.c | 8 drivers/hid/hid-prodikeys.c| 7 +++ drivers/hid/hid-wiimote-core.c | 6 +++--- drivers/hid/usbhid/hid-core.c | 8 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c index 07cbc70..1c913a7 100644 --- a/drivers/hid/hid-appleir.c +++ b/drivers/hid/hid-appleir.c @@ -173,9 +173,9 @@ static void battery_flat(struct appleir *appleir) dev_err(&appleir->input_dev->dev, "possible flat battery?\n"); } -static void key_up_tick(unsigned long data) +static void key_up_tick(struct timer_list *t) { - struct appleir *appleir = (struct appleir *)data; + struct appleir *appleir = from_timer(appleir, t, key_up_timer); struct hid_device *hid = appleir->hid; unsigned long flags; @@ -303,8 +303,8 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id) hid->quirks |= HID_QUIRK_HIDINPUT_FORCE; spin_lock_init(&appleir->lock); - setup_timer(&appleir->key_up_timer, - key_up_tick, (unsigned long) appleir); + timer_setup(&appleir->key_up_timer, + key_up_tick, 0); hid_set_drvdata(hid, appleir); diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c index 49c4bd3..87eda34 100644 --- a/drivers/hid/hid-prodikeys.c +++ b/drivers/hid/hid-prodikeys.c @@ -239,9 +239,9 @@ static void pcmidi_send_note(struct pcmidi_snd *pm, return; } -static void pcmidi_sustained_note_release(unsigned long data) +static void pcmidi_sustained_note_release(struct timer_list *t) { - struct pcmidi_sustain *pms = (struct pcmidi_sustain *)data; + struct pcmidi_sustain *pms = from_timer(pms, t, timer); pcmidi_send_note(pms->pm, pms->status, pms->note, pms->velocity); pms->in_use = 0; @@ -256,8 +256,7 @@ static void init_sustain_timers(struct pcmidi_snd *pm) pms = &pm->sustained_notes[i]; pms->in_use = 0; pms->pm = pm; - setup_timer(&pms->timer, pcmidi_sustained_note_release, - (unsigned long)pms); + timer_setup(&pms->timer, pcmidi_sustained_note_release, 0); } } diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c index d003914..579884e 100644 --- a/drivers/hid/hid-wiimote-core.c +++ b/drivers/hid/hid-wiimote-core.c @@ -1226,9 +1226,9 @@ static void wiimote_schedule(struct wiimote_data *wdata) spin_unlock_irqrestore(&wdata->state.lock, flags); } -static void wiimote_init_timeout(unsigned long arg) +static void wiimote_init_timeout(struct timer_list *t) { - struct wiimote_data *wdata = (void*)arg; + struct wiimote_data *wdata = from_timer(wdata, t, timer); wiimote_schedule(wdata); } @@ -1740,7 +1740,7 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev) wdata->state.cmd_battery = 0xff; INIT_WORK(&wdata->init_worker, wiimote_init_worker); - setup_timer(&wdata->timer, wiimote_init_timeout, (long)wdata); + timer_setup(&wdata->timer, wiimote_init_timeout, 0); return wdata; } diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 045b5da..640dfb93 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -101,10 +101,10 @@ static int hid_start_in(struct hid_device *hid) } /* I/O retry timer routine */ -static void hid_retry_timeout(unsigned long _hid) +static void hid_retry_timeout(struct timer_list *t) { - struct hid_device *hid = (struct hid_device *) _hid; - struct usbhid_device *usbhid = hid->driver_data; + struct usbhid_device *usbhid = from_timer(usbhid, t, io_retry); + struct hid_device *hid = usbhid->hid; dev_dbg(&usbhid->intf->dev, "retrying intr urb\n"); if (hid_start_in(hid)) @@ -1373,7 +1373,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * init_waitqueue_head(&usbhid->wait); INIT_WORK(&usbhid->reset_work, hid_reset); - setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); + timer_setup(&usbhid->io_retry, hid_retry_timeout, 0); spin_lock_init(&usbhid->lock); ret = hid_add_device(hid); -- 1.9.1 -- 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 1/1] net: usb: catc: use setup_timer() helper
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/net/usb/catc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index dbc9031..aeb62e1 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c @@ -805,9 +805,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id spin_lock_init(&catc->tx_lock); spin_lock_init(&catc->ctrl_lock); - init_timer(&catc->timer); - catc->timer.data = (long) catc; - catc->timer.function = catc_stats_timer; + setup_timer(&catc->timer, catc_stats_timer, (long)catc); catc->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); catc->tx_urb = usb_alloc_urb(0, GFP_KERNEL); -- 2.7.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
[PATCH 0/9] use setup_timer() helper function.
This series uses setup_timer() helper function. The series addresses the files under drivers/usb/*. Allen Pais (9): drivers: usb: hcd: use setup_timer() helper. drivers: usb: phy: omap: use setup_timer() helper. usb: gadget: udc: m66592: use setup_timer() helper. usb: gadget: udc: pxa25x_udc: use setup_timer() helper. drivers: usb: atm: cxacru: use setup_timer() helper. usb: gadget: udc: r8a66597: use setup_timer() helper. drivers: usb: speedtch: use setup_timer() helper. usb: gadget: udc: dummy_hcd: use setup_timer() helper. usb: gadget: udc: snps_udc_core: use setup_timer() helper. drivers/usb/atm/cxacru.c | 4 +--- drivers/usb/atm/speedtch.c | 11 --- drivers/usb/core/hcd.c | 4 +--- drivers/usb/gadget/udc/dummy_hcd.c | 8 ++-- drivers/usb/gadget/udc/m66592-udc.c| 4 +--- drivers/usb/gadget/udc/pxa25x_udc.c| 4 +--- drivers/usb/gadget/udc/r8a66597-udc.c | 4 +--- drivers/usb/gadget/udc/snps_udc_core.c | 8 ++-- drivers/usb/phy/phy-isp1301-omap.c | 4 +--- 9 files changed, 14 insertions(+), 37 deletions(-) -- 2.7.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
[PATCH 1/9] drivers: usb: hcd: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/core/hcd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 75ad671..67aa3d0 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2558,9 +2558,7 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver, hcd->self.bus_name = bus_name; hcd->self.uses_dma = (sysdev->dma_mask != NULL); - init_timer(&hcd->rh_timer); - hcd->rh_timer.function = rh_timer_func; - hcd->rh_timer.data = (unsigned long) hcd; + setup_timer(&hcd->rh_timer, rh_timer_func, (unsigned long)hcd); #ifdef CONFIG_PM INIT_WORK(&hcd->wakeup_work, hcd_resume_work); #endif -- 2.7.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
[PATCH 2/9] drivers: usb: phy: omap: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/phy/phy-isp1301-omap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp1301-omap.c index c6052c8..5630840 100644 --- a/drivers/usb/phy/phy-isp1301-omap.c +++ b/drivers/usb/phy/phy-isp1301-omap.c @@ -1507,9 +1507,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) } INIT_WORK(&isp->work, isp1301_work); - init_timer(&isp->timer); - isp->timer.function = isp1301_timer; - isp->timer.data = (unsigned long) isp; + setup_timer(&isp->timer, isp1301_timer, (unsigned long)isp); i2c_set_clientdata(i2c, isp); isp->client = i2c; -- 2.7.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
[PATCH 5/9] drivers: usb: atm: cxacru: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/atm/cxacru.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 5160a4a..600a670 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -570,10 +570,8 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done, { struct timer_list timer; - init_timer(&timer); + setup_timer(&timer, cxacru_timeout_kill, (unsigned long)urb); timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT); - timer.data = (unsigned long) urb; - timer.function = cxacru_timeout_kill; add_timer(&timer); wait_for_completion(done); del_timer_sync(&timer); -- 2.7.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
[PATCH 4/9] usb: gadget: udc: pxa25x_udc: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/pxa25x_udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index a238da9..974b778 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -2417,9 +2417,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev) gpio_direction_output(dev->mach->gpio_pullup, 0); } - init_timer(&dev->timer); - dev->timer.function = udc_watchdog; - dev->timer.data = (unsigned long) dev; + setup_timer(&dev->timer, udc_watchdog, (unsigned long)dev); the_controller = dev; platform_set_drvdata(pdev, dev); -- 2.7.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
[PATCH 6/9] usb: gadget: udc: r8a66597: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/r8a66597-udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 118ad70..bb844b9 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1877,9 +1877,7 @@ static int r8a66597_probe(struct platform_device *pdev) r8a66597->gadget.max_speed = USB_SPEED_HIGH; r8a66597->gadget.name = udc_name; - init_timer(&r8a66597->timer); - r8a66597->timer.function = r8a66597_timer; - r8a66597->timer.data = (unsigned long)r8a66597; + setup_timer(&r8a66597->timer, r8a66597_timer, (unsigned long)r8a66597); r8a66597->reg = reg; if (r8a66597->pdata->on_chip) { -- 2.7.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
[PATCH 8/9] usb: gadget: udc: dummy_hcd: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/dummy_hcd.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index a030d79..c9ac44d 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -2389,9 +2389,7 @@ static DEVICE_ATTR_RO(urbs); static int dummy_start_ss(struct dummy_hcd *dum_hcd) { - init_timer(&dum_hcd->timer); - dum_hcd->timer.function = dummy_timer; - dum_hcd->timer.data = (unsigned long)dum_hcd; + setup_timer(&dum_hcd->timer, dummy_timer, (unsigned long)dum_hcd); dum_hcd->rh_state = DUMMY_RH_RUNNING; dum_hcd->stream_en_ep = 0; INIT_LIST_HEAD(&dum_hcd->urbp_list); @@ -2420,9 +2418,7 @@ static int dummy_start(struct usb_hcd *hcd) return dummy_start_ss(dum_hcd); spin_lock_init(&dum_hcd->dum->lock); - init_timer(&dum_hcd->timer); - dum_hcd->timer.function = dummy_timer; - dum_hcd->timer.data = (unsigned long)dum_hcd; + setup_timer(&dum_hcd->timer, dummy_timer, (unsigned long)dum_hcd); dum_hcd->rh_state = DUMMY_RH_RUNNING; INIT_LIST_HEAD(&dum_hcd->urbp_list); -- 2.7.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
[PATCH 9/9] usb: gadget: udc: snps_udc_core: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/snps_udc_core.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c index 38a165d..47df99d 100644 --- a/drivers/usb/gadget/udc/snps_udc_core.c +++ b/drivers/usb/gadget/udc/snps_udc_core.c @@ -3207,13 +3207,9 @@ int udc_probe(struct udc *dev) goto finished; /* timer init */ - init_timer(&udc_timer); - udc_timer.function = udc_timer_function; - udc_timer.data = 1; + setup_timer(&udc_timer, udc_timer_function, 1); /* timer pollstall init */ - init_timer(&udc_pollstall_timer); - udc_pollstall_timer.function = udc_pollstall_timer_function; - udc_pollstall_timer.data = 1; + setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 1); /* set SD */ reg = readl(&dev->regs->ctl); -- 2.7.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
[PATCH 7/9] drivers: usb: speedtch: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/atm/speedtch.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 3676adb..091db9b 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c @@ -874,16 +874,13 @@ static int speedtch_bind(struct usbatm_data *usbatm, usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); INIT_WORK(&instance->status_check_work, speedtch_check_status); - init_timer(&instance->status_check_timer); - - instance->status_check_timer.function = speedtch_status_poll; - instance->status_check_timer.data = (unsigned long)instance; + setup_timer(&instance->status_check_timer, speedtch_status_poll, + (unsigned long)instance); instance->last_status = 0xff; instance->poll_delay = MIN_POLL_DELAY; - init_timer(&instance->resubmit_timer); - instance->resubmit_timer.function = speedtch_resubmit_int; - instance->resubmit_timer.data = (unsigned long)instance; + setup_timer(&instance->resubmit_timer, speedtch_resubmit_int, + (unsigned long)instance); instance->int_urb = usb_alloc_urb(0, GFP_KERNEL); -- 2.7.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
[PATCH 3/9] usb: gadget: udc: m66592: use setup_timer() helper.
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/m66592-udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index 46ce7bc..3b8dbed 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c @@ -1592,9 +1592,7 @@ static int m66592_probe(struct platform_device *pdev) m66592->gadget.max_speed = USB_SPEED_HIGH; m66592->gadget.name = udc_name; - init_timer(&m66592->timer); - m66592->timer.function = m66592_timer; - m66592->timer.data = (unsigned long)m66592; + setup_timer(&m66592->timer, m66592_timer, (unsigned long)m66592); m66592->reg = reg; ret = request_irq(ires->start, m66592_irq, IRQF_SHARED, -- 2.7.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
P/Contact
Dear Sir Please contact for detailed information of funds transfer based on your surname, Your prompt response will be highly appreciated. Kind Regards, Allen Yun B.Group manager contact id..
EHSET with hub and PCIe root hub
I am trying to validate the USB on an embedded platform based on the NXP i.MX7. So far I have only been able to validate root ports on the board but also have a PCIe xhci controller and a microchip USB3503 hub off of the HSIC port on the SoC which I would like to run the tests on. I have reviewed the mailing list archives and found another discussion of using the EHSET driver to validate a driver and they reference the same issue I am seeing. When I plug in the device I see usb_ehset_test: probe of failed with error -32 for either the PCIe root hub or the USB3503 HSIC hub. Further down in the mailing list chain Peter Chen states > Besides, do not connect HUB between your host board and emulation board > (for sending VID/PID). but there is no additional information regarding this statement. Looking around it looks like the hubs have some mechanism for being tested[0] and the HSETT application for Windows supports testing of hubs according to the documentation.[1] Is this something there exists a module for or are either of these cases unexpected behavior for the EHSET kernel module? Allen [0] http://www.testusb.com/Hub_test.html [1] https://usb.org/sites/default/files/HSETT_Instruction_0_4_1.pdf
RE: EHSET with hub and PCIe root hub
> >On 9/11/2019 8:27 AM, Peter Chen wrote: >> On 19-09-10 22:01:58, Allen Blaylock wrote: >>> I am trying to validate the USB on an embedded platform based on the NXP >>> i.MX7. >>> So far I have only been able to validate root ports on the board but >>> also have a PCIe xhci controller and a microchip USB3503 hub off of >>> the HSIC port on the SoC which I would like to run the tests on. >>> >>> I have reviewed the mailing list archives and found another >>> discussion of using the EHSET driver to validate a driver and they >>> reference the same issue I am seeing. When I plug in the device I see >>> usb_ehset_test: probe of failed with error -32 for either >>> the PCIe root hub or the USB3503 HSIC hub. > > >I remember seeing some HUBs which fail to enter compliance mode (STALL >SetFeature request) if a device is connected to the port. >You can check usbmon logs if SetFeature request was sent to HUB. So I do see the PORT_TEST SetFeature Request and Response when I use tcpdump to make a capture using usbmon. Unfortunately I am not as familiar with the raw usbmon output or some of the diagnostics output by usbmon so I may be missing something. Here is a capture from the sysfs usbmon file: a52efe00 268933702 C Ii:002:01 0 1 = 08 a52efe00 268933736 S Ii:002:01 -115 1 < a546b700 268934005 S Ci:002:00 s a3 00 0003 0004 4 < a546b700 268934303 C Ci:002:00 0 4 = 01010100 a546b700 268934327 S Co:002:00 s 23 01 0010 0003 0 a546b700 268934384 C Co:002:00 0 0 a546b700 268934438 S Ci:002:00 s a3 00 0003 0004 4 < a546b700 268934520 C Ci:002:00 0 4 = 0101 a546b700 268980085 S Ci:002:00 s a3 00 0003 0004 4 < a546b700 268980332 C Ci:002:00 0 4 = 0101 a546b700 269030091 S Ci:002:00 s a3 00 0003 0004 4 < a546b700 269030333 C Ci:002:00 0 4 = 0101 a546b700 269080082 S Ci:002:00 s a3 00 0003 0004 4 < a546b700 269080335 C Ci:002:00 0 4 = 0101 a546b280 269130094 S Ci:002:00 s a3 00 0003 0004 4 < a546b280 269130339 C Ci:002:00 0 4 = 0101 a546b280 269130376 S Co:002:00 s 23 03 0004 0003 0 a546b280 269130577 C Co:002:00 0 0 a546be00 269160091 S Ci:002:00 s a3 00 0003 0004 4 < a546be00 269160344 C Ci:002:00 0 4 = 03051000 a546be00 269160361 S Co:002:00 s 23 01 0014 0003 0 a546be00 269160416 C Co:002:00 0 0 a546be00 269230118 S Ci:000:00 s 80 06 0100 0040 64 < a546be00 269230341 C Ci:000:00 0 18 = 12010002 0040 0a1a0401 00010102 0301 a546be00 269230358 S Co:002:00 s 23 03 0004 0003 0 a546be00 269230425 C Co:002:00 0 0 a546be00 269260104 S Ci:002:00 s a3 00 0003 0004 4 < a546be00 269260354 C Ci:002:00 0 4 = 03051000 a546be00 269260374 S Co:002:00 s 23 01 0014 0003 0 a546be00 269260430 C Co:002:00 0 0 a546be00 269330097 S Co:000:00 s 00 05 0004 0 a546be00 269330372 C Co:000:00 0 0 a546b700 269380050 S Ci:004:00 s 80 06 0100 0012 18 < a546b700 269380327 C Ci:004:00 0 18 = 12010002 0040 0a1a0401 00010102 0301 a546b700 269380360 S Ci:004:00 s 80 06 0200 0009 9 < a546b700 269380453 C Ci:004:00 0 9 = 09022e00 01010080 32 a546b700 269380468 S Ci:004:00 s 80 06 0200 002e 46 < a546b700 269380574 C Ci:004:00 0 46 = 09022e00 01010080 32090400 0004ff00 0705 02020002 00070504 02000200 a546b700 269380608 S Ci:004:00 s 80 06 0300 00ff 255 < a546b700 269380701 C Ci:004:00 0 4 = 04030904 a546b700 269380717 S Ci:004:00 s 80 06 0302 0409 00ff 255 < a546b700 269380824 C Ci:004:00 0 34 = 22035500 53004200 20004500 48004f00 53005400 20005400 45005300 54004500 a546b700 269380845 S Ci:004:00 s 80 06 0301 0409 00ff 255 < a546b700 269380949 C Ci:004:00 0 34 = 22035500 53004200 20004500 48004f00 53005400 20005400 45005300 54004500 a546b700 269380968 S Ci:004:00 s 80 06 0303 0409 00ff 255 < a546b700 269381074 C Ci:004:00 0 10 = 0a034900 4f005600 3300 a546b280 269381564 S Co:004:00 s 00 09 0001 0 a546b280 269381704 C Co:004:00 0 0 a560a000 269407637 S Co:002:00 s 23 03 0015 0403 0 a560a000 269407869 C Co:002:00 -32 0 I was unable to make sense of it with the help of the usbmon.txt documentation and will need some more time using wireshark and the output of tcpdump to get familiar with decoding the raw usbmon output. >>> >>> Further down in the mailing list chain Peter Chen states >>>> Besides, do not connect HUB between your host board and emulation >>>> board (for sending VID/PID). >>> but there is no additional information regarding this statement. >> EHSET is used to test embedded host electrical signal required by USB >> IF Compliance Test, not test the signal for USB HUB, since the EHSET >> module could only let embedded host controller enter test mode by >> writing TEST MODE registers follows EHCI or xHCI spec. Maybe the USB >> HUB coul
RE: EHSET with hub and PCIe root hub
Thank you Alan, I am still working through understanding the usbmon and this is a helpful hint. I will contact the device manufacturer and see if there is some alternative method they recommend for testing. >Most of the usbmon output shows that a device was attached to port 3 of hub 2 >and enumerated as usual over the course of about half a second. > >The very last two lines show the computer sending the hub a Set-Port-Test >request on port 3 for test mode 4, which is Test Packet. >The hub's response is a STALL, indicating that the hub doesn't understand or >doesn't implement this request. > >Alan Stern >
RE: EHSET with hub and PCIe root hub
>I should add that the USB 2.0 spec includes the following text (from section >11.24.2.13): > >Test mode of a downstream facing port can only be used in >a well defined sequence of hub states. This sequence is >defined as follows: > >1) All enabled downstream facing ports of the hub containing >the port to be tested must be (selectively) suspended via >the SetPortFeature(PORT_SUSPEND) request. Each downstream >facing port of the hub must be in the disabled, >disconnected, or suspended state (see Figure 11-9). > >So you can see the hub probably failed the request because a non-suspended >device was connected to port 3. (And who knows what was attached to the other >ports -- the usbmon trace doesn't say.) > >Alan Stern This was very helpful. I was able to get the USB3503 to generate test packets by adding a SetPortFeature(PORT_SUSPEND) request to suspend the port before setting the PORT_TEST feature. Is there a way to tell that a device is a hub but not a root hub so ports on root hub ports aren't suspended prior to calling SetPortFeature(PORT_TEST)? I tried to use hub_udev->maxchild to determine if something was a hub but this appears misguided since root hubs can have multiple children, nothing else in the usb_device structure jumped out as being directly related to a hub. --- a/drivers/usb/misc/ehset.c +++ b/drivers/usb/misc/ehset.c @@ -62,6 +62,16 @@ static int ehset_probe(struct usb_interface *intf, NULL, 0, 1000); break; case TEST_PACKET_PID: + if(hub_udev->maxchild) + { + ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), + USB_REQ_SET_FEATURE, USB_RT_PORT, + USB_PORT_FEAT_SUSPEND, portnum, + NULL, 0, 1000); + if (ret < 0) + break; + + } ret = usb_control_msg(hub_udev, usb_sndctrlpipe(hub_udev, 0), USB_REQ_SET_FEATURE, USB_RT_PORT, USB_PORT_FEAT_TEST,