From ea48c3680829c0c522a799a4a9e0fb6cc5afd0a4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 7 Dec 2016 14:53:26 -0200 Subject: [PATCH] [media] em28xx: don't change the device's name Changing the device name, causes it to be unable to remove the sysfs file, causing troubles if a device is removed and then re-inserted. [ 1010.310320] WARNING: CPU: 3 PID: 119 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x7b/0x90 [ 1010.310323] sysfs: cannot create duplicate filename '/bus/usb/devices/1-3.3' [ 1010.310325] Modules linked in: lgdt330x em28xx_dvb dvb_core em28xx_alsa tuner_xc2028 tuner tvp5150 em28xx_v4l videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core em28xx tveeprom v4l2_common videodev media xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables cmac bnep cpufreq_powersave cpufreq_conservative cpufreq_userspace binfmt_misc parport_pc ppdev lp parport snd_hda_codec_hdmi iTCO_wdt snd_hda_codec_realtek iTCO_vendor_support snd_hda_codec_generic arc4 intel_rapl x86_pkg_temp_thermal iwlmvm intel_powerclamp coretemp kvm_intel mac80211 kvm i915 [ 1010.310383] irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel iwlwifi pl2303 aesni_intel btusb aes_x86_64 usbserial lrw btrtl gf128mul glue_helper btbcm ablk_helper cryptd btintel bluetooth drm_kms_helper cfg80211 drm psmouse pcspkr i2c_i801 e1000e serio_raw snd_hda_intel snd_soc_rt5640 snd_hda_codec snd_soc_rl6231 snd_soc_ssm4567 mei_me i2c_smbus rfkill snd_hda_core ptp mei snd_soc_core ehci_pci sg lpc_ich shpchp mfd_core ehci_hcd pps_core snd_hwdep i2c_algo_bit snd_compress snd_pcm sdhci_acpi snd_timer battery snd sdhci elan_i2c snd_soc_sst_acpi mmc_core fjes dw_dmac i2c_hid soundcore snd_soc_sst_match i2c_designware_platform video i2c_designware_core acpi_pad acpi_als kfifo_buf tpm_tis button industrialio tpm_tis_core tpm ext4 crc16 jbd2 fscrypto mbcache dm_mod joydev evdev hid_logitech_hidpp [ 1010.310449] sd_mod hid_logitech_dj usbhid hid ahci libahci crc32c_intel libata xhci_pci xhci_hcd scsi_mod usbcore fan thermal [ 1010.310464] CPU: 3 PID: 119 Comm: kworker/3:2 Not tainted 4.9.0-rc8+ #14 [ 1010.310466] Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015 [ 1010.310487] Workqueue: usb_hub_wq hub_event [usbcore] [ 1010.310490] 0000000000000000 ffffffff848f56c5 ffff8803b1f7f858 0000000000000000 [ 1010.310496] ffffffff8414f8f8 ffff88030000001f ffffed00763eff07 ffff8803b1f7f8f0 [ 1010.310501] ffff8803b3ea1e60 0000000000000001 ffffffffffffffef ffff8803b45c6840 [ 1010.310505] Call Trace: [ 1010.310517] [] ? dump_stack+0x5c/0x77 [ 1010.310522] [] ? __warn+0x168/0x1a0 [ 1010.310526] [] ? warn_slowpath_fmt+0xb4/0xf0 [ 1010.310529] [] ? __warn+0x1a0/0x1a0 [ 1010.310534] [] ? kasan_kmalloc+0xa6/0xd0 [ 1010.310539] [] ? kernfs_path_from_node+0x4a/0x60 [ 1010.310543] [] ? sysfs_warn_dup+0x7b/0x90 [ 1010.310547] [] ? sysfs_do_create_link_sd.isra.2+0xb6/0xd0 [ 1010.310553] [] ? bus_add_device+0x318/0x6b0 [ 1010.310557] [] ? sysfs_create_groups+0x83/0x110 [ 1010.310562] [] ? device_add+0x777/0x1350 [ 1010.310567] [] ? device_private_init+0x180/0x180 [ 1010.310583] [] ? usb_new_device+0x707/0x1030 [usbcore] [ 1010.310598] [] ? hub_event+0x1d65/0x3280 [usbcore] [ 1010.310604] [] ? account_entity_dequeue+0x30b/0x4a0 [ 1010.310618] [] ? hub_port_debounce+0x280/0x280 [usbcore] [ 1010.310624] [] ? compat_start_thread+0x80/0x80 [ 1010.310629] [] ? __schedule+0x704/0x1770 [ 1010.310633] [] ? io_schedule_timeout+0x390/0x390 [ 1010.310638] [] ? cache_reap+0x173/0x200 [ 1010.310642] [] ? process_one_work+0x4ed/0xe60 [ 1010.310646] [] ? worker_thread+0xe2/0xfd0 [ 1010.310650] [] ? __wake_up_common+0xbc/0x160 [ 1010.310654] [] ? process_one_work+0xe60/0xe60 [ 1010.310658] [] ? kthread+0x1cc/0x220 [ 1010.310663] [] ? kthread_park+0x80/0x80 [ 1010.310667] [] ? kthread_park+0x80/0x80 [ 1010.310671] [] ? kthread_park+0x80/0x80 [ 1010.310675] [] ? ret_from_fork+0x25/0x30 Tested-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-cards.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index b516c691b9eb..50e4c6e51ee7 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3236,8 +3236,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, int minor) { int retval; - static const char *default_chip_name = "em28xx"; - const char *chip_name = default_chip_name; + const char *chip_name = NULL; dev->udev = udev; mutex_init(&dev->ctrl_urb_lock); @@ -3324,14 +3323,9 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev, break; } } - - dev_set_name(&dev->udev->dev, "%d-%s: %s#%d", - dev->udev->bus->busnum, dev->udev->devpath, - chip_name, dev->devno); - - if (chip_name == default_chip_name) - dev_info(&dev->udev->dev, - "unknown em28xx chip ID (%d)\n", dev->chip_id); + if (!chip_name) + dev_info(&dev->udev->dev, + "unknown em28xx chip ID (%d)\n", dev->chip_id); else dev_info(&dev->udev->dev, "chip ID is %s\n", chip_name); -- 2.45.2