[Nouveau] [PATCH v2 1/4] iccsense: remove read function

Karol Herbst nouveau at karolherbst.de
Mon Mar 28 12:24:29 UTC 2016


Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
Reviewed-by: Martin Peres <martin.peres at free.fr>
---
 drm/nouveau/include/nvkm/subdev/iccsense.h |  1 -
 drm/nouveau/nvkm/subdev/iccsense/base.c    | 23 ++++++++++-------------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drm/nouveau/include/nvkm/subdev/iccsense.h b/drm/nouveau/include/nvkm/subdev/iccsense.h
index 530c621..c3defcd 100644
--- a/drm/nouveau/include/nvkm/subdev/iccsense.h
+++ b/drm/nouveau/include/nvkm/subdev/iccsense.h
@@ -12,6 +12,5 @@ struct nvkm_iccsense {
 };
 
 int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **);
-int nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx);
 int nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense);
 #endif
diff --git a/drm/nouveau/nvkm/subdev/iccsense/base.c b/drm/nouveau/nvkm/subdev/iccsense/base.c
index c44a852..bf1b94e 100644
--- a/drm/nouveau/nvkm/subdev/iccsense/base.c
+++ b/drm/nouveau/nvkm/subdev/iccsense/base.c
@@ -96,26 +96,23 @@ nvkm_iccsense_ina3221_read(struct nvkm_iccsense *iccsense,
 }
 
 int
-nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx)
+nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense)
 {
-	struct nvkm_iccsense_rail *rail;
+	int result = 0, i;
 
-	if (!iccsense || idx >= iccsense->rail_count)
+	if (!iccsense)
 		return -EINVAL;
 
-	rail = &iccsense->rails[idx];
-	if (!rail->read)
+	if (iccsense->rail_count == 0)
 		return -ENODEV;
 
-	return rail->read(iccsense, rail);
-}
-
-int
-nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense)
-{
-	int result = 0, i;
 	for (i = 0; i < iccsense->rail_count; ++i) {
-		int res = nvkm_iccsense_read(iccsense, i);
+		int res;
+		struct nvkm_iccsense_rail *rail = &iccsense->rails[i];
+		if (!rail->read)
+			return -ENODEV;
+
+		res = rail->read(iccsense, rail);
 		if (res >= 0)
 			result += res;
 		else
-- 
2.7.4



More information about the Nouveau mailing list