linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mei: expand minor range when registering chrdev region
@ 2019-02-12  6:02 Chengguang Xu
  2019-02-12  9:29 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Chengguang Xu @ 2019-02-12  6:02 UTC (permalink / raw)
  To: tomas.winkler, arnd, gregkh; +Cc: linux-kernel, Chengguang Xu

Actually, total amount of available minor number
for a single major is MINORMARK + 1. So expand
minor range when registering chrdev region.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 drivers/misc/mei/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 87281b3695e6..3df54f1e1a8b 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -869,7 +869,7 @@ static const struct file_operations mei_fops = {
 
 static struct class *mei_class;
 static dev_t mei_devt;
-#define MEI_MAX_DEVS  MINORMASK
+#define MEI_MAX_DEVS  (MINORMASK + 1)
 static DEFINE_MUTEX(mei_minor_lock);
 static DEFINE_IDR(mei_idr);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mei: expand minor range when registering chrdev region
  2019-02-12  6:02 [PATCH] mei: expand minor range when registering chrdev region Chengguang Xu
@ 2019-02-12  9:29 ` Greg KH
  2019-02-12 14:55   ` cgxu519
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2019-02-12  9:29 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: tomas.winkler, arnd, linux-kernel

On Tue, Feb 12, 2019 at 02:02:52PM +0800, Chengguang Xu wrote:
> Actually, total amount of available minor number
> for a single major is MINORMARK + 1. So expand
> minor range when registering chrdev region.
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  drivers/misc/mei/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
> index 87281b3695e6..3df54f1e1a8b 100644
> --- a/drivers/misc/mei/main.c
> +++ b/drivers/misc/mei/main.c
> @@ -869,7 +869,7 @@ static const struct file_operations mei_fops = {
>  
>  static struct class *mei_class;
>  static dev_t mei_devt;
> -#define MEI_MAX_DEVS  MINORMASK
> +#define MEI_MAX_DEVS  (MINORMASK + 1)

Why is this needed?  Have you really run out of that many minor nodes
for this driver?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mei: expand minor range when registering chrdev region
  2019-02-12  9:29 ` Greg KH
@ 2019-02-12 14:55   ` cgxu519
  2019-02-12 15:22     ` Winkler, Tomas
  0 siblings, 1 reply; 4+ messages in thread
From: cgxu519 @ 2019-02-12 14:55 UTC (permalink / raw)
  To: Greg KH; +Cc: tomas.winkler, arnd, linux-kernel

On 2/12/19 5:29 PM, Greg KH wrote:
> On Tue, Feb 12, 2019 at 02:02:52PM +0800, Chengguang Xu wrote:
>> Actually, total amount of available minor number
>> for a single major is MINORMARK + 1. So expand
>> minor range when registering chrdev region.
>>
>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
>> ---
>>   drivers/misc/mei/main.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
>> index 87281b3695e6..3df54f1e1a8b 100644
>> --- a/drivers/misc/mei/main.c
>> +++ b/drivers/misc/mei/main.c
>> @@ -869,7 +869,7 @@ static const struct file_operations mei_fops = {
>>   
>>   static struct class *mei_class;
>>   static dev_t mei_devt;
>> -#define MEI_MAX_DEVS  MINORMASK
>> +#define MEI_MAX_DEVS  (MINORMASK + 1)
> Why is this needed?  Have you really run out of that many minor nodes
> for this driver?

Not really, practically maybe we cannot reach to the limit.
I was just curious why only one minor number left there and assumed
that was from a mistake(since I've seen similar mistake in other driver).
However, if it explicitly sets to MINORMASK for some reasons, then it's
better to keep as is.

Thanks





^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] mei: expand minor range when registering chrdev region
  2019-02-12 14:55   ` cgxu519
@ 2019-02-12 15:22     ` Winkler, Tomas
  0 siblings, 0 replies; 4+ messages in thread
From: Winkler, Tomas @ 2019-02-12 15:22 UTC (permalink / raw)
  To: cgxu519, Greg KH; +Cc: arnd, linux-kernel


> 
> On 2/12/19 5:29 PM, Greg KH wrote:
> > On Tue, Feb 12, 2019 at 02:02:52PM +0800, Chengguang Xu wrote:
> >> Actually, total amount of available minor number for a single major
> >> is MINORMARK + 1. So expand minor range when registering chrdev
> >> region.
> >>
> >> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> >> ---
> >>   drivers/misc/mei/main.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index
> >> 87281b3695e6..3df54f1e1a8b 100644
> >> --- a/drivers/misc/mei/main.c
> >> +++ b/drivers/misc/mei/main.c
> >> @@ -869,7 +869,7 @@ static const struct file_operations mei_fops = {
> >>
> >>   static struct class *mei_class;
> >>   static dev_t mei_devt;
> >> -#define MEI_MAX_DEVS  MINORMASK
> >> +#define MEI_MAX_DEVS  (MINORMASK + 1)
> > Why is this needed?  Have you really run out of that many minor nodes
> > for this driver?
> 
> Not really, practically maybe we cannot reach to the limit.
> I was just curious why only one minor number left there and assumed that was
> from a mistake(since I've seen similar mistake in other driver).
> However, if it explicitly sets to MINORMASK for some reasons, then it's better
> to keep as is.

I guess this was a boilerplate code, but I'm sure we don't need so many devices.

Thanks
Tomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-12 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12  6:02 [PATCH] mei: expand minor range when registering chrdev region Chengguang Xu
2019-02-12  9:29 ` Greg KH
2019-02-12 14:55   ` cgxu519
2019-02-12 15:22     ` Winkler, Tomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).