linux/drivers/firmware/arm_scmi
Florian Fainelli b9ceca6be4 firmware: arm_scmi: Fix duplicate workqueue name
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: bd31b24969 ("firmware: arm_scmi: Add notification dispatch and delivery")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
[sudeep.holla: trimmed backtrace to remove all unwanted hexcodes and timestamps]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2020-10-14 18:42:41 +01:00
..
base.c firmware: arm_scmi: Add missing Rx size re-initialisation 2020-10-13 10:01:47 +01:00
bus.c firmware: arm_scmi: Move scmi bus init and exit calls into the driver 2020-09-14 07:30:48 +01:00
clock.c firmware: arm_scmi: Add missing Rx size re-initialisation 2020-10-13 10:01:47 +01:00
common.h firmware: arm_scmi: Add missing Rx size re-initialisation 2020-10-13 10:01:47 +01:00
driver.c firmware: arm_scmi: Add missing Rx size re-initialisation 2020-10-13 10:01:47 +01:00
mailbox.c firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free 2020-09-09 10:01:21 +01:00
Makefile firmware: arm_scmi: Enable building as a single module 2020-09-14 07:31:03 +01:00
notify.c firmware: arm_scmi: Fix duplicate workqueue name 2020-10-14 18:42:41 +01:00
notify.h firmware: arm_scmi: Remove fixed size fields from reports/scmi_event_header 2020-07-13 09:40:21 +01:00
perf.c firmware: arm_scmi: Add missing Rx size re-initialisation 2020-10-13 10:01:47 +01:00
power.c firmware: arm_scmi: Move scmi protocols registration into the driver 2020-09-14 07:30:55 +01:00
reset.c firmware: arm_scmi: Fix ARCH_COLD_RESET 2020-10-12 14:05:12 +01:00
scmi_pm_domain.c firmware: arm_scmi: Fix SCMI genpd domain probing 2020-06-30 14:08:18 +01:00
sensors.c firmware: arm_scmi: Add missing Rx size re-initialisation 2020-10-13 10:01:47 +01:00
shmem.c firmware: arm_scmi: Rename .clear_notification() transport_ops 2020-04-20 17:25:26 +01:00
smc.c firmware: arm_scmi: Expand SMC/HVC message pool to more than one 2020-10-12 15:10:42 +01:00
system.c firmware: arm_scmi: Move scmi protocols registration into the driver 2020-09-14 07:30:55 +01:00