*/
dev_t dm_get_dev_t(const char *path)
{
- dev_t uninitialized_var(dev);
+ dev_t dev;
struct block_device *bdev;
bdev = lookup_bdev(path);
struct dm_target *uninitialized_var(ti);
struct queue_limits ti_limits;
- unsigned i = 0;
+ unsigned i;
/*
* Check each entry in the table in turn.
*/
- while (i < dm_table_get_num_targets(table)) {
- ti = dm_table_get_target(table, i++);
+ for (i = 0; i < dm_table_get_num_targets(table); i++) {
+ ti = dm_table_get_target(table, i);
blk_set_stacking_limits(&ti_limits);
static bool dm_table_supports_dax(struct dm_table *t)
{
struct dm_target *ti;
- unsigned i = 0;
+ unsigned i;
/* Ensure that all targets support DAX. */
- while (i < dm_table_get_num_targets(t)) {
- ti = dm_table_get_target(t, i++);
+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
+ ti = dm_table_get_target(t, i);
if (!ti->type->direct_access)
return false;
struct dm_target *dm_table_get_wildcard_target(struct dm_table *t)
{
- struct dm_target *uninitialized_var(ti);
- unsigned i = 0;
+ struct dm_target *ti;
+ unsigned i;
- while (i < dm_table_get_num_targets(t)) {
- ti = dm_table_get_target(t, i++);
+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
+ ti = dm_table_get_target(t, i);
if (dm_target_is_wildcard(ti->type))
return ti;
}
*/
bool dm_table_has_no_data_devices(struct dm_table *table)
{
- struct dm_target *uninitialized_var(ti);
- unsigned i = 0, num_devices = 0;
+ struct dm_target *ti;
+ unsigned i, num_devices;
- while (i < dm_table_get_num_targets(table)) {
- ti = dm_table_get_target(table, i++);
+ for (i = 0; i < dm_table_get_num_targets(table); i++) {
+ ti = dm_table_get_target(table, i);
if (!ti->type->iterate_devices)
return false;
+ num_devices = 0;
ti->type->iterate_devices(ti, count_device, &num_devices);
if (num_devices)
return false;
int dm_calculate_queue_limits(struct dm_table *table,
struct queue_limits *limits)
{
- struct dm_target *uninitialized_var(ti);
+ struct dm_target *ti;
struct queue_limits ti_limits;
- unsigned i = 0;
+ unsigned i;
blk_set_stacking_limits(limits);
- while (i < dm_table_get_num_targets(table)) {
+ for (i = 0; i < dm_table_get_num_targets(table); i++) {
blk_set_stacking_limits(&ti_limits);
- ti = dm_table_get_target(table, i++);
+ ti = dm_table_get_target(table, i);
if (!ti->type->iterate_devices)
goto combine_limits;
static bool dm_table_supports_flush(struct dm_table *t, unsigned long flush)
{
struct dm_target *ti;
- unsigned i = 0;
+ unsigned i;
/*
* Require at least one underlying device to support flushes.
* so we need to use iterate_devices here, which targets
* supporting flushes must provide.
*/
- while (i < dm_table_get_num_targets(t)) {
- ti = dm_table_get_target(t, i++);
+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
+ ti = dm_table_get_target(t, i);
if (!ti->num_flush_bios)
continue;
iterate_devices_callout_fn func)
{
struct dm_target *ti;
- unsigned i = 0;
+ unsigned i;
- while (i < dm_table_get_num_targets(t)) {
- ti = dm_table_get_target(t, i++);
+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
+ ti = dm_table_get_target(t, i);
if (!ti->type->iterate_devices ||
!ti->type->iterate_devices(ti, func, NULL))
static bool dm_table_supports_write_same(struct dm_table *t)
{
struct dm_target *ti;
- unsigned i = 0;
+ unsigned i;
- while (i < dm_table_get_num_targets(t)) {
- ti = dm_table_get_target(t, i++);
+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
+ ti = dm_table_get_target(t, i);
if (!ti->num_write_same_bios)
return false;
static bool dm_table_supports_discards(struct dm_table *t)
{
struct dm_target *ti;
- unsigned i = 0;
+ unsigned i;
/*
* Unless any target used by the table set discards_supported,
* so we need to use iterate_devices here, which targets
* supporting discard selectively must provide.
*/
- while (i < dm_table_get_num_targets(t)) {
- ti = dm_table_get_target(t, i++);
+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
+ ti = dm_table_get_target(t, i);
if (!ti->num_discard_bios)
continue;