fpga: expand minor range when registering chrdev region
diff mbox series

Message ID 20190212062451.1354-1-cgxu519@gmx.com
State Changes Requested
Headers show
Series
  • fpga: expand minor range when registering chrdev region
Related show

Commit Message

Chengguang Xu Feb. 12, 2019, 6:24 a.m. UTC
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(-)

Comments

Moritz Fischer Feb. 12, 2019, 10:54 a.m. UTC | #1
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
Chengguang Xu Feb. 12, 2019, 2:32 p.m. UTC | #2
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
Wu, Hao Feb. 21, 2019, 5:17 a.m. UTC | #3
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

Patch
diff mbox series

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;
 	}