Commit 5cab3ff2 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: bus: rename sdw_bus_master_add/delete, add arguments

In preparation for future extensions, rename functions to use
sdw_bus_master prefix and add a parent and fwnode argument to
sdw_bus_master_add to help with device registration in follow-up
patches.

No functionality change, just renames and additional arguments.

The Intel code is currently unused, the two additional arguments are
only needed for compilation.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: default avatarJaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20200518174322.31561-2-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 6f7219fe
...@@ -101,10 +101,11 @@ Following is the Bus API to register the SoundWire Bus: ...@@ -101,10 +101,11 @@ Following is the Bus API to register the SoundWire Bus:
.. code-block:: c .. code-block:: c
int sdw_add_bus_master(struct sdw_bus *bus) int sdw_bus_master_add(struct sdw_bus *bus,
struct device *parent,
struct fwnode_handle)
{ {
if (!bus->dev) sdw_master_device_add(bus, parent, fwnode);
return -ENODEV;
mutex_init(&bus->lock); mutex_init(&bus->lock);
INIT_LIST_HEAD(&bus->slaves); INIT_LIST_HEAD(&bus->slaves);
......
...@@ -10,13 +10,16 @@ ...@@ -10,13 +10,16 @@
#include "bus.h" #include "bus.h"
/** /**
* sdw_add_bus_master() - add a bus Master instance * sdw_bus_master_add() - add a bus Master instance
* @bus: bus instance * @bus: bus instance
* @parent: parent device
* @fwnode: firmware node handle
* *
* Initializes the bus instance, read properties and create child * Initializes the bus instance, read properties and create child
* devices. * devices.
*/ */
int sdw_add_bus_master(struct sdw_bus *bus) int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
struct fwnode_handle *fwnode)
{ {
struct sdw_master_prop *prop = NULL; struct sdw_master_prop *prop = NULL;
int ret; int ret;
...@@ -107,7 +110,7 @@ int sdw_add_bus_master(struct sdw_bus *bus) ...@@ -107,7 +110,7 @@ int sdw_add_bus_master(struct sdw_bus *bus)
return 0; return 0;
} }
EXPORT_SYMBOL(sdw_add_bus_master); EXPORT_SYMBOL(sdw_bus_master_add);
static int sdw_delete_slave(struct device *dev, void *data) static int sdw_delete_slave(struct device *dev, void *data)
{ {
...@@ -131,18 +134,18 @@ static int sdw_delete_slave(struct device *dev, void *data) ...@@ -131,18 +134,18 @@ static int sdw_delete_slave(struct device *dev, void *data)
} }
/** /**
* sdw_delete_bus_master() - delete the bus master instance * sdw_bus_master_delete() - delete the bus master instance
* @bus: bus to be deleted * @bus: bus to be deleted
* *
* Remove the instance, delete the child devices. * Remove the instance, delete the child devices.
*/ */
void sdw_delete_bus_master(struct sdw_bus *bus) void sdw_bus_master_delete(struct sdw_bus *bus)
{ {
device_for_each_child(bus->dev, NULL, sdw_delete_slave); device_for_each_child(bus->dev, NULL, sdw_delete_slave);
sdw_bus_debugfs_exit(bus); sdw_bus_debugfs_exit(bus);
} }
EXPORT_SYMBOL(sdw_delete_bus_master); EXPORT_SYMBOL(sdw_bus_master_delete);
/* /*
* SDW IO Calls * SDW IO Calls
......
...@@ -1110,9 +1110,9 @@ static int intel_probe(struct platform_device *pdev) ...@@ -1110,9 +1110,9 @@ static int intel_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, sdw); platform_set_drvdata(pdev, sdw);
ret = sdw_add_bus_master(&sdw->cdns.bus); ret = sdw_bus_master_add(&sdw->cdns.bus, &pdev->dev, pdev->dev.fwnode);
if (ret) { if (ret) {
dev_err(&pdev->dev, "sdw_add_bus_master fail: %d\n", ret); dev_err(&pdev->dev, "sdw_bus_master_add fail: %d\n", ret);
return ret; return ret;
} }
...@@ -1173,7 +1173,7 @@ static int intel_probe(struct platform_device *pdev) ...@@ -1173,7 +1173,7 @@ static int intel_probe(struct platform_device *pdev)
sdw_cdns_enable_interrupt(&sdw->cdns, false); sdw_cdns_enable_interrupt(&sdw->cdns, false);
free_irq(sdw->link_res->irq, sdw); free_irq(sdw->link_res->irq, sdw);
err_init: err_init:
sdw_delete_bus_master(&sdw->cdns.bus); sdw_bus_master_delete(&sdw->cdns.bus);
return ret; return ret;
} }
...@@ -1189,7 +1189,7 @@ static int intel_remove(struct platform_device *pdev) ...@@ -1189,7 +1189,7 @@ static int intel_remove(struct platform_device *pdev)
free_irq(sdw->link_res->irq, sdw); free_irq(sdw->link_res->irq, sdw);
snd_soc_unregister_component(sdw->cdns.dev); snd_soc_unregister_component(sdw->cdns.dev);
} }
sdw_delete_bus_master(&sdw->cdns.bus); sdw_bus_master_delete(&sdw->cdns.bus);
return 0; return 0;
} }
......
...@@ -822,7 +822,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) ...@@ -822,7 +822,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
goto err_clk; goto err_clk;
} }
ret = sdw_add_bus_master(&ctrl->bus); ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode);
if (ret) { if (ret) {
dev_err(dev, "Failed to register Soundwire controller (%d)\n", dev_err(dev, "Failed to register Soundwire controller (%d)\n",
ret); ret);
...@@ -841,7 +841,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) ...@@ -841,7 +841,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
return 0; return 0;
err_master_add: err_master_add:
sdw_delete_bus_master(&ctrl->bus); sdw_bus_master_delete(&ctrl->bus);
err_clk: err_clk:
clk_disable_unprepare(ctrl->hclk); clk_disable_unprepare(ctrl->hclk);
err_init: err_init:
...@@ -852,7 +852,7 @@ static int qcom_swrm_remove(struct platform_device *pdev) ...@@ -852,7 +852,7 @@ static int qcom_swrm_remove(struct platform_device *pdev)
{ {
struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev); struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
sdw_delete_bus_master(&ctrl->bus); sdw_bus_master_delete(&ctrl->bus);
clk_disable_unprepare(ctrl->hclk); clk_disable_unprepare(ctrl->hclk);
return 0; return 0;
......
...@@ -832,8 +832,9 @@ struct sdw_bus { ...@@ -832,8 +832,9 @@ struct sdw_bus {
bool multi_link; bool multi_link;
}; };
int sdw_add_bus_master(struct sdw_bus *bus); int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
void sdw_delete_bus_master(struct sdw_bus *bus); struct fwnode_handle *fwnode);
void sdw_bus_master_delete(struct sdw_bus *bus);
/** /**
* sdw_port_config: Master or Slave Port configuration * sdw_port_config: Master or Slave Port configuration
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment