• Florian Fainelli's avatar
    firmware: arm_scmi: Fix duplicate workqueue name · b9ceca6b
    Florian Fainelli authored
    When more than a single SCMI device are present in the system, the
    creation of the notification workqueue with the WQ_SYSFS flag will lead
    to the following sysfs duplicate node warning:
    
     sysfs: cannot create duplicate filename '/devices/virtual/workqueue/scmi_notify'
     CPU: 0 PID: 20 Comm: kworker/0:1 Not tainted 5.9.0-gdf4dd84a3f7d #29
     Hardware name: Broadcom STB (Flattened Device Tree)
     Workqueue: events deferred_probe_work_func
     Backtrace:
       show_stack + 0x20/0x24
       dump_stack + 0xbc/0xe0
       sysfs_warn_dup + 0x70/0x80
       sysfs_create_dir_ns + 0x15c/0x1a4
       kobject_add_internal + 0x140/0x4d0
       kobject_add + 0xc8/0x138
       device_add + 0x1dc/0xc20
       device_register + 0x24/0x28
       workqueue_sysfs_register + 0xe4/0x1f0
       alloc_workqueue + 0x448/0x6ac
       scmi_notification_init + 0x78/0x1dc
       scmi_probe + 0x268/0x4fc
       platform_drv_probe + 0x70/0xc8
       really_probe + 0x184/0x728
       driver_probe_device + 0xa4/0x278
       __device_attach_driver + 0xe8/0x148
       bus_for_each_drv + 0x108/0x158
       __device_attach + 0x190/0x234
       device_initial_probe + 0x1c/0x20
       bus_probe_device + 0xdc/0xec
       deferred_probe_work_func + 0xd4/0x11c
       process_one_work + 0x420/0x8f0
       worker_thread + 0x4fc/0x91c
       kthread + 0x21c/0x22c
       ret_from_fork + 0x14/0x20
     kobject_add_internal failed for scmi_notify with -EEXIST, don't try to
     	register things with the same name in the same directory.
     arm-scmi brcm_scmi@1: SCMI Notifications - Initialization Failed.
     arm-scmi brcm_scmi@1: SCMI Notifications NOT available.
     arm-scmi brcm_scmi@1: SCMI Protocol v1.0 'brcm-scmi:' Firmware version 0x1
    
    Fix this by using dev_name(handle->dev) which guarantees that the name is
    unique and this also helps correlate which notification workqueue corresponds
    to which SCMI device instance.
    
    Link: https://lore.kernel.org/r/20201014021737.287340-1-f.fainelli@gmail.com
    Fixes: bd31b249 ("firmware: arm_scmi: Add notification dispatch and delivery")
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    [sudeep.holla: trimmed backtrace to remove all unwanted hexcodes and timestamps]
    Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
    b9ceca6b
notify.c 48.2 KB