soundwire: bus_type: convert open-coded while() to for() loop
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 8 Jun 2020 20:54:34 +0000 (04:54 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 30 Jun 2020 15:56:17 +0000 (21:26 +0530)
No functionality change, just more structured code.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20200608205436.2402-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/bus_type.c

index de9a671..c8d948c 100644 (file)
 static const struct sdw_device_id *
 sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv)
 {
-       const struct sdw_device_id *id = drv->id_table;
+       const struct sdw_device_id *id;
 
-       while (id && id->mfg_id) {
+       for (id = drv->id_table; id && id->mfg_id; id++)
                if (slave->id.mfg_id == id->mfg_id &&
                    slave->id.part_id == id->part_id)
                        return id;
-               id++;
-       }
 
        return NULL;
 }