cmem driver device major number conflicts with rtc driver's

when rtc0 driver is called, cmem driver is called instead, I found
both drivers have
same major 252 and minor in /dev. I tracked down, I don't know why rtc
uses dynamic major allocation instead of major 10 and minor 135. I
tried it, but not successful. When I looked at cmem driver, it also
uses dynamic major allocation. Since the cmem driver is compiled in
separate bitbake, it uses the same major number as a result.
I tried to use different major number like 251, after modprobing, it
doesm't appear in /dev/cmem. I don't know if this is a bug or I missed
something. Does anyone know this issue?

Kai wrote:

when rtc0 driver is called, cmem driver is called instead, I found
both drivers have
same major 252 and minor in /dev. I tracked down, I don't know why rtc
uses dynamic major allocation instead of major 10 and minor 135. I
tried it, but not successful. When I looked at cmem driver, it also
uses dynamic major allocation. Since the cmem driver is compiled in
separate bitbake, it uses the same major number as a result.

dynamic major numbers are assigned at runtime, not at compile time, so if
both drivers have dynamic major numbers, they should not conflict.

I tried to use different major number like 251, after modprobing, it
doesm't appear in /dev/cmem. I don't know if this is a bug or I missed
something. Does anyone know this issue?

how did you change the major to 251?

Kai wrote:
> when rtc0 driver is called, cmem driver is called instead, I found
> both drivers have
> same major 252 and minor in /dev. I tracked down, I don't know why rtc
> uses dynamic major allocation instead of major 10 and minor 135. I
> tried it, but not successful. When I looked at cmem driver, it also
> uses dynamic major allocation. Since the cmem driver is compiled in
> separate bitbake, it uses the same major number as a result.

dynamic major numbers are assigned at runtime, not at compile time, so if
both drivers have dynamic major numbers, they should not conflict.

Yes, they conflict. Maybe they use different dynamic allocation source
code.

> I tried to use different major number like 251, after modprobing, it
> doesm't appear in /dev/cmem. I don't know if this is a bug or I missed
> something. Does anyone know this issue?

how did you change the major to 251?

240-252 range is reserved for experimental or new devices.

in cmemk.c

original: cmem_major = register_chrdev(0, "cmem", &cmem_fxns);
modified: cmem_major = register_chrdev(251, "cmem", &cmem_fxns);