aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-08-28 23:35:17 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-08-29 00:39:09 -0400
commit2c4e9671edfef534e9726366707d64e63d44e7e6 (patch)
tree79d1e786e962eba6a7e12309a022b52d9d913126 /drivers
parentd9f66c1a46163c7c83411058516a69da547262f8 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/vt_ioctl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 2bbeaaea46e9..38df8c19e74c 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -533,11 +533,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
533 case KIOCSOUND: 533 case KIOCSOUND:
534 if (!perm) 534 if (!perm)
535 goto eperm; 535 goto eperm;
536 /* FIXME: This is an old broken API but we need to keep it 536 /*
537 supported and somehow separate the historic advertised 537 * The use of PIT_TICK_RATE is historic, it used to be
538 tick rate from any real one */ 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 if (arg) 542 if (arg)
540 arg = CLOCK_TICK_RATE / arg; 543 arg = PIT_TICK_RATE / arg;
541 kd_mksound(arg, 0); 544 kd_mksound(arg, 0);
542 break; 545 break;
543 546
@@ -553,11 +556,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
553 */ 556 */
554 ticks = HZ * ((arg >> 16) & 0xffff) / 1000; 557 ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
555 count = ticks ? (arg & 0xffff) : 0; 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 if (count) 559 if (count)
560 count = CLOCK_TICK_RATE / count; 560 count = PIT_TICK_RATE / count;
561 kd_mksound(count, ticks); 561 kd_mksound(count, ticks);
562 break; 562 break;
563 } 563 }