* how to check regmap start address @ 2020-04-02 11:48 Tomek The Messenger 2020-04-02 11:58 ` Valentin Vidić 2020-04-02 12:14 ` Greg KH 0 siblings, 2 replies; 5+ messages in thread From: Tomek The Messenger @ 2020-04-02 11:48 UTC (permalink / raw) To: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 476 bytes --] Hi Let's see how it looks: https://github.com/u-boot/u-boot/blob/master/include/regmap.h I first time ever see such thing like this: struct regmap_range { ulong start; ulong size; }; struct regmap { enum regmap_endianness_t endianness; int range_count; struct regmap_range ranges[0]; }; How I can get access to variable ranges it if is 0 size? Who develops this one and who reviewed:) Anyway If I have pointer to regmap can I check what is start variable in some other way? [-- Attachment #1.2: Type: text/html, Size: 7467 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to check regmap start address 2020-04-02 11:48 how to check regmap start address Tomek The Messenger @ 2020-04-02 11:58 ` Valentin Vidić 2020-04-02 12:14 ` Greg KH 1 sibling, 0 replies; 5+ messages in thread From: Valentin Vidić @ 2020-04-02 11:58 UTC (permalink / raw) To: kernelnewbies On Thu, Apr 02, 2020 at 01:48:23PM +0200, Tomek The Messenger wrote: > Hi > Let's see how it looks: > https://github.com/u-boot/u-boot/blob/master/include/regmap.h > > I first time ever see such thing like this: > struct regmap_range { > ulong start; > ulong size; > }; > struct regmap { > enum regmap_endianness_t endianness; > int range_count; > struct regmap_range ranges[0]; > }; > > How I can get access to variable ranges it if is 0 size? Who develops this > one and who reviewed:) > Anyway If I have pointer to regmap can I check what is start variable in > some other way? Perhaps range_count gives the number of elements in the array, so you can just access r->ranges[i].start? -- Valentin _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to check regmap start address 2020-04-02 11:48 how to check regmap start address Tomek The Messenger 2020-04-02 11:58 ` Valentin Vidić @ 2020-04-02 12:14 ` Greg KH 2020-04-03 12:39 ` Tomek The Messenger 1 sibling, 1 reply; 5+ messages in thread From: Greg KH @ 2020-04-02 12:14 UTC (permalink / raw) To: Tomek The Messenger; +Cc: kernelnewbies On Thu, Apr 02, 2020 at 01:48:23PM +0200, Tomek The Messenger wrote: > Hi > Let's see how it looks: > https://github.com/u-boot/u-boot/blob/master/include/regmap.h > > I first time ever see such thing like this: > struct regmap_range { > ulong start; > ulong size; > }; > struct regmap { > enum regmap_endianness_t endianness; > int range_count; > struct regmap_range ranges[0]; > }; > > How I can get access to variable ranges it if is 0 size? Who develops this > one and who reviewed:) It is very common and standard C coding style. It happens all the time when you have a variable of unknown length at declaration time. > Anyway If I have pointer to regmap can I check what is start variable in > some other way? What other way do you need to check it? Why do you think the above code is incorrect? What do you think it should look like? thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to check regmap start address 2020-04-02 12:14 ` Greg KH @ 2020-04-03 12:39 ` Tomek The Messenger 2020-04-04 9:00 ` Tomek The Messenger 0 siblings, 1 reply; 5+ messages in thread From: Tomek The Messenger @ 2020-04-03 12:39 UTC (permalink / raw) To: Greg KH; +Cc: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 1217 bytes --] ok, for me strange was this ranges[0] declaration. I found other way to get to know mmio regmap size, just to remember pointer to struct resource* in private data in probe when parsing from device tree reg=<address, size> On Thu, Apr 2, 2020 at 2:15 PM Greg KH <greg@kroah.com> wrote: > On Thu, Apr 02, 2020 at 01:48:23PM +0200, Tomek The Messenger wrote: > > Hi > > Let's see how it looks: > > https://github.com/u-boot/u-boot/blob/master/include/regmap.h > > > > I first time ever see such thing like this: > > struct regmap_range { > > ulong start; > > ulong size; > > }; > > struct regmap { > > enum regmap_endianness_t endianness; > > int range_count; > > struct regmap_range ranges[0]; > > }; > > > > How I can get access to variable ranges it if is 0 size? Who develops > this > > one and who reviewed:) > > It is very common and standard C coding style. It happens all the time > when you have a variable of unknown length at declaration time. > > > Anyway If I have pointer to regmap can I check what is start variable in > > some other way? > > What other way do you need to check it? > > Why do you think the above code is incorrect? What do you think it > should look like? > > thanks, > > greg k-h > [-- Attachment #1.2: Type: text/html, Size: 1772 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to check regmap start address 2020-04-03 12:39 ` Tomek The Messenger @ 2020-04-04 9:00 ` Tomek The Messenger 0 siblings, 0 replies; 5+ messages in thread From: Tomek The Messenger @ 2020-04-04 9:00 UTC (permalink / raw) To: kernelnewbies [-- Attachment #1.1: Type: text/plain, Size: 2259 bytes --] Is it somehow possible to say to kernel user in probe function that when parsing from device tree such entry: reg = <0 0xffff0000 0 0x4>; red-names = "some_name"; inform user that he can set in device tree only 32 bits of address? probe( .... struct resource *res; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "some_name"); if(res!) return -EINVAL; if(res->start > 0xFFFFFFFF) //this doesn't make sense { //pr_error("%s, only max 32 bits are supported\n", __func__); return -EINVAL; } start variable in struct resource is type of resource_size_t. On 32 bit arch this type is u32 and on 64 bit arch it is 64. Nevertheless on each architecture I want my driver supports only 32 bits. I wonder if driver has to be such perfect and robust for everything user set in device tree or just information in kernel driver doc would be enough that user cannot set more than 32 bits. On Fri, Apr 3, 2020 at 2:39 PM Tomek The Messenger < tomekthemessenger@gmail.com> wrote: > ok, for me strange was this ranges[0] declaration. I found other way to > get to know mmio regmap size, just to remember pointer to struct resource* > in private data in probe when parsing from device tree reg=<address, size> > > On Thu, Apr 2, 2020 at 2:15 PM Greg KH <greg@kroah.com> wrote: > >> On Thu, Apr 02, 2020 at 01:48:23PM +0200, Tomek The Messenger wrote: >> > Hi >> > Let's see how it looks: >> > https://github.com/u-boot/u-boot/blob/master/include/regmap.h >> > >> > I first time ever see such thing like this: >> > struct regmap_range { >> > ulong start; >> > ulong size; >> > }; >> > struct regmap { >> > enum regmap_endianness_t endianness; >> > int range_count; >> > struct regmap_range ranges[0]; >> > }; >> > >> > How I can get access to variable ranges it if is 0 size? Who develops >> this >> > one and who reviewed:) >> >> It is very common and standard C coding style. It happens all the time >> when you have a variable of unknown length at declaration time. >> >> > Anyway If I have pointer to regmap can I check what is start variable in >> > some other way? >> >> What other way do you need to check it? >> >> Why do you think the above code is incorrect? What do you think it >> should look like? >> >> thanks, >> >> greg k-h >> > [-- Attachment #1.2: Type: text/html, Size: 3392 bytes --] [-- Attachment #2: Type: text/plain, Size: 170 bytes --] _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-04 9:01 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-04-02 11:48 how to check regmap start address Tomek The Messenger 2020-04-02 11:58 ` Valentin Vidić 2020-04-02 12:14 ` Greg KH 2020-04-03 12:39 ` Tomek The Messenger 2020-04-04 9:00 ` Tomek The Messenger
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).