Commit 2c4e9671edfef534e9726366707d64e63d44e7e6

Authored by Arnd Bergmann
Committed by Dmitry Torokhov
1 parent d9f66c1a46

Input: use PIT_TICK_RATE in vt beep ioctl

The KIOCSOUND and KDMKTONE ioctls are based on the CLOCK_TICK_RATE,
which is architecture and sometimes configuration specific.

In practice, most user applications assume that it is actually defined
as the i8253 PIT base clock of 1193182 Hz, which is true on some
architectures but not on others.

This patch makes the vt code use the PIT frequency on all
architectures, which is much more well-defined.  It will change the
behavior of user applications sending the beep ioctl on all
architectures that define CLOCK_TICK_RATE different from
PIT_TICK_RATE.

The original breakage was introduced in commit bcc8ca099 "Adapt
drivers/char/vt_ioctl.c to non-x86".  Hopefully, reverting this change
will make the frequency correct in more cases than it will make it
incorrect.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff

drivers/char/vt_ioctl.c
... ... @@ -533,11 +533,14 @@
533 533 case KIOCSOUND:
534 534 if (!perm)
535 535 goto eperm;
536   - /* FIXME: This is an old broken API but we need to keep it
537   - supported and somehow separate the historic advertised
538   - tick rate from any real one */
  536 + /*
  537 + * The use of PIT_TICK_RATE is historic, it used to be
  538 + * the platform-dependent CLOCK_TICK_RATE between 2.6.12
  539 + * and 2.6.36, which was a minor but unfortunate ABI
  540 + * change.
  541 + */
539 542 if (arg)
540   - arg = CLOCK_TICK_RATE / arg;
  543 + arg = PIT_TICK_RATE / arg;
541 544 kd_mksound(arg, 0);
542 545 break;
543 546  
544 547  
... ... @@ -553,11 +556,8 @@
553 556 */
554 557 ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
555 558 count = ticks ? (arg & 0xffff) : 0;
556   - /* FIXME: This is an old broken API but we need to keep it
557   - supported and somehow separate the historic advertised
558   - tick rate from any real one */
559 559 if (count)
560   - count = CLOCK_TICK_RATE / count;
  560 + count = PIT_TICK_RATE / count;
561 561 kd_mksound(count, ticks);
562 562 break;
563 563 }