linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] drivers: macintosh: rack-meter: limit idle ticks to total ticks
@ 2016-03-02 19:59 Aaro Koskinen
  2016-03-02 19:59 ` [PATCH RESEND 2/2] drivers: macintosh: rack-meter: fix bogus memsets Aaro Koskinen
  0 siblings, 1 reply; 3+ messages in thread
From: Aaro Koskinen @ 2016-03-02 19:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Aaro Koskinen

Limit idle ticks to total ticks. This prevents the annoying rackmeter
leds fully ON / OFF blinking state that happens on fully idling
G5 Xserve systems.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 drivers/macintosh/rack-meter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index caaec65..ba7e330 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -227,6 +227,7 @@ static void rackmeter_do_timer(struct work_struct *work)
 
 	total_idle_ticks = get_cpu_idle_time(cpu);
 	idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle);
+	idle_ticks = min(idle_ticks, total_ticks);
 	rcpu->prev_idle = total_idle_ticks;
 
 	/* We do a very dumb calculation to update the LEDs for now,
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RESEND 2/2] drivers: macintosh: rack-meter: fix bogus memsets
  2016-03-02 19:59 [PATCH RESEND 1/2] drivers: macintosh: rack-meter: limit idle ticks to total ticks Aaro Koskinen
@ 2016-03-02 19:59 ` Aaro Koskinen
  0 siblings, 0 replies; 3+ messages in thread
From: Aaro Koskinen @ 2016-03-02 19:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Aaro Koskinen

Fix bogus memsets pointed out by sparse:

linux-v4.3/drivers/macintosh/rack-meter.c:157:15: warning: memset with byte count of 0
linux-v4.3/drivers/macintosh/rack-meter.c:158:15: warning: memset with byte count of 0

Probably "&" is mistyped "*"; use ARRAY_SIZE to make it more safe.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 drivers/macintosh/rack-meter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index ba7e330..465c522 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -154,8 +154,8 @@ static void rackmeter_do_pause(struct rackmeter *rm, int pause)
 		DBDMA_DO_STOP(rm->dma_regs);
 		return;
 	}
-	memset(rdma->buf1, 0, SAMPLE_COUNT & sizeof(u32));
-	memset(rdma->buf2, 0, SAMPLE_COUNT & sizeof(u32));
+	memset(rdma->buf1, 0, ARRAY_SIZE(rdma->buf1));
+	memset(rdma->buf2, 0, ARRAY_SIZE(rdma->buf2));
 
 	rm->dma_buf_v->mark = 0;
 
-- 
2.4.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RESEND 1/2] drivers: macintosh: rack-meter: limit idle ticks to total ticks
@ 2016-04-10 19:53 Aaro Koskinen
  0 siblings, 0 replies; 3+ messages in thread
From: Aaro Koskinen @ 2016-04-10 19:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Michael Ellerman, linuxppc-dev; +Cc: Aaro Koskinen

Limit idle ticks to total ticks. This prevents the annoying rackmeter
leds fully ON / OFF blinking state that happens on fully idling
G5 Xserve systems.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 drivers/macintosh/rack-meter.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index caaec65..ba7e330 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -227,6 +227,7 @@ static void rackmeter_do_timer(struct work_struct *work)
 
 	total_idle_ticks = get_cpu_idle_time(cpu);
 	idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle);
+	idle_ticks = min(idle_ticks, total_ticks);
 	rcpu->prev_idle = total_idle_ticks;
 
 	/* We do a very dumb calculation to update the LEDs for now,
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-10 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02 19:59 [PATCH RESEND 1/2] drivers: macintosh: rack-meter: limit idle ticks to total ticks Aaro Koskinen
2016-03-02 19:59 ` [PATCH RESEND 2/2] drivers: macintosh: rack-meter: fix bogus memsets Aaro Koskinen
2016-04-10 19:53 [PATCH RESEND 1/2] drivers: macintosh: rack-meter: limit idle ticks to total ticks Aaro Koskinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).