diff mbox series

[06/10] media: rtl2832_sdr: drop vb2_ops_wait_prepare/finish

Message ID 20241211042355.8479-1-user@am64 (mailing list archive)
State New
Headers show
Series None | expand

Commit Message

Arthur Marsh Dec. 11, 2024, 4:23 a.m. UTC
Hi, I had the following when rtl2832_sdr was loading:

 Linux version 6.13.0-rc2 (root@am64) (gcc-14 (Debian 14.2.0-8) 14.2.0, GNU ld (GNU Binutils for Debian) 2.43.50.20241204) #6236 SMP PREEMPT_RT Mon Dec  9 10:25:04 ACDT 2024

 usb 9-5: new low-speed USB device number 2 using ohci-pci
 usb 4-3: New USB device found, idVendor=0bda, idProduct=2838, bcdDevice= 1.00
 usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
 usb 4-3: Product: RTL2838UHIDIR
 usb 4-3: Manufacturer: Realtek

 usb 4-3: dvb_usb_v2: found a 'Realtek RTL2832U reference design' in warm state
 usb 4-3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer
 dvbdev: DVB: registering new adapter (Realtek RTL2832U reference design)
 usb 4-3: media controller created
 dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered.
 i2c i2c-5: Added multiplexed i2c bus 6
 rtl2832 5-0010: Realtek RTL2832 successfully attached
 usb 4-3: DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))...
 dvbdev: dvb_create_media_entity: media entity 'Realtek RTL2832 (DVB-T)' registered.
 i2c i2c-6: fc0012: Fitipower FC0012 successfully identified
 videodev: Linux video capture interface: v2.00
 [drm] ib test on ring 6 succeeded
 ------------[ cut here ]------------
 WARNING: CPU: 1 PID: 453 at drivers/media/common/videobuf2/videobuf2-core.c:2661 vb2_core_queue_init+0x272/0x280 [videobuf2_common]
 Modules linked in: rtl2832_sdr videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev fc0012 rtl2832 i2c_mux dvb_usb_rtl28xxu(+) dvb_usb_v2 dvb_core mc radeon(+) snd_emu10k1_synth snd_emux_synth snd_seq_midi_emul snd_seq_virmidi snd_seq_midi snd_seq_midi_event drm_ttm_helper snd_seq ttm snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg drm_client_lib drm_suballoc_helper snd_emu10k1 drm_display_helper snd_hda_codec edac_mce_amd sha512_ssse3 sha512_generic sha256_ssse3 snd_util_mem sha1_ssse3 drm_kms_helper aesni_intel snd_ac97_codec snd_hda_core ac97_bus snd_rawmidi snd_seq_device snd_hwdep k10temp drm gf128mul snd_pcm crypto_simd cryptd pcspkr at24 evdev serio_raw acpi_cpufreq emu10k1_gp gameport regmap_i2c i2c_algo_bit snd_timer video snd wmi soundcore sp5100_tco button ext4 crc32c_generic crc16 mbcache jbd2 uas usb_storage hid_generic usbhid hid sg sr_mod cdrom sd_mod ata_generic firewire_ohci ahci crc32_pclmul crc32c_intel firewire_core crc_itu_t pata_atiixp xhci_pci_renesas libahci
  ohci_pci i2c_piix4 i2c_smbus xhci_pci ehci_pci ohci_hcd libata ehci_hcd xhci_hcd r8169 realtek mdio_devres scsi_mod usbcore libphy scsi_common usb_common
 CPU: 1 UID: 0 PID: 453 Comm: udevd Not tainted 6.13.0-rc2 #6236
 Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./F2A78M-HD2, BIOS F2 05/28/2014
 RIP: 0010:vb2_core_queue_init+0x272/0x280 [videobuf2_common]
 Code: 90 0f 1f 80 00 00 00 00 eb be 0f 0b eb ba 0f 0b 90 0f 1f 80 00 00 00 00 eb ae 0f 0b eb aa 0f 0b 90 0f 1f 80 00 00 00 00 eb 9e <0f> 0b eb 9a 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90
 RSP: 0018:ffffb26cc13d3780 EFLAGS: 00010246
 RAX: 0000000000000000 RBX: ffff90e6856d85a0 RCX: ffffffffc0d03320
 RDX: 0000000000000001 RSI: 0000000000000001 RDI: 0000000000000000
 RBP: ffff90e6837ada80 R08: 0000000000001000 R09: 0000000000000000
 R10: ffff90e6856d8000 R11: 6f7475612e312e72 R12: 0000000000000000
 R13: ffff90e6856d8000 R14: ffff90e6856d8790 R15: ffff90e6856d85a0
 FS:  00007fbae6471840(0000) GS:ffff90e9af880000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 00007f6c22049e76 CR3: 0000000102ba4000 CR4: 00000000000406f0
 Call Trace:
  <TASK>
  ? vb2_core_queue_init+0x272/0x280 [videobuf2_common]
  ? __warn.cold+0xad/0x111
  ? vb2_core_queue_init+0x272/0x280 [videobuf2_common]
  ? report_bug+0x10e/0x1a0
  ? handle_bug+0x53/0x90
  ? exc_invalid_op+0x1f/0x90
  ? asm_exc_invalid_op+0x16/0x20
  ? vb2_core_queue_init+0x272/0x280 [videobuf2_common]
  rtl2832_sdr_probe+0x188/0x490 [rtl2832_sdr]
  ? __pfx___device_attach_driver+0x10/0x10
  platform_probe+0x4d/0xa0
  ? driver_sysfs_add+0x73/0xd0
  really_probe+0xde/0x350
  ? pm_runtime_barrier+0x61/0xb0
  __driver_probe_device+0x78/0x110
  driver_probe_device+0x2d/0xc0
  __device_attach_driver+0x8c/0x100
  bus_for_each_drv+0x86/0xe0
  __device_attach+0xb0/0x1b0
  bus_probe_device+0x92/0xb0
  device_add+0x654/0x870
  ? dev_set_name+0x43/0x50
  platform_device_add+0xe6/0x250
  platform_device_register_full+0x117/0x1a0
  rtl2832u_tuner_attach+0x2e0/0x9e0 [dvb_usb_rtl28xxu]
  dvb_usbv2_probe.cold+0xba6/0xccd [dvb_usb_v2]
  ? __pm_runtime_set_status+0x19b/0x2e0
  usb_probe_interface+0x16e/0x360 [usbcore]
  really_probe+0xde/0x350
  ? pm_runtime_barrier+0x61/0xb0
  ? __pfx___driver_attach+0x10/0x10
  __driver_probe_device+0x78/0x110
  driver_probe_device+0x2d/0xc0
  __driver_attach+0xc9/0x1c0
  bus_for_each_dev+0x6a/0xb0
  ? migrate_enable+0xbf/0xf0
  bus_add_driver+0x139/0x220
  driver_register+0x6e/0xc0
  usb_register_driver+0x93/0x140 [usbcore]
  ? __pfx_rtl28xxu_usb_driver_init+0x10/0x10 [dvb_usb_rtl28xxu]
  do_one_initcall+0x42/0x210
  ? __kmalloc_cache_noprof+0x98/0x240
  do_init_module+0x60/0x210
  init_module_from_file+0x89/0xc0
  __x64_sys_finit_module+0x143/0x390
  do_syscall_64+0x47/0x110
  entry_SYSCALL_64_after_hwframe+0x76/0x7e
 RIP: 0033:0x7fbae62a25b9
 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 37 88 0d 00 f7 d8 64 89 01 48
 RSP: 002b:00007ffdcfa41df8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
 RAX: ffffffffffffffda RBX: 000055a9baaadff0 RCX: 00007fbae62a25b9
 RDX: 0000000000000000 RSI: 00007fbae63a2541 RDI: 000000000000000d
 RBP: 0000000000000000 R08: 00007fbae637bad0 R09: 000055a9baaa2540
 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbae63a2541
 R13: 0000000000020000 R14: 000055a9baab55f0 R15: 0000000000000000
  </TASK>
 ---[ end trace 0000000000000000 ]---
 rtl2832_sdr rtl2832_sdr.1.auto: Could not initialize vb2 queue
 rtl2832_sdr rtl2832_sdr.1.auto: probe with driver rtl2832_sdr failed with error -22
 usb 4-3: dvb_usb_v2: 'Realtek RTL2832U reference design' successfully initialized and connected
 usbcore: registered new interface driver dvb_usb_rtl28xxu

It was git-bisected back to:

commit 8fcd2795d22a7b6aa0671aaa67a74c0f776707af
Author: Hans Verkuil <hverkuil@xs4all.nl>
Date:   Mon Oct 14 17:06:33 2024 +0200

    media: rtl2832_sdr: drop vb2_ops_wait_prepare/finish
    
    Since commit 88785982a19d ("media: vb2: use lock if wait_prepare/finish
    are NULL") it is no longer needed to set the wait_prepare/finish
    vb2_ops callbacks as long as the lock field in vb2_queue is set.
    
    Since the vb2_ops_wait_prepare/finish callbacks already rely on that field,
    we can safely drop these callbacks.
    
    This simplifies the code and this is a step towards the goal of deleting
    these callbacks.
    
    Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>


Reversing this patch to the current Linus git head kernel resulted in an
apparently successful load:

[   19.678284] rtl2832 5-0010: Realtek RTL2832 successfully attached
[   20.477909] rtl2832_sdr rtl2832_sdr.1.auto: Registered as swradio0
[   20.477916] rtl2832_sdr rtl2832_sdr.1.auto: Realtek RTL2832 SDR attached
[   20.477919] rtl2832_sdr rtl2832_sdr.1.auto: SDR API is still slightly experimental and functionality changes may follow

I have not tested the sdr functionality though.

Arthur Marsh.
diff mbox series

Patch

diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c
index 922c1662f1f0..05254d8717db 100644
--- a/drivers/media/dvb-frontends/rtl2832_sdr.c
+++ b/drivers/media/dvb-frontends/rtl2832_sdr.c
@@ -947,8 +947,6 @@  static const struct vb2_ops rtl2832_sdr_vb2_ops = {
 	.buf_queue              = rtl2832_sdr_buf_queue,
 	.start_streaming        = rtl2832_sdr_start_streaming,
 	.stop_streaming         = rtl2832_sdr_stop_streaming,
-	.wait_prepare           = vb2_ops_wait_prepare,
-	.wait_finish            = vb2_ops_wait_finish,
 };
 
 static int rtl2832_sdr_g_tuner(struct file *file, void *priv,