mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dirk VanDerMerwe <dirk.vandermerwe@sophos.com>,
	Vimal Agrawal <vimal.agrawal@sophos.com>,
	kernel-dev@igalia.com
Subject: Re: [PATCH 2/4] char: misc: add test cases
Date: Thu, 20 Feb 2025 15:32:15 +0100	[thread overview]
Message-ID: <2025022023-fragile-moonstone-3419@gregkh> (raw)
In-Reply-To: <20250123123249.4081674-3-cascardo@igalia.com>

On Thu, Jan 23, 2025 at 09:32:47AM -0300, Thadeu Lima de Souza Cascardo wrote:
> Add test cases for static and dynamic minor number allocation and
> deallocation.
> 
> While at it, improve description and test suite name.
> 
> Some of the cases include:
> 
> - that static and dynamic allocation reserved the expected minors.
> 
> - that registering duplicate minors or duplicate names will fail.
> 
> - that failing to create a sysfs file (due to duplicate names) will
>   deallocate the dynamic minor correctly.
> 
> - that dynamic allocation does not allocate a minor number in the static
>   range.
> 
> - that there are no collisions when mixing dynamic and static allocations.
> 
> - that registering a static number in the dynamic range won't conflict with
>   a dynamic allocation.
> 
> This last test verifies the bug fixed by commit 6d04d2b554b1 ("misc:
> misc_minor_alloc to use ida for all dynamic/misc dynamic minors") has not
> regressed.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
> ---
>  drivers/misc/misc_minor_kunit.c | 515 +++++++++++++++++++++++++++++++-
>  1 file changed, 513 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/misc_minor_kunit.c b/drivers/misc/misc_minor_kunit.c
> index 293e0fb7e43e..84e13bc5c61c 100644
> --- a/drivers/misc/misc_minor_kunit.c
> +++ b/drivers/misc/misc_minor_kunit.c
> @@ -51,19 +51,530 @@ static void kunit_misc_dynamic_minor(struct kunit *test)
>  	misc_deregister(&dev_misc_dynamic_minor);
>  }
>  
> +struct miscdev_test_case {
> +	const char *str;
> +	int minor;
> +};
> +
> +static struct miscdev_test_case miscdev_test_ranges[] = {
> +	{
> +		.str = "lower static range, top",
> +		.minor = 15,

As I don't agree with the previous patch, I'll not apply this one.

How about at least just redoing this one and using the values that the
code currently allocates?

thanks,

greg k-h

  reply	other threads:[~2025-02-20 14:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 12:32 [PATCH 0/4] char: misc: improve test and dynamic allocation Thadeu Lima de Souza Cascardo
2025-01-23 12:32 ` [PATCH 1/4] char: misc: improve testing Kconfig description Thadeu Lima de Souza Cascardo
2025-01-23 12:32 ` [PATCH 2/4] char: misc: add test cases Thadeu Lima de Souza Cascardo
2025-02-20 14:32   ` Greg Kroah-Hartman [this message]
2025-01-23 12:32 ` [PATCH 3/4] char: misc: restrict the dynamic range to exclude reserved minors Thadeu Lima de Souza Cascardo
2025-02-20 14:31   ` Greg Kroah-Hartman
2025-02-20 14:52     ` Thadeu Lima de Souza Cascardo
2025-02-20 15:05       ` Greg Kroah-Hartman
2025-01-23 12:32 ` [PATCH 4/4] char: misc: deallocate static minor in error path Thadeu Lima de Souza Cascardo
2025-02-20 12:11   ` Greg Kroah-Hartman

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=2025022023-fragile-moonstone-3419@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=cascardo@igalia.com \
    --cc=dirk.vandermerwe@sophos.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vimal.agrawal@sophos.com \
    /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

all inboxes | Powered by JetHome®