linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: expand minor range when registering chrdev region
@ 2019-02-12  6:24 Chengguang Xu
  2019-02-12 10:54 ` Moritz Fischer
  0 siblings, 1 reply; 4+ messages in thread
From: Chengguang Xu @ 2019-02-12  6:24 UTC (permalink / raw)
  To: hao.wu, atull, mdf; +Cc: linux-fpga, 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/fpga/dfl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index 2c09e502e721..02fff566be46 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -315,7 +315,7 @@ static void dfl_chardev_uinit(void)
 	for (i = 0; i < DFL_FPGA_DEVT_MAX; i++)
 		if (MAJOR(dfl_chrdevs[i].devt)) {
 			unregister_chrdev_region(dfl_chrdevs[i].devt,
-						 MINORMASK);
+						 MINORMASK + 1);
 			dfl_chrdevs[i].devt = MKDEV(0, 0);
 		}
 }
@@ -325,8 +325,8 @@ static int dfl_chardev_init(void)
 	int i, ret;
 
 	for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) {
-		ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0, MINORMASK,
-					  dfl_chrdevs[i].name);
+		ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0,
+					  MINORMASK + 1, dfl_chrdevs[i].name);
 		if (ret)
 			goto exit;
 	}
-- 
2.20.1

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

* Re: [PATCH] fpga: expand minor range when registering chrdev region
  2019-02-12  6:24 [PATCH] fpga: expand minor range when registering chrdev region Chengguang Xu
@ 2019-02-12 10:54 ` Moritz Fischer
  2019-02-12 14:32   ` cgxu519
  0 siblings, 1 reply; 4+ messages in thread
From: Moritz Fischer @ 2019-02-12 10:54 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: Wu Hao, Alan Tull, linux-fpga

Hi Chengguang,

On Mon, Feb 11, 2019 at 10:25 PM Chengguang Xu <cgxu519@gmx.com> wrote:
>
> Actually, total amount of available minor number
> for a single major is MINORMARK + 1. So expand
Typo. MINORMASK?

> minor range when registering chrdev region

How does that manifest?
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
>  drivers/fpga/dfl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
> index 2c09e502e721..02fff566be46 100644
> --- a/drivers/fpga/dfl.c
> +++ b/drivers/fpga/dfl.c
> @@ -315,7 +315,7 @@ static void dfl_chardev_uinit(void)
>         for (i = 0; i < DFL_FPGA_DEVT_MAX; i++)
>                 if (MAJOR(dfl_chrdevs[i].devt)) {
>                         unregister_chrdev_region(dfl_chrdevs[i].devt,
> -                                                MINORMASK);
> +                                                MINORMASK + 1);
>                         dfl_chrdevs[i].devt = MKDEV(0, 0);
>                 }
>  }
> @@ -325,8 +325,8 @@ static int dfl_chardev_init(void)
>         int i, ret;
>
>         for (i = 0; i < DFL_FPGA_DEVT_MAX; i++) {
> -               ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0, MINORMASK,
> -                                         dfl_chrdevs[i].name);
> +               ret = alloc_chrdev_region(&dfl_chrdevs[i].devt, 0,
> +                                         MINORMASK + 1, dfl_chrdevs[i].name);
>                 if (ret)
>                         goto exit;
>         }
> --
> 2.20.1
>

Thanks,
Moritz

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

* Re: [PATCH] fpga: expand minor range when registering chrdev region
  2019-02-12 10:54 ` Moritz Fischer
@ 2019-02-12 14:32   ` cgxu519
  2019-02-21  5:17     ` Wu Hao
  0 siblings, 1 reply; 4+ messages in thread
From: cgxu519 @ 2019-02-12 14:32 UTC (permalink / raw)
  To: Moritz Fischer; +Cc: Wu Hao, Alan Tull, linux-fpga

On 2/12/19 6:54 PM, Moritz Fischer wrote:
> Hi Chengguang,
>
> On Mon, Feb 11, 2019 at 10:25 PM Chengguang Xu <cgxu519@gmx.com> wrote:
>> Actually, total amount of available minor number
>> for a single major is MINORMARK + 1. So expand
> Typo. MINORMASK?

Yeah, it's a typo, should be MINORMASK.

>
>> minor range when registering chrdev region
> How does that manifest?

The output of /proc/devices only shows major so
I'm not sure is there an easy way to do that except
hacking the code to show minor range with major.

Thanks

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

* Re: [PATCH] fpga: expand minor range when registering chrdev region
  2019-02-12 14:32   ` cgxu519
@ 2019-02-21  5:17     ` Wu Hao
  0 siblings, 0 replies; 4+ messages in thread
From: Wu Hao @ 2019-02-21  5:17 UTC (permalink / raw)
  To: cgxu519; +Cc: Moritz Fischer, Alan Tull, linux-fpga

On Tue, Feb 12, 2019 at 10:32:14PM +0800, cgxu519 wrote:
> On 2/12/19 6:54 PM, Moritz Fischer wrote:
> >Hi Chengguang,
> >
> >On Mon, Feb 11, 2019 at 10:25 PM Chengguang Xu <cgxu519@gmx.com> wrote:
> >>Actually, total amount of available minor number
> >>for a single major is MINORMARK + 1. So expand
> >Typo. MINORMASK?
> 
> Yeah, it's a typo, should be MINORMASK.
> 

Please fix this typo, and change the patch title to "fpga: dfl: ..."

with above fixings,

Acked-by: Wu Hao <hao.wu@intel.com>

Thanks
Hao

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

end of thread, other threads:[~2019-02-21  5:32 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:24 [PATCH] fpga: expand minor range when registering chrdev region Chengguang Xu
2019-02-12 10:54 ` Moritz Fischer
2019-02-12 14:32   ` cgxu519
2019-02-21  5:17     ` Wu Hao

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).