From 2111134fe413311ea2e89c7ffc66abb68ada5982 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Fri, 4 Sep 2015 15:10:09 +0530 Subject: [PATCH] greybus: spi: Allow spi-core to allocate bus numbers dynamically And that fixes these warnings generated with BDB: WARNING: at /home/viresh/ara/jetson-kernel-build/tegra/fs/sysfs/dir.c:530 sysfs_add_one+0xa4/0xb4() sysfs: cannot create duplicate filename '/class/spi_master/spi0' Modules linked in: gb_es2(O) gb_phy(O) greybus(O) CPU: 2 PID: 111 Comm: kworker/u8:3 Tainted: G W O 3.10.40-gf32f9c5ca7e8 #2 Workqueue: events_unbound svc_process_hotplug [greybus] [] (unwind_backtrace+0x0/0x13c) from [] (show_stack+0x18/0x1c) [] (show_stack+0x18/0x1c) from [] (warn_slowpath_common+0x5c/0x74) [] (warn_slowpath_common+0x5c/0x74) from [] (warn_slowpath_fmt+0x38/0x48) [] (warn_slowpath_fmt+0x38/0x48) from [] (sysfs_add_one+0xa4/0xb4) [] (sysfs_add_one+0xa4/0xb4) from [] (sysfs_do_create_link_sd+0xc0/0x20c) [] (sysfs_do_create_link_sd+0xc0/0x20c) from [] (device_add+0x2e8/0x5f4) [] (device_add+0x2e8/0x5f4) from [] (spi_register_master+0x15c/0x654) [] (spi_register_master+0x15c/0x654) from [] (gb_spi_connection_init+0x164/0x19c [gb_phy]) [] (gb_spi_connection_init+0x164/0x19c [gb_phy]) from [] (gb_connection_bind_protocol+0x160/0x1b4 [greybus]) [] (gb_connection_bind_protocol+0x160/0x1b4 [greybus]) from [] (gb_connection_create_range+0x228/0x2fc [greybus]) [] (gb_connection_create_range+0x228/0x2fc [greybus]) from [] (gb_connection_create+0x40/0x48 [greybus]) [] (gb_connection_create+0x40/0x48 [greybus]) from [] (gb_manifest_parse+0x61c/0x628 [greybus]) [] (gb_manifest_parse+0x61c/0x628 [greybus]) from [] (gb_interface_init+0x130/0x170 [greybus]) [] (gb_interface_init+0x130/0x170 [greybus]) from [] (svc_process_hotplug+0x214/0x258 [greybus]) [] (svc_process_hotplug+0x214/0x258 [greybus]) from [] (process_one_work+0x13c/0x454) [] (process_one_work+0x13c/0x454) from [] (worker_thread+0x140/0x3dc) [] (worker_thread+0x140/0x3dc) from [] (kthread+0xe0/0xe4) [] (kthread+0xe0/0xe4) from [] (ret_from_fork+0x14/0x20) Reported-by: Mitchell Tasman Suggested-by: Johan Hovold Signed-off-by: Viresh Kumar Signed-off-by: Johan Hovold --- drivers/staging/greybus/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index ef3cc33772f8..e5d216646b9c 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -299,7 +299,7 @@ static int gb_spi_connection_init(struct gb_connection *connection) if (ret) goto out_err; - master->bus_num = 0; /* How do we get controller id here? */ + master->bus_num = -1; /* Allow spi-core to allocate it dynamically */ master->num_chipselect = spi->num_chipselect; master->mode_bits = spi->mode; master->flags = spi->flags;