From: Greg KH <gregkh@linuxfoundation.org>
To: bchalios@amazon.es
Cc: linux-kernel@vger.kernel.org, tytso@mit.edu, Jason@zx2c4.com,
dwmw@amazon.co.uk, graf@amazon.de, xmarcalx@amazon.co.uk
Subject: Re: [PATCH 2/2] virt: vmgenid: add support for generation counter
Date: Wed, 3 Aug 2022 17:30:21 +0200 [thread overview]
Message-ID: <YuqUjUBxq6X738t/@kroah.com> (raw)
In-Reply-To: <20220803152127.48281-3-bchalios@amazon.es>
On Wed, Aug 03, 2022 at 05:21:27PM +0200, bchalios@amazon.es wrote:
> +static const struct file_operations fops = {
> + .owner = THIS_MODULE,
> + .open = vmgenid_open,
> + .read = vmgenid_read,
> + .mmap = vmgenid_mmap,
> + .llseek = noop_llseek,
Where is this new user/kernel api being documented?
See, put it in the code please, no one knows to look in a random file in
Documentation/
> +};
> +
> +static struct miscdevice vmgenid_misc = {
> + .minor = MISC_DYNAMIC_MINOR,
> + .name = "vmgenid",
> + .fops = &fops,
> };
>
> static int parse_vmgenid_address(struct acpi_device *device, acpi_string object_name,
> @@ -57,7 +124,7 @@ static int vmgenid_add(struct acpi_device *device)
> phys_addr_t phys_addr;
> int ret;
>
> - state = devm_kmalloc(&device->dev, sizeof(*state), GFP_KERNEL);
> + state = devm_kzalloc(&device->dev, sizeof(*state), GFP_KERNEL);
> if (!state)
> return -ENOMEM;
>
> @@ -74,6 +141,27 @@ static int vmgenid_add(struct acpi_device *device)
>
> device->driver_data = state;
>
> + /* Backwards compatibility. If CTRA is not there we just don't expose
> + * the char device
> + */
> + ret = parse_vmgenid_address(device, "CTRA", &state->gen_cntr_addr);
> + if (ret)
> + return 0;
> +
> + state->next_counter = devm_memremap(&device->dev, state->gen_cntr_addr,
> + sizeof(u32), MEMREMAP_WB);
> + if (IS_ERR(state->next_counter))
> + return 0;
> +
> + memcpy(&state->misc, &vmgenid_misc, sizeof(state->misc));
> + ret = misc_register(&state->misc);
> + if (ret) {
> + devm_memunmap(&device->dev, state->next_counter);
> + return 0;
Why are you not returning an error? Why is this ok?
And why call devm_memunmap() directly? That kind of defeats the purpose
of using devm_memremap(), right?
thanks,
greg k-h
next prev parent reply other threads:[~2022-08-03 15:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 15:21 [PATCH 0/2] virt: vmgenid: add generation counter bchalios
2022-08-03 15:21 ` [PATCH 1/2] virt: vmgenid: add helper function to parse ADDR bchalios
2022-08-03 15:21 ` [PATCH 2/2] virt: vmgenid: add support for generation counter bchalios
2022-08-03 15:28 ` Greg KH
2022-08-03 15:30 ` Greg KH [this message]
2022-08-03 17:53 ` Chalios, Babis
2022-08-03 15:31 ` Greg KH
2022-08-03 17:58 ` Chalios, Babis
2022-08-14 3:26 ` kernel test robot
2022-08-03 15:50 ` [PATCH 0/2] virt: vmgenid: add " Chalios, Babis
2022-08-03 15:57 ` Chalios, Babis
2022-08-04 13:33 ` Chalios, Babis
2022-08-04 14:59 ` Jason A. Donenfeld
2022-08-04 15:46 ` bchalios
2022-08-10 9:19 ` bchalios
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YuqUjUBxq6X738t/@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Jason@zx2c4.com \
--cc=bchalios@amazon.es \
--cc=dwmw@amazon.co.uk \
--cc=graf@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=xmarcalx@amazon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox