--- zzzz-none-000/linux-3.10.107/sound/drivers/pcsp/pcsp.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/drivers/pcsp/pcsp.c 2021-02-04 17:41:59.000000000 +0000 @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "pcsp_input.h" #include "pcsp.h" @@ -42,15 +42,13 @@ static int snd_pcsp_create(struct snd_card *card) { static struct snd_device_ops ops = { }; - struct timespec tp; - int err; - int div, min_div, order; + unsigned int resolution = hrtimer_resolution; + int err, div, min_div, order; if (!nopcm) { - hrtimer_get_res(CLOCK_MONOTONIC, &tp); - if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) { + if (resolution > PCSP_MAX_PERIOD_NS) { printk(KERN_ERR "PCSP: Timer resolution is not sufficient " - "(%linS)\n", tp.tv_nsec); + "(%unS)\n", resolution); printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI " "enabled.\n"); printk(KERN_ERR "PCSP: Turned into nopcm mode.\n"); @@ -58,13 +56,13 @@ } } - if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS) + if (loops_per_jiffy >= PCSP_MIN_LPJ && resolution <= PCSP_MIN_PERIOD_NS) min_div = MIN_DIV; else min_div = MAX_DIV; #if PCSP_DEBUG - printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n", - loops_per_jiffy, min_div, tp.tv_nsec); + printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%u\n", + loops_per_jiffy, min_div, resolution); #endif div = MAX_DIV / min_div; @@ -104,7 +102,7 @@ hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); pcsp_chip.timer.function = pcsp_do_timer; - err = snd_card_create(index, id, THIS_MODULE, 0, &card); + err = snd_card_new(dev, index, id, THIS_MODULE, 0, &card); if (err < 0) return err; @@ -126,8 +124,6 @@ return err; } - snd_card_set_dev(pcsp_chip.card, dev); - strcpy(card->driver, "PC-Speaker"); strcpy(card->shortname, "pcsp"); sprintf(card->longname, "Internal PC-Speaker at port 0x%x", @@ -187,9 +183,8 @@ static int pcsp_remove(struct platform_device *dev) { struct snd_pcsp *chip = platform_get_drvdata(dev); - alsa_card_pcsp_exit(chip); pcspkr_input_remove(chip->input_dev); - platform_set_drvdata(dev, NULL); + alsa_card_pcsp_exit(chip); return 0; } @@ -223,7 +218,6 @@ static struct platform_driver pcsp_platform_driver = { .driver = { .name = "pcspkr", - .owner = THIS_MODULE, .pm = PCSP_PM_OPS, }, .probe = pcsp_probe,