On Thu, Nov 16, 2017 at 04:05:29PM +0000, Srinivas Kandagatla wrote:
Minor Comment!
On 10/11/17 11:49, Vinod Koul wrote:
From: Sanyog Kale sanyog.r.kale@intel.com
SoundWire Slaves report status to bus. Add helpers to handle the status changes.
Signed-off-by: Hardik T Shah hardik.t.shah@intel.com Signed-off-by: Sanyog Kale sanyog.r.kale@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com
+static int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id) +{
- if ((slave->id.unique_id != id.unique_id) ||
(slave->id.mfg_id != id.mfg_id) ||
(slave->id.part_id != id.part_id) ||
(slave->id.class_id != id.class_id))
return -ENODEV;
- return 0;
+}
+/* called with bus_lock held */ +static int sdw_get_device_num(struct sdw_slave *slave) +{
If we use ida we would not need this function.
Not really, find_first_zero_bit and set_bit will be replaced by get_ida()
the bound check will still be required as we have finite set of ids to work with. Nevertheless I will check if it helps in this case and move if helpful.
- int bit;
- bit = find_first_zero_bit(slave->bus->assigned, SDW_MAX_DEVICES);
- if (bit == SDW_MAX_DEVICES) {
bit = -ENODEV;
goto err;
- }
- /*
* Do not update dev_num in Slave data structure here,
* Update once program dev_num is successful
*/
- set_bit(bit, slave->bus->assigned);
+err:
- return bit;
+}