Re: [PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt

2017-04-03 Thread Clemens Ladisch
Corentin Labbe wrote:
> This patch fix the following warning:
> drivers/char/hpet.c:146:17: attention : variable ‘m’ set but not used 
> [-Wunused-but-set-variable]
> by removing the unused variable m in hpet_interrupt

This patch might silence the warning, but it leaves the bug that
actually caused the warning.

As far as I can see, the computation of "base" should use "m".

But the entire algorithm is completely bogus because it does not
actually remove the race condition; the counter is likely to have
advanced beyond the "mc" value when the new comparator value is
written.  Also see arch/x86/kernel/hpet.c for how hpet_next_event()
handles this.

And why a non-periodic timer should generate periodic interrupts is
another question.

And nobody uses this crap.
So I'm really not sure what to do about this ...


Regards,
Clemens


Re: [PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt

2017-04-03 Thread Clemens Ladisch
Corentin Labbe wrote:
> This patch fix the following warning:
> drivers/char/hpet.c:146:17: attention : variable ‘m’ set but not used 
> [-Wunused-but-set-variable]
> by removing the unused variable m in hpet_interrupt

This patch might silence the warning, but it leaves the bug that
actually caused the warning.

As far as I can see, the computation of "base" should use "m".

But the entire algorithm is completely bogus because it does not
actually remove the race condition; the counter is likely to have
advanced beyond the "mc" value when the new comparator value is
written.  Also see arch/x86/kernel/hpet.c for how hpet_next_event()
handles this.

And why a non-periodic timer should generate periodic interrupts is
another question.

And nobody uses this crap.
So I'm really not sure what to do about this ...


Regards,
Clemens


[PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt

2017-04-03 Thread Corentin Labbe
This patch fix the following warning:
drivers/char/hpet.c:146:17: attention : variable ‘m’ set but not used 
[-Wunused-but-set-variable]
by removing the unused variable m in hpet_interrupt

Signed-off-by: Corentin Labbe 
---
 drivers/char/hpet.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 59e89e5..f6096e1 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -144,12 +144,11 @@ static irqreturn_t hpet_interrupt(int irq, void *data)
 * This has the effect of treating non-periodic like periodic.
 */
if ((devp->hd_flags & (HPET_IE | HPET_PERIODIC)) == HPET_IE) {
-   unsigned long m, t, mc, base, k;
+   unsigned long t, mc, base, k;
struct hpet __iomem *hpet = devp->hd_hpet;
struct hpets *hpetp = devp->hd_hpets;
 
t = devp->hd_ireqfreq;
-   m = read_counter(>hd_timer->hpet_compare);
mc = read_counter(>hpet_mc);
/* The time for the next interrupt would logically be t + m,
 * however, if we are very unlucky and the interrupt is delayed
-- 
2.10.2



[PATCH v2 5/6] hpet: removing unused variable m in hpet_interrupt

2017-04-03 Thread Corentin Labbe
This patch fix the following warning:
drivers/char/hpet.c:146:17: attention : variable ‘m’ set but not used 
[-Wunused-but-set-variable]
by removing the unused variable m in hpet_interrupt

Signed-off-by: Corentin Labbe 
---
 drivers/char/hpet.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 59e89e5..f6096e1 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -144,12 +144,11 @@ static irqreturn_t hpet_interrupt(int irq, void *data)
 * This has the effect of treating non-periodic like periodic.
 */
if ((devp->hd_flags & (HPET_IE | HPET_PERIODIC)) == HPET_IE) {
-   unsigned long m, t, mc, base, k;
+   unsigned long t, mc, base, k;
struct hpet __iomem *hpet = devp->hd_hpet;
struct hpets *hpetp = devp->hd_hpets;
 
t = devp->hd_ireqfreq;
-   m = read_counter(>hd_timer->hpet_compare);
mc = read_counter(>hpet_mc);
/* The time for the next interrupt would logically be t + m,
 * however, if we are very unlucky and the interrupt is delayed
-- 
2.10.2