Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7b621b8 authored by Jiang Liu's avatar Jiang Liu Committed by Olav Haugan
Browse files

zram: simplify and optimize dev_to_zram()



Simplify and optimize dev_to_zram() without walking the zram_devices
array.

Change-Id: I7d2031baabfd880ee8479abf3657358cd7db57cb
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 80de574dca050b734d8413a98a983fba3d06240b
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
parent 2579c718
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -30,18 +30,9 @@ static u64 zram_stat64_read(struct zram *zram, u64 *v)
	return val;
}

static struct zram *dev_to_zram(struct device *dev)
static inline struct zram *dev_to_zram(struct device *dev)
{
	int i;
	struct zram *zram = NULL;

	for (i = 0; i < zram_get_num_devices(); i++) {
		zram = &zram_devices[i];
		if (disk_to_dev(zram->disk) == dev)
			break;
	}

	return zram;
	return (struct zram *)dev_to_disk(dev)->private_data;
}

static ssize_t disksize_show(struct device *dev,