Skip to content

Commit

Permalink
Documentation/timers/hpet_example.c: add supporting info for hpet_exa…
Browse files Browse the repository at this point in the history
…mple

$./hpet_example info /dev/hpet
-hpet: executing info
hpet_info: hi_irqfreq 0x0 hi_flags 0x0 hi_hpet 0 hi_timer 2

Signed-off-by: Jaswinder Singh Rajput <[email protected]>
Cc: Clemens Ladisch <[email protected]>
Cc: "Venkatesh Pallipadi (Venki)" <[email protected]>
Cc: john stultz <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Jaswinder Singh Rajput authored and torvalds committed Oct 26, 2010
1 parent 0ca0176 commit aaaddfe
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Documentation/timers/hpet_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,33 @@ hpet_open_close(int argc, const char **argv)
void
hpet_info(int argc, const char **argv)
{
struct hpet_info info;
int fd;

if (argc != 1) {
fprintf(stderr, "hpet_info: device-name\n");
return;
}

fd = open(argv[0], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]);
return;
}

if (ioctl(fd, HPET_INFO, &info) < 0) {
fprintf(stderr, "hpet_info: failed to get info\n");
goto out;
}

fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ",
info.hi_ireqfreq, info.hi_flags);
fprintf(stderr, "hi_hpet %d hi_timer %d\n",
info.hi_hpet, info.hi_timer);

out:
close(fd);
return;
}

void
Expand Down

0 comments on commit aaaddfe

Please sign in to comment.