[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEY2b1QU5RxozL0r@kroah.com>
Date: Mon, 8 Mar 2021 15:36:31 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Adrian Catangiu <acatan@...zon.com>
Cc: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
qemu-devel@...gnu.org, kvm@...r.kernel.org,
linux-s390@...r.kernel.org, graf@...zon.com, rdunlap@...radead.org,
arnd@...db.de, ebiederm@...ssion.com, rppt@...nel.org,
0x7f454c46@...il.com, borntraeger@...ibm.com, Jason@...c4.com,
jannh@...gle.com, w@....eu, colmmacc@...zon.com, luto@...nel.org,
tytso@....edu, ebiggers@...nel.org, dwmw@...zon.co.uk,
bonzini@....org, sblbir@...zon.com, raduweis@...zon.com,
corbet@....net, mst@...hat.com, mhocko@...nel.org,
rafael@...nel.org, pavel@....cz, mpe@...erman.id.au,
areber@...hat.com, ovzxemul@...il.com, avagin@...il.com,
ptikhomirov@...tuozzo.com, gil@...l.com, asmehra@...hat.com,
dgunigun@...hat.com, vijaysun@...ibm.com, oridgar@...il.com,
ghammer@...hat.com
Subject: Re: [PATCH v8] drivers/misc: sysgenid: add system generation id
driver
On Mon, Mar 08, 2021 at 04:18:03PM +0200, Adrian Catangiu wrote:
> +static struct miscdevice sysgenid_misc = {
> + .minor = MISC_DYNAMIC_MINOR,
> + .name = "sysgenid",
> + .fops = &fops,
> +};
Much cleaner, but:
> +static int __init sysgenid_init(void)
> +{
> + int ret;
> +
> + sysgenid_data.map_buf = get_zeroed_page(GFP_KERNEL);
> + if (!sysgenid_data.map_buf)
> + return -ENOMEM;
> +
> + atomic_set(&sysgenid_data.generation_counter, 0);
> + atomic_set(&sysgenid_data.outdated_watchers, 0);
> + init_waitqueue_head(&sysgenid_data.read_waitq);
> + init_waitqueue_head(&sysgenid_data.outdated_waitq);
> + spin_lock_init(&sysgenid_data.lock);
> +
> + ret = misc_register(&sysgenid_misc);
> + if (ret < 0) {
> + pr_err("misc_register() failed for sysgenid\n");
> + goto err;
> + }
> +
> + return 0;
> +
> +err:
> + free_pages(sysgenid_data.map_buf, 0);
> + sysgenid_data.map_buf = 0;
> +
> + return ret;
> +}
> +
> +static void __exit sysgenid_exit(void)
> +{
> + misc_deregister(&sysgenid_misc);
> + free_pages(sysgenid_data.map_buf, 0);
> + sysgenid_data.map_buf = 0;
> +}
> +
> +module_init(sysgenid_init);
> +module_exit(sysgenid_exit);
So you do this for any bit of hardware that happens to be out there?
Will that really work? You do not have any hwid to trigger off of to
know that this is a valid device you can handle?
> +
> +MODULE_AUTHOR("Adrian Catangiu");
> +MODULE_DESCRIPTION("System Generation ID");
> +MODULE_LICENSE("GPL");
> +MODULE_VERSION("0.1");
MODULE_VERSION() isn't a thing, just drop it please :)
thnaks,
greg k-h
Powered by blists - more mailing lists